LinuxQuestions.org
Help answer threads with 0 replies.
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 03-06-2012, 07:44 PM   #1
angelo.c
Member
 
Registered: Jul 2011
Location: Hong Kong
Distribution: Slackware 13.1,CentOS 6.4,Fedora 16
Posts: 56

Rep: Reputation: Disabled
Checking Linux firewall security


Hello,everyone.

I've just adjusted my linux firewall (iptables) and would like to know what program can I use to check whether the firewall is functioning.I mean,whether the firewall is protecting my computer from attack.

I hope you guys can give me some hints on this.
 
Old 03-06-2012, 07:53 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
A common utility for host scanning (confirming TCP/UDP ports are open or filtered) is nmap. It should be available in your distro's repositories.
 
Old 03-06-2012, 08:48 PM   #3
angelo.c
Member
 
Registered: Jul 2011
Location: Hong Kong
Distribution: Slackware 13.1,CentOS 6.4,Fedora 16
Posts: 56

Original Poster
Rep: Reputation: Disabled
anomie,thanks for your prompt reply.

Actually,my home server is behind my router so it actually blocks all incoming connection except those I open (e.g.http,ssh).However,I am curious to know whether I know which port(s) the server is opening for connection when the router doesn't exist?I've tried like nmap localhost and it lists the port which is open but I don't know whether it's accessible to outsider(Outside the LAN) or not.

Sorry for bothering you with yet another dumb question.
 
Old 03-06-2012, 09:46 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Scanning localhost doesn't provide any info of real value.

Can you scan your host from another device (e.g. a laptop) on your same, private subnet? That would be best.

From the host itself, you can see which TCP / UDP sockets are listening with:
Code:
# netstat -ltunp
(Those options are, in order, "l"istening_sockets + "t"cp + "u"dp + "n"o_resolve + "p"rogram_listening.)

And you can of course see your netfilter ruleset with:
Code:
# iptables-save
But a scan of the host is the true test.
 
Old 03-06-2012, 10:46 PM   #5
angelo.c
Member
 
Registered: Jul 2011
Location: Hong Kong
Distribution: Slackware 13.1,CentOS 6.4,Fedora 16
Posts: 56

Original Poster
Rep: Reputation: Disabled
anomie,thanks again for the help.

After issuing the netstat as specified by you,I got the following result:
Click image for larger version

Name:	Capture.JPG
Views:	24
Size:	60.3 KB
ID:	9203

But the question is,which one is opening to outsider?I did open these ports but not sure they are opened to outsider.

Thanks.
 
Old 03-07-2012, 01:50 AM   #6
leslie_jones
Member
 
Registered: Sep 2011
Posts: 130

Rep: Reputation: Disabled
You could try: http://nmap-online.com/

Use a 'custom scan' like: -sS -PN <your_public_ip>

Don't bother with the 'email me results', just leave it running in the background.

I've had mixed results with it myself, it has been known to contradict itself at times.
 
Old 03-07-2012, 03:02 AM   #7
angelo.c
Member
 
Registered: Jul 2011
Location: Hong Kong
Distribution: Slackware 13.1,CentOS 6.4,Fedora 16
Posts: 56

Original Poster
Rep: Reputation: Disabled
leslie_jones,thanks for replying me.

What's the different between your website besides the nmap on my server? I guess they are more or less the same.

Thanks.
 
Old 03-07-2012, 05:44 AM   #8
leslie_jones
Member
 
Registered: Sep 2011
Posts: 130

Rep: Reputation: Disabled
The online version is on the public side of the router/gateway, whereas if your server, and testing client, is behind it on your lan - the view may be very different.
 
Old 03-07-2012, 11:57 AM   #9
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by angelo.c
But the question is,which one is opening to outsider?I did open these ports but not sure they are opened to outsider.
The way to interpret that output is - check the "Local Address" column:
  • 0.0.0.0 -- listening on all interfaces over IPv4
  • ::: -- listening on all interfaces over IPv6
  • 192.168.1.201 -- listening on that particular IPv4 address / interface
  • 127.0.0.1 -- listening on localhost

In cases where you have 0.0.0.0, :::, or 192.168.x.y, you should be aware that you're listening for connections from the outside world. (Well, 192.168.1/24 is RFC 1918 private IP space, but you said you're forwarding connections from your router.)

So if there are any of those services you don't want to be potentially serving up to the 'net, then be sure your netfilter ruleset is protecting them. Or - if you're not using it - disable and/or uninstall the service.
 
Old 03-10-2012, 08:29 PM   #10
brak44
Member
 
Registered: Aug 2010
Location: Brisbane Australia
Distribution: Centos, Fedora
Posts: 87

Rep: Reputation: 24
Try the ShieldsUP! application at https://www.grc.com
The objective here is to get a PASS on All Service Ports in Stealth (all green).
To be able to pass you need to suppress ICMP Echo Request (ping) which you may not want to do.
 
1 members found this post helpful.
Old 03-11-2012, 12:56 AM   #11
angelo.c
Member
 
Registered: Jul 2011
Location: Hong Kong
Distribution: Slackware 13.1,CentOS 6.4,Fedora 16
Posts: 56

Original Poster
Rep: Reputation: Disabled
Thanks for the detailed replies from anomie and brak44. Those are very informative knowledge which I should have.

Quote:
In cases where you have 0.0.0.0, :::, or 192.168.x.y, you should be aware that you're listening for connections from the outside world. (Well, 192.168.1/24 is RFC 1918 private IP space, but you said you're forwarding connections from your router.)

So if there are any of those services you don't want to be potentially serving up to the 'net, then be sure your netfilter ruleset is protecting them. Or - if you're not using it - disable and/or uninstall the service.
anomie,I use my router to forward some specific service like web or ssh only.As I used the ShieldUp which is recommended by brak44,they can only scan the port 80 as open.So I think I am protected against intrusion other than attack from port 80.

I think if time is allowed for the experiment,I have to connect my web server directly with the outside world to see whether the iptable rules are activated.

Last edited by angelo.c; 03-11-2012 at 01:44 AM.
 
  


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
Internet security/Firewall for linux joshd1982 Linux - Newbie 4 01-29-2006 06:19 PM

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

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