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 |
| 9 | # libpam-runtime-1.0.1 is GPLv2+), by openembedded |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 10 | LICENSE = "GPLv2+ | 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 | |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 15 | SRC_URI = "https://github.com/linux-pam/linux-pam/releases/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 \ |
Andrew Geissler | 87ddd3e | 2021-01-28 18:27:13 -0600 | [diff] [blame] | 24 | file://pam-security-abstract-securetty-handling.patch \ |
| 25 | file://pam-unix-nullok-secure.patch \ |
| 26 | file://crypt_configure.patch \ |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 27 | file://pam-volatiles.conf \ |
Andrew Geissler | 87ddd3e | 2021-01-28 18:27:13 -0600 | [diff] [blame] | 28 | " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 29 | |
Andrew Geissler | 87ddd3e | 2021-01-28 18:27:13 -0600 | [diff] [blame] | 30 | SRC_URI[md5sum] = "558ff53b0fc0563ca97f79e911822165" |
| 31 | SRC_URI[sha256sum] = "eff47a4ecd833fbf18de9686632a70ee8d0794b79aecb217ebd0ce11db4cd0db" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 32 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 33 | DEPENDS = "bison-native flex 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} \ |
| 37 | --disable-nis \ |
| 38 | --disable-regenerate-docu \ |
| 39 | --disable-prelude" |
| 40 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 41 | CFLAGS:append = " -fPIC " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 42 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 43 | S = "${WORKDIR}/Linux-PAM-${PV}" |
| 44 | |
Andrew Geissler | 87ddd3e | 2021-01-28 18:27:13 -0600 | [diff] [blame] | 45 | inherit autotools gettext pkgconfig |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 46 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 47 | PACKAGECONFIG ??= "" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 48 | PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit," |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 49 | PACKAGECONFIG[userdb] = "--enable-db=db,--enable-db=no,db," |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 50 | |
| 51 | PACKAGES += "${PN}-runtime ${PN}-xtests" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 52 | FILES:${PN} = "${base_libdir}/lib*${SOLIBS}" |
| 53 | FILES:${PN}-dev += "${base_libdir}/security/*.la ${base_libdir}/*.la ${base_libdir}/lib*${SOLIBSDEV}" |
| 54 | FILES:${PN}-runtime = "${sysconfdir}" |
| 55 | FILES:${PN}-xtests = "${datadir}/Linux-PAM/xtests" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 56 | |
| 57 | PACKAGES_DYNAMIC += "^${MLPREFIX}pam-plugin-.*" |
| 58 | |
| 59 | def get_multilib_bit(d): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 60 | baselib = d.getVar('baselib') or '' |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 61 | return baselib.replace('lib', '') |
| 62 | |
| 63 | libpam_suffix = "suffix${@get_multilib_bit(d)}" |
| 64 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 65 | RPROVIDES:${PN} += "${PN}-${libpam_suffix}" |
| 66 | RPROVIDES:${PN}-runtime += "${PN}-runtime-${libpam_suffix}" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 67 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 68 | RDEPENDS:${PN}-runtime = "${PN}-${libpam_suffix} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 69 | ${MLPREFIX}pam-plugin-deny-${libpam_suffix} \ |
| 70 | ${MLPREFIX}pam-plugin-permit-${libpam_suffix} \ |
| 71 | ${MLPREFIX}pam-plugin-warn-${libpam_suffix} \ |
| 72 | ${MLPREFIX}pam-plugin-unix-${libpam_suffix} \ |
| 73 | " |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 74 | RDEPENDS:${PN}-xtests = "${PN}-${libpam_suffix} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 75 | ${MLPREFIX}pam-plugin-access-${libpam_suffix} \ |
| 76 | ${MLPREFIX}pam-plugin-debug-${libpam_suffix} \ |
Andrew Geissler | 87ddd3e | 2021-01-28 18:27:13 -0600 | [diff] [blame] | 77 | ${MLPREFIX}pam-plugin-cracklib-${libpam_suffix} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 78 | ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \ |
| 79 | ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \ |
| 80 | ${MLPREFIX}pam-plugin-time-${libpam_suffix} \ |
Andrew Geissler | 87ddd3e | 2021-01-28 18:27:13 -0600 | [diff] [blame] | 81 | coreutils" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 82 | |
| 83 | # FIXME: Native suffix breaks here, disable it for now |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 84 | RRECOMMENDS:${PN} = "${PN}-runtime-${libpam_suffix}" |
| 85 | RRECOMMENDS:${PN}_class-native = "" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 86 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 87 | python populate_packages:prepend () { |
Andrew Geissler | 9b4d8b0 | 2021-02-19 12:26:16 -0600 | [diff] [blame] | 88 | def pam_plugin_append_file(pn, dir, file): |
| 89 | nf = os.path.join(dir, file) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 90 | of = d.getVar('FILES:' + pn) |
Andrew Geissler | 9b4d8b0 | 2021-02-19 12:26:16 -0600 | [diff] [blame] | 91 | if of: |
| 92 | nf = of + " " + nf |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 93 | d.setVar('FILES:' + pn, nf) |
Andrew Geissler | 9b4d8b0 | 2021-02-19 12:26:16 -0600 | [diff] [blame] | 94 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 95 | def pam_plugin_hook(file, pkg, pattern, format, basename): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 96 | pn = d.getVar('PN') |
| 97 | libpam_suffix = d.getVar('libpam_suffix') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 98 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 99 | rdeps = d.getVar('RDEPENDS:' + pkg) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 100 | if rdeps: |
| 101 | rdeps = rdeps + " " + pn + "-" + libpam_suffix |
| 102 | else: |
| 103 | rdeps = pn + "-" + libpam_suffix |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 104 | d.setVar('RDEPENDS:' + pkg, rdeps) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 105 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 106 | provides = d.getVar('RPROVIDES:' + pkg) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 107 | if provides: |
| 108 | provides = provides + " " + pkg + "-" + libpam_suffix |
| 109 | else: |
| 110 | provides = pkg + "-" + libpam_suffix |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 111 | d.setVar('RPROVIDES:' + pkg, provides) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 112 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 113 | mlprefix = d.getVar('MLPREFIX') or '' |
| 114 | dvar = d.expand('${WORKDIR}/package') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 115 | pam_libdir = d.expand('${base_libdir}/security') |
| 116 | pam_sbindir = d.expand('${sbindir}') |
| 117 | pam_filterdir = d.expand('${base_libdir}/security/pam_filter') |
| 118 | pam_pkgname = mlprefix + 'pam-plugin%s' |
| 119 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 120 | do_split_packages(d, pam_libdir, r'^pam(.*)\.so$', pam_pkgname, |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 121 | 'PAM plugin for %s', hook=pam_plugin_hook, extra_depends='') |
Andrew Geissler | 9b4d8b0 | 2021-02-19 12:26:16 -0600 | [diff] [blame] | 122 | pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_chkpwd') |
| 123 | pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_update') |
| 124 | pam_plugin_append_file('%spam-plugin-tally' % mlprefix, pam_sbindir, 'pam_tally') |
| 125 | pam_plugin_append_file('%spam-plugin-tally2' % mlprefix, pam_sbindir, 'pam_tally2') |
| 126 | pam_plugin_append_file('%spam-plugin-timestamp' % mlprefix, pam_sbindir, 'pam_timestamp_check') |
| 127 | pam_plugin_append_file('%spam-plugin-mkhomedir' % mlprefix, pam_sbindir, 'mkhomedir_helper') |
| 128 | pam_plugin_append_file('%spam-plugin-console' % mlprefix, pam_sbindir, 'pam_console_apply') |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 129 | 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] | 130 | } |
| 131 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 132 | do_compile_ptest() { |
| 133 | cd tests |
| 134 | sed -i -e 's/$(MAKE) $(AM_MAKEFLAGS) check-TESTS//' Makefile |
| 135 | oe_runmake check-am |
| 136 | cd - |
| 137 | } |
| 138 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 139 | do_install() { |
| 140 | autotools_do_install |
| 141 | |
| 142 | # don't install /var/run when populating rootfs. Do it through volatile |
| 143 | rm -rf ${D}${localstatedir} |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 144 | |
| 145 | if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then |
| 146 | rm -rf ${D}${sysconfdir}/init.d/ |
| 147 | rm -rf ${D}${sysconfdir}/rc* |
| 148 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 149 | install -m 0644 ${WORKDIR}/pam-volatiles.conf \ |
| 150 | ${D}${sysconfdir}/tmpfiles.d/pam.conf |
| 151 | else |
| 152 | install -d ${D}${sysconfdir}/default/volatiles |
| 153 | install -m 0644 ${WORKDIR}/99_pam \ |
| 154 | ${D}${sysconfdir}/default/volatiles/ |
| 155 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 156 | |
| 157 | install -d ${D}${sysconfdir}/pam.d/ |
| 158 | install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/ |
| 159 | |
| 160 | # The lsb requires unix_chkpwd has setuid permission |
| 161 | chmod 4755 ${D}${sbindir}/unix_chkpwd |
| 162 | |
| 163 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
| 164 | echo "session optional pam_systemd.so" >> ${D}${sysconfdir}/pam.d/common-session |
| 165 | fi |
| 166 | } |
| 167 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 168 | do_install_ptest() { |
| 169 | if [ ${PTEST_ENABLED} = "1" ]; then |
| 170 | mkdir -p ${D}${PTEST_PATH}/tests |
| 171 | install -m 0755 ${B}/tests/.libs/* ${D}${PTEST_PATH}/tests |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 172 | install -m 0644 ${S}/tests/confdir ${D}${PTEST_PATH}/tests |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 173 | fi |
| 174 | } |
| 175 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 176 | pkg_postinst_${PN}() { |
| 177 | if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then |
| 178 | /etc/init.d/populate-volatile.sh update |
| 179 | fi |
| 180 | } |
| 181 | |
Brad Bishop | 6dbb316 | 2019-11-25 09:41:34 -0500 | [diff] [blame] | 182 | inherit features_check |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 183 | REQUIRED_DISTRO_FEATURES = "pam" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 184 | |
| 185 | BBCLASSEXTEND = "nativesdk native" |
| 186 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 187 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-session" |
| 188 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-auth" |
| 189 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-password" |
| 190 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-session-noninteractive" |
| 191 | CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-account" |
| 192 | CONFFILES:${PN}-runtime += "${sysconfdir}/security/limits.conf" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 193 | |
| 194 | UPSTREAM_CHECK_URI = "https://github.com/linux-pam/linux-pam/releases" |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 195 | |
| 196 | CVE_PRODUCT = "linux-pam" |