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

add jetty-ee8-proxy #8332

Merged
merged 3 commits into from Jul 25, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/codeql-analysis.yml
Expand Up @@ -67,8 +67,12 @@ jobs:
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: Set up Maven
run:
mvn -e -B -V --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.1.0:wrapper "-Dmaven=3.8.6"

- name: Clean install dependencies and build
run: mvn clean install -DskipTests
run: ./mvnw clean install -DskipTests -V -B

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand Down
2 changes: 1 addition & 1 deletion jetty-ee10/jetty-ee10-proxy/pom.xml
Expand Up @@ -12,7 +12,7 @@

<properties>
<bundle-symbolic-name>${project.groupId}.proxy</bundle-symbolic-name>
<spotbugs.onlyAnalyze>org.eclipse.jetty.proxy.*</spotbugs.onlyAnalyze>
<spotbugs.onlyAnalyze>org.eclipse.jetty.ee10.proxy.*</spotbugs.onlyAnalyze>
</properties>


Expand Down
79 changes: 79 additions & 0 deletions jetty-ee8/jetty-ee8-proxy/pom.xml
@@ -0,0 +1,79 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee8-proxy</artifactId>
<name>EE8 :: Jetty :: Proxy</name>
<description>Jetty Proxy</description>

<properties>
<ee9.module>jetty-ee9-proxy</ee9.module>
<bundle-symbolic-name>${project.groupId}.proxy</bundle-symbolic-name>
<spotbugs.onlyAnalyze>org.eclipse.jetty.ee8.proxy.*</spotbugs.onlyAnalyze>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
@{argLine} ${jetty.surefire.argLine} --add-reads org.eclipse.jetty.ee8.proxy=org.eclipse.jetty.logging
</argLine>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-servlet</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util-ajax</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http-tools</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-rewrite</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
35 changes: 35 additions & 0 deletions jetty-ee8/jetty-ee8-proxy/src/main/config/etc/jetty-ee8-proxy.xml
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">

<Configure id="Server" class="org.eclipse.jetty.server.Server">

<Set name="handler">
<New class="org.eclipse.jetty.ee8.proxy.ConnectHandler">
<Set name="handler">
<New class="org.eclipse.jetty.ee8.servlet.ServletHandler">
<Call id="proxyHolder" name="addServletWithMapping">
<Arg><Property name="jetty.proxy.servletClass" default="org.eclipse.jetty.ee8.proxy.ProxyServlet"/></Arg>
<Arg><Property name="jetty.proxy.servletMapping" default="/*"/></Arg>
<Call name="setInitParameter">
<Arg>maxThreads</Arg>
<Arg><Property name="jetty.proxy.maxThreads" default="128" /></Arg>
</Call>
<Call name="setInitParameter">
<Arg>maxConnections</Arg>
<Arg><Property name="jetty.proxy.maxConnections" default="256" /></Arg>
</Call>
<Call name="setInitParameter">
<Arg>idleTimeout</Arg>
<Arg><Property name="jetty.proxy.idleTimeout" default="30000" /></Arg>
</Call>
<Call name="setInitParameter">
<Arg>timeout</Arg>
<Arg><Property name="jetty.proxy.timeout" default="60000" /></Arg>
</Call>
</Call>
</New>
</Set>
</New>
</Set>

</Configure>
27 changes: 27 additions & 0 deletions jetty-ee8/jetty-ee8-proxy/src/main/config/modules/ee8-proxy.mod
@@ -0,0 +1,27 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html

[description]
Enables the Jetty Proxy service.
Allows the server to act as a non-transparent proxy for browsers.

[depend]
ee8-servlet
client

[environment]
ee8

[lib]
lib/jetty-ee8-proxy-${jetty.version}.jar

[xml]
etc/jetty-ee8-proxy.xml

[ini-template]
## Proxy Configuration
# jetty.proxy.servletClass=org.eclipse.jetty.ee8.proxy.ProxyServlet
# jetty.proxy.servletMapping=/*
# jetty.proxy.maxThreads=128
# jetty.proxy.maxConnections=256
# jetty.proxy.idleTimeout=30000
# jetty.proxy.timeout=60000
1 change: 1 addition & 0 deletions jetty-ee8/pom.xml
Expand Up @@ -34,6 +34,7 @@
<module>jetty-ee8-jaas</module>
<module>jetty-ee8-plus</module>
<module>jetty-ee8-jndi</module>
<module>jetty-ee8-proxy</module>
<module>jetty-ee8-annotations</module>
<module>jetty-ee8-websocket</module>
<module>jetty-ee8-quickstart</module>
Expand Down
Expand Up @@ -19,7 +19,7 @@ etc/jetty-ee9-proxy.xml

[ini-template]
## Proxy Configuration
# jetty.proxy.servletClass=org.eclipse.jetty.proxy.ProxyServlet
# jetty.proxy.servletClass=org.eclipse.jetty.ee9.proxy.ProxyServlet
# jetty.proxy.servletMapping=/*
# jetty.proxy.maxThreads=128
# jetty.proxy.maxConnections=256
Expand Down
Expand Up @@ -117,7 +117,7 @@ private void startServer(Handler handler) throws Exception
serverTLS.setSniRequired(false);
serverTLS.setNeedClientAuth(true);
// The KeyStore is also a TrustStore.
serverTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_auth/server_keystore.p12").getAbsolutePath());
serverTLS.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_auth/server_keystore.p12").getAbsolutePath());
serverTLS.setKeyStorePassword("storepwd");
serverTLS.setKeyStoreType("PKCS12");

Expand Down Expand Up @@ -166,7 +166,7 @@ private void startProxy(AbstractProxyServlet servlet) throws Exception
proxyTLS.setSniRequired(false);
proxyTLS.setNeedClientAuth(true);
// The KeyStore is also a TrustStore.
proxyTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_auth/proxy_keystore.p12").getAbsolutePath());
proxyTLS.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_auth/proxy_keystore.p12").getAbsolutePath());
proxyTLS.setKeyStorePassword("storepwd");
proxyTLS.setKeyStoreType("PKCS12");

Expand All @@ -188,7 +188,7 @@ private void startClient() throws Exception
SslContextFactory.Client clientTLS = new SslContextFactory.Client();
// Disable TLS-level hostname verification.
clientTLS.setEndpointIdentificationAlgorithm(null);
clientTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_auth/client_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_auth/client_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePassword("storepwd");
clientTLS.setKeyStoreType("PKCS12");
ClientConnector connector = new ClientConnector();
Expand Down Expand Up @@ -261,7 +261,7 @@ private HttpClient getOrCreateHttpClient(String user)
SslContextFactory.Client clientTLS = new SslContextFactory.Client();
// Disable TLS-level hostname verification for this test.
clientTLS.setEndpointIdentificationAlgorithm(null);
clientTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_auth/proxy_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_auth/proxy_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePassword("storepwd");
clientTLS.setKeyStoreType("PKCS12");
clientTLS.setCertAlias(key + "_proxy");
Expand Down Expand Up @@ -327,7 +327,7 @@ protected KeyManager[] getKeyManagers(KeyStore keyStore) throws Exception
};
// Disable TLS-level hostname verification for this test.
clientTLS.setEndpointIdentificationAlgorithm(null);
clientTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_auth/proxy_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_auth/proxy_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePassword("storepwd");
clientTLS.setKeyStoreType("PKCS12");
ClientConnector connector = new ClientConnector();
Expand Down Expand Up @@ -390,7 +390,7 @@ protected KeyManager[] getKeyManagers(KeyStore keyStore) throws Exception
};
// Disable hostname verification is required.
clientTLS.setEndpointIdentificationAlgorithm(null);
clientTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_auth/proxy_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_auth/proxy_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePassword("storepwd");
clientTLS.setKeyStoreType("PKCS12");
ClientConnector connector = new ClientConnector();
Expand Down Expand Up @@ -440,7 +440,7 @@ private <T extends SslContextFactory.Client> T configure(T tls, String user)
{
// Disable TLS-level hostname verification for this test.
tls.setEndpointIdentificationAlgorithm(null);
tls.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_auth/proxy_keystore.p12").getAbsolutePath());
tls.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_auth/proxy_keystore.p12").getAbsolutePath());
tls.setKeyStorePassword("storepwd");
tls.setKeyStoreType("PKCS12");
if (user != null)
Expand Down
Expand Up @@ -48,7 +48,7 @@ public class ConnectHandlerSSLTest extends AbstractConnectHandlerTest
public void prepare() throws Exception
{
sslContextFactory = new SslContextFactory.Server();
String keyStorePath = MavenTestingUtils.getTestResourceFile("server_keystore.p12").getAbsolutePath();
String keyStorePath = MavenTestingUtils.getTargetFile("test-classes/server_keystore.p12").getAbsolutePath();
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword("storepwd");
server = new Server();
Expand Down
Expand Up @@ -72,7 +72,7 @@ public static Stream<SslContextFactory.Server> serverTLS()
private static SslContextFactory.Server newServerSslContextFactory()
{
SslContextFactory.Server serverTLS = new SslContextFactory.Server();
String keyStorePath = MavenTestingUtils.getTestResourceFile("server_keystore.p12").getAbsolutePath();
String keyStorePath = MavenTestingUtils.getTargetFile("test-classes/server_keystore.p12").getAbsolutePath();
serverTLS.setKeyStorePath(keyStorePath);
serverTLS.setKeyStorePassword("storepwd");
return serverTLS;
Expand Down
Expand Up @@ -144,7 +144,7 @@ private HttpClient newHttpClient()
private static SslContextFactory.Server newServerSslContextFactory()
{
SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
String keyStorePath = MavenTestingUtils.getTestResourceFile("server_keystore.p12").getAbsolutePath();
String keyStorePath = MavenTestingUtils.getTargetFile("test-classes/server_keystore.p12").getAbsolutePath();
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword("storepwd");
return sslContextFactory;
Expand All @@ -153,7 +153,7 @@ private static SslContextFactory.Server newServerSslContextFactory()
private static SslContextFactory.Server newProxySslContextFactory()
{
SslContextFactory.Server proxyTLS = new SslContextFactory.Server();
String keyStorePath = MavenTestingUtils.getTestResourceFile("proxy_keystore.p12").getAbsolutePath();
String keyStorePath = MavenTestingUtils.getTargetFile("test-classes/proxy_keystore.p12").getAbsolutePath();
proxyTLS.setKeyStorePath(keyStorePath);
proxyTLS.setKeyStorePassword("storepwd");
return proxyTLS;
Expand Down Expand Up @@ -692,7 +692,7 @@ else if (port == proxyPort)
return keyManagers;
}
};
clientSslContextFactory.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_keystore.p12").getAbsolutePath());
clientSslContextFactory.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_keystore.p12").getAbsolutePath());
clientSslContextFactory.setKeyStorePassword("storepwd");
clientSslContextFactory.setEndpointIdentificationAlgorithm(null);
ClientConnector clientConnector = new ClientConnector();
Expand Down Expand Up @@ -747,7 +747,7 @@ public SSLEngine newSSLEngine(String host, int port)
return super.newSSLEngine(host, port);
}
};
clientTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_server_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_server_keystore.p12").getAbsolutePath());
clientTLS.setKeyStorePassword("storepwd");
clientTLS.setEndpointIdentificationAlgorithm(null);
ClientConnector clientConnector = new ClientConnector();
Expand All @@ -765,7 +765,7 @@ public SSLEngine newSSLEngine(String host, int port)
return super.newSSLEngine(host, port);
}
};
proxyClientTLS.setKeyStorePath(MavenTestingUtils.getTestResourceFile("client_proxy_keystore.p12").getAbsolutePath());
proxyClientTLS.setKeyStorePath(MavenTestingUtils.getTargetFile("test-classes/client_proxy_keystore.p12").getAbsolutePath());
proxyClientTLS.setKeyStorePassword("storepwd");
proxyClientTLS.setEndpointIdentificationAlgorithm(null);
proxyClientTLS.start();
Expand Down
Expand Up @@ -140,7 +140,7 @@ private void startServer(HttpServlet servlet) throws Exception
server.addConnector(serverConnector);

SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
String keyStorePath = MavenTestingUtils.getTestResourceFile("server_keystore.p12").getAbsolutePath();
String keyStorePath = MavenTestingUtils.getTargetFile("test-classes/server_keystore.p12").getAbsolutePath();
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword("storepwd");
tlsServerConnector = new ServerConnector(server, new SslConnectionFactory(
Expand Down