LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Cant get blacklisting script (sshblack) working (https://www.linuxquestions.org/questions/linux-security-4/cant-get-blacklisting-script-sshblack-working-374854/)

blkcamarozr28 10-19-2005 08:01 PM

Cant get blacklisting script (sshblack) working
 
blacklisting script: http://www.pettingers.org/code/SSHBlack.html

Im running FC3 with IPTABLES.

Here is my iptables config [/etc/sysconfig/iptables]
Code:

:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:BLACKLIST - [0:0]                <---------Add BLACKLIST CHAIN
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A INPUT -p tcp -m tcp --dport 22 -j BLACKLIST  <------Add Checking of SSH via BLACKLIST
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 110 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 110 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --source 192.168.0.0/255.255.255.0 --dport 137:139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --source 192.168.0.0/255.255.255.0 --dport 137:139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 465 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 465 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 995 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 995 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

and im running the default for /usr/src/sshblack/sshblack.pl

Does everything above look okay? I tried getting it to lock me out but it wont.
Is it because i have this in there?

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT


However, if I take that line out you cant connect via SSH.

blkcamarozr28 10-19-2005 11:44 PM

I figured it out! :D


-A INPUT -p tcp -m tcp --dport 22 -j BLACKLIST <------Add Checking of SSH via BLACKLIST

Should of been this:
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 22 -j BLACKLIST <------Add Checking of SSH via BLACKLIST
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT:D :D

Because the default Redhat firewall uses RH-Firewall-1 as the INPUT name. doh! Other then that you need to make sure the -j BLACKLIST is before the regular SSH ACL.


All times are GMT -5. The time now is 08:15 AM.