Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Shorewall oddities
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
lots
Tux's lil' helper
Tux's lil' helper


Joined: 11 Mar 2003
Posts: 95

PostPosted: Sun Oct 15, 2006 4:22 pm    Post subject: Shorewall oddities Reply with quote

I'm using Nmap on a windows machine (yeah I know :P, but its the only machine type I have available outside my shorewall router). I'm testing a new machine's firewall that I plan to replace my current firewall/router with. Upon using nmap's connect() scan, I discovered a bunch of random ports that are listed by nmap as open. Ports 22, 25, 113, nntp, imap, pop3, imap2. There may have been a few others, but I dont remember off the top of my head.

I thought this was odd, because during the test, the only port that should have reported back was 22, due to ssh. All the others should be filtered. I dont even have services running on these ports. So I figured I'd specifically add drop rules to the shorewall rules file, for these ports. Nothing's changed. Is this windows version of NMap crazy? or am I missing something. Shorewall is the only thing modifying the iptables rules, as far as I know :).
Back to top
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2588
Location: Near Toronto

PostPosted: Sun Oct 15, 2006 6:21 pm    Post subject: Reply with quote

Sorry if this it too obvious - but you're not testing
the network from *inside* the network are you?
Back to top
View user's profile Send private message
lots
Tux's lil' helper
Tux's lil' helper


Joined: 11 Mar 2003
Posts: 95

PostPosted: Sun Oct 15, 2006 6:56 pm    Post subject: Reply with quote

currently I've got it all set up in the following way:

Code:

<internet> ---- <current router> ----- <PC-A and PC-B>
                                    |
                                     ------<new router> ---- <laptop for testing>


Im running nmap from PC-A on the "outside" network to the new router. Also after completing an nmap scan using udp ports, I get a whole list of open ports.

Any advice on getting the default action for UDP ports to be dropped using shorewall?

Thanks for the help :)
Back to top
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2588
Location: Near Toronto

PostPosted: Mon Oct 16, 2006 12:15 pm    Post subject: Reply with quote

as a quick and dirty independent check, what does
shields up (https://www.grc.com/x/ne.dll?bh0bkyd2)
report?
Back to top
View user's profile Send private message
lots
Tux's lil' helper
Tux's lil' helper


Joined: 11 Mar 2003
Posts: 95

PostPosted: Mon Oct 16, 2006 8:59 pm    Post subject: Reply with quote

In order for me to check against shields up, i'd have to put my router out onto the internet. Currently the way its hooked up, it is still behind another router.

Maybe my attempt at a diagram was not clear :)

Basically I have a router running on my network currently. This router feeds directly to a switch which then feeds to the other computers on the network, _and_ my new router that I am setting up. My new router treats the peers on the "active" network as if they're from the internet, or supposidly it does :). It then serves this connection to a laptop I have hooked up to it for testing. I guess I can call this a "testing" network.

So ideally, the new router should be dropping unwanted connection attempts and nmap scans from other computers on the "active" network. Simply checking GRC will have GRC hit my old router, which isn't very effective. :)

I suppose I could temporarily hook my new router to the net to see what GRC says. I could also boot my laptop into knoppix and hook it up to the active network and see if linux based nmap reports anything different from the windows version. I'll get back to you on the GRC test when I get back home and can physically swap around the cables.

On a good note, it does appear to be dropping pings ... but udp port scans and some tcp ports still report active.. even though they shouldn't.

Are there any special rules I need to add to shorewall to have it drop everything from the net by default? I followed the tutorials on the shorewall site, but they included steps like this, and they rules/policies files are set up according to it.
Back to top
View user's profile Send private message
yabbadabbadont
Advocate
Advocate


Joined: 14 Mar 2003
Posts: 4791
Location: 2 exits past crazy

PostPosted: Mon Oct 16, 2006 9:05 pm    Post subject: Reply with quote

You probably should post the non-comment portions of the interfaces, policy, rules, and zones files.
_________________
Bones McCracker wrote:
On the other hand, regex is popular with the ladies.
Back to top
View user's profile Send private message
lots
Tux's lil' helper
Tux's lil' helper


Joined: 11 Mar 2003
Posts: 95

PostPosted: Mon Oct 16, 2006 10:47 pm    Post subject: Reply with quote

Here they are:

interfaces (note eth0 is internal):
Code:
net     eth1            detect          dhcp,tcpflags,routefilter,nosmurfs,logmartians
loc     eth0            detect          tcpflags,detectnets,nosmurfs


policy:
Code:
loc             net             ACCEPT
loc             $FW             ACCEPT
loc             all             REJECT          info
$FW             net             ACCEPT
$FW             loc             ACCEPT
$FW             all             REJECT          info
net             $FW             DROP            info
net             loc             DROP            info
net             all             DROP            info
all             all             DROP            info


zones:
Code:
fw      firewall
net     ipv4
loc     ipv4


rules:
Code:
DNS/ACCEPT      $FW             net
SSH/ACCEPT      loc             $FW
SSH/ACCEPT      net             $FW
Webmin/ACCEPT   loc             $FW
SMB/ACCEPT      $FW             loc
SMB/ACCEPT      loc             $FW
Ping/ACCEPT     loc             $FW
Ping/DROP       net             $FW
SMTP/DROP       net             loc
POP3/DROP       net             loc
IMAP/DROP       net             loc
NNTP/DROP       net             loc
SMTP/DROP       net             $FW
POP3/DROP       net             $FW
IMAP/DROP       net             $FW
NNTP/DROP       net             $FW
ACCEPT          $FW             loc             icmp
ACCEPT          $FW             net             icmp


Note in the rules file i added a bunch of drops for the specific ports that nmap reported. I will see what grc says in just a few minutes.


EDIT:
A run through of shields up on grc.com results in almost all ports being stealthed. The only two that are noticable to a random scan seem to be the ssh port (which I have been depating using a port knocker with) and the ident port.

Which makes me curious as to why my nmap scan using the connect scan type results in open ports? And should I be concerned with the open UDP ports? Though those too were obtained using the nmap windows version.. which im starting to think is bugged :)

Next to come is a scan of the new firewall using a linux native machine...

EDIT2:
I took a look using a linux based machine outside the new firewall's network, but inside my own network, and nmap there reported much more believable results (according to my configs). I now get filtered udp ports, and similar results to the grc site. All I need to do now is figure out how to stealth the ident and ssh ports in an effective way.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum