blob: 3b35e56355faeb8a5242d2da9ab8c964981ab8ba [file] [log] [blame]
Joseph Reynoldsfa324832021-03-16 21:30:40 +00001# Remove pwquality from PAM, to avoid breaking PAM and further dependencies
2# This allows pwquality to be neatly severed from the system.
kasunath951f1aa2022-08-10 11:08:14 -07003
Joseph Reynoldsfa324832021-03-16 21:30:40 +00004RDEPENDS:${PN}-runtime:remove:gbmc = "libpwquality"
kasunath951f1aa2022-08-10 11:08:14 -07005
6do_install:append:gbmc() {
Joseph Reynoldsfa324832021-03-16 21:30:40 +00007 # Remove reference to pwquality library from PAM config file
8 sed -i '/pam_pwquality.so/d' ${D}${sysconfdir}/pam.d/common-password
Oskar Senft6cc57fe2022-10-05 08:27:03 -04009
10 # Remove the first occurrence of "use_authtok" in the first line starting
Joseph Reynoldsfa324832021-03-16 21:30:40 +000011 # with "password". This makes sure that if pam_pwquality.so was the first
Oskar Senft6cc57fe2022-10-05 08:27:03 -040012 # 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
kasunath951f1aa2022-08-10 11:08:14 -070022}