patrickkasie
Verified User
Dear DirectAdmin forum,
I have set up my servers to have the following lines in /etc/hosts.allow:
However, some of the servers do not seem to take the /etc/hosts.allow into account, where I'm capable of connecting to those servers on a foreign IP address. I have taken in the answer from ChatGPT to do the following:
Resulting in the following error:
I had already noticed that the /etc/hosts.allow files on those servers did not exist from the moment I created them, but on other servers where the files do exist, they also include some comments detailing how the file works. It seems to be on those servers that there's no failed login attempts on SSH because the IP addresses get properly blocked, which is what I'm aiming for. How do I get to have this result on all servers? The following OS's are affected:
CentOS 7
CentOS 8
AlmaLinux 8.8
Edit: Some servers do not have CSF, nor would I like to add that to said servers. I would like to streamline everything in the same way with /etc/hosts.allow
I have set up my servers to have the following lines in /etc/hosts.allow:
Code:
sshd : localhost : allow
sshd : 192.168.1. : allow
sshd : my.own.ip.address : allow
sshd : ALL : deny
However, some of the servers do not seem to take the /etc/hosts.allow into account, where I'm capable of connecting to those servers on a foreign IP address. I have taken in the answer from ChatGPT to do the following:
Check SSH Configuration: First, confirm that your SSH server is configured to use /etc/hosts.allow and /etc/hosts.deny. The SSH server configuration file (sshd_config) should have the following settings:
shellCopy code
/etc/ssh/sshd_config:
# /etc/hosts.allow and /etc/hosts.deny
hosts.allow
hosts.deny
Resulting in the following error:
Code:
-- Unit sshd.service has begun starting up.
Oct 09 09:53:56 dabackup.domain.nl sshd[1930]: /etc/ssh/sshd_config: line 150: Bad configuration option: /etc/hosts.allow
Oct 09 09:53:56 dabackup.domain.nl sshd[1930]: /etc/ssh/sshd_config: line 151: Bad configuration option: /etc/hosts.deny
Oct 09 09:53:56 dabackup.domain.nl sshd[1930]: /etc/ssh/sshd_config: terminating, 2 bad configuration options
Oct 09 09:53:56 dabackup.domain.nl systemd[1]: sshd.service: Main process exited, code=exited, status=255/n/a
Oct 09 09:53:56 dabackup.domain.nl systemd[1]: sshd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
I had already noticed that the /etc/hosts.allow files on those servers did not exist from the moment I created them, but on other servers where the files do exist, they also include some comments detailing how the file works. It seems to be on those servers that there's no failed login attempts on SSH because the IP addresses get properly blocked, which is what I'm aiming for. How do I get to have this result on all servers? The following OS's are affected:
CentOS 7
CentOS 8
AlmaLinux 8.8
Edit: Some servers do not have CSF, nor would I like to add that to said servers. I would like to streamline everything in the same way with /etc/hosts.allow