Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Nächste Überarbeitung | Vorherige Überarbeitung | ||
admin_grundlagen:pam-ssh-passwoerter-loggen [2021/10/03 11:30] ingo_wichmann angelegt |
admin_grundlagen:pam-ssh-passwoerter-loggen [2021/10/13 07:39] (aktuell) ingo_wichmann |
||
---|---|---|---|
Zeile 3: | Zeile 3: | ||
Achtung: führt dazu, dass __alle__ Passwörter geloggt werden. Das ist auf Maschinen, wo Nutzer Passwörter haben sicher nicht sinnvoll. | Achtung: führt dazu, dass __alle__ Passwörter geloggt werden. Das ist auf Maschinen, wo Nutzer Passwörter haben sicher nicht sinnvoll. | ||
- | rudimentär getestet unter CentOS 8 | + | rudimentär getestet unter CentOS 8. Bekannter Bug: nur root-Passworte werden geloggt. |
<file txt /usr/local/sbin/log_password> | <file txt /usr/local/sbin/log_password> | ||
Zeile 9: | Zeile 9: | ||
read password | read password | ||
- | echo "PAM_RHOST: $PAM_RHOST, PAM_RUSER: $PAM_RUSER, PAM_USER: $PAM_USER, password: $password" >> /tmp/passwords | + | echo "PAM_RHOST: $PAM_RHOST, PAM_RUSER: $PAM_RUSER, PAM_USER: $PAM_USER, password: $password" |
- | </file> (( vielleicht besser eine Lösung mit syslog, statt selbst in die Datei zu schreiben )) | + | </file> |
chmod +x /usr/local/sbin/log_password | chmod +x /usr/local/sbin/log_password | ||
<file txt /etc/pam.d/password-auth> | <file txt /etc/pam.d/password-auth> | ||
+ | … | ||
auth sufficient pam_unix.so try_first_pass nullok | auth sufficient pam_unix.so try_first_pass nullok | ||
- | auth optional pam_exec.so expose_authtok /usr/local/sbin/log_password | + | auth optional pam_exec.so expose_authtok log=/tmp/passwords /usr/local/sbin/log_password |
+ | … | ||
</file> | </file> | ||
(( ob ''/etc/pam.d/password-auth'' der ideale Ort dafür, ist fraglich. Und was passiert, wenn authselect o.ä. ausgeführt wird? )) | (( ob ''/etc/pam.d/password-auth'' der ideale Ort dafür, ist fraglich. Und was passiert, wenn authselect o.ä. ausgeführt wird? )) | ||
+ | tail -F /tmp/passwords | ||
+ | warten ;-) | ||