The web hosting publication by web hosting users for web hosting users
Update a Host / Editor Login
Search
Article News Host Business Name
DIRECTORY TOP RATING EDITOR REVIEW SEARCH HOSTING SHOWCASE BECOME AN EDITOR
RECENT NEWS
ICANN Decides To Expand Internet
Pingdom Adds Business Monitoring Plan
Apptix Offers Hosted VoIP Products
Hostway Offers Free Server Setup
FWHN Offers 3 Discount Programs
Hosting Networking Site Launches
Infinera Names Strategic Materials VP
Egenera Hosts Virtualization Webinar
ARTICLES
Co-location Hosting
Dedicated Servers
Domain Names
E-Commerce / Merchant Accounts / Payment Gateways
Free Web Hosting
General Web Hosting
Hosting Software & Control Panels
Managed Web Hosting
Programming
Reseller Hosting
Running a Web Hosting Business
Search Engine Optimization
Specific Web Hosting Provider or Company
Technical & Security
Useful Website Tools
Virtual Private Servers
Web Design & Content
Website Marketing Campaign
SEARCH ARTICLES
WEBHOST DIRECTORY
By Location

By Category
Application Hosting
Collocation Hosting
Dedicated Servers
Domain Name Registration
Ecommerce Hosting
Free Web Hosting
Reseller Domain Name Registration
Reseller Hosting
Shared Web Hosting
Virtual Private Servers
By Function
Windows Web hosting
PHP Web Hosting
Mysql Web Hosting
ASP Web Hosting
MS SQL Server Web Hosting
Coldfusion Web Hosting
MS FrontPage Web Hosting
Ecommerce Web Hosting
Cheap/Discount Web Hosting
Personal Web Hosting
Domain Name Web Hosting
A-Z Listing
Enter web host domain:




Articles
  You are here : Home Articles Technical & Security
APF Deny ALL for SSH - Limit IP Connections
Submitted by Darren Star on | 211 reads
APF Deny ALL for SSH – Limit IP Connections

Do you know the coolest part from APF firewall? It can deny ALL connections for ssh and allow only a single or select few of IPs to connect to your server. This article provides guidance 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, e.g. 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, e.g. 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.


ARTICLES | NEWS | DIRECTORY | TOP REVIEWS| TOP RATINGS| SEARCH | SHOWCASE | UPDATE A HOST
OUR EDITORS | CONTACT US | ADVERTISING | TERMS OF AGREEMENT
© Copyright 2006 , The Web Hosting Herald. All rights reserved.