Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in Support of SSH-Tunneling of RMI traffic for Remote Testing #2703

Closed
asfimport opened this issue Jan 15, 2012 · 2 comments
Closed

Comments

@asfimport
Copy link
Collaborator

Brian Ferris (Bug 52469):
In order to better support SSH-tunneling of the RMI communication channels used in remote testing, please see the attached patch which makes the following two changes:

  1. Just as the RMI ports used for the server component can be specified using "server.rmi.port" and "server.rmi.localport" parameters, introduce a "client.rmi.localport" parameter that can control the RMI port used by the RemoteSampleListenerImpl. Currently, the port is randomly assigned, which makes it tricky to tunnel traffic to that port over a SSH tunnel.

  2. The current behavior of RemoteJMeterEngineImpl is to throw an exception if the remote engine attempts to listen to traffic over the loopback interface. However, we often need this behavior when tunneling RMI traffic over an SSH tunnel as the remote endpoint will actually be a port on the local machine, which is subsequently tunneled. To support this functionality, I propose allowing the localhost loopback interface to be used if it has been specified directly using the "java.rmi.server.hostname" parameter. Thus, we keep the current default behavior of warning the user if their remote endpoint is only listening on the local interface, but allowing users who know what they are doing to specify the local interface if they really want to.

Created attachment jmeter-rmi.patch: Support RMI client port configuration and using loopback interfaces.

jmeter-rmi.patch
### Eclipse Workspace Patch 1.0
#P jmeter
Index: src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java
===================================================================
--- src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java	(revision 1231656)
+++ src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java	(working copy)
@@ -23,6 +23,7 @@
 
 import org.apache.jmeter.engine.event.LoopIterationEvent;
 import org.apache.jmeter.testelement.TestListener;
+import org.apache.jmeter.util.JMeterUtils;
 
 /**
  * Implementation of remote sampler listener, also supports TestListener
@@ -35,9 +36,12 @@
     private final TestListener testListener;
 
     private final SampleListener sampleListener;
+    
+    private static final int DEFAULT_LOCAL_PORT = 
+        JMeterUtils.getPropDefault("client.rmi.localport", 0); // $NON-NLS-1$
 
     public RemoteSampleListenerImpl(Object listener) throws RemoteException {
-        super();
+        super(DEFAULT_LOCAL_PORT);
         if (listener instanceof TestListener) {
             testListener = (TestListener) listener;
         } else {
Index: src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java
===================================================================
--- src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java	(revision 1231656)
+++ src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java	(working copy)
@@ -81,9 +81,9 @@
     private void init() throws RemoteException {
         log.info("Starting backing engine on " + this.rmiPort);
         InetAddress localHost=null;
+        // Bug 47980 - allow override of local hostname
+        String host = System.getProperties().getProperty("java.rmi.server.hostname"); // $NON-NLS-1$
         try {
-            // Bug 47980 - allow override of local hostname
-            String host = System.getProperties().getProperty("java.rmi.server.hostname"); // $NON-NLS-1$
             if( host==null ) {
                 localHost = InetAddress.getLocalHost();
             } else {
@@ -94,7 +94,7 @@
         }
         log.info("IP address="+localHost.getHostAddress());
         String hostName = localHost.getHostName();
-        if (localHost.isLoopbackAddress()){
+        if (localHost.isLoopbackAddress() && host == null){
             throw new RemoteException("Cannot start. "+hostName+" is a loopback address.");
         }
         if (localHost.isSiteLocalAddress()){

Version: Nightly
OS: All

Duplicates:

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Applied with minor modifications:

  • changes.xml
  • new property added to jmeter.properties with comment

Thanks for the patch.

Date: Sun Jan 15 14:11:54 2012
New Revision: 1231671

URL: http://svn.apache.org/viewvc?rev=1231671&view=rev
Log:
#2703 - Changes in Support of SSH-Tunneling of RMI traffic for Remote Testing

Modified:
jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java
jmeter/trunk/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java
jmeter/trunk/xdocs/changes.xml

Date: Sun Jan 15 14:13:34 2012
New Revision: 1231672

URL: http://svn.apache.org/viewvc?rev=1231672&view=rev
Log:
#2703 - Changes in Support of SSH-Tunneling of RMI traffic for Remote Testing

Modified:
jmeter/trunk/bin/jmeter.properties

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Date: Sun Jan 15 15:36:52 2012
New Revision: 1231689

URL: http://svn.apache.org/viewvc?rev=1231689&view=rev
Log:
#2703 - Changes in Support of SSH-Tunneling of RMI traffic for Remote Testing

Modified:
jmeter/trunk/xdocs/usermanual/remote-test.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant