blob: 7af3ea99d1e73c2b0bb6e4aade770673bf9a3452 [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
Andrew Geissler9aee5002022-03-30 16:27:02 +00009# libpam-runtime-1.0.1 is GPL-2.0-or-later), by openembedded
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000010LICENSE = "GPL-2.0-or-later | BSD-3-Clause"
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
Andrew Geissler87f5cff2022-09-30 13:13:31 -050015SRC_URI = "${GITHUB_BASE_URI}/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 Geissler8f840682023-07-21 09:09:43 -050024 file://0001-examples-Replace-use-of-termio.h-with-termios.h.patch \
Joseph Reynoldsfa324832021-03-16 21:30:40 +000025 file://run-ptest \
Andrew Geisslerc926e172021-05-07 16:11:35 -050026 file://pam-volatiles.conf \
Patrick Williams8e7b46e2023-05-01 14:19:06 -050027 "
Patrick Williamsc0f7c042017-02-23 20:41:17 -060028
Andrew Geissler8f840682023-07-21 09:09:43 -050029SRC_URI[sha256sum] = "7ac4b50feee004a9fa88f1dfd2d2fa738a82896763050cd773b3c54b0a818283"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060030
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050031DEPENDS = "bison-native flex-native cracklib libxml2-native virtual/crypt"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060032
Andrew Geissler82c905d2020-04-13 13:39:40 -050033EXTRA_OECONF = "--includedir=${includedir}/security \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060034 --libdir=${base_libdir} \
Joseph Reynoldsfa324832021-03-16 21:30:40 +000035 --with-systemdunitdir=${systemd_system_unitdir} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060036 --disable-nis \
37 --disable-regenerate-docu \
Joseph Reynoldsfa324832021-03-16 21:30:40 +000038 --disable-doc \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060039 --disable-prelude"
40
Patrick Williams12fc9392021-08-06 09:16:53 -050041CFLAGS:append = " -fPIC "
Patrick Williamsc0f7c042017-02-23 20:41:17 -060042
Patrick Williamsc0f7c042017-02-23 20:41:17 -060043S = "${WORKDIR}/Linux-PAM-${PV}"
44
Andrew Geissler87f5cff2022-09-30 13:13:31 -050045inherit autotools gettext pkgconfig systemd ptest github-releases
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046
Andrew Geissler82c905d2020-04-13 13:39:40 -050047PACKAGECONFIG ??= ""
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit,"
Andrew Geissler82c905d2020-04-13 13:39:40 -050049PACKAGECONFIG[userdb] = "--enable-db=db,--enable-db=no,db,"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060050
51PACKAGES += "${PN}-runtime ${PN}-xtests"
Patrick Williamsac13d5f2023-11-24 18:59:46 -060052FILES:${PN} = " \
53 ${base_libdir}/lib*${SOLIBS} \
54 ${nonarch_libdir}/tmpfiles.d/*.conf \
55"
Patrick Williams12fc9392021-08-06 09:16:53 -050056FILES:${PN}-dev += "${base_libdir}/security/*.la ${base_libdir}/*.la ${base_libdir}/lib*${SOLIBSDEV}"
Joseph Reynoldsfa324832021-03-16 21:30:40 +000057FILES:${PN}-runtime = "${sysconfdir} ${sbindir} ${systemd_system_unitdir}"
Patrick Williams12fc9392021-08-06 09:16:53 -050058FILES:${PN}-xtests = "${datadir}/Linux-PAM/xtests"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060059
60PACKAGES_DYNAMIC += "^${MLPREFIX}pam-plugin-.*"
61
62def get_multilib_bit(d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063 baselib = d.getVar('baselib') or ''
Patrick Williamsc0f7c042017-02-23 20:41:17 -060064 return baselib.replace('lib', '')
65
66libpam_suffix = "suffix${@get_multilib_bit(d)}"
67
Patrick Williams12fc9392021-08-06 09:16:53 -050068RPROVIDES:${PN} += "${PN}-${libpam_suffix}"
69RPROVIDES:${PN}-runtime += "${PN}-runtime-${libpam_suffix}"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060070
Patrick Williams12fc9392021-08-06 09:16:53 -050071RDEPENDS:${PN}-runtime = "${PN}-${libpam_suffix} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060072 ${MLPREFIX}pam-plugin-deny-${libpam_suffix} \
73 ${MLPREFIX}pam-plugin-permit-${libpam_suffix} \
74 ${MLPREFIX}pam-plugin-warn-${libpam_suffix} \
75 ${MLPREFIX}pam-plugin-unix-${libpam_suffix} \
76 "
Patrick Williams12fc9392021-08-06 09:16:53 -050077RDEPENDS:${PN}-xtests = "${PN}-${libpam_suffix} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060078 ${MLPREFIX}pam-plugin-access-${libpam_suffix} \
79 ${MLPREFIX}pam-plugin-debug-${libpam_suffix} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060080 ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \
81 ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \
82 ${MLPREFIX}pam-plugin-time-${libpam_suffix} \
Joseph Reynoldsfa324832021-03-16 21:30:40 +000083 bash coreutils"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060084
85# FIXME: Native suffix breaks here, disable it for now
Patrick Williams12fc9392021-08-06 09:16:53 -050086RRECOMMENDS:${PN} = "${PN}-runtime-${libpam_suffix}"
Joseph Reynoldsfa324832021-03-16 21:30:40 +000087RRECOMMENDS:${PN}:class-native = ""
Patrick Williamsc0f7c042017-02-23 20:41:17 -060088
Patrick Williams12fc9392021-08-06 09:16:53 -050089python populate_packages:prepend () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -060090 def pam_plugin_hook(file, pkg, pattern, format, basename):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050091 pn = d.getVar('PN')
92 libpam_suffix = d.getVar('libpam_suffix')
Patrick Williamsc0f7c042017-02-23 20:41:17 -060093
Patrick Williams12fc9392021-08-06 09:16:53 -050094 rdeps = d.getVar('RDEPENDS:' + pkg)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060095 if rdeps:
96 rdeps = rdeps + " " + pn + "-" + libpam_suffix
97 else:
98 rdeps = pn + "-" + libpam_suffix
Patrick Williams12fc9392021-08-06 09:16:53 -050099 d.setVar('RDEPENDS:' + pkg, rdeps)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600100
Patrick Williams12fc9392021-08-06 09:16:53 -0500101 provides = d.getVar('RPROVIDES:' + pkg)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600102 if provides:
103 provides = provides + " " + pkg + "-" + libpam_suffix
104 else:
105 provides = pkg + "-" + libpam_suffix
Patrick Williams12fc9392021-08-06 09:16:53 -0500106 d.setVar('RPROVIDES:' + pkg, provides)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600107
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500108 mlprefix = d.getVar('MLPREFIX') or ''
109 dvar = d.expand('${WORKDIR}/package')
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600110 pam_libdir = d.expand('${base_libdir}/security')
111 pam_sbindir = d.expand('${sbindir}')
112 pam_filterdir = d.expand('${base_libdir}/security/pam_filter')
113 pam_pkgname = mlprefix + 'pam-plugin%s'
114
Brad Bishop19323692019-04-05 15:28:33 -0400115 do_split_packages(d, pam_libdir, r'^pam(.*)\.so$', pam_pkgname,
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600116 'PAM plugin for %s', hook=pam_plugin_hook, extra_depends='')
Brad Bishop19323692019-04-05 15:28:33 -0400117 do_split_packages(d, pam_filterdir, r'^(.*)$', 'pam-filter-%s', 'PAM filter for %s', extra_depends='')
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600118}
119
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600120do_compile_ptest() {
121 cd tests
122 sed -i -e 's/$(MAKE) $(AM_MAKEFLAGS) check-TESTS//' Makefile
123 oe_runmake check-am
124 cd -
125}
126
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600127do_install() {
128 autotools_do_install
129
130 # don't install /var/run when populating rootfs. Do it through volatile
131 rm -rf ${D}${localstatedir}
Andrew Geisslerc926e172021-05-07 16:11:35 -0500132
133 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then
134 rm -rf ${D}${sysconfdir}/init.d/
135 rm -rf ${D}${sysconfdir}/rc*
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600136 install -d ${D}${nonarch_libdir}/tmpfiles.d
Andrew Geisslerc926e172021-05-07 16:11:35 -0500137 install -m 0644 ${WORKDIR}/pam-volatiles.conf \
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600138 ${D}${nonarch_libdir}/tmpfiles.d/pam.conf
Andrew Geisslerc926e172021-05-07 16:11:35 -0500139 else
140 install -d ${D}${sysconfdir}/default/volatiles
141 install -m 0644 ${WORKDIR}/99_pam \
142 ${D}${sysconfdir}/default/volatiles/
143 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600144
145 install -d ${D}${sysconfdir}/pam.d/
146 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
147
148 # The lsb requires unix_chkpwd has setuid permission
149 chmod 4755 ${D}${sbindir}/unix_chkpwd
150
151 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
152 echo "session optional pam_systemd.so" >> ${D}${sysconfdir}/pam.d/common-session
153 fi
Joseph Reynoldsfa324832021-03-16 21:30:40 +0000154 if ${@bb.utils.contains('DISTRO_FEATURES','usrmerge','false','true',d)}; then
155 install -d ${D}/${libdir}/
156 mv ${D}/${base_libdir}/pkgconfig ${D}/${libdir}/
157 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600158}
159
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600160do_install_ptest() {
161 if [ ${PTEST_ENABLED} = "1" ]; then
162 mkdir -p ${D}${PTEST_PATH}/tests
163 install -m 0755 ${B}/tests/.libs/* ${D}${PTEST_PATH}/tests
Andrew Geisslerc926e172021-05-07 16:11:35 -0500164 install -m 0644 ${S}/tests/confdir ${D}${PTEST_PATH}/tests
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600165 fi
166}
167
Joseph Reynoldsfa324832021-03-16 21:30:40 +0000168pkg_postinst:${PN}() {
Andrew Geisslerc926e172021-05-07 16:11:35 -0500169 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
170 /etc/init.d/populate-volatile.sh update
171 fi
172}
173
Brad Bishop6dbb3162019-11-25 09:41:34 -0500174inherit features_check
Patrick Williams2a254922023-08-11 09:48:11 -0500175ANY_OF_DISTRO_FEATURES = "pam systemd"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600176
177BBCLASSEXTEND = "nativesdk native"
178
Patrick Williams12fc9392021-08-06 09:16:53 -0500179CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-session"
180CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-auth"
181CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-password"
182CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-session-noninteractive"
183CONFFILES:${PN}-runtime += "${sysconfdir}/pam.d/common-account"
184CONFFILES:${PN}-runtime += "${sysconfdir}/security/limits.conf"
Brad Bishop15ae2502019-06-18 21:44:24 -0400185
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500186GITHUB_BASE_URI = "https://github.com/linux-pam/linux-pam/releases"
Brad Bishop1d80a2e2019-11-15 16:35:03 -0500187
188CVE_PRODUCT = "linux-pam"