+ Reply to Thread
Results 1 to 2 of 2




  

Thread: APF Deny ALL for SSH - Limit IP Connections

      
  1. #1
    sandy
    Forum Guest

    Thumbs up APF Deny ALL for SSH - Limit IP Connections

    APF firewall can deny ALL connections for ssh and allow only a single or select few of IPs to connect to your server. We’ll guide you through DENY ALL with APF firewall.

    PROBLEM:
    You want to deny all IPs to connect to shell/ssh on you server but only allow a select one or few to connect with APF firewall.

    APF SOLUTION:
    1) Login to your server as the root user.

    2) cd /etc/apf

    3) Use vi or nano to edit the /etc/apf/allow_hosts.rules file
    EG: vi /etc/apf/allow_hosts.rules

    4) Scroll down until after their last comment with the ##

    Add the following in:

    tcp:in:d=22:s=YOURHOMEIPHERE
    out:d=22:d=YOURHOMEIPHERE

    The d=22 part is the port, so you can repeat for other services as well to limit connections if you like.

    Save the changes.

    5) Edit the /etc/apf/deny_hosts.rules file
    EG: vi /etc/apf/deny_hosts.rules

    Scroll down until the last default comment ## then below it add the following:

    tcp:in:d=22:s=0/0
    out:d=22:d=0/0

    Save the changes.

    6) Restart APF firewall
    apf -r

    Your server is now only allowing connections to the SSH service from one IP using APF. To add more than one IP repeat the steps in 4) adding a new tcp and out line for each IP.

  2. #2
    The Force is Strong! wildweb is on a distinguished road wildweb's Avatar
    Join Date
    April 7, 2007
    Location
    Los Angeles
    Posts
    52
    Rep Power
    6
    Feedback Score
    0

    Default

    you really should move SSH completely off of port 22 period. All the bad folks, script kids and other wannabe's know to try port 22. Changing it is as easy as editing a script and restarting the daemon. Changing the port to something more obscure coupled with denying Root access login (require reular login then SU) plus IP restriction is a very solid practice for securing one of the biggest liability holes on a webserver...especially for those new to *nix and/or web sites.

    tc
    Directory-Owners.com
    Forums, Resources, and Directory for directory owners
    Interviews - SEO Articles

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Upload Limit Workarounds?
    By West in forum Web Hosting
    Replies: 4
    Last Post: Dec 12th, 2006, 7:44 pm
  2. Kmemsize Memory Limit
    By grim in forum Dedicated / VPS Hosting
    Replies: 7
    Last Post: Nov 14th, 2006, 12:40 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
WebTalkForums
WebTalkForums
Recent Forum Threads