Taming the beast: Binding imqbrokerd / OpenMQ to fixed ports

If you want to tunnel OpenMQ through SSH or any firewall, you’ll have to make sure to have fixed ports you can open.
This took me ages, so maybe it helps someone:

I’m starting my imqbrokerd with this command

/home/domdorn/gf/glassfishv3/mq/bin/imqbrokerd \
-javahome /home/domdorn/jdk1.6.0_21/ \
-port 7676 \
-startRmiRegistry \
-rmiRegistryPort 34000 \
-Dimq.jmx.connector.jmxrmi.port=31000 \
-Dimq.jmx.connector.ssljmxrmi.port=32000 \
-Dimq.jmx.rmiregistry.port=34000 \
-Dimq.portmapper.port=7676 \
-Dimq.admin.tcp.port=36000 \
-Dimq.cluster.port=37000 \
-Dimq.cluster_discovery.port=38000 \
-Dimq.cluster.heartbeat.port=39000 \
-Dimq.httpjms.http.servletPort=40000 \
-Dimq.httpsjms.https.servletPort=41000 \
-Dimq.jms.tcp.port=43000

which effectively binds imqbrokerd to these ports:

tcp6       0      0 :::34000                :::*                    LISTEN      22171/java      
tcp6       0      0 :::43000                :::*                    LISTEN      22171/java      
tcp6       0      0 :::31000                :::*                    LISTEN      22171/java      
tcp6       0      0 :::7676                 :::*                    LISTEN      22171/java      
tcp6       0      0 :::36000                :::*                    LISTEN      22171/java

Now simply connect to the remote host with

ssh REMOTEHOST -L7676:127.0.0.1:7676 -L31000:127.0.0.1:31000 -L34000:127.0.0.1:34000 -L36000:127.0.0.1:36000 -L43000:127.0.0.1:43000

Good luck!

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *