Ubuntu Java Proxy Settings

It appears that not everything looks at the environment setting http_proxy/all_proxy/no_proxy (I had set in my /etc/environment).

For my Java->JBoss application to use the proxy, I had to setup a specific proxy for my JVM.

I was pointed to /etc/java-6-sun/net.properties.  I made my changes there, and everything works as expected.

Port Forwarding

I hate system administration.  But, once in a while I need to do some simple stuff.

In *nix environments, ports <1024 are can only be opened by root.

In this example, I run a mail server proxy that listens on port 1025, but all my applications want to send mail out on port 25.  I need an iptables rule that will forward all the traffic from port 25 to port 1025.

iptables -t nat -A OUTPUT -d localhost -p tcp --dport 25 -j REDIRECT --to-ports 1025

I sometimes us it for Tomcat as well, I want to forward port 80 (the http port) to port 8080 (default port for tomcat).

iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080