Skip to content

Commit

Permalink
WIP Test oauth-proxy in isolation
Browse files Browse the repository at this point in the history
Configure rabbitmq with oath-proxy
  • Loading branch information
MarcialRosales committed Dec 2, 2024
1 parent 0007eea commit f7d5912
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 18 deletions.
3 changes: 1 addition & 2 deletions selenium/bin/components/keycloak
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ ensure_keycloak() {
init_keycloak() {
KEYCLOAK_CONFIG_PATH=${KEYCLOAK_CONFIG_PATH:-oauth/keycloak}
KEYCLOAK_CONFIG_DIR=$(realpath ${TEST_DIR}/${KEYCLOAK_CONFIG_PATH})
KEYCLOAK_URL=${OAUTH_PROVIDER_URL}


print "> KEYCLOAK_CONFIG_DIR: ${KEYCLOAK_CONFIG_DIR}"
print "> KEYCLOAK_URL: ${KEYCLOAK_URL}"
print "> KEYCLOAK_DOCKER_IMAGE: ${KEYCLOAK_DOCKER_IMAGE}"
Expand Down
6 changes: 3 additions & 3 deletions selenium/bin/components/oauth-proxy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ init_oauth-proxy() {
print "> OAUTH_PROVIDER_URL: ${OAUTH_PROVIDER_URL}"
print "> PROXY_HOSTNAME: ${PROXY_HOSTNAME}"
print "> PROXY_PORT: ${PROXY_PORT}"

}
start_oauth-proxy() {
begin "Starting oauth-proxy ..."
Expand All @@ -38,7 +39,6 @@ start_oauth-proxy() {
--mount "type=bind,source=${MOUNT_HTTPD_CONFIG_DIR},target=/usr/local/apache2/conf" \
${HTTPD_DOCKER_IMAGE}

PROXY_URL=$(calculate_forward_proxy_url $OAUTH_PROVIDER_URL $PROXY_HOSTNAME $PROXY_PORT)

end "Proxy is ready"
wait_for_url $OAUTH_PROVIDER_URL ${PROXY_HOSTNAME}:${PROXY_PORT}
end "oauth-proxy is ready"
}
2 changes: 1 addition & 1 deletion selenium/bin/components/proxy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ensure_proxy() {
fi
}
init_proxy() {
HTTPD_CONFIG_DIR=${TEST_CONFIG_DIR}/httpd-proxy
HTTPD_CONFIG_DIR=${TEST_CONFIG_DIR}/oauth-proxy
PUBLIC_RABBITMQ_HOST=${PUBLIC_RABBITMQ_HOST:-proxy:9090}
PROXIED_RABBITMQ_URL=$(calculate_rabbitmq_url $PUBLIC_RABBITMQ_HOST)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ TEST_CONFIG_PATH=/oauth
PROFILES="oauth-proxy keycloak proxy-oauth-provider keycloak-mgt-oauth-provider tls"

source $SCRIPT/../../bin/suite_template $@
runWith keycloak forward-proxy
runWith keycloak oauth-proxy
2 changes: 2 additions & 0 deletions selenium/test/oauth/env.docker.oauth-proxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export OAUTH_PROXY_CA_CERT=/config/oauth/oauth-proxy/ca_oauth-proxy_certificate.pem
export OAUTH_PROXY_URL=https://proxy:9092/realms/test
3 changes: 0 additions & 3 deletions selenium/test/oauth/env.docker.proxy

This file was deleted.

1 change: 0 additions & 1 deletion selenium/test/oauth/env.local.keycloak
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export KEYCLOAK_URL=https://localhost:8443/realms/test
#export OAUTH_PROVIDER_URL=https://localhost:8443/realms/test
export KEYCLOAK_CA_CERT=selenium/test/oauth/keycloak/ca_keycloak_certificate.pem
2 changes: 2 additions & 0 deletions selenium/test/oauth/env.local.oauth-proxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export OAUTH_PROXY_CA_CERT=selenium/test/oauth/oauth-proxy/ca_oauth-proxy_certificate.pem
export OAUTH_PROXY_URL=https://localhost:9092/realms/test
3 changes: 0 additions & 3 deletions selenium/test/oauth/env.local.proxy

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ServerRoot "/usr/local/apache2"
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 9090
Listen 9092

#
# Dynamic Shared Object (DSO) Support
Expand Down Expand Up @@ -238,7 +238,7 @@ ServerAdmin [email protected]
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName ${PUBLIC_RABBITMQ_HOST}
ServerName oauth-proxy

#
# Deny access to the entirety of your server's filesystem. You must
Expand Down Expand Up @@ -502,10 +502,16 @@ SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

<VirtualHost *:9090>
ServerName "proxy"
<VirtualHost *:9092>
ServerName "oauth-proxy"
ProxyRequests On
ProxyVia On
SSLProxyEngine On
SSLProxyVerify require
SSLProxyVerifyDepth 10

SSLProxyCACertificateFile /etc/httpd/conf/certs/ca.pem

<Proxy "*">
Allow from all
</Proxy>
Expand Down
5 changes: 5 additions & 0 deletions selenium/test/oauth/rabbitmq.oauth-proxy-oauth-provider.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
auth_oauth2.issuer = ${OAUTH_PROVIDER_URL}
auth_oauth2.https.cacertfile = ${OAUTH_PROXY_CA_CERT}
auth_oauth2.proxy = ${OAUTH_PROXY_URL}
#auth_oauth2.proxy_username = ${OAUTH_PROXY_USERNAME}
#auth_oauth2.proxy_password = ${OAUTH_PROXY_PASSWORD}

0 comments on commit f7d5912

Please sign in to comment.