Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" |
Brad Bishop | f61a81a | 2019-02-04 14:28:33 -0500 | [diff] [blame] | 2 | |
| 3 | SRC_URI += " file://pam.d/common-password \ |
| 4 | file://pam.d/common-account \ |
| 5 | file://pam.d/common-auth \ |
Richard Marian Thomaiyar | 2b59705 | 2019-11-02 21:24:29 +0530 | [diff] [blame] | 6 | file://pam.d/common-session \ |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 7 | file://faillock.conf \ |
| 8 | file://convert-pam-configs.service \ |
| 9 | file://convert-pam-configs.sh \ |
Brad Bishop | f61a81a | 2019-02-04 14:28:33 -0500 | [diff] [blame] | 10 | " |
| 11 | |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 12 | inherit systemd |
| 13 | SYSTEMD_SERVICE:${PN} += "convert-pam-configs.service" |
| 14 | |
| 15 | FILES:${PN} += "${bindir}/convert-pam-configs.sh \ |
| 16 | ${systemd_system_unitdir}/convert-pam-configs.service \ |
| 17 | " |
| 18 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 19 | do_install:append() { |
Matt Spinler | 31ab8e7 | 2018-10-16 11:32:13 -0500 | [diff] [blame] | 20 | # 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 Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 25 | |
| 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 Spinler | 31ab8e7 | 2018-10-16 11:32:13 -0500 | [diff] [blame] | 34 | } |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 35 | |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 36 | RDEPENDS:${PN}-runtime += "libpwquality \ |
| 37 | ${MLPREFIX}pam-plugin-faillock-${libpam_suffix} \ |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 38 | ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \ |
| 39 | ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \ |
| 40 | ${MLPREFIX}pam-plugin-localuser-${libpam_suffix} \ |
| 41 | " |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 42 | |
| 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. |