LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-30-2006, 12:18 PM   #1
daiver
Member
 
Registered: Oct 2003
Location: Uruguay
Distribution: PCLinuxOS
Posts: 53

Rep: Reputation: 15
Blacklist all, whitelist two countries


I've been reading some horror stories about people getting cracked and played with. I would really like to avoid this.

I would like to have remote SSH access to my computer, but I don't want anyone else to have it. Nothing is secure, but at least I can narrow it down.

Basically, I want no computers to have access to mine anywhere in the world, EXCEPT for computers in Uruguay and Argentina. So I guess that would involve blacklisting the world and whitelisting these two countries. I guess that this would narrow down the hacking possibilities.

Can anyone teach or link me how to do this?

Also, how do I dissallow root SSH access?

Edit: If someone can explain how to change the SSH port and what port I should put it in, that would be great too. Thanks!

Last edited by daiver; 04-30-2006 at 12:19 PM.
 
Old 04-30-2006, 01:42 PM   #2
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
Reply

To disable remote root access go into /etc/ssh/sshd_config and change PermitRootLogin to no. This will make the user have to su to get access to root. You might also want to set it up that only users in a select group can su into it. This is traditionally wheel. If using a Linux system with PAM go into /etc/pam.d/su and uncomment:

auth required pam_wheel.so group=wheel

Make sure you're in the group before you do this or at least make sure you have a root session already open in case of problems. Open up another terminal and test whether you can su into it. If not uncomment it and find out what's wrong. If you're on a distro without pam you want to look into /etc/login.defs

To only allow certain traffic I would suggest looking into tcp wrappers. The files are /etc/hosts.allow and /etc/hosts.deny. You can find some online docs telling you how to do this. You can specify specific hosts, ranges, etc. For you to block by country you would need to find out which ip ranges are registered to your country. I don't know if this is possible. However, they're are tricks if you want to limit access to select known hosts. If you have a dynamic IP look into no-ip.com which lets you use a dns name with a dynamic ip. You can also set up a VPN which would give you a private network.


To change the SSH port this is listed in /etc/sshd_config as well. Change the port and restart it with

/etc/init.d/ssh restart

Last edited by HGeneAnthony; 04-30-2006 at 01:48 PM.
 
Old 04-30-2006, 02:44 PM   #3
daiver
Member
 
Registered: Oct 2003
Location: Uruguay
Distribution: PCLinuxOS
Posts: 53

Original Poster
Rep: Reputation: 15
Awesome information! Thank you very much. Ill investigate and see how can I block countries. Its probably easier not to block countries, but only to allow a few of them.
 
Old 04-30-2006, 03:32 PM   #4
daiver
Member
 
Registered: Oct 2003
Location: Uruguay
Distribution: PCLinuxOS
Posts: 53

Original Poster
Rep: Reputation: 15
I was also wondering if there was something similar to this:

if nslookup=*.uy, *.ar
then allow access
else block

I am aware that this is not programming language, I just needed a quick way to express myself.
 
Old 04-30-2006, 10:41 PM   #5
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
Reply

I'm really not sure. I haven't looked into it to much beyond my own needs. The one thing is users who might connect to your system probably won't have a dns to begin with so this might not work well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail : Whitelist Skip-DMP Linux - Software 5 04-11-2006 10:38 AM
spamassassin blacklist stomach Linux - Software 1 02-08-2006 04:37 PM
'blacklist' WARNING JerryP Mandriva 5 12-01-2005 06:47 PM
secret whitelist for qmail Chris Murphy Linux - General 1 01-03-2005 12:35 AM
Spamassassin 3 whitelist ignored gquiring Linux - Software 0 10-04-2004 08:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration