Como parte de nossas pesquisas sobre o DRP, gostaríamos de ter certeza de que ainda conseguiremos acessar bastante rápido aos servidores quando o LDAP estiver inativo.
Eu adicionei tempos limite em nslcd.conf
e verifiquei se o PAM verificou contas / senhas locais antes do ldap.
O problema é com o SSHAuthorizedKeysCommand
. Eu adicionei um tempo limite ao ldapsearch
para que ele não seja interrompido para sempre.
O que eu não entendo é como sshd
funciona.
Parece que:
Existe uma maneira de fazer o sshd procurar por chaves nos arquivos antes de usar o comando?
Veja o log de depuração do sshd:
(Eu fiz o script SSHAuthorizedKeysCommand para produzir a data no STDERR quando executado.)
Connection from 192.168.x.y port 56662
debug1: Client protocol version 2.0; client software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
...
debug1: userauth-request for user ansible service ssh-connection method none
debug1: attempt 0 failures 0
...
debug2: input_userauth_request: try method none
debug1: PAM: initializing for "ansible"
debug1: userauth-request for user ansible service ssh-connection method publickey
debug1: attempt 1 failures 0
debug2: input_userauth_request: try method publickey
debug1: test whether pkalg/pkblob are acceptable
debug1: PAM: setting PAM_RHOST to "192.168.x.y"
debug1: PAM: setting PAM_TTY to "ssh"
debug1: temporarily_use_uid: 99/99 (e=0/0)
debug1: restore_uid: 0/0
debug1: permanently_set_uid: 99/99
mar. nov. 28 10:49:27 CET 2017
debug2: key not found
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 1011/1011 (e=0/0)
debug1: trying public key file /home/ansible/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: matching key found: file /home/ansible/.ssh/authorized_keys, line 1
Found matching RSA key: <hash>
debug1: restore_uid: 0/0
debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa
Postponed publickey for ansible from 192.168.x.y port 56662 ssh2
debug1: userauth-request for user ansible service ssh-connection method publickey
debug1: attempt 2 failures 0
debug2: input_userauth_request: try method publickey
debug1: temporarily_use_uid: 99/99 (e=0/0)
debug1: restore_uid: 0/0
debug1: permanently_set_uid: 99/99
mar. nov. 28 10:49:29 CET 2017
debug2: key not found
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 1011/1011 (e=0/0)
debug1: trying public key file /home/ansible/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: matching key found: file /home/ansible/.ssh/authorized_keys, line 1
Found matching RSA key: <hash>
debug1: restore_uid: 0/0
debug1: ssh_rsa_verify: signature correct
debug2: userauth_pubkey: authenticated 1 pkalg ssh-rsa
debug1: do_pam_account: called
Accepted publickey for ansible from 192.168.x.y port 56662 ssh2