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