blob: d9ffdac9b009caecf8a21bedf2af444f4bd6ac40 [file] [log] [blame]
Patrick Williams12fc9392021-08-06 09:16:53 -05001FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
Brad Bishopf61a81a2019-02-04 14:28:33 -05002
3SRC_URI += " file://pam.d/common-password \
4 file://pam.d/common-account \
5 file://pam.d/common-auth \
Richard Marian Thomaiyar2b597052019-11-02 21:24:29 +05306 file://pam.d/common-session \
Joseph Reynoldsfa324832021-03-16 21:30:40 +00007 file://faillock.conf \
8 file://convert-pam-configs.service \
9 file://convert-pam-configs.sh \
Brad Bishopf61a81a2019-02-04 14:28:33 -050010 "
11
Joseph Reynoldsfa324832021-03-16 21:30:40 +000012inherit systemd
13SYSTEMD_SERVICE:${PN} += "convert-pam-configs.service"
14
15FILES:${PN} += "${bindir}/convert-pam-configs.sh \
16 ${systemd_system_unitdir}/convert-pam-configs.service \
17 "
18
Patrick Williams12fc9392021-08-06 09:16:53 -050019do_install:append() {
Matt Spinler31ab8e72018-10-16 11:32:13 -050020 # The libpam recipe will always add a pam_systemd.so line to
21 # common-session if systemd is enabled; however systemd only
22 # builds pam_systemd.so if logind is enabled, and we disable
23 # that package. So, remove the pam_systemd.so line here.
24 sed -i '/pam_systemd.so/d' ${D}${sysconfdir}/pam.d/common-session
Joseph Reynoldsfa324832021-03-16 21:30:40 +000025
26 install -d ${D}/etc/security
27 install -m 0644 ${WORKDIR}/faillock.conf ${D}/etc/security
28
29 install -d ${D}${bindir}
30 install -m 0755 ${WORKDIR}/convert-pam-configs.sh ${D}${bindir}
31
32 install -d ${D}${systemd_system_unitdir}
33 install -m 0644 ${WORKDIR}/convert-pam-configs.service ${D}${systemd_system_unitdir}
Matt Spinler31ab8e72018-10-16 11:32:13 -050034}
Ed Tanous9936f862022-09-19 09:13:20 -070035
Joseph Reynoldsfa324832021-03-16 21:30:40 +000036RDEPENDS:${PN}-runtime += "libpwquality \
37 ${MLPREFIX}pam-plugin-faillock-${libpam_suffix} \
Ed Tanous9936f862022-09-19 09:13:20 -070038 ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \
39 ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \
40 ${MLPREFIX}pam-plugin-localuser-${libpam_suffix} \
41 "
Joseph Reynoldsfa324832021-03-16 21:30:40 +000042
43#
44# Background:
45# 1. Linux-PAM modules tally2 and cracklib were removed in libpam_1.5,
46# which prompted OpenBMC to change to the faillock and pwquality modules.
47# The PAM config files under /etc/pam.d were changed accordingly.
48# 2. OpenBMC implementations store Redfish property values in PAM config files.
49# For example, the D-Bus property maxLoginAttemptBeforeLockout is stored in
50# /etc/pam.d/common-auth as the pam_tally2.so deny= parameter value.
51# 3. The /etc directory is readonly and has a readwrite overlayfs. That
52# means when a config file changes, an overlay file is created which hides
53# the readonly version.
54#
55# Problem scenario:
56# 1. Begin with a BMC that has a firmware image which has the old PAM
57# modules and the old PAM config files which have modified parameters.
58# For example, there is an overlay file for /etc/pam.d/common-auth.
59# 2. Perform a firmware update to a firmware image which has the new PAM
60# modules. The updated image will have not have the old PAM modules.
61# It will have the new PAM config files in its readonly file system and
62# the old PAM config files in its readwrite overlay.
63# 3. Note that PAM authentication will always fail at this point because
64# the old PAM config files in the overlay tell PAM to use the old PAM
65# modules which are not present on the system.
66#
67# Two possible recoveries are:
68# A. Factory reset the BMC. This will clear the readwrite overlay,
69# allowing PAM to use the readonly version.
70# B. Convert the old PAM config files to the new style. See below.
71#
72# Service: The convert-pam-configs.service updates the old-style PAM config
73# files on the BMC: it changes uses of the old modules to the new modules
74# and carries forward configuration parameters. A key point is that files
75# are written to *only* as needed to convert uses of the old modules to the
76# new modules. See the conversion tool for details.
77#
78# This service can be removed when the BMC no longer supports a direct
79# firware update path from a version which has the old PAM configs to a
80# version which has the new PAM configs.
81#
82# In case of downgrade, Factory reset is recommended. Current logic in existing
83# images won't be able to take care of these settings during downgrade.