Build Forge Agent Proxy

So I’ve been really busy the last few months. REALLY BUSY.

But, I’ve also had the chance to learn a lot of new things. One of the more interesting things I’ve learned lately (as in, the past week) is that Build Forge Agent communication can be routed through a reverse proxy. This isn’t officially support by IBM, mind you, but it does seem like it can be done. And quite easily at that.

I had used Wireshark to look at the Build Forge Agent protocol a couple of times just so I could understand how it worked. This helped me tremendously when it came time to request firewall rules in different environments. I never saw anything that looked like the Console needed to really know what Agent it was talking to. Instead, the traffic appeared to be very simple and to the point: “Hey Agent! I need you to do X, Y, and then Z. Oh, and use this account while you’re at it!”

So we ran into a situation where I was only allowed one hole through a particular firewall. To clarify, this one whole meant one source server and one target server. If you know anything about Build Forge, you know that means you can only get to one Build Forge Agent on the other side of the firewall. This was a major bummer for us because we already had three agents installed on the other side with plans for many, many more. But the security gods had spoken and one hole it was.

All hope looked lost until we started tossing around the idea of  a proxy server. I knew we couldn’t use a normal forward proxy since we’re basically talking about routing telnet traffic here and that just isn’t forward proxy routable (nothing is built into the protocol to allow for that like HTTP). So, reverse proxies came to mind. If we could open multiple ports to this one server and then have multiple reverse proxy listeners that would route the traffic on the other side of the firewall this just might work.

The first step was to find a simple reverse proxy. We couldn’t use an HTTP proxy because, again, this isn’t HTTP traffic and HTTP proxies alter the traffic. We needed the raw TCP packets to be passed through. I knew I could write something like this myself in Java quite easily but I wanted to see if someone else had done any work before wasting investing a lot of time on this. After trying a few things, a Google search on “java simple tcp proxy” gave me what I wanted. And what exactly did I want? The Grinder TCP Proxy.

This thing is nice. Very easy to use and quick to test out. I set up the proxy for simple TCP routing and voilá, it worked! The Build Forge Console was able to communicate with my personal PC running The Grinder which routed the traffic on to a real Build Forge Agent. I even ran several concurrent jobs through the reverse proxy connection and it didn’t miss a beat. Well, this was very promising. But what about SSL support? We had to use SSL for our implementation and that would be a deal breaker there.

While The Grinder’s TCP Proxy can do a basic SSL “man in the middle” approach (not an attack per se, but the concept is the same). I attempted to use this but it failed because it tried to connect to the Agent with SSLv2 rather than TLSv1 (SSLv3). Well, my own implementation might be able to address this. Then I wondered…hmm, could just routing the TCP packets work? I know it shouldn’t because the Common Name on the SSL certificate wouldn’t match a reverse DNS lookup on the origin IP, but I wasn’t completely sure that Build Forge Agents actually did their due diligence to confirm the origin IP was associated with the Common Name on the certificate. It was worth a shot.

OK, I’ll admit, I’m lying. I messed up initially and forgot to pass the TCPProxy class the “-ssl” option at first and everything worked. Only afterward did I realize that SSL traffic worked through The Grinder in pure TCP routing mode! It was once I used “-ssl” (like I meant to originally) that I found the SSLv2 issue mentioned above.

So, pure TCP routing not only worked for regular connections, it also worked for SSL connections too. Great! On a slightly not so great note, IBM Rational Build Forge Agents (and the console too) don’t actually reverse ping the origin IP of SSL communication to verify that the reverse DNS name retrieved matches the Common Name on the certificate. This doesn’t compromise the encryption since a “man in the middle” can’t do much with encrypted traffic; however, I’m still a bit shocked to say the least. Perhaps IBM’s approach here is to just use SSL for encryption and not truly for client/server verification. Still, I find that a bit odd, especially considering one of the Build Forge Agent paramters is ssl_verify_client. Even with that set to “true”, raw TCP routing through a reverse proxy didn’t cause an SSL alert.

So we’re now working on “productionizing” this and writing our own simple TCP router. It will listen on multiple ports and forwards them to multiple agents on the other side of the firewall. We might also look at putting in a true SSL “man in the middle” which decrypts the traffic (like a normal agent would) and then begins a new SSL channel to the real Agent (like a normal console would). This would prevent any issues later if IBM decides to start performing reverse DNS lookups for Common Name matching to origin IP. It never hurts to plan ahead.

Alright, I’m headed to bed now.


This entry was posted in Work and tagged , , , . Bookmark the permalink.

6 Responses to Build Forge Agent Proxy

  1. Benjamin Chodroff says:

    I am forwarding this to the Build Forge product manager. Thank you for bringing this to our attention.

    • Thanks! I was hoping I might get hooked up with him again at this year’s Innovate. I was planning on making a pitch for adding built-in proxy capability but it wouldn’t hurt to get the SSL behavior looked at either. In a way now though, I don’t want it fixed because our little proxy solution worked quite well today. More than 500 MB of files in less than an hour using .rget! That might seem slow to some, but compared to not getting the files across at all it’s great!

      • Benjamin Chodroff says:

        I’d be happy to set meeting up! Can you send me an email to benjamin [dot] chodroff [at] us [dot] ibm [dot] com and we’ll get it on our calendars?

        Using .rget is quite handy when all you have is a single port open!

        • wayne says:

          Can I get in on this meeting at innovate or will this be brought up in one of the VOICE BF session? I jsut want to hear — i think i have a similar scenario coming up.

  2. wayne says:

    ArchimedesNewton: I too am looking for this official support for reverse proxy. I’ve already brought this up in the VOICE Session so this is also important for us.

    • Wayne,

      I wasn’t able to attend Innovate 2011 at the last minute. I’m really missing it at this point but such things happen. I’m glad that you presented this need at a VoiCE session on Build Forge. Hopefully IBM will be able to incorporate it into the product roadmap fairly soon. It would really be nice as you say to have this official support. Though, in the meantime I suppose we can make due with more unconventional solutions like the one in my post.


Leave a Reply

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