Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Please help me block a port, I am a Linux Newbie (big time) I installed Slackware 9.0 about a week ago I have everything up and running almost but I have port 515, 6000 open and cant seem to shut them. So I thought I could Firewall it with iptables. I am on a cable modem. Here is the Syntax I am using
iptables -A INPUT -p all -d 515 -j DROP
When I Run iptools -L I get
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -- anywhere 0.0.2.3
the port 515 is still open when I run nmap
Any help would be appreciated
The -d option is destination ip address (like 192.168.0.1), not destination port. What you want is --dport 515 instead. You will also get errors trying to do -p all --dport 515, because there are no port numbers for the icmp protocol. Only tcp and udp protocols use port numbers, so just make two rules:
iptables -A INPUT -p tcp --dport 515 -j DROP
iptables -A INPUT -p udp --dport 515 -j DROP
For port 6000 you have to be a little more careful, because it's the port that the Xserver connects to. If you block port 6000 to all interfaces, I'm pretty sure you won't be able to start X. So when you write that rule, remember to at least allow conections over the loopback interface. Something like this will do:
iptables -A INPUT -i !lo -p tcp --dport 6000 -j DROP
Where that is an exclaimation point before the lo. So what that's doing is saying "drop all connections to port 6000 that are not over the loopback interface".
HTH
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.