Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HTTPS configuration sharing with embedded Tomcat #727

Merged
merged 19 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4c2af94
Don't create `server` directory for embedded Tomcat
labkey-tchad Jan 24, 2024
9397278
Merge branch 'develop' into fb_embedded_noServerDir
labkey-tchad Jan 24, 2024
077ebfc
Merge remote-tracking branch 'origin/develop' into fb_embedded_noServ…
labkey-tchad Feb 5, 2024
c5df778
Get rid of 'deploy/embedded' directory
labkey-tchad Feb 5, 2024
4f0780b
Revert accidental change to org.gradle.workers.max
labkey-tchad Feb 5, 2024
f26b6d7
Not those parameters too
labkey-tchad Feb 5, 2024
ebdaf5b
Merge remote-tracking branch 'origin/develop' into fb_embedded_noServ…
labkey-tchad Feb 7, 2024
2051ff4
Remove obsolete 'extraDataSource' definition
labkey-tchad Feb 7, 2024
7fe4b1f
Revert some changes
labkey-tchad Feb 8, 2024
ecd9a06
Merge remote-tracking branch 'origin/develop' into fb_embedded_noServ…
labkey-tchad Feb 9, 2024
df7470b
Merge remote-tracking branch 'origin/develop' into fb_embedded_noServ…
labkey-tchad Feb 12, 2024
c23a85c
Add shutdown port
labkey-tchad Feb 12, 2024
b46200c
Merge remote-tracking branch 'origin/develop' into fb_embedded_noServ…
labkey-tchad Feb 14, 2024
9faefc2
Hard-code keystore location to test on TeamCity
labkey-tchad Feb 14, 2024
0783d9d
Don't define unnecessary ssl properties
labkey-tchad Feb 15, 2024
dc67f3d
Make the keystore alias match TeamCity
labkey-tchad Feb 16, 2024
1415a0f
Update ssl properties
labkey-tchad Feb 16, 2024
b8b0c08
Grab the real keystore path when running embedded Tomcat
labkey-jeckels Feb 19, 2024
57936a4
Merge branch 'develop' into fb_embedded_noServerDir
labkey-jeckels Feb 19, 2024
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
28 changes: 28 additions & 0 deletions server/embedded/src/org/labkey/embedded/LabKeyServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class LabKeyServer
private static final String JARS_TO_SCAN = "tomcat.util.scan.StandardJarScanFilter.jarsToScan";
private static final String SERVER_GUID = "serverGUID";
public static final String SERVER_GUID_PARAMETER_NAME = "org.labkey.mothership." + SERVER_GUID;
public static final String SERVER_SSL_KEYSTORE = "org.labkey.serverSslKeystore";
static final String MAX_TOTAL_CONNECTIONS_DEFAULT = "50";
static final String MAX_IDLE_DEFAULT = "10";
static final String MAX_WAIT_MILLIS_DEFAULT = "120000";
Expand Down Expand Up @@ -76,6 +77,12 @@ public CSPFilterProperties cspSource()
return new CSPFilterProperties();
}

@Bean
public ServerSslProperties serverSslSource()
{
return new ServerSslProperties();
}

@Bean
public JsonAccessLog jsonAccessLog()
{
Expand Down Expand Up @@ -610,4 +617,25 @@ public void setReport(String report)
}
}

/**
* Spring Boot doesn't propagate the keystore path into Tomcat's SSL config so we need to grab it and stash
* it for potential use via the Connectors module.
*/
@Configuration
@ConfigurationProperties("server.ssl")
public static class ServerSslProperties
{
private String keyStore;

public String getKeyStore()
{
return keyStore;
}

public void setKeyStore(String keyStore)
{
this.keyStore = keyStore;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.zip.ZipInputStream;

import static org.labkey.embedded.LabKeyServer.SERVER_GUID_PARAMETER_NAME;
import static org.labkey.embedded.LabKeyServer.SERVER_SSL_KEYSTORE;

class LabKeyTomcatServletWebServerFactory extends TomcatServletWebServerFactory
{
Expand Down Expand Up @@ -176,6 +177,12 @@ protected TomcatWebServer getTomcatWebServer(Tomcat tomcat)
context.addParameter(SERVER_GUID_PARAMETER_NAME, contextProperties.getServerGUID());
}

LabKeyServer.ServerSslProperties sslProps = _server.serverSslSource();
if (null != sslProps)
{
context.addParameter(SERVER_SSL_KEYSTORE, sslProps.getKeyStore());
}

// Point at the special classloader with the hack for SLF4J
WebappLoader loader = new WebappLoader();
loader.setLoaderClass(LabKeySpringBootClassLoader.class.getName());
Expand Down