Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | DISABLE_STATIC = "" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 2 | SUMMARY = "Linux-PAM (Pluggable Authentication Modules)" |
| 3 | DESCRIPTION = "Linux-PAM (Pluggable Authentication Modules for Linux), a flexible mechanism for authenticating users" |
| 4 | HOMEPAGE = "https://fedorahosted.org/linux-pam/" |
| 5 | BUGTRACKER = "https://fedorahosted.org/linux-pam/newticket" |
| 6 | SECTION = "base" |
| 7 | # PAM is dual licensed under GPL and BSD. |
| 8 | # /etc/pam.d comes from Debian libpam-runtime in 2009-11 (at that time |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 9 | # libpam-runtime-1.0.1 is GPL-2.0-or-later), by openembedded |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 10 | LICENSE = "GPL-2.0-or-later | BSD-3-Clause" |
Brad Bishop | f8caae3 | 2019-03-25 13:13:56 -0400 | [diff] [blame] | 11 | LIC_FILES_CHKSUM = "file://COPYING;md5=7eb5c1bf854e8881005d673599ee74d3 \ |
| 12 | file://libpamc/License;md5=a4da476a14c093fdc73be3c3c9ba8fb3 \ |
| 13 | " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 14 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 15 | SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/Linux-PAM-${PV}.tar.xz \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 16 | file://99_pam \ |
| 17 | file://pam.d/common-account \ |
| 18 | file://pam.d/common-auth \ |
| 19 | file://pam.d/common-password \ |
| 20 | file://pam.d/common-session \ |
| 21 | file://pam.d/common-session-noninteractive \ |
| 22 | file://pam.d/other \ |
| 23 | file://libpam-xtests.patch \ |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 24 | file://0001-run-xtests.sh-check-whether-files-exist.patch \ |
| 25 | file://run-ptest \ |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 26 | file://pam-volatiles.conf \ |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 27 | file://CVE-2022-28321-0002.patch \ |
| 28 | file://0001-pam_motd-do-not-rely-on-all-filesystems-providing-a-.patch \ |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 29 | " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 30 | |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 31 | SRC_URI[sha256sum] = "e4ec7131a91da44512574268f493c6d8ca105c87091691b8e9b56ca685d4f94d" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 32 | |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 33 | DEPENDS = "bison-native flex-native cracklib libxml2-native virtual/crypt" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 34 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 35 | EXTRA_OECONF = "--includedir=${includedir}/security \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 36 | --libdir=${base_libdir} \ |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 37 | --with-systemdunitdir=${systemd_system_unitdir} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 38 | --disable-nis \ |
| 39 | --disable-regenerate-docu \ |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 40 | --disable-doc \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 41 | --disable-prelude" |
| 42 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 43 | CFLAGS:append = " -fPIC " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 44 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 45 | S = "${WORKDIR}/Linux-PAM-${PV}" |
| 46 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 47 | inherit autotools gettext pkgconfig systemd ptest github-releases |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 48 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 49 | PACKAGECONFIG ??= "" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 50 | PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit," |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 51 | PACKAGECONFIG[userdb] = "--enable-db=db,--enable-db=no,db," |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 52 | |
| 53 | PACKAGES += "${PN}-runtime ${PN}-xtests" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 54 | FILES:${PN} = "${base_libdir}/lib*${SOLIBS}" |
| 55 | FILES:${PN}-dev += "${base_libdir}/security/*.la ${base_libdir}/*.la ${base_libdir}/lib*${SOLIBSDEV}" |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 56 | FILES:${PN}-runtime = "${sysconfdir} ${sbindir} ${systemd_system_unitdir}" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 57 | FILES:${PN}-xtests = "${datadir}/Linux-PAM/xtests" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 58 | |
| 59 | PACKAGES_DYNAMIC += "^${MLPREFIX}pam-plugin-.*" |
| 60 | |
| 61 | def get_multilib_bit(d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 62 | baselib = d.getVar('baselib') or '' |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 63 | return baselib.replace('lib', '') |
| 64 | |
| 65 | libpam_suffix = "suffix${@get_multilib_bit(d)}" |
| 66 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 67 | RPROVIDES:${PN} += "${PN}-${libpam_suffix}" |
| 68 | RPROVIDES:${PN}-runtime += "${PN}-runtime-${libpam_suffix}" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 69 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 70 | RDEPENDS:${PN}-runtime = "${PN}-${libpam_suffix} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 71 | ${MLPREFIX}pam-plugin-deny-${libpam_suffix} \ |
| 72 | ${MLPREFIX}pam-plugin-permit-${libpam_suffix} \ |
| 73 | ${MLPREFIX}pam-plugin-warn-${libpam_suffix} \ |
| 74 | ${MLPREFIX}pam-plugin-unix-${libpam_suffix} \ |
| 75 | " |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 76 | RDEPENDS:${PN}-xtests = "${PN}-${libpam_suffix} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 77 | ${MLPREFIX}pam-plugin-access-${libpam_suffix} \ |
| 78 | ${MLPREFIX}pam-plugin-debug-${libpam_suffix} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 79 | ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \ |
| 80 | ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \ |
| 81 | ${MLPREFIX}pam-plugin-time-${libpam_suffix} \ |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 82 | bash coreutils" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 83 | |
| 84 | # FIXME: Native suffix breaks here, disable it for now |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 85 | RRECOMMENDS:${PN} = "${PN}-runtime-${libpam_suffix}" |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 86 | RRECOMMENDS:${PN}:class-native = "" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 87 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 88 | python populate_packages:prepend () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 89 | def pam_plugin_hook(file, pkg, pattern, format, basename): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 90 | pn = d.getVar('PN') |
| 91 | libpam_suffix = d.getVar('libpam_suffix') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 92 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 93 | rdeps = d.getVar('RDEPENDS:' + pkg) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 94 | if rdeps: |
| 95 | rdeps = rdeps + " " + pn + "-" + libpam_suffix |
| 96 | else: |
| 97 | rdeps = pn + "-" + libpam_suffix |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 98 | d.setVar('RDEPENDS:' + pkg, rdeps) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 99 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 100 | provides = d.getVar('RPROVIDES:' + pkg) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 101 | if provides: |
| 102 | provides = provides + " " + pkg + "-" + libpam_suffix |
| 103 | else: |
| 104 | provides = pkg + "-" + libpam_suffix |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 105 | d.setVar('RPROVIDES:' + pkg, provides) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 106 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 107 | mlprefix = d.getVar('MLPREFIX') or '' |
| 108 | dvar = d.expand('${WORKDIR}/package') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 109 | pam_libdir = d.expand('${base_libdir}/security') |
| 110 | pam_sbindir = d.expand('${sbindir}') |
| 111 | pam_filterdir = d.expand('${base_libdir}/security/pam_filter') |
| 112 | pam_pkgname = mlprefix + 'pam-plugin%s' |
| 113 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 114 | do_split_packages(d, pam_libdir, r'^pam(.*)\.so$', pam_pkgname, |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 115 | 'PAM plugin for %s', hook=pam_plugin_hook, extra_depends='') |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 116 | do_split_packages(d, pam_filterdir, r'^(.*)$', 'pam-filter-%s', 'PAM filter for %s', extra_depends='') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 117 | } |
| 118 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 119 | do_compile_ptest() { |
| 120 | cd tests |
| 121 | sed -i -e 's/$(MAKE) $(AM_MAKEFLAGS) check-TESTS//' Makefile |
| 122 | oe_runmake check-am |
| 123 | cd - |
| 124 | } |
| 125 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 126 | do_install() { |
| 127 | autotools_do_install |
| 128 | |
| 129 | # don't install /var/run when populating rootfs. Do it through volatile |
| 130 | rm -rf ${D}${localstatedir} |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 131 | |
| 132 | if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then |
| 133 | rm -rf ${D}${sysconfdir}/init.d/ |
| 134 | rm -rf ${D}${sysconfdir}/rc* |
| 135 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 136 | install -m 0644 ${WORKDIR}/pam-volatiles.conf \ |
| 137 | ${D}${sysconfdir}/tmpfiles.d/pam.conf |
| 138 | else |
| 139 | install -d ${D}${sysconfdir}/default/volatiles |
| 140 | install -m 0644 ${WORKDIR}/99_pam \ |
| 141 | ${D}${sysconfdir}/default/volatiles/ |
| 142 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 143 | |
| 144 | install -d ${D}${sysconfdir}/pam.d/ |
| 145 | install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/ |
| 146 | |
| 147 | # The lsb requires unix_chkpwd has setuid permission |
| 148 | chmod 4755 ${D}${sbindir}/unix_chkpwd |
| 149 | |
| 150 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
| 151 | echo "session optional pam_systemd.so" >> ${D}${sysconfdir}/pam.d/common-session |
| 152 | fi |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 153 | if ${@bb.utils.contains('DISTRO_FEATURES','usrmerge','false','true',d)}; then |
| 154 | install -d ${D}/${libdir}/ |
| 155 | mv ${D}/${base_libdir}/pkgconfig ${D}/${libdir}/ |
| 156 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 157 | } |
| 158 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 159 | do_install_ptest() { |
| 160 | if [ ${PTEST_ENABLED} = "1" ]; then |
| 161 | mkdir -p ${D}${PTEST_PATH}/tests |
| 162 | install -m 0755 ${B}/tests/.libs/* ${D}${PTEST_PATH}/tests |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 163 | install -m 0644 ${S}/tests/confdir ${D}${PTEST_PATH}/tests |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 164 | fi |
| 165 | } |
| 166 | |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 167 | pkg_postinst:${PN}() { |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 168 | if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then |
| 169 | /etc/init.d/populate-volatile.sh update |
| 170 | fi |
| 171 | } |
| 172 | |
Brad Bishop | 6dbb316 | 2019-11-25 09:41:34 -0500 | [diff] [blame] | 173 | inherit features_check |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 174 | REQUIRED_DISTRO_FEATURES = "pam" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 175 | |
| 176 | BBCLASSEXTEND = "nativesdk native" |
| 177 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 178 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-session" |
| 179 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-auth" |
| 180 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-password" |
| 181 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-session-noninteractive" |
| 182 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-account" |
| 183 | CONFFILES:${PN}-runtime += "${sysconfdir}/security/limits.conf" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 184 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 185 | GITHUB_BASE_URI = "https://github.com/linux-pam/linux-pam/releases" |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 186 | |
| 187 | CVE_PRODUCT = "linux-pam" |