Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Aug 11, 2014 10:51 pm 
Offline
Newbie
User avatar

Joined: Mon Aug 11, 2014 10:34 pm
Posts: 3
Website: http://www.onboardify.com
Location: San Francisco
This is the second time I am posting on the Linode forum, and my first experience was really great. Thank you to all who respond, in advance!

We use a Linode with Ubuntu 12.04. I went through the basics to install RSA encryption for SSH logins, and setup fail2ban, but I am not sure how to do the following. I want to only allow specific IP addresses (or ranges of IP addresses) to be able to SSH. In other words, I want to turn away ALL others from SSH. This way, I will be able to SSH from my office, and from home, and so will 1 other administrator. And block everybody else.

With my rudimentary unix sysadm knowledge - really, so rudimentary - I don't know how to configure fail2ban to enforce such a ban. Is this a normal thing to do, or is there a different way to achieve what I want - make it really restrictive for the world to access our servers, but allow a handful of known administrators only.

Any advice appreciated!
Thanks,
Vik


Top
   
PostPosted: Tue Aug 12, 2014 12:37 am 
Offline
Senior Member

Joined: Fri Jul 03, 2009 2:31 am
Posts: 54
ICQ: 897607
This is the job of your firewall, not fail2ban. fail2ban just watches your kernel logs for probes on your SSH and then sends commands to the firewall to start blocking those IP addresses.

If you want to whitelist specific IP addresses then you have no need for fail2ban... because all (non-whitelisted) IP addresses will already be blocked by the firewall.

On Ubuntu the easiest firewall choice for admins with rudimentary knowledge is Uncomplicated Firewall or "ufw". The guide I linked there will give you a few quick lines you can use to setup ufw, but in particular you are interested in is example 6:
Code:
sudo ufw allow proto tcp from 192.168.0.2 to any port 22


... where you replace 192.168.0.2 with an ip address you want to whitelist.

The Linode Iptables Guide also has an example of whitelisting IP addresses for SSH, but uses iptables directly instead of a beginner friendly syntax like ufw.


Top
   
PostPosted: Tue Aug 12, 2014 12:44 pm 
Offline
Senior Member

Joined: Sun May 23, 2010 1:57 pm
Posts: 315
Website: http://www.jebblue.net
For ssh I use AllowUsers lines in /etc/ssh/sshd_config.


Top
   
PostPosted: Tue Aug 12, 2014 1:21 pm 
Offline
Newbie
User avatar

Joined: Mon Aug 11, 2014 10:34 pm
Posts: 3
Website: http://www.onboardify.com
Location: San Francisco
Ox - I will read up on UFW, thanks for the information. I thought fail2ban was a firewall, but I guess I didn't read the Linode article properly (https://www.linode.com/docs/security/se ... our-server). I presume I can configure UFW to only block SSH traffic, but it will let all users to my web server (of course, I don't mind blocking bots from my web server).

Jebblue - That sounds like a very good thing for me to try. I appreciate the new solution!

You guys are great for helping, thank you!

_________________
Vik Chaudhary
vik@onboardify.com

Disclaimer: My employer cannot even understand my accent, let alone being responsible for my postings on this forum.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group