View previous topic :: View next topic |
Author |
Message |
nikl n00b
Joined: 06 Feb 2003 Posts: 5 Location: Hamburg, DE
|
Posted: Thu Jul 31, 2003 6:06 pm Post subject: Is it possible to find out what port(s) an application uses? |
|
|
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 |
|
|
carbon Guru
Joined: 27 Jun 2003 Posts: 455 Location: New York
|
Posted: Thu Jul 31, 2003 6:13 pm Post subject: |
|
|
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 |
|
|
uzik Apprentice
Joined: 17 Apr 2003 Posts: 257
|
Posted: Thu Jul 31, 2003 6:32 pm Post subject: |
|
|
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 |
|
|
kashani Advocate
Joined: 02 Sep 2002 Posts: 2032 Location: San Francisco
|
Posted: Thu Jul 31, 2003 6:37 pm Post subject: |
|
|
netstat -ptln _________________ Will personally fix your server in exchange for motorcycle related shop tools in good shape. |
|
Back to top |
|
|
nikl n00b
Joined: 06 Feb 2003 Posts: 5 Location: Hamburg, DE
|
Posted: Thu Jul 31, 2003 6:42 pm Post subject: |
|
|
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 |
|
|
sschlueter Guru
Joined: 26 Jul 2002 Posts: 578 Location: Dortmund, Germany
|
Posted: Thu Jul 31, 2003 7:15 pm Post subject: |
|
|
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
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 |
|
|
credmp Apprentice
Joined: 02 Jul 2002 Posts: 207 Location: Netherlands
|
Posted: Fri Aug 01, 2003 8:58 pm Post subject: |
|
|
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 |
|
|
|