V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m1s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m1s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -606,23 +606,26 @@ pam_access_sync_login_sshd() {
|
||||
fi
|
||||
|
||||
### 1) If the 'pam_access' line is commented in '/etc/pam.d/login', uncomment exactly one occurrence.
|
||||
### Match lines like: [spaces]# [spaces]account required pam_access.so ...
|
||||
chroot_script "${TARGET}" "
|
||||
if grep -Eq '^[[:space:]]*#[[:space:]]*account[[:space:]]+required[[:space:]]+pam_access\.so([[:space:]]|$)' /etc/pam.d/login; then
|
||||
awk '
|
||||
BEGIN { done=0 }
|
||||
LC_ALL=C awk '
|
||||
BEGIN { done=0 }
|
||||
{
|
||||
if (!done && $0 ~ /^[[:space:]]*#[[:space:]]*account[[:space:]]+required[[:space:]]+pam_access\.so([[:space:]]|$)/) {
|
||||
### Drop leading '#'+spaces; use 2-arg form to avoid $0 in the source.
|
||||
sub(/^[[:space:]]*#[[:space:]]*/, "")
|
||||
done=1
|
||||
if (!done) {
|
||||
tmp=\$0
|
||||
# Strip a leading comment marker plus following spaces (but only once)
|
||||
sub(/^[[:space:]]*#+[[:space:]]*/, \"\", tmp)
|
||||
# Match the pam_access.so line after decommenting attempt
|
||||
if (tmp ~ /^[[:space:]]*account[[:space:]]+required[[:space:]]+pam_access[.]so([[:space:]]|$)/) {
|
||||
print tmp
|
||||
done=1
|
||||
next
|
||||
}
|
||||
}
|
||||
print
|
||||
print
|
||||
}
|
||||
' /etc/pam.d/login >| /etc/pam.d/login.new
|
||||
mv -f /etc/pam.d/login.new /etc/pam.d/login
|
||||
fi
|
||||
"
|
||||
"
|
||||
|
||||
### 2) If '/etc/pam.d/login' now has an active pam_access line, ensure '/etc/pam.d/sshd' pam_access line(s) are commented out.
|
||||
chroot_script "${TARGET}" "
|
||||
|
||||
Reference in New Issue
Block a user