Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Incoming TCP connections bloked
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
dave9000
n00b
n00b


Joined: 20 Feb 2005
Posts: 8

PostPosted: Sun Feb 20, 2005 7:46 pm    Post subject: Incoming TCP connections bloked Reply with quote

Hi,

because of a disk failure I had to re-install my Gentoo box from scratch (2004.3/amd64).
Most of the internet-related applications are working just fine (e.g. firefox, pan, bittorrent, ftp, ...) with some notable exceptions:

1. sshd can receive only local connections
2. aMule run low-id since the other clients cannot connect to port 4662 (changing port doesn't help)

I tried to cleanup the firewall ... I even unmerged iptables and removed packet-filtering support from the kernel!
Where may I look for something misconfigured?
xinetd is not running: should it?

Thanks for your help. dave
Back to top
View user's profile Send private message
Cuardin
l33t
l33t


Joined: 06 Feb 2003
Posts: 713
Location: vasastaden.stockholm.se

PostPosted: Sun Feb 20, 2005 7:53 pm    Post subject: Reply with quote

nmap is your friend. Do a portscan of your computer, first from itself to see which ports are open to localhost, and then from another computer to see which are open to the outside.
_________________
Part of "The adopt an unanswered post initiative"
Back to top
View user's profile Send private message
dave9000
n00b
n00b


Joined: 20 Feb 2005
Posts: 8

PostPosted: Sun Feb 20, 2005 9:15 pm    Post subject: Reply with quote

Cuardin wrote:
nmap is your friend. Do a portscan of your computer, first from itself to see which ports are open to localhost, and then from another computer to see which are open to the outside.


From the inside:
22/tcp open ssh
111/tcp open rpcbind
769/tcp open vid

From the outside (running nmap as unprivileged user):
Note: Host seems down.

I can ssh to localhost.
I can even get a connection to aMule with: telnet localhost 4662.
I am puzzled!
Back to top
View user's profile Send private message
Cuardin
l33t
l33t


Joined: 06 Feb 2003
Posts: 713
Location: vasastaden.stockholm.se

PostPosted: Sun Feb 20, 2005 9:44 pm    Post subject: Reply with quote

Try it again with the -P0 option.
nmap must have tried to ping your comp and you block the ping attempts.
Oh, and allways run nmap with as much verbosity as possible. -vv
_________________
Part of "The adopt an unanswered post initiative"
Back to top
View user's profile Send private message
dave9000
n00b
n00b


Joined: 20 Feb 2005
Posts: 8

PostPosted: Mon Feb 21, 2005 5:11 pm    Post subject: Reply with quote

In all tests aMule and sshd were both running and accessible from within the box.
iptables/ipchains are not installed.

[TEST1] kernel 2.6.10 R6 with packet filter support
In order to keep scan time short I restricted nmap to the ports I am interested in, plus a fake one for validation (5555):

[dave] nmap -sT -p '22,4662,5555' -vv -P0 myhost.dyndns.org
Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Host host181-86.pool8248.interbusiness.it (82.48.86.181) appears to be up ... good.
Initiating Connect() Scan against host181-86.pool8248.interbusiness.it (82.48.86.181)
The Connect() Scan took 36 seconds to scan 3 ports.
Interesting ports on host181-86.pool8248.interbusiness.it (82.48.86.181):
Port State Service
22/tcp filtered ssh
4662/tcp filtered unknown
5555/tcp filtered freeciv
Nmap run completed -- 1 IP address (1 host up) scanned in 37 seconds


[TEST2] kernel 2.6.10 R6 without packet filter support
[dave] nmap -sT -p '22,4662,5555' -vv -P0 myhost.dyndns.org
Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Host host181-86.pool8248.interbusiness.it (82.48.86.181) appears to be up ... good.
Initiating Connect() Scan against host181-86.pool8248.interbusiness.it (82.48.86.181)
The Connect() Scan took 0 seconds to scan 3 ports.
All 3 scanned ports on host181-86.pool8248.interbusiness.it (82.48.86.181) are: closed
Nmap run completed -- 1 IP address (1 host up) scanned in 0 seconds


[TEST3] kernel 2.6.10 R6 without packet filter support
[dave] nmap -sT -vv -P0 myhost.dyndns.org
Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Host host181-86.pool8248.interbusiness.it (82.48.86.181) appears to be up ... good.
Initiating Connect() Scan against host181-86.pool8248.interbusiness.it (82.48.86.181)
The Connect() Scan took 19 seconds to scan 1601 ports.
Interesting ports on host181-86.pool8248.interbusiness.it (82.48.86.181):
(The 1598 ports scanned but not shown below are in state: closed)
Port State Service
21/tcp filtered ftp
23/tcp filtered telnet
80/tcp filtered http
Nmap run completed -- 1 IP address (1 host up) scanned in 19 seconds
Back to top
View user's profile Send private message
Cuardin
l33t
l33t


Joined: 06 Feb 2003
Posts: 713
Location: vasastaden.stockholm.se

PostPosted: Mon Feb 21, 2005 6:59 pm    Post subject: Reply with quote

Filtered means that the port is blocked and not responding anythign at all I believe.
Closed means the kernel claims that noone has opened the port and tells nmap so.

But I am not really sure of the details on this. Either way, did you conf sshd to accept connections from external comps?
_________________
Part of "The adopt an unanswered post initiative"
Back to top
View user's profile Send private message
dave9000
n00b
n00b


Joined: 20 Feb 2005
Posts: 8

PostPosted: Tue Feb 22, 2005 5:21 pm    Post subject: Reply with quote

Cuardin wrote:
Either way, did you conf sshd to accept connections from external comps?


in my previous installation it worked out of the box with the default config (openssh 3.9).
This settings are uncommented by default:

root ~ grep -v '#' /etc/ssh/sshd_config
Protocol 2
PasswordAuthentication no
UsePAM yes
Subsystem sftp /usr/lib/misc/sftp-server


Anyway I guess this is not the point. I wonder how many layers of software are still between the network card and my application? layers I am not aware of ;-)
Firewall seems to be excluded. I re-emerged iptables just to check out:

root ~ iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


May something else related to security override application defaults? Maybe the pam thing?
Back to top
View user's profile Send private message
Cuardin
l33t
l33t


Joined: 06 Feb 2003
Posts: 713
Location: vasastaden.stockholm.se

PostPosted: Tue Feb 22, 2005 9:24 pm    Post subject: Reply with quote

And you are running sshd as a stand-alone? Not through inetd/xinetd?
OK, I see xinetd is off, well, that is good. xinetd should not be on unless there is a speciffic reason.

Can you try another server like apache or monkeyd or something to see if you get anything through?
_________________
Part of "The adopt an unanswered post initiative"
Back to top
View user's profile Send private message
dave9000
n00b
n00b


Joined: 20 Feb 2005
Posts: 8

PostPosted: Wed Feb 23, 2005 7:17 pm    Post subject: Reply with quote

OK, I had some problem getting monkeyd to work so I switched to webfs.
As I expected I can't connect from the outer world :-(
Back to top
View user's profile Send private message
Cuardin
l33t
l33t


Joined: 06 Feb 2003
Posts: 713
Location: vasastaden.stockholm.se

PostPosted: Thu Feb 24, 2005 1:41 pm    Post subject: Reply with quote

This is acutely bizare.
I saw your IP-tables entries, and they are OK. By default sshd allows connections at all IPs and all interfaces.
Since you can do connections from the box to other computers than obviously your network settings are healthy.

I can't figure out what the problem is.
_________________
Part of "The adopt an unanswered post initiative"
Back to top
View user's profile Send private message
dave9000
n00b
n00b


Joined: 20 Feb 2005
Posts: 8

PostPosted: Sun Feb 27, 2005 4:32 pm    Post subject: Reply with quote

Cuardin, first of all thank you for you effort ...
... I finally found out where the problem was :-)
I had eth0 configured for dhcp and net.eth0 enabled at the default runlevel.
[root] route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.1 * 255.255.255.255 UH 0 0 0 ppp0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
loopback localhost 255.0.0.0 UG 0 0 0 lo
default
192.168.1.1 0.0.0.0 UG 0 0 0 eth0


Which is wrong! Should be:
[root] route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.1 * 255.255.255.255 UH 0 0 0 ppp0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
loopback localhost 255.0.0.0 UG 0 0 0 lo
default 192.168.100.1 0.0.0.0 UG 0 0 0 ppp0


I posted the "solution" just in case somebody else is going to mess up his adsl connection :-)
Back to top
View user's profile Send private message
Cuardin
l33t
l33t


Joined: 06 Feb 2003
Posts: 713
Location: vasastaden.stockholm.se

PostPosted: Mon Feb 28, 2005 8:24 pm    Post subject: Reply with quote

Are you telling me you could connect to the internet with that configuration????
_________________
Part of "The adopt an unanswered post initiative"
Back to top
View user's profile Send private message
dave9000
n00b
n00b


Joined: 20 Feb 2005
Posts: 8

PostPosted: Tue Mar 01, 2005 5:00 pm    Post subject: Reply with quote

Cuardin wrote:
Are you telling me you could connect to the internet with that configuration????

Yes I did, that was exatly the output of the route command.
It behaved oddly enough tough. It took some 10 second to execute!
At the time of writing I get this (different) result:

[root] route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.1 * 255.255.255.255 UH 0 0 0 ppp0
loopback localhost 255.0.0.0 UG 0 0 0 lo
default 192.168.100.1 0.0.0.0 UG 0 0 0 ppp0


eth0 is left unconfigured (no IP) .. strange as this may be still everything is working :-)
Back to top
View user's profile Send private message
Cuardin
l33t
l33t


Joined: 06 Feb 2003
Posts: 713
Location: vasastaden.stockholm.se

PostPosted: Tue Mar 01, 2005 5:54 pm    Post subject: Reply with quote

Well, you don't need eth0 to get to the itnernet. you use the ppp0 for that. eth0 is only for reaching other comps on the same LAN.
_________________
Part of "The adopt an unanswered post initiative"
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