Symptoms
- Error appears in Plesk SSH Terminal extension:
ssh_exchange_identification: read: Connection reset by peer
-
In/var/log/fail2ban.log
, the following output found:fail2ban.filter [XXXXX]: INFO [ssh] Ignore 127.0.0.1 by ignoreself rule
fail2ban.filter [XXXXX]: INFO [ssh] Ignore 127.0.0.1 by ignoreself rule - In /var/log/secure the following output is found:
server sshd[XXXXX]: refused connect from 127.0.0.1 (127.0.0.1)
server sshd[XXXXX]: refused connect from 127.0.0.1 (127.0.0.1) - Fail2ban configuration has the following parameters set up:
# "ignorself" specifies whether the local resp. own IP addresses should be ignored
# (default is true). Fail2ban will not ban a host which matches such addresses.
ignorself = true# "ignoreip" can be a list of IP addresses, CIDR masks or DNS hosts. Fail2ban
# will not ban a host which matches an address in this list. Several addresses
# can be defined using space (and/or comma) separator.
ignoreip = 127.0.0.1/8 ::1
Cause
Custom configurations causing refused connections from localhost (127.0.0.1)
Resolution
- Login to the server via SSH
- Open
/etc/hosts.allow
in any text editor and allow connections from localhost by adding:sshd: 127.0.0.1
- Reload the sshd service:
# systemctl reload sshd