Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is it possible to find out what port(s) an application uses?
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
nikl
n00b
n00b


Joined: 06 Feb 2003
Posts: 5
Location: Hamburg, DE

PostPosted: Thu Jul 31, 2003 6:06 pm    Post subject: Is it possible to find out what port(s) an application uses? Reply with quote

Hi there,

one thing I really liked about those windoze "desktop-firewalls" was the ability to setup a rule-set that made it possible to clearly define which ports a certain application was allowed to use or not. Unfortunately I haven't found such a possibility for linux yet. My iptables only watch ports - indepently from which application uses these ports. Netstat shows me which ports are effectively used. But unfortunately not which applications are using them.

Can anyone point me in the right direction? thanks in advance.
_________________
- Nikl
Back to top
View user's profile Send private message
carbon
Guru
Guru


Joined: 27 Jun 2003
Posts: 455
Location: New York

PostPosted: Thu Jul 31, 2003 6:13 pm    Post subject: Reply with quote

if you dont need to know what port it uses in advance, you can use trafshow to monitor the traffic. it shows who is talking to you and who are you (all your process in your gentoo box) talking to on which port.
_________________
I do what I want, and that's what I do.
GNU World Domination

Carbon
Back to top
View user's profile Send private message
uzik
Apprentice
Apprentice


Joined: 17 Apr 2003
Posts: 257

PostPosted: Thu Jul 31, 2003 6:32 pm    Post subject: Reply with quote

I thought there was a command line option for netstat
to show the command line of the program using each port.
That tells you which program is using the port.
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Thu Jul 31, 2003 6:37 pm    Post subject: Reply with quote

netstat -ptln
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
nikl
n00b
n00b


Joined: 06 Feb 2003
Posts: 5
Location: Hamburg, DE

PostPosted: Thu Jul 31, 2003 6:42 pm    Post subject: Reply with quote

kashani wrote:
netstat -ptln


thx - that's exactly what I needed.

next question: is there a possibility to limit certain apps to specific ports?
_________________
- Nikl
Back to top
View user's profile Send private message
sschlueter
Guru
Guru


Joined: 26 Jul 2002
Posts: 578
Location: Dortmund, Germany

PostPosted: Thu Jul 31, 2003 7:15 pm    Post subject: Reply with quote

nikl wrote:
next question: is there a possibility to limit certain apps to specific ports?


iptables can't do that - it can only filter by proccess id - so you'd need a different user for each app - probably not what you want :D

But systrace is able to do it (although I have no personal experience with it yet). Here's an example policy file for gaim: http://www.citi.umich.edu/u/provos/systrace/usr_local_bin_gaim
Back to top
View user's profile Send private message
credmp
Apprentice
Apprentice


Joined: 02 Jul 2002
Posts: 207
Location: Netherlands

PostPosted: Fri Aug 01, 2003 8:58 pm    Post subject: Reply with quote

Hi,

just to add to the previous answers with netstat; you can also use lsof...

Code:
/usr/sbin/lsof -i tcp


the above gives you all open tcp connections.... man lsof for more info...

regards,

Arjen
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