[jetty-dev] Secure websockets

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jetty-dev] Secure websockets

dhirajpraj
Hi, 
I am trying to write a server which can establish secure websocket connections, using embedded jetty 9.2.2
Below is my code snippet:

               Server server;
WebSocketHandler wsHandler = new WebSocketHandler()
{
@Override
public void configure( WebSocketServletFactory webSocketServletFactory )
{
webSocketServletFactory.register( WebSocketProxyHandler.class  );
}
};
QueuedThreadPool threadPool = new QueuedThreadPool( mainConfig.getIntValue( "jetty.server.threadpool", 100 ) );
server = new Server( threadPool );
server.manage( threadPool );
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath("/home/deploy/cs/conf/keystore");
sslContextFactory.setKeyStorePassword("games24x7");
sslContextFactory.setKeyManagerPassword("games24x7");
sslContextFactory.setTrustStorePath("/home/deploy/cs/conf/keystore");
       sslContextFactory.setTrustStorePassword("games24x7");
ServerConnector sc = new ServerConnector( server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()) );
sc.setPort( mainConfig.getIntValue( "proxy.jetty.listenport" ) );
server.setConnectors( new Connector[] { sc } );
// server = new
// Server(mainConfig.getIntValue("proxy.jetty.listenport"));
server.setHandler( wsHandler );
try
{
server.start();
logger.debug( "Websocket Server started" );
server.join();

}
catch( Exception e )
{
logger.error( "Error in jetty startup", e );
}


I am getting the below exception:
10-Aug-2015 17:44:01.893 41539 [qtp980326486-336-selector-ServerConnectorManager@5520f675/0] DEBUG org.eclipse.jetty.io.SelectorManager  -  
java.lang.NullPointerException
        at org.eclipse.jetty.server.SslConnectionFactory.newConnection(SslConnectionFactory.java:86)
        at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.newConnection(ServerConnector.java:462)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.createEndPoint(SelectorManager.java:676)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.access$700(SelectorManager.java:353)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector$Accept.run(SelectorManager.java:828)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.runChange(SelectorManager.java:469)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.runChanges(SelectorManager.java:460)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:518)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.run(SelectorManager.java:488)
        at org.eclipse.jetty.util.thread.NonBlockingThread.run(NonBlockingThread.java:52)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:606)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:535)
        at java.lang.Thread.run(Thread.java:745)

Is there anything wrong in my code?


Thanks in advance

_______________________________________________
jetty-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-dev] Secure websockets

Joakim Erdfelt-8
Looks like your env got caught in a TLS / next proto quirk.
I'm guessing you tried to access this jetty server from a current and updated browser.

Can you upgrade to 9.2.17 at least?

When it comes to SSL (now called TLS) you *have to* stay up to date.
The introduction of HTTP/2 in browsers is mandating this.
The fundamentals and minimums of SSL/TLS are being updated at a much higher frequency.
And your 9.2.2 release is before a large chunk of these updated minimums.


Joakim Erdfelt / [hidden email]

On Mon, Aug 10, 2015 at 6:08 AM, dhiraj prajapati <[hidden email]> wrote:
Hi, 
I am trying to write a server which can establish secure websocket connections, using embedded jetty 9.2.2
Below is my code snippet:

               Server server;
WebSocketHandler wsHandler = new WebSocketHandler()
{
@Override
public void configure( WebSocketServletFactory webSocketServletFactory )
{
webSocketServletFactory.register( WebSocketProxyHandler.class  );
}
};
QueuedThreadPool threadPool = new QueuedThreadPool( mainConfig.getIntValue( "jetty.server.threadpool", 100 ) );
server = new Server( threadPool );
server.manage( threadPool );
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath("/home/deploy/cs/conf/keystore");
sslContextFactory.setKeyStorePassword("games24x7");
sslContextFactory.setKeyManagerPassword("games24x7");
sslContextFactory.setTrustStorePath("/home/deploy/cs/conf/keystore");
       sslContextFactory.setTrustStorePassword("games24x7");
ServerConnector sc = new ServerConnector( server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()) );
sc.setPort( mainConfig.getIntValue( "proxy.jetty.listenport" ) );
server.setConnectors( new Connector[] { sc } );
// server = new
// Server(mainConfig.getIntValue("proxy.jetty.listenport"));
server.setHandler( wsHandler );
try
{
server.start();
logger.debug( "Websocket Server started" );
server.join();

}
catch( Exception e )
{
logger.error( "Error in jetty startup", e );
}


I am getting the below exception:
10-Aug-2015 17:44:01.893 41539 [qtp980326486-336-selector-ServerConnectorManager@5520f675/0] DEBUG org.eclipse.jetty.io.SelectorManager  -  
java.lang.NullPointerException
        at org.eclipse.jetty.server.SslConnectionFactory.newConnection(SslConnectionFactory.java:86)
        at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.newConnection(ServerConnector.java:462)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.createEndPoint(SelectorManager.java:676)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.access$700(SelectorManager.java:353)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector$Accept.run(SelectorManager.java:828)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.runChange(SelectorManager.java:469)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.runChanges(SelectorManager.java:460)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:518)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.run(SelectorManager.java:488)
        at org.eclipse.jetty.util.thread.NonBlockingThread.run(NonBlockingThread.java:52)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:606)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:535)
        at java.lang.Thread.run(Thread.java:745)

Is there anything wrong in my code?


Thanks in advance

_______________________________________________
jetty-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev


_______________________________________________
jetty-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-dev] Secure websockets

dhirajpraj

I upgraded to jetty 9.3.2, but I am still seeing the same exception.

On 10 Aug 2015 18:55, "Joakim Erdfelt" <[hidden email]> wrote:
Looks like your env got caught in a TLS / next proto quirk.
I'm guessing you tried to access this jetty server from a current and updated browser.

Can you upgrade to 9.2.17 at least?

When it comes to SSL (now called TLS) you *have to* stay up to date.
The introduction of HTTP/2 in browsers is mandating this.
The fundamentals and minimums of SSL/TLS are being updated at a much higher frequency.
And your 9.2.2 release is before a large chunk of these updated minimums.


Joakim Erdfelt / [hidden email]

On Mon, Aug 10, 2015 at 6:08 AM, dhiraj prajapati <[hidden email]> wrote:
Hi, 
I am trying to write a server which can establish secure websocket connections, using embedded jetty 9.2.2
Below is my code snippet:

               Server server;
WebSocketHandler wsHandler = new WebSocketHandler()
{
@Override
public void configure( WebSocketServletFactory webSocketServletFactory )
{
webSocketServletFactory.register( WebSocketProxyHandler.class  );
}
};
QueuedThreadPool threadPool = new QueuedThreadPool( mainConfig.getIntValue( "jetty.server.threadpool", 100 ) );
server = new Server( threadPool );
server.manage( threadPool );
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath("/home/deploy/cs/conf/keystore");
sslContextFactory.setKeyStorePassword("games24x7");
sslContextFactory.setKeyManagerPassword("games24x7");
sslContextFactory.setTrustStorePath("/home/deploy/cs/conf/keystore");
       sslContextFactory.setTrustStorePassword("games24x7");
ServerConnector sc = new ServerConnector( server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()) );
sc.setPort( mainConfig.getIntValue( "proxy.jetty.listenport" ) );
server.setConnectors( new Connector[] { sc } );
// server = new
// Server(mainConfig.getIntValue("proxy.jetty.listenport"));
server.setHandler( wsHandler );
try
{
server.start();
logger.debug( "Websocket Server started" );
server.join();

}
catch( Exception e )
{
logger.error( "Error in jetty startup", e );
}


I am getting the below exception:
10-Aug-2015 17:44:01.893 41539 [qtp980326486-336-selector-ServerConnectorManager@5520f675/0] DEBUG org.eclipse.jetty.io.SelectorManager  -  
java.lang.NullPointerException
        at org.eclipse.jetty.server.SslConnectionFactory.newConnection(SslConnectionFactory.java:86)
        at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.newConnection(ServerConnector.java:462)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.createEndPoint(SelectorManager.java:676)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.access$700(SelectorManager.java:353)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector$Accept.run(SelectorManager.java:828)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.runChange(SelectorManager.java:469)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.runChanges(SelectorManager.java:460)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:518)
        at org.eclipse.jetty.io.SelectorManager$ManagedSelector.run(SelectorManager.java:488)
        at org.eclipse.jetty.util.thread.NonBlockingThread.run(NonBlockingThread.java:52)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:606)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:535)
        at java.lang.Thread.run(Thread.java:745)

Is there anything wrong in my code?


Thanks in advance

_______________________________________________
jetty-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev


_______________________________________________
jetty-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev

_______________________________________________
jetty-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev