blob: cc1241020f0cb0f79b6567daaa96a48e82a2f41e [file] [log] [blame]
Patrick Williamsc0f7c042017-02-23 20:41:17 -06001SUMMARY = "Linux-PAM (Pluggable Authentication Modules)"
2DESCRIPTION = "Linux-PAM (Pluggable Authentication Modules for Linux), a flexible mechanism for authenticating users"
3HOMEPAGE = "https://fedorahosted.org/linux-pam/"
4BUGTRACKER = "https://fedorahosted.org/linux-pam/newticket"
5SECTION = "base"
6# PAM is dual licensed under GPL and BSD.
7# /etc/pam.d comes from Debian libpam-runtime in 2009-11 (at that time
8# libpam-runtime-1.0.1 is GPLv2+), by openembedded
9LICENSE = "GPLv2+ | BSD"
Brad Bishopf8caae32019-03-25 13:13:56 -040010LIC_FILES_CHKSUM = "file://COPYING;md5=7eb5c1bf854e8881005d673599ee74d3 \
11 file://libpamc/License;md5=a4da476a14c093fdc73be3c3c9ba8fb3 \
12 "
Patrick Williamsc0f7c042017-02-23 20:41:17 -060013
14SRC_URI = "http://linux-pam.org/library/Linux-PAM-${PV}.tar.bz2 \
15 file://99_pam \
16 file://pam.d/common-account \
17 file://pam.d/common-auth \
18 file://pam.d/common-password \
19 file://pam.d/common-session \
20 file://pam.d/common-session-noninteractive \
21 file://pam.d/other \
22 file://libpam-xtests.patch \
23 file://fixsepbuild.patch \
24 file://pam-security-abstract-securetty-handling.patch \
25 file://pam-unix-nullok-secure.patch \
26 file://libpam-xtests-remove-bash-dependency.patch \
27 file://crypt_configure.patch \
28 "
29
30SRC_URI[md5sum] = "da4b2289b7cfb19583d54e9eaaef1c3a"
31SRC_URI[sha256sum] = "241aed1ef522f66ed672719ecf2205ec513fd0075ed80cda8e086a5b1a01d1bb"
32
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033SRC_URI_append_libc-musl = " file://0001-Add-support-for-defining-missing-funcitonality.patch \
34 file://include_paths_header.patch \
35 "
36
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080037DEPENDS = "bison-native flex flex-native cracklib libxml2-native virtual/crypt"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060038
39EXTRA_OECONF = "--with-db-uniquename=_pam \
40 --includedir=${includedir}/security \
41 --libdir=${base_libdir} \
42 --disable-nis \
43 --disable-regenerate-docu \
44 --disable-prelude"
45
46CFLAGS_append = " -fPIC "
47
48PR = "r5"
49
50S = "${WORKDIR}/Linux-PAM-${PV}"
51
52inherit autotools gettext pkgconfig
53
54PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit,"
55
56PACKAGES += "${PN}-runtime ${PN}-xtests"
57FILES_${PN} = "${base_libdir}/lib*${SOLIBS}"
58FILES_${PN}-dev += "${base_libdir}/security/*.la ${base_libdir}/*.la ${base_libdir}/lib*${SOLIBSDEV}"
59FILES_${PN}-runtime = "${sysconfdir}"
60FILES_${PN}-xtests = "${datadir}/Linux-PAM/xtests"
61
62PACKAGES_DYNAMIC += "^${MLPREFIX}pam-plugin-.*"
63
64def get_multilib_bit(d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050065 baselib = d.getVar('baselib') or ''
Patrick Williamsc0f7c042017-02-23 20:41:17 -060066 return baselib.replace('lib', '')
67
68libpam_suffix = "suffix${@get_multilib_bit(d)}"
69
70RPROVIDES_${PN} += "${PN}-${libpam_suffix}"
71RPROVIDES_${PN}-runtime += "${PN}-runtime-${libpam_suffix}"
72
73RDEPENDS_${PN}-runtime = "${PN}-${libpam_suffix} \
74 ${MLPREFIX}pam-plugin-deny-${libpam_suffix} \
75 ${MLPREFIX}pam-plugin-permit-${libpam_suffix} \
76 ${MLPREFIX}pam-plugin-warn-${libpam_suffix} \
77 ${MLPREFIX}pam-plugin-unix-${libpam_suffix} \
78 "
79RDEPENDS_${PN}-xtests = "${PN}-${libpam_suffix} \
80 ${MLPREFIX}pam-plugin-access-${libpam_suffix} \
81 ${MLPREFIX}pam-plugin-debug-${libpam_suffix} \
82 ${MLPREFIX}pam-plugin-cracklib-${libpam_suffix} \
83 ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \
84 ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \
85 ${MLPREFIX}pam-plugin-time-${libpam_suffix} \
86 coreutils"
87
88# FIXME: Native suffix breaks here, disable it for now
89RRECOMMENDS_${PN} = "${PN}-runtime-${libpam_suffix}"
90RRECOMMENDS_${PN}_class-native = ""
91
92python populate_packages_prepend () {
93 def pam_plugin_append_file(pn, dir, file):
94 nf = os.path.join(dir, file)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050095 of = d.getVar('FILES_' + pn)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060096 if of:
97 nf = of + " " + nf
98 d.setVar('FILES_' + pn, nf)
99
100 def pam_plugin_hook(file, pkg, pattern, format, basename):
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500101 pn = d.getVar('PN')
102 libpam_suffix = d.getVar('libpam_suffix')
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600103
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500104 rdeps = d.getVar('RDEPENDS_' + pkg)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600105 if rdeps:
106 rdeps = rdeps + " " + pn + "-" + libpam_suffix
107 else:
108 rdeps = pn + "-" + libpam_suffix
109 d.setVar('RDEPENDS_' + pkg, rdeps)
110
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500111 provides = d.getVar('RPROVIDES_' + pkg)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600112 if provides:
113 provides = provides + " " + pkg + "-" + libpam_suffix
114 else:
115 provides = pkg + "-" + libpam_suffix
116 d.setVar('RPROVIDES_' + pkg, provides)
117
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500118 mlprefix = d.getVar('MLPREFIX') or ''
119 dvar = d.expand('${WORKDIR}/package')
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600120 pam_libdir = d.expand('${base_libdir}/security')
121 pam_sbindir = d.expand('${sbindir}')
122 pam_filterdir = d.expand('${base_libdir}/security/pam_filter')
123 pam_pkgname = mlprefix + 'pam-plugin%s'
124
125 do_split_packages(d, pam_libdir, '^pam(.*)\.so$', pam_pkgname,
126 'PAM plugin for %s', hook=pam_plugin_hook, extra_depends='')
127 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_chkpwd')
128 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_update')
129 pam_plugin_append_file('%spam-plugin-tally' % mlprefix, pam_sbindir, 'pam_tally')
130 pam_plugin_append_file('%spam-plugin-tally2' % mlprefix, pam_sbindir, 'pam_tally2')
131 pam_plugin_append_file('%spam-plugin-timestamp' % mlprefix, pam_sbindir, 'pam_timestamp_check')
132 pam_plugin_append_file('%spam-plugin-mkhomedir' % mlprefix, pam_sbindir, 'mkhomedir_helper')
133 pam_plugin_append_file('%spam-plugin-console' % mlprefix, pam_sbindir, 'pam_console_apply')
134 do_split_packages(d, pam_filterdir, '^(.*)$', 'pam-filter-%s', 'PAM filter for %s', extra_depends='')
135}
136
137do_install() {
138 autotools_do_install
139
140 # don't install /var/run when populating rootfs. Do it through volatile
141 rm -rf ${D}${localstatedir}
142 install -d ${D}${sysconfdir}/default/volatiles
143 install -m 0644 ${WORKDIR}/99_pam ${D}${sysconfdir}/default/volatiles
144
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
154}
155
Brad Bishop316dfdd2018-06-25 12:45:53 -0400156inherit distro_features_check
157REQUIRED_DISTRO_FEATURES = "pam"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600158
159BBCLASSEXTEND = "nativesdk native"
160
161CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-session"
162CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-auth"
163CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-password"
164CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-session-noninteractive"
165CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-account"
166CONFFILES_${PN}-runtime += "${sysconfdir}/security/limits.conf"