Skip to content

Commit 89a290a

Browse files
Configure UAA with tls
And RabbitMq with TLS too
1 parent 8bd8e86 commit 89a290a

File tree

8 files changed

+75
-5
lines changed

8 files changed

+75
-5
lines changed

selenium/bin/components/uaa

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ init_uaa() {
1616
print "> UAA_CONFIG_DIR: ${UAA_CONFIG_DIR}"
1717
print "> UAA_URL: ${UAA_URL}"
1818
print "> UAA_DOCKER_IMAGE: ${UAA_DOCKER_IMAGE}"
19+
20+
generate-ca-server-client-kpi uaa $UAA_CONFIG_DIR
21+
generate-keystore-if-required uaa $UAA_CONFIG_DIR
1922
}
2023
start_uaa() {
2124
begin "Starting UAA ..."
@@ -35,11 +38,13 @@ start_uaa() {
3538
--name uaa \
3639
--net ${DOCKER_NETWORK} \
3740
--publish 8080:8080 \
41+
--publish 8443:8443 \
3842
--mount "type=bind,source=$MOUNT_UAA_CONF_DIR,target=/uaa" \
43+
-v ${UAA_CONFIG_DIR}/server.xml:/layers/paketo-buildpacks_apache-tomcat/catalina-base/conf/server.xml \
3944
--env UAA_CONFIG_PATH="/uaa" \
40-
--env JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom" \
45+
--env JAVA_OPTS="-Djava.security.policy=unlimited -Djava.security.egd=file:/dev/./urandom" \
4146
${UAA_DOCKER_IMAGE}
42-
47+
4348
wait_for_oidc_endpoint uaa $UAA_URL
4449
end "UAA is ready"
4550
}

selenium/bin/suite_template

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,25 @@ do_generate-ca-server-client-kpi() {
420420
end "SSL Certificates generated for $NAME under $FOLDER"
421421
}
422422

423+
generate-keystore-if-required() {
424+
NAME=$1
425+
FOLDER=$2
426+
if [[ ! -f "${FOLDER}/${NAME}.jks " ]]; then
427+
keytool -importkeystore \
428+
-destkeystore ${FOLDER}/${NAME}.jks \
429+
-srckeystore ${FOLDER}/server_${NAME}.p12 \
430+
-deststoretype pkcs12 \
431+
-srcstoretype pkcs12 \
432+
-alias 1 \
433+
-destalias ${NAME}-tls \
434+
-deststorepass foobar \
435+
-destkeypass foobar \
436+
-srcstorepass "" \
437+
-srckeypass "" \
438+
-noprompt
439+
fi
440+
}
441+
423442
run() {
424443
runWith rabbitmq
425444
}

selenium/suites/authnz-mgt/oauth-with-uaa.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44

55
TEST_CASES_PATH=/oauth/with-sp-initiated
66
TEST_CONFIG_PATH=/oauth
7-
PROFILES="uaa uaa-oauth-provider uaa-mgt-oauth-provider"
7+
PROFILES="uaa uaa-oauth-provider uaa-mgt-oauth-provider tls"
88

99
source $SCRIPT/../../bin/suite_template $@
1010
runWith uaa

selenium/test/oauth/env.docker.uaa

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export UAA_URL=https://uaa:8443
1+
export UAA_URL=http://uaa:8080

selenium/test/oauth/env.local.uaa

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export UAA_URL=https://localhost:8443
1+
export UAA_URL=http://localhost:8080

selenium/test/oauth/uaa/server.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<Server port="-1">
3+
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
4+
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
5+
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
6+
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
7+
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
8+
<Service name="Catalina">
9+
<Connector class="org.apache.coyote.http11.Http11NioProtocol" protocol="HTTP/1.1" connectionTimeout="20000"
10+
scheme="https"
11+
port="8443"
12+
SSLEnabled="true"
13+
sslEnabledProtocols="TLSv1.2"
14+
ciphers="TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
15+
secure="true"
16+
clientAuth="false"
17+
sslProtocol="TLS"
18+
keystoreFile="/uaa/uaa.jks"
19+
keystoreType="PKCS12"
20+
keyAlias="uaa-tls"
21+
keystorePass="foobar"
22+
bindOnInit="false"/>
23+
<Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
24+
connectionTimeout="20000"
25+
port="8989"
26+
address="127.0.0.1"
27+
bindOnInit="true"/>
28+
<Engine name="Catalina" defaultHost="localhost">
29+
<Host name="localhost"
30+
appBase="webapps"
31+
unpackWARs="true"
32+
autoDeploy="false"
33+
failCtxIfServletStartFails="true">
34+
<Valve className="org.apache.catalina.valves.RemoteIpValve"
35+
remoteIpHeader="x-forwarded-for"
36+
protocolHeader="x-forwarded-proto"
37+
internalProxies="10\.\d{1,3}\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3}|169\.254\.\d{1,3}\.\d{1,3}|127\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.1[6-9]{1}\.\d{1,3}\.\d{1,3}|172\.2[0-9]{1}\.\d{1,3}\.\d{1,3}|172\.3[0-1]{1}\.\d{1,3}\.\d{1,3}"/>
38+
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
39+
prefix="localhost_access" suffix=".log" rotatable="false" pattern="%h %l %u %t &quot;%r&quot; %s %b"/>
40+
</Host>
41+
</Engine>
42+
</Service>
43+
</Server>

selenium/test/oauth/uaa/uaa.jks

3.79 KB
Binary file not shown.

selenium/test/oauth/uaa/uaa.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
require_https: true
2+
https_port: 8443
3+
14
logging:
25
config: /uaa/log4j2.properties
36

0 commit comments

Comments
 (0)