Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.ssl.KeyStoreScanner;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.jboss.netty.channel.ChannelException;
import org.jboss.netty.handler.codec.http.HttpMethod;
Expand Down Expand Up @@ -275,6 +276,8 @@ public void testFriendlySelfSignedHttpsServer() throws Exception

sslConnector.setPort(0);
server.setConnectors(new Connector[]{sslConnector});
KeyStoreScanner keyStoreScanner = new KeyStoreScanner(sslContextFactory);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't detect keystore changes if the keystore path was a soft link, would it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server.addBean(keyStoreScanner);
server.start();

try {
Expand Down
2 changes: 2 additions & 0 deletions docs/operations/tls-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ values for the configs below, among others provided by Java implementation.
|`druid.server.https.keyStoreType`|The type of the key store.|none|yes|
|`druid.server.https.certAlias`|Alias of TLS/SSL certificate for the connector.|none|yes|
|`druid.server.https.keyStorePassword`|The [Password Provider](../operations/password-provider.md) or String password for the Key Store.|none|yes|
|`druid.server.https.reloadSslContext`| Should Druid server detect Key Store file change and reload.|false|no|
|`druid.server.https.reloadSslContextSeconds`| How frequently should Druid server scan for Key Store file change.|60|yes|

The following table contains configuration options related to client certificate authentication.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public class TLSServerConfig
@JsonProperty
private String crlPath;

@JsonProperty
private boolean reloadSslContext = false;

@JsonProperty
private int reloadSslContextSeconds = 60;

public String getKeyStorePath()
{
return keyStorePath;
Expand Down Expand Up @@ -170,6 +176,16 @@ public String getCrlPath()
return crlPath;
}

public int getReloadSslContextSeconds()
{
return reloadSslContextSeconds;
}

public boolean isReloadSslContext()
{
return reloadSslContext;
}

@Override
public String toString()
{
Expand All @@ -189,6 +205,8 @@ public String toString()
", trustStoreAlgorithm='" + trustStoreAlgorithm + '\'' +
", validateHostnames='" + validateHostnames + '\'' +
", crlPath='" + crlPath + '\'' +
", reloadSslContext='" + reloadSslContext + '\'' +
", reloadSslContextSeconds='" + reloadSslContextSeconds + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.ssl.KeyStoreScanner;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
Expand Down Expand Up @@ -347,6 +348,11 @@ static Server makeAndInitializeServer(
}
connector.setPort(node.getTlsPort());
serverConnectors.add(connector);
if (tlsServerConfig.isReloadSslContext()) {
KeyStoreScanner keyStoreScanner = new KeyStoreScanner(sslContextFactory);
keyStoreScanner.setScanInterval(tlsServerConfig.getReloadSslContextSeconds());
server.addBean(keyStoreScanner);
}
} else {
sslContextFactory = null;
}
Expand Down
Loading