Repository navigation
Closed
apache/pulsar
#18097Labels
Description
Describe the bug
The reissued certificates from the Cert Manager will not be used by Pulsar until the pods are rebooted.
To Reproduce
Steps to reproduce the behavior:
- Activate Cert Manager with the internal issuer.
- Wait until the certificate has expired.
- The certificates have been updated, but the Java Services have not checked this and SSL errors occur in the Zookeeper.
ERROR org.apache.zookeeper.server.NettyServerCnxnFactory - Unsuccessful handshake with session 0x0
2022-08-03T14:53:45,862+0000 [epollEventLoopGroup-7-2] WARN org.apache.zookeeper.server.NettyServerCnxnFactory - Exception caught io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_expired at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:480) ~[io.netty-netty-codec-4.1.74.Final.jar:4.1.74.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279) ~[io.netty-netty-codec-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [io.netty-netty-transport-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) [io.netty-netty-transport-classes-epoll-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) [io.netty-netty-transport-classes-epoll-4.1.74.Final.jar:4.1.74.Final] at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) [io.netty-netty-transport-classes-epoll-4.1.74.Final.jar:4.1.74.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [io.netty-netty-common-4.1.74.Final.jar:4.1.74.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [io.netty-netty-common-4.1.74.Final.jar:4.1.74.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-common-4.1.74.Final.jar:4.1.74.Final] at java.lang.Thread.run(Thread.java:829) [?:?]
Expected behavior
When the Cert Manager issues new certificates, Pulsar should also be aware of this and use the new certificates.
Additional context
The certificates have been correctly reissued by the Cert Manager. They were also correct in the Config Maps and in the Secrets. Also where we were in the pods per shell, the new correct SSL certificates were there. But since Pulsar itself was already running, it did not re-read them. We think that Java caches the certificates.
Quick fix
After all pods were restarted everything worked again.
Activity
michaeljmarshall commentedon Oct 18, 2022
@danny-krueger - it's possible that zookeeper does not support reloading certificates for the client facing server. I can see that quorum server allows for reloading cert files, but I don't see the same setting for the client facing server:
https://github.com/apache/zookeeper/blob/b4f9aab099880ba8ef08eaff697debe6cdeae057/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java#L78
@eolivelli - would you happen to know?
michaeljmarshall commentedon Oct 18, 2022
Looks like my fork was out of date and I was looking at old information. This issue has already been resolved in Apache Zookeeper just earlier this year: https://issues.apache.org/jira/browse/ZOOKEEPER-3806. Here is the relevant documentation:
We can keep this issue open for now. Then, we we upgrade to a version of zookeeper that supports the feature, we'll add it in as a default.
michaeljmarshall commentedon Oct 18, 2022
The right place to fix this is in our default zk config. I've opened a PR here: apache/pulsar#18097.
danny-krueger commentedon Oct 20, 2022
Thanks for fixing it. We will try it out, if we update to the next version.
Currently we have helped ourselves by restarting all pods one after the other when the certificate is updated. We have solved this with Stakater Reloader. This worked great for us.
michaeljmarshall commentedon Oct 20, 2022
@danny-krueger - thanks for highlighting a work around. Apache Zookeeper hasn't released 3.8.1 or 3.9.0, so the complete feature won't be available until ZK gets released and Pulsar upgrades to use that ZK version.
d80tb7 commentedon Apr 27, 2024
Just to check- has anyone got cert refresh working with zookeeper? I'm of the opinion that this still won't work. Copying the explanation here from my comment on #359 .