Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to monitor network activity on the server. I would like all traffic to pass through a script, like a proxy. My proxy script will inspect the request and then serve the response.

How can I do this?

  • I'm running Ubuntu, but would be interested in answers for any Linux OS
  • The traffic I need to proxy may be on any port (not just port 80)
  • This is for outgoing traffic only, not traffic coming into the server.
share|improve this question
    
Could you be more specific here. Are you trying to do something with the traffic (like block it) or just monitor connections made to your server? – Matthew Williams Feb 17 '14 at 14:19
    
@MatthewWilliams My script will first inspect the request, if it meets certain criteria it could be logged/blocked. On some occasions the response will also be inspected and may be blocked. – Drahcir Feb 17 '14 at 14:21
    
@MatthewWilliams My script needs to be able to see the request, then fetch the response from the remote server. It can do other things in-between. – Drahcir Feb 17 '14 at 14:21
    
@MatthewWilliams, Sorry I should have mentioned this is for outgoing traffic only. Where the request originates on the server, not a remote. – Drahcir Feb 17 '14 at 14:23
    
I only ask because there are security applications like iptable which can log and block connections for you. Do you have a reason for needing to use your own script or would you be able to use a ready made system (this can apply to outbound traffic also) – Matthew Williams Feb 17 '14 at 14:25

You must log in to answer this question.

Browse other questions tagged .