X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Fcore%2Finternal%2FSecureMessageReadWriteService.java;h=1a9dfdad95d94ea00ad733de6cca8987ced0b535;hp=43a64814d8498a1842ae9f4e2ce4ee75a08aca2f;hb=8a6695d355f0d84ff1af5eaf958f735b5f86cd50;hpb=1757a30c3631e2a5ef97c6b5e79ad2c87fc7d855 diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java index 43a64814d8..1a9dfdad95 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java @@ -41,7 +41,6 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { .getLogger(SecureMessageReadWriteService.class); private Selector selector; - private SelectionKey clientSelectionKey; private SocketChannel socket; private BasicFactory factory; @@ -64,6 +63,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { createSecureChannel(socket); createBuffers(sslEngine); } catch (Exception e) { + logger.warn("Failed to setup TLS connection {} {}", socket, e); stop(); throw e; } @@ -71,7 +71,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { /** * Bring up secure channel using SSL Engine - * + * * @param socket * TCP socket channel * @throws Exception @@ -132,18 +132,34 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { sslEngine = sslContext.createSSLEngine(); sslEngine.setUseClientMode(false); sslEngine.setNeedClientAuth(true); + sslEngine.setEnabledCipherSuites(new String[] { + "SSL_RSA_WITH_RC4_128_MD5", + "SSL_RSA_WITH_RC4_128_SHA", + "TLS_RSA_WITH_AES_128_CBC_SHA", + "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", + "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", + "SSL_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", + "SSL_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_DSS_WITH_DES_CBC_SHA", + "SSL_RSA_EXPORT_WITH_RC4_40_MD5", + "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", + "TLS_EMPTY_RENEGOTIATION_INFO_SCSV"}); // Do initial handshake doHandshake(socket, sslEngine); - this.clientSelectionKey = this.socket.register(this.selector, - SelectionKey.OP_READ); + this.socket.register(this.selector, SelectionKey.OP_READ); } /** * Sends the OF message out over the socket channel. The message is * encrypted by SSL Engine. - * + * * @param msg * OF message to be sent * @throws Exception @@ -182,12 +198,10 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { if (myAppData.hasRemaining()) { myAppData.compact(); - this.clientSelectionKey = this.socket.register(this.selector, - SelectionKey.OP_WRITE, this); + this.socket.register(this.selector, SelectionKey.OP_WRITE, this); } else { myAppData.clear(); - this.clientSelectionKey = this.socket.register(this.selector, - SelectionKey.OP_READ, this); + this.socket.register(this.selector, SelectionKey.OP_READ, this); } logger.trace("Message sent: {}", msg); @@ -196,7 +210,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { /** * Resumes sending the remaining messages in the outgoing buffer - * + * * @throws Exception */ @Override @@ -221,12 +235,10 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { if (myAppData.hasRemaining()) { myAppData.compact(); - this.clientSelectionKey = this.socket.register(this.selector, - SelectionKey.OP_WRITE, this); + this.socket.register(this.selector, SelectionKey.OP_WRITE, this); } else { myAppData.clear(); - this.clientSelectionKey = this.socket.register(this.selector, - SelectionKey.OP_READ, this); + this.socket.register(this.selector, SelectionKey.OP_READ, this); } } } @@ -234,7 +246,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { /** * Reads the incoming network data from the socket, decryptes them and then * retrieves the OF messages. - * + * * @return list of OF messages * @throws Exception */ @@ -280,8 +292,7 @@ public class SecureMessageReadWriteService implements IMessageReadWrite { peerAppData.clear(); } - this.clientSelectionKey = this.socket.register(this.selector, - SelectionKey.OP_READ, this); + this.socket.register(this.selector, SelectionKey.OP_READ, this); return msgs; }