Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 1 | # Remove pwquality from PAM, to avoid breaking PAM and further dependencies |
| 2 | # This allows pwquality to be neatly severed from the system. |
kasunath | 951f1aa | 2022-08-10 11:08:14 -0700 | [diff] [blame] | 3 | |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 4 | RDEPENDS:${PN}-runtime:remove:gbmc = "libpwquality" |
kasunath | 951f1aa | 2022-08-10 11:08:14 -0700 | [diff] [blame] | 5 | |
| 6 | do_install:append:gbmc() { |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 7 | # Remove reference to pwquality library from PAM config file |
| 8 | sed -i '/pam_pwquality.so/d' ${D}${sysconfdir}/pam.d/common-password |
Oskar Senft | 6cc57fe | 2022-10-05 08:27:03 -0400 | [diff] [blame] | 9 | |
| 10 | # Remove the first occurrence of "use_authtok" in the first line starting |
Joseph Reynolds | fa32483 | 2021-03-16 21:30:40 +0000 | [diff] [blame] | 11 | # with "password". This makes sure that if pam_pwquality.so was the first |
Oskar Senft | 6cc57fe | 2022-10-05 08:27:03 -0400 | [diff] [blame] | 12 | # entry, we didn't invalidate the next entry in the stack. If the first |
| 13 | # entry has the "use_authtok" set, this "forces the module to not prompt |
| 14 | # the user for a new password but use the one provided by the previously |
| 15 | # stacked password module". Since there is no "previous" entry, it never |
| 16 | # asks for a password which causes the process to fail. |
| 17 | awk '/^password/ && !f{sub(/ use_authtok/, ""); f=1} 1' \ |
| 18 | ${D}${sysconfdir}/pam.d/common-password \ |
| 19 | > ${D}${sysconfdir}/pam.d/common-password.new |
| 20 | mv ${D}${sysconfdir}/pam.d/common-password.new \ |
| 21 | ${D}${sysconfdir}/pam.d/common-password |
kasunath | 951f1aa | 2022-08-10 11:08:14 -0700 | [diff] [blame] | 22 | } |