Skip to content

TLS Next Protocol is required? #404

@achingbrain

Description

@achingbrain

I'm trying to add TLS to the transport-interop suite used by js-libp2p. It works against go, rust etc but fails against jvm-libp2p - this is the stack trace:

  dialer-1    | WARNING: An exception was thrown by io.libp2p.security.tls.TLSSecureChannelKt$$Lambda$106/0x00007cdae0235878.operationComplete()
  dialer-1    | java.lang.NullPointerException: nextProtocol must not be null
  dialer-1    | 	at io.libp2p.security.tls.TLSSecureChannelKt.buildTlsHandler$lambda-3(TLSSecureChannel.kt:145)
  dialer-1    | 	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
  dialer-1    | 	at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583)
  dialer-1    | 	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559)
  dialer-1    | 	at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
  dialer-1    | 	at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
  dialer-1    | 	at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625)
  dialer-1    | 	at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:105)
  dialer-1    | 	at io.netty.handler.ssl.SslHandler.setHandshakeSuccess(SslHandler.java:1838)
  dialer-1    | 	at io.netty.handler.ssl.SslHandler.wrapNonAppData(SslHandler.java:952)
  dialer-1    | 	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1418)
  dialer-1    | 	at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1245)
  dialer-1    | 	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1294)
  dialer-1    | 	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
  dialer-1    | 	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
  dialer-1    | 	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
  dialer-1    | 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
  dialer-1    | 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
  dialer-1    | 	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
  dialer-1    | 	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
  dialer-1    | 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
  dialer-1    | 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
  dialer-1    | 	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
  dialer-1    | 	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
  dialer-1    | 	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
  dialer-1    | 	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
  dialer-1    | 	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
  dialer-1    | 	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
  dialer-1    | 	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
  dialer-1    | 	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
  dialer-1    | 	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
  dialer-1    | 	at java.base/java.lang.Thread.run(Unknown Source)

I think this means it's expecting the muxer protocol name to be sent as an ALPN protool - unless I've missed it this isn't in the libp2p TLS authentication spec (though maybe it should be, skipping the muxer negotiation round-trips in the same way noise can would be good) so js-libp2p doesn't send it which causes the connection to fail with the above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions