如果 DNS 隧道处于活动状态,则无法在 ssh 中登录两次

如果 DNS 隧道处于活动状态,则无法在 ssh 中登录两次

我最近安装了 WireGuard,这样我就可以将 DNS 请求隧道传输到 VPN。我还有 portsentry 和 fail2ban,但现在我禁用了它们,直到找到问题的解决方案。

当我在 ssh 中登录我的用户时,一切都正常。但我必须等待几分钟才能进行第二次登录,即使我关闭了第一个连接,如果没有,它会尝试很长时间进行连接,但连接超时。我只在 wan 上遇到这个问题,在 lan 上没有。在其他设备(智能手机)上,我可以检查,如果我禁用 VPN,我可以多次登录而不会出现问题。但真正奇怪的是,在我的 PC 上,即使我禁用 VPN,我也遇到同样的问题(没有 VPN 的 DNS 是 8.8.8.8 和 9.9.9.9)。

我可以看到指向我 IP 的/var/log/auth.log警告。所以,这一定是 DNS 反向建议。我禁用了这些警告,并将其添加到系统文件中。直到现在,我仍然遇到第二次登录问题。"POSSIBLE BREAK-IN ATTEMPT!"UseDNS nosshd_config

其他一些信息:

  • iptables 没有禁止我的 IP,之后iptables -Xiptables -F遇到了同样的问题。

  • 文件中没有该 IP /etc/hosts.deny

我的/etc/ssh/sshd_config是:

# What ports, IPs and protocols we listen for
Port "myport"
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication yes

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

# Only allow "myuser"
AllowUsers "myuser"

# Allow DNS reverse (wireguard)
UseDNS no

其中“myport”和“myuser”是我的端口和用户数据。

我怎样才能检查出了什么问题?

相关内容