LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 02-09-2006, 11:10 PM   #1
~=gr3p=~
Member
 
Registered: Feb 2005
Location: ~h3av3n~
Distribution: RHEL 4, Fedora Core 3,6,7 Centos 5, Ubuntu 7.04
Posts: 227

Rep: Reputation: 30
Angry Port Scanning my server from Chinese


I have setup a good iptable firewall script on my GATEWAY machine (Linux 2.6xx) and rules for my internet NIC is:

ipt -A INPUT -i $INET_IFACE -m state --state NEW -j LOG --log-prefix "INPUT_IFACE_NEW: "
ipt -A INPUT -i $INET_IFACE -m state --state NEW -j DROP
ipt -A INPUT -i $INET_IFACE -m state --state INVALID,NEW -j LOG --log-prefix "INPUT_IFACE_NEW_INVALID: "
ipt -A INPUT -i $INET_IFACE -m state --state INVALID,NEW -j DROP

I use this nice open source product which alerts me of port scans:

http://www.cipherdyne.org/projects/psad/

I'm continuously recieving alerts for this IP Address from chinese source:

221.203.145.54

I have also added this IP in /ets/hosts.deny

what else can i do to stop this nuisance atleast from this IP. earlier i was under dictionary attack on my SSH port from chinese and i fixed by changing the port for SSH and using open source solution like DenyHosts.
 
Old 02-10-2006, 01:02 AM   #2
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Quote:
Originally Posted by ~=gr3p=~
I'm continuously recieving alerts for this IP Address from chinese source:

221.203.145.54
It seems to have a significant history of abuse.

what else can i do to stop this nuisance atleast from this IP.
Support for tcpwrappers (HostsDeny) isn't used by all applications, but you can completely ban all traffic with iptables using:
iptables -I INPUT -s 221.203.145.54 -j DROP

earlier i was under dictionary attack on my SSH port from chinese and i fixed by changing the port for SSH and using open source solution like DenyHosts.
Changing the port is effective in cutting the number of attacks, but you might want to switch to using key-based authentication rather than passwords. There also are a number of alternate solutions you may want to checkout in the thread on "Failed SSH Logins" at the top of the forum.
 
Old 02-11-2006, 01:47 AM   #3
~=gr3p=~
Member
 
Registered: Feb 2005
Location: ~h3av3n~
Distribution: RHEL 4, Fedora Core 3,6,7 Centos 5, Ubuntu 7.04
Posts: 227

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Capt_Caveman
It seems to have a significant history of abuse.
Support for tcpwrappers (HostsDeny) isn't used by all applications, but you can completely ban all traffic with iptables using:
iptables -I INPUT -s 221.203.145.54 -j DROP
I have only ssh running on 0.0.0.0 other services are binded to local LAN thats why i used 2nd level of security like tcp wrappers. maybe i'm too paranoid


Changing the port is effective in cutting the number of attacks, but you might want to switch to using key-based authentication rather than passwords. There also are a number of alternate solutions you may want to checkout in the thread on "Failed SSH Logins" at the top of the forum.


actually i have some variable clients who use WinSCP to connect to my SSH to download my application builds. it's easier form me to jus give them user/pass rather than breaking my head to show them how to generate public private pair and hand over the public key to me and give them my public key.

what u say buddy?
anywayz will check the thread

TIA

Last edited by ~=gr3p=~; 02-11-2006 at 01:49 AM.
 
Old 02-11-2006, 12:30 PM   #4
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 43
scponly

You could probably benefit from using scponly, which is essentially an ssh wrapper that allows only scp transfers. Here's the website: http://www.sublimation.org/scponly/. You can enable it by specifying it as the remote user's login shell. Keeping with defense in depth, this wouldn't give out a remote shell for the clients who only need scp, making a successful dictionary attack essentially futile (as long as the compromised user doesn't have write capability). It would still leave any administrative accounts vulnerable, though, without switching over completely to public/private keypair auth.
 
Old 02-11-2006, 10:54 PM   #5
~=gr3p=~
Member
 
Registered: Feb 2005
Location: ~h3av3n~
Distribution: RHEL 4, Fedora Core 3,6,7 Centos 5, Ubuntu 7.04
Posts: 227

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by taylor_venable
You could probably benefit from using scponly, which is essentially an ssh wrapper that allows only scp transfers. Here's the website: http://www.sublimation.org/scponly/. You can enable it by specifying it as the remote user's login shell. Keeping with defense in depth, this wouldn't give out a remote shell for the clients who only need scp, making a successful dictionary attack essentially futile (as long as the compromised user doesn't have write capability). It would still leave any administrative accounts vulnerable, though, without switching over completely to public/private keypair auth.
I give only SFTP access to my SSH server with chrooted environment. The shell for allusers is set to /usr/local/libexec/sftp-server

anywayz thnks for replies. maybe i'm too much paranoid.

just wanted to know any new things security experts here use. You see i'm just a young Linux admin in his 20's, single handedly configured & now managing my company's Gateway squid proxy ,Qmail server and one Linux Samab PDC. so wanna learn lot of new stuff and open source rox

Last edited by ~=gr3p=~; 02-11-2006 at 10:56 PM.
 
Old 02-12-2006, 12:41 PM   #6
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
In that case I recommend that you disable direct root access by setting PermitRootLogin to "no' (make sure it's uncommented as well). Make sure that you are using a decent password policy (not dictionary words). You can even reduce the number of MaxAuthTries which will bog down a brute force attempt.
 
  


Reply



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
Port scanning? muppski Linux - Security 6 07-01-2005 05:44 PM
Mail server port-scanning my firewall? bleunuit Linux - Networking 2 11-24-2004 05:14 PM
Smart Port Scanning? Half_Elf Linux - Security 1 01-25-2002 11:28 PM
port scanning johncla Linux - Networking 1 05-02-2001 03:09 AM
Port Scanning tfrye Linux - Security 2 03-24-2001 09:43 AM

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

All times are GMT -5. The time now is 07:04 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