8 Replies Latest reply on Sep 10, 2009 6:38 AM by Daniel Filgueiras

    Http Proxy Communication

    Daniel Filgueiras Newbie

      I need to install an agent on my client server, but they have a firewall and will be throblesome to ask them to open an port.

      Can an agent communicate though a http proxy server ?

        • 1. Re: Http Proxy Communication
          mazz Master

          The agent by default communicates to the server over the server's HTTP/HTTPS tomcat connectors (via the jboss/remoting servlet/sslservlet transports) - so it is http protocol.

          There are a few things you could try. I've never tried any of these, so I would not be surprised if none of this worked. But these are worth a shot:

          1) I suppose you could try to set the proxy system properties (http.proxyHost, http.proxyPort) to their appropriate values. To set system properties in the agent, see RHQ_AGENT_ADDITIONAL_JAVA_OPTS in rhq-agent-env.sh, or just pass in -D on the rhq-agent.sh command line to test it out.

          2) If that doesn't work, there may be some jboss/remoting transport parameters you can specify to define the proxy info - see http://jopr.org/confluence/display/JOPR2/Communications+Configuration#CommunicationsConfiguration-TransportParameters. Again, I've never tried any of this, so I don't know if jboss/remoting provides transport parameters to support proxies. But there are links there to the JBoss/Remoting docs that you can peruse.

          In fact, section 5.4.11 in http://www.jboss.org/file-access/default/members/jbossremoting/freezone/docs/guide/2.2/JBoss_Remoting_Guide.pdf seems to indicate my 1) suggestion above would work.

          • 2. Re: Http Proxy Communication
            Daniel Filgueiras Newbie

            Thanks Mazz.

            I have tried your first suggestion: edit the rhq-agent-env script with the parans "-Dhttp.proxyHost=myproxyserver -Dhttp.proxyPort=8080 -DproxySet=true", but I notice that this configurations was ignored and the agent was connecting directly to Server. So I download JbossRemoting source (2.2.1.GA) and I didn´t find any code that load http.proxyHost through System.properties, so I made a little change and deployed on my agent lib folder and it worked as expected.

            Now my agent connects through an Http Proxy Server, but my server still is connecting directly on the agent.

            I try to set the following parameters: proxySet=true&http.proxyHost=myproxyserver&http.proxyPort=8080 on Agent Transport Parameters (web)

            Now I am stuck

            • 3. Re: Http Proxy Communication
              Daniel Filgueiras Newbie

              On RHQ 1.2.0 GA release I notice that in JBossRemotingRemoteCommunicator class there is a function called "rawSend(Command command)" that invoking a method on Remoting Client Object passing null on metadata map, this metadata seens to be necessary to estabilish an http proxy connection. So I changed to pass m_invokerLocator.getParameters(). My first test was OK, now I will compile the entire project an try in a real scenario.

              private CommandResponse rawSend(Command command) throws Throwable {
               Object ret_response;
              
               try {
               try {
               OutgoingCommandTrace.start(command);
               ret_response = getRemotingClient().invoke(command, null);
               OutgoingCommandTrace.finish(command, ret_response);
               } catch (ServerInvoker.InvalidStateException serverDown) {
               // under rare condition, a bug in remoting 2.2 causes this when the server restarted
               // try it one more time, this will get a new server thread on the server side (JBREM-745)
               // once JBREM-745 is fixed, we can probably get rid of this catch block
               ret_response = getRemotingClient().invoke(command, null);
               OutgoingCommandTrace.finish(command, ret_response);
               }
               } catch (Throwable t) {
               OutgoingCommandTrace.finish(command, t);
               throw t;
               }
              


              • 4. Re: Http Proxy Communication
                mazz Master

                FWIW, we're using JBoss/Remoting 2.2.2.SP8 (at least in the latest stuff).

                I didn't think you'd have to pass that - the jboss/remoting client was built with the invoker locator so it already knows the parameters we configured it with. You would think calling "invoke" on that client would already configure it with the parameters. Unless that "null" overrides the locator parameters? I'll have to look at the remoting code a bit closer.

                • 6. Re: Http Proxy Communication
                  Daniel Filgueiras Newbie

                  Thanks Mazz,

                  I will try to update the jboss remoting library with the version 2.2.2.SP8 in JOPR.


                  • 7. Re: Http Proxy Communication
                    mazz Master

                    It should already be that version. What version of Jopr are you using now? I thought the Jopr 2.2 was using JBossAS 4.2.3 which had 2.2.2.SP8 in it - but now that I type this, I think I remember something about how we didn't upgrade until AFTER 2.2 was released.

                    Jopr 2.3 was just released, perhaps you can use that first (though I doubt remoting 2.2.2.SP8 changed behavior here, but at least you'll be working with the latest version that Jopr is using)

                    • 8. Re: Http Proxy Communication
                      Daniel Filgueiras Newbie

                      The JOPR 2.2.0 is using JBossAS 4.2.3 with Jboss Remoting version 2.2.1.GA.

                      I opened de manifest file of jboss-remoting.jar


                      Manifest-Version: 1.0
                      Specification-Title: JBoss
                      Built-By: rsigal
                      Created-By: 1.4.2_14-b05 (Sun Microsystems Inc.)
                      Specification-Version: 4.2.1.GA
                      Implementation-Vendor-Id: http://www.jboss.org/
                      Implementation-URL: http://www.jboss.org/
                      Created-On: 2007-07-01 03:31:22
                      Ant-Version: Apache Ant 1.7.0
                      Main-Class: org.jboss.remoting.Version
                      Implementation-Title: JBoss [Trinity]
                      Specification-Vendor: JBoss (http://www.jboss.org/)
                      Implementation-Version: 4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=20
                      0707131605)
                      Implementation-Vendor: JBoss Inc.

                      Name: JBossRemoting
                      Specification-Title: JBossRemoting
                      Implementation-Title: JBossRemoting
                      Specification-Vendor: JBoss Inc.
                      Specification-Version: 2.2.1.GA
                      Implementation-Vendor-Id: http://www.jboss.org
                      Implementation-Version: 2.2.1.GA
                      Implementation-Vendor: JBoss Inc.