diff options
author | Christoph Schulthess | 2017-04-06 12:05:30 +0200 |
---|---|---|
committer | Christoph Schulthess | 2017-04-06 12:05:30 +0200 |
commit | bdde6b667eed4b699ad2adb175367bddb83d2838 (patch) | |
tree | 502e39bc342562b0f61b509fc3c8e10b7a7417c0 | |
parent | Keystore added (diff) | |
download | tmlite-bwlp-bdde6b667eed4b699ad2adb175367bddb83d2838.tar.gz tmlite-bwlp-bdde6b667eed4b699ad2adb175367bddb83d2838.tar.xz tmlite-bwlp-bdde6b667eed4b699ad2adb175367bddb83d2838.zip |
RemoteDebug w/o extensive logging
-rw-r--r-- | src/main/java/org/openslx/taskmanager/tasks/RemoteDebug.java | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/RemoteDebug.java b/src/main/java/org/openslx/taskmanager/tasks/RemoteDebug.java index aee7c8c..a30db08 100644 --- a/src/main/java/org/openslx/taskmanager/tasks/RemoteDebug.java +++ b/src/main/java/org/openslx/taskmanager/tasks/RemoteDebug.java @@ -1,6 +1,5 @@ package org.openslx.taskmanager.tasks; -import java.io.Closeable; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -8,11 +7,15 @@ import java.io.OutputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; -import java.net.InetSocketAddress; + import java.security.KeyStore; import java.security.cert.X509Certificate; + import java.util.Date; +import java.net.InetAddress; +import java.net.InetSocketAddress; + import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocket; @@ -22,7 +25,6 @@ import javax.net.ssl.SSLSocket; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import org.openslx.satserver.util.Util; import org.openslx.taskmanager.api.AbstractTask; import com.google.gson.annotations.Expose; @@ -61,21 +63,7 @@ public class RemoteDebug extends AbstractTask bindToPort( srvSock ); try ( SSLSocket poolSock = ( SSLSocket ) srvSock.accept() ) { status.addMessage( "INFO: Connection from pool client established." ); -// status.addMessage( "Enabled Cipher Suites Pool Socket" ); -// for ( String cipher : poolSock.getEnabledCipherSuites() ) -// status.addMessage( cipher ); -// status.addMessage( "Enabled Cipher Suites Debug Socket" ); -// for ( String cipher : dbgSock.getEnabledCipherSuites() ) -// status.addMessage( cipher ); -// -// status.addMessage( "Supported Cipher Suites Pool Socket" ); -// for ( String cipher : poolSock.getSupportedCipherSuites() ) -// status.addMessage( cipher ); -// status.addMessage( "Supported Cipher Suites Debug Socket" ); -// for ( String cipher : dbgSock.getSupportedCipherSuites() ) -// status.addMessage( cipher ); - - + status.setCltAddr( poolSock.getInetAddress() ); relay( dbgSock, poolSock ); } catch ( Exception ex ) { throw( ex ); @@ -97,7 +85,6 @@ public class RemoteDebug extends AbstractTask InetSocketAddress addr = new InetSocketAddress( ip, port ); dbgSock.connect( addr ); status.addMessage( "INFO: Connected to debug server at " + ip + ":" + port + "." ); - status.setDbgAddr( addr ); } /** @@ -118,11 +105,10 @@ public class RemoteDebug extends AbstractTask protected SSLContext getSSLContext() { SSLContext ctx = null; try { - //ctx = SSLContext.getDefault(); ctx = trustAll(); } catch ( Exception e ) { status.addMessage( "ERROR: Failed to create SSLContext." ); - status.addMessage( "DEBUG: " + getStrStackTrace(e) ); + //status.addMessage( "DEBUG: " + getStrStackTrace(e) ); } return ctx; } @@ -202,7 +188,6 @@ public class RemoteDebug extends AbstractTask { status.addMessage( "INFO: Creating debug socket." ); SSLSocketFactory ssf = ctx.getSocketFactory(); - status.addMessage( "INFO: Socket factory created." ); SSLSocket s = ( SSLSocket ) ssf.createSocket(); status.addMessage( "INFO: Debug socket created." ); return s; @@ -229,12 +214,12 @@ public class RemoteDebug extends AbstractTask protected String messages = null; protected Date d = null; - protected InetSocketAddress dbgAddr = null; + protected InetAddress cltAddr = null; protected int listenPort = -1; public void setListenPort ( int port ) { listenPort = port; } public int getListenPort () { return listenPort; } - public void setDbgAddr ( InetSocketAddress addr ) { dbgAddr = addr; } + public void setCltAddr ( InetAddress addr ) { cltAddr = addr; } public void addMessage( String str ) { |