patrickkasie
Verified User
Dear DirectAdmin forum,
I would like to know how only one or several IP addresses van access port 22, denying every other IP address on port 22, but all other open ports to be accessible by the zoo nextdoors or those Russian hackers that always seem to wiggle their way into everyone's system. Edit: Similar to /etc/hosts.allow in CentOS7, but for AlmaLinux 8
I have seen the following thread but I don't know where to put this specifically in the file/how to make it work/what line etc:
forum.directadmin.com
I am familiar with the conf, so this is the -confusing- result when asking ChatGPT:
I would like to know how only one or several IP addresses van access port 22, denying every other IP address on port 22, but all other open ports to be accessible by the zoo nextdoors or those Russian hackers that always seem to wiggle their way into everyone's system. Edit: Similar to /etc/hosts.allow in CentOS7, but for AlmaLinux 8
I have seen the following thread but I don't know where to put this specifically in the file/how to make it work/what line etc:
only one IP adress for directadmin
I know this question has been asked many times before. I do think I implemented it right but it doesn't work yet. I want only one IP address to be able to login to direct admin. So I added this line to csf.allow tcp|in|d=2222|s=ip adress I use and restarted csf and lfd but it doesnt work. My...

I am familiar with the conf, so this is the -confusing- result when asking ChatGPT:
Code:
User
So what happens when I do something like this:TCP_IN = "20,21,22,123.456.78.90,192.168.1.0/24,111.111.111.111,23,53,80"
ChatGPT
In the configuration you provided:
plaintextCopy code
TCP_IN = "20,21,22,123.456.78.90,192.168.1.0/24,111.111.111.111,23,53,80"
You are specifying a list of allowed TCP ports and IP addresses for incoming connections. Here's what each component means:
[LIST]
[*]20,21,22,23,53,80: These are the TCP ports allowed for incoming connections. Ports 20, 21, 22, 23, 53, and 80 are commonly associated with FTP, SSH, Telnet, DNS, and HTTP respectively.
[*]123.456.78.90: This is an IP address from which SSH connections are allowed.
[*]192.168.1.0/24: This is a CIDR notation representing the IP address range 192.168.1.0 to 192.168.1.255, commonly associated with a local network.
[*]111.111.111.111: This is an additional specific IP address from which incoming connections are allowed on the specified ports.
[/LIST]
With this configuration:
[LIST]
[*]Incoming connections to ports 20, 21, 22, 23, 53, and 80 from any IP address are allowed.
[*]Incoming SSH connections (port 22) are allowed only from the IP addresses 123.456.78.90 and 192.168.1.0/24.
[*]Incoming connections from any IP address within the 192.168.1.0/24 network are allowed on all specified ports.
[*]Incoming connections from the specific IP address 111.111.111.111 are allowed on all specified ports.
[*]All other incoming connections to unspecified ports are denied by default.
[/LIST]
As with any firewall configuration, it's essential to thoroughly review and test your rules to ensure they align with your security requirements and that they function as intended. Regularly monitoring and updating your firewall rules is also important to maintain the security of your system.
User
What about something like this:
TCP_IN = "20,21,23,53,80,tcp|in|d=22|s=111.111.111.111"
ChatGPT
In the configuration you provided:
plaintext
Copy code
TCP_IN = "20,21,23,53,80,tcp|in|d=22|s=111.111.111.111"
You are specifying a list of allowed TCP ports and IP address/port combinations for incoming connections. Here's what each component means:
20,21,23,53,80: These are the TCP ports allowed for incoming connections. Ports 20, 21, 23, 53, and 80 are commonly associated with FTP, SSH, Telnet, DNS, and HTTP respectively.
tcp|in|d=22|s=111.111.111.111: This is a specific rule for SSH (port 22) connections from the IP address 111.111.111.111.
With this configuration:
Incoming connections to ports 20, 21, 23, 53, and 80 from any IP address are allowed.
SSH connections (port 22) are allowed only from the specific IP address 111.111.111.111.
All other incoming connections to unspecified ports are denied by default.
This configuration provides granular control over SSH access by allowing connections only from the specified IP address while allowing other services to accept connections from any IP address. It's a more specific rule compared to allowing SSH access from all IP addresses or from a range of IP addresses.
As always, thoroughly review and test your firewall rules to ensure they meet your security requirements and function as intended. Regularly updating and monitoring your firewall rules is also important to maintain the security of your system.