LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-27-2009, 09:34 AM   #1
SavoTU
Member
 
Registered: Apr 2005
Distribution: Slackware64 Current
Posts: 199

Rep: Reputation: 40
Firewall


I have written a script that will find failed ssh logins and block the offending ip address and set it up to write to my firewall which was generated by alien bobs script.

I just want to check the command i am adding to the end of the script is correct.

iptables -A INPUT -s IPADDRESS -j DROP

Thanks
 
Old 09-27-2009, 10:09 AM   #2
Scuzz
Member
 
Registered: Jul 2009
Posts: 35

Rep: Reputation: 16
This is my /etc/rc.d/rc.firewall i use this to block brute force ssh logins

The xxx.xxx.xxx.xxx is where you put a remote ip you want to always accept. you can keep adding ips if needed.
These tables will also drop localhost connection if the ip isnt set in xxx.xxx.xxxx.xxx

Code:
iptables -N SSHSCAN
iptables -A INPUT -p tcp --dport 22 -s xxx.xxx.xxx.xxx -j ACCEPT   
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j SSHSCAN
iptables -A SSHSCAN -m recent --set --name SSH
iptables -A SSHSCAN -m recent --update --seconds 300 --hitcount 3 --name SSH -j LOG --log-level info --log-prefix "SSH SCAN blocked: "
iptables -A SSHSCAN -m recent --update --seconds 300 --hitcount 3 --name SSH -j DROP
After 3 bad login attempts, there connection is dropped for 5 minutes.
Each time they try and login after the connection has been dropped keeps reseting the timer to 5 minutes.

This is a script i found and been using for awhile now.
I know i didnt realy answer your question but just showing you another way of going about what your after.

Last edited by Scuzz; 09-27-2009 at 10:18 AM.
 
Old 09-27-2009, 10:18 AM   #3
SavoTU
Member
 
Registered: Apr 2005
Distribution: Slackware64 Current
Posts: 199

Original Poster
Rep: Reputation: 40
Thanks for that i have been teaching my self Perl which is why i wrote the script, but your code there confirms that the command i have should work and now my script is finished it can be deemed unnecessary as there is no point checking the log file if that is all that's needed.
 
Old 09-27-2009, 10:21 AM   #4
tuxrules
Senior Member
 
Registered: Jun 2004
Location: Chicago
Distribution: Slackware64 -current
Posts: 1,158

Rep: Reputation: 62
EDIT: my reply was similar to that to Scuzz.

Last edited by tuxrules; 09-27-2009 at 10:25 AM.
 
Old 09-27-2009, 01:34 PM   #5
SavoTU
Member
 
Registered: Apr 2005
Distribution: Slackware64 Current
Posts: 199

Original Poster
Rep: Reputation: 40
I have just noticed my modem flashing like mad and it turns out that adding the above to my firewall script doesn't work for some reason.

Can anyone let me know if there is anything different i can do to make it work with alien bobs firewall generator?

EDIT

Sorry posted to soon i placed the code in the ssh section and it worked.

Last edited by SavoTU; 09-27-2009 at 01:42 PM.
 
  


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
pptp gets modem hung up outside firewall, but not inside firewall cmnorton Linux - Networking 4 11-27-2008 12:04 AM
router billion 5102 has firewall and software firewall tests aus9 Linux - Security 6 12-31-2006 10:09 PM
slackware's /etc/rc.d/rc.firewall equivalent ||| firewall script startup win32sux Debian 1 03-06-2004 09:15 PM
Firewall Builder sample firewall policy file ? (.xml) nuwanguy Linux - Networking 0 09-13-2003 12:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:40 PM.

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