Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 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 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 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 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 at 14:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.