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-03-2007, 12:03 PM   #1
marcossf
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
how to block port 135


Hi

My server (fedora 5) is receiving hundreds of scans on port 135 everyday. It's normal, I know. That's why I'm trying to drop all packets to/from port 135 with iptables (version 1.3.5). But when I look at the network traffic with iptraf 3.0.0, it still shows packets arriving on port 135.

Can somebody take a look at my iptables config file? As you can see, I tried everything!
Is iptraf catching packets before iptables?

# Generated by iptables-save v1.3.5 on Fri Mar 30 17:49:54 2007
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [16303:6247268]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -p tcp -m multiport --dports 135 -j DROP
-A INPUT -p udp -m multiport --dports 135 -j DROP
-A INPUT -p tcp -m tcp --dport 135 -j DROP
-A INPUT -p udp -m udp --dport 135 -j DROP
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A OUTPUT -p tcp -m multiport --sports 135 -j DROP
-A OUTPUT -p udp -m multiport --sports 135 -j DROP
-A OUTPUT -p udp -m udp --sport 123 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 135 -j DROP
-A OUTPUT -p udp -m udp --sport 135 -j DROP
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 123 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 9081 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 22 -m iprange --src-range 444.444.444.444-555.555.555.555 -j ACCEPT
-A RH-Firewall-1-INPUT -s 333.333.333.333 -p tcp -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Fri Mar 30 17:49:54 2007
# OF COURSE THE IP ADDRESSES SHOWED ABOVE WHERE CHANGED

Thank you

Marcos
 
Old 04-03-2007, 05:18 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
These are the iptables rules that Shorewall made for me. This listing came from me entering iptables -L.
Code:
Chain DropSMB (1 references)
target     prot opt source               destination
DROP       udp  --  anywhere             anywhere            udp dpt:135
DROP       udp  --  anywhere             anywhere            udp dpts:netbios-ns:netbios-ssn
DROP       udp  --  anywhere             anywhere            udp dpt:microsoft-ds
DROP       tcp  --  anywhere             anywhere            tcp dpt:135
DROP       tcp  --  anywhere             anywhere            tcp dpt:netbios-ssn
DROP       tcp  --  anywhere             anywhere            tcp dpt:microsoft-ds
 
Old 04-03-2007, 06:27 PM   #3
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Your rules look like they should block those packets. I believe the reason you're still seeing them with IPtraf is because it uses raw sockets and looks at network traffic earlier in the network stack before iptables handles the packets. So they're still getting dropped, you're just peaking at the traffic before it gets dropped. To be sure, do iptables -vnL. Look at the output showing your dport 135 rules and see if the packet and byte counters show anything being blocked. It will look something like this (packet and byte counters are the 1st and 2nd numbers):
Code:
12203 1550K DROP     all  --  eth0   *    0.0.0.0/0    0.0.0.0/0  tcp dpt:135
If those rules aren't working for some reason, then those numbers will be zero.
 
Old 04-04-2007, 10:41 AM   #4
marcossf
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thumbs up thank you

iptables is working!
iptraf catches packets before iptables.
thank you.
 
  


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
unwanted network traffic on tcp port 135 debasish_5849 Linux - Security 4 04-20-2006 10:33 PM
How to block a port, such as 21? iclinux Linux - Newbie 3 01-16-2005 12:51 PM
Getting through a port block basketkase999 Linux - Networking 3 12-16-2004 02:58 PM
Port Scan on 135 ghight Linux - Security 6 12-15-2003 12:40 PM
TCP packets port 135,137,138,139 Gilion Linux - Networking 1 10-27-2003 09:11 AM

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

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