问题原文
原帖链接 · Déjà vu · CC BY-SA 3.0
Have two servers communicating via ssh and crontab, a "master" and a "slave". Only the master can connect (execute command) on the slave.
Authentication was done automatically (IPv4) thanks to
- master's
~/.ssh/id_rsa.pubadded to slave's~/.ssh/authorized_keys - slave's
sshd_confighavingAllowUsers [email omitted]
It was working fine until IPv6 was added
- both master and slave have IPv6 enabled
- both servers have had DNS reverse setup for both protocols
- sshd_config changed to
AllowUsers [email omitted]
and was hoping sshd slave does a reverse lookup of the incoming IPv6 IP (to get myhost.tld) but auth.log shows
User me from 2103:cc11::...:fe93:4a10 not allowed because not listed in AllowUsers
I'd have two questions
- does
sshdperform an IPv6 reverse lookup to find out if the host matches? (if yes, there is another problem) what is the correct way to add an IPv6 address hard-coded in. (edit works without theAllowUsers? It seemsme@[2103:cc11::...:fe93:4a10]doesn't work[])
已采纳解答
原帖链接 · William Sandin · CC BY-SA 3.0
Have a look at the UseDNS directive.
"UseDNS Specifies whether sshd(8) should look up the remote host name, and to check that the resolved hostname for the remote IP address maps back to the very same IP address.
If this option is set to no (the default) then only addresses and not host names may be used in ~/.ssh/authorized_keys from and sshd_config Match Host directives."
As a side-note you could always configure the client to force IPv4 for connection to that particular host in your ssh_config. I mostly used AllowUsers to match usernames, if you want to match on hostnames and IP you might want to have a look at using TCP wrapper instead.
See: https://www.akadia.com/services/ssh_tcp_wrapper.html
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
