blob: adc641505d17629a635c1f53283ab0613d7000e5 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001DISABLE_STATIC = ""
Patrick Williamsc0f7c042017-02-23 20:41:17 -06002SUMMARY = "Linux-PAM (Pluggable Authentication Modules)"
3DESCRIPTION = "Linux-PAM (Pluggable Authentication Modules for Linux), a flexible mechanism for authenticating users"
4HOMEPAGE = "https://fedorahosted.org/linux-pam/"
5BUGTRACKER = "https://fedorahosted.org/linux-pam/newticket"
6SECTION = "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
10LICENSE = "GPLv2+ | BSD"
Brad Bishopf8caae32019-03-25 13:13:56 -040011LIC_FILES_CHKSUM = "file://COPYING;md5=7eb5c1bf854e8881005d673599ee74d3 \
12 file://libpamc/License;md5=a4da476a14c093fdc73be3c3c9ba8fb3 \
13 "
Patrick Williamsc0f7c042017-02-23 20:41:17 -060014
Brad Bishop15ae2502019-06-18 21:44:24 -040015SRC_URI = "https://github.com/linux-pam/linux-pam/releases/download/v${PV}/Linux-PAM-${PV}.tar.xz \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060016 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 Geissler87ddd3e2021-01-28 18:27:13 -060024 file://pam-security-abstract-securetty-handling.patch \
25 file://pam-unix-nullok-secure.patch \
26 file://crypt_configure.patch \
27 "
Patrick Williamsc0f7c042017-02-23 20:41:17 -060028
Andrew Geissler87ddd3e2021-01-28 18:27:13 -060029SRC_URI[md5sum] = "558ff53b0fc0563ca97f79e911822165"
30SRC_URI[sha256sum] = "eff47a4ecd833fbf18de9686632a70ee8d0794b79aecb217ebd0ce11db4cd0db"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060031
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080032DEPENDS = "bison-native flex flex-native cracklib libxml2-native virtual/crypt"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033
Andrew Geissler82c905d2020-04-13 13:39:40 -050034EXTRA_OECONF = "--includedir=${includedir}/security \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060035 --libdir=${base_libdir} \
36 --disable-nis \
37 --disable-regenerate-docu \
38 --disable-prelude"
39
40CFLAGS_append = " -fPIC "
41
Patrick Williamsc0f7c042017-02-23 20:41:17 -060042S = "${WORKDIR}/Linux-PAM-${PV}"
43
Andrew Geissler87ddd3e2021-01-28 18:27:13 -060044inherit autotools gettext pkgconfig
Patrick Williamsc0f7c042017-02-23 20:41:17 -060045
Andrew Geissler82c905d2020-04-13 13:39:40 -050046PACKAGECONFIG ??= ""
Patrick Williamsc0f7c042017-02-23 20:41:17 -060047PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit,"
Andrew Geissler82c905d2020-04-13 13:39:40 -050048PACKAGECONFIG[userdb] = "--enable-db=db,--enable-db=no,db,"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060049
50PACKAGES += "${PN}-runtime ${PN}-xtests"
51FILES_${PN} = "${base_libdir}/lib*${SOLIBS}"
52FILES_${PN}-dev += "${base_libdir}/security/*.la ${base_libdir}/*.la ${base_libdir}/lib*${SOLIBSDEV}"
Andrew Geissler87ddd3e2021-01-28 18:27:13 -060053FILES_${PN}-runtime = "${sysconfdir}"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060054FILES_${PN}-xtests = "${datadir}/Linux-PAM/xtests"
55
56PACKAGES_DYNAMIC += "^${MLPREFIX}pam-plugin-.*"
57
58def get_multilib_bit(d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050059 baselib = d.getVar('baselib') or ''
Patrick Williamsc0f7c042017-02-23 20:41:17 -060060 return baselib.replace('lib', '')
61
62libpam_suffix = "suffix${@get_multilib_bit(d)}"
63
64RPROVIDES_${PN} += "${PN}-${libpam_suffix}"
65RPROVIDES_${PN}-runtime += "${PN}-runtime-${libpam_suffix}"
66
67RDEPENDS_${PN}-runtime = "${PN}-${libpam_suffix} \
68 ${MLPREFIX}pam-plugin-deny-${libpam_suffix} \
69 ${MLPREFIX}pam-plugin-permit-${libpam_suffix} \
70 ${MLPREFIX}pam-plugin-warn-${libpam_suffix} \
71 ${MLPREFIX}pam-plugin-unix-${libpam_suffix} \
72 "
73RDEPENDS_${PN}-xtests = "${PN}-${libpam_suffix} \
74 ${MLPREFIX}pam-plugin-access-${libpam_suffix} \
75 ${MLPREFIX}pam-plugin-debug-${libpam_suffix} \
Andrew Geissler87ddd3e2021-01-28 18:27:13 -060076 ${MLPREFIX}pam-plugin-cracklib-${libpam_suffix} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060077 ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \
78 ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \
79 ${MLPREFIX}pam-plugin-time-${libpam_suffix} \
Andrew Geissler87ddd3e2021-01-28 18:27:13 -060080 coreutils"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060081
82# FIXME: Native suffix breaks here, disable it for now
83RRECOMMENDS_${PN} = "${PN}-runtime-${libpam_suffix}"
84RRECOMMENDS_${PN}_class-native = ""
85
86python populate_packages_prepend () {
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060087 def pam_plugin_append_file(pn, dir, file):
88 nf = os.path.join(dir, file)
89 of = d.getVar('FILES_' + pn)
90 if of:
91 nf = of + " " + nf
92 d.setVar('FILES_' + pn, nf)
93
Patrick Williamsc0f7c042017-02-23 20:41:17 -060094 def pam_plugin_hook(file, pkg, pattern, format, basename):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050095 pn = d.getVar('PN')
96 libpam_suffix = d.getVar('libpam_suffix')
Patrick Williamsc0f7c042017-02-23 20:41:17 -060097
Brad Bishop6e60e8b2018-02-01 10:27:11 -050098 rdeps = d.getVar('RDEPENDS_' + pkg)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060099 if rdeps:
100 rdeps = rdeps + " " + pn + "-" + libpam_suffix
101 else:
102 rdeps = pn + "-" + libpam_suffix
103 d.setVar('RDEPENDS_' + pkg, rdeps)
104
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500105 provides = d.getVar('RPROVIDES_' + pkg)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600106 if provides:
107 provides = provides + " " + pkg + "-" + libpam_suffix
108 else:
109 provides = pkg + "-" + libpam_suffix
110 d.setVar('RPROVIDES_' + pkg, provides)
111
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500112 mlprefix = d.getVar('MLPREFIX') or ''
113 dvar = d.expand('${WORKDIR}/package')
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600114 pam_libdir = d.expand('${base_libdir}/security')
115 pam_sbindir = d.expand('${sbindir}')
116 pam_filterdir = d.expand('${base_libdir}/security/pam_filter')
117 pam_pkgname = mlprefix + 'pam-plugin%s'
118
Brad Bishop19323692019-04-05 15:28:33 -0400119 do_split_packages(d, pam_libdir, r'^pam(.*)\.so$', pam_pkgname,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600120 'PAM plugin for %s', hook=pam_plugin_hook, extra_depends='')
Andrew Geissler9b4d8b02021-02-19 12:26:16 -0600121 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_chkpwd')
122 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_update')
123 pam_plugin_append_file('%spam-plugin-tally' % mlprefix, pam_sbindir, 'pam_tally')
124 pam_plugin_append_file('%spam-plugin-tally2' % mlprefix, pam_sbindir, 'pam_tally2')
125 pam_plugin_append_file('%spam-plugin-timestamp' % mlprefix, pam_sbindir, 'pam_timestamp_check')
126 pam_plugin_append_file('%spam-plugin-mkhomedir' % mlprefix, pam_sbindir, 'mkhomedir_helper')
127 pam_plugin_append_file('%spam-plugin-console' % mlprefix, pam_sbindir, 'pam_console_apply')
Brad Bishop19323692019-04-05 15:28:33 -0400128 do_split_packages(d, pam_filterdir, r'^(.*)$', 'pam-filter-%s', 'PAM filter for %s', extra_depends='')
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600129}
130
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600131do_compile_ptest() {
132 cd tests
133 sed -i -e 's/$(MAKE) $(AM_MAKEFLAGS) check-TESTS//' Makefile
134 oe_runmake check-am
135 cd -
136}
137
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600138do_install() {
139 autotools_do_install
140
141 # don't install /var/run when populating rootfs. Do it through volatile
142 rm -rf ${D}${localstatedir}
143 install -d ${D}${sysconfdir}/default/volatiles
144 install -m 0644 ${WORKDIR}/99_pam ${D}${sysconfdir}/default/volatiles
145
146 install -d ${D}${sysconfdir}/pam.d/
147 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
148
149 # The lsb requires unix_chkpwd has setuid permission
150 chmod 4755 ${D}${sbindir}/unix_chkpwd
151
152 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
153 echo "session optional pam_systemd.so" >> ${D}${sysconfdir}/pam.d/common-session
154 fi
155}
156
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600157do_install_ptest() {
158 if [ ${PTEST_ENABLED} = "1" ]; then
159 mkdir -p ${D}${PTEST_PATH}/tests
160 install -m 0755 ${B}/tests/.libs/* ${D}${PTEST_PATH}/tests
161 fi
162}
163
Brad Bishop6dbb3162019-11-25 09:41:34 -0500164inherit features_check
Brad Bishop316dfdd2018-06-25 12:45:53 -0400165REQUIRED_DISTRO_FEATURES = "pam"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600166
167BBCLASSEXTEND = "nativesdk native"
168
169CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-session"
170CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-auth"
171CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-password"
172CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-session-noninteractive"
173CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-account"
174CONFFILES_${PN}-runtime += "${sysconfdir}/security/limits.conf"
Brad Bishop15ae2502019-06-18 21:44:24 -0400175
176UPSTREAM_CHECK_URI = "https://github.com/linux-pam/linux-pam/releases"
Brad Bishop1d80a2e2019-11-15 16:35:03 -0500177
178CVE_PRODUCT = "linux-pam"