Q. I’ve CentOS Linux server configured with APF firewall. How do I open port 22 from specific IP address only? I’ve fix static ADSL IP address assgined and I’d like to open port 22 from my IP 22.214.171.124 only using APF firewall script. How do I configure firewall?
A. You need to edit two files:
a) /etc/apf/conf.apf – Main configuration file
b) /etc/apf/allow_hosts.rules – File to allow host wise configuration. You can set trust based rulesto grant access all or specific IP and port via the firewall.
Open file /etc/apf/conf.apf, enter:
# vi /etc/apf/conf.apf
Find line that read as follows:
ake sure you remove 22 from the list, so that it read as follows:
Save and close the file. Now, open /etc/apf/allow_hosts.rules
# vi /etc/apf/allow_hosts.rules
Allow incomming SSH (TCP port # 22) traffic from your own ADSL connection only 126.96.36.199, append following text.
Save and close the file. Restart APF firewall:
# /etc/init.d/apf restart