Skip to content

Commit

Permalink
GRP-2793: add GROUPER_APACHE_SERVER_NAME option in container
Browse files Browse the repository at this point in the history
  • Loading branch information
mchyzer committed May 13, 2020
1 parent 8990936 commit fe11ba5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ "$#" -ne 4 ]; then
exit 1
fi

expectedSuccesses=528
expectedSuccesses=531

export containerName=$1
export imageName=$2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ testContainerUi() {

assertFileContains /etc/httpd/conf.d/grouper-www.conf "3600"
assertFileNotContains /etc/httpd/conf.d/grouper-www.conf "__"

assertFileNotContains /etc/httpd/conf.d/grouper-www.conf "ServerName"
assertFileNotContains /etc/httpd/conf.d/grouper-www.conf "UseCanonicalName On"

assertEnvVarNot GROUPER_APACHE_SERVER_NAME https://a.b.c:443
assertEnvVar GROUPERSCIM_PROXY_PASS "#"
assertEnvVar GROUPERSCIM_URL_CONTEXT "grouper-ws-scim"
assertEnvVar GROUPERWS_PROXY_PASS "#"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ testContainerWs() {
echo
echo '################'
echo Running container as ws
echo "docker run --detach --name $containerName --publish 443:443 -e GROUPER_SELF_SIGNED_CERT=true $imageName ws"
echo "docker run --detach --name $containerName --publish 443:443 -e GROUPER_SELF_SIGNED_CERT=true -e GROUPER_APACHE_SERVER_NAME=https://a.b.c:443 $imageName ws"
echo '################'
echo

docker run --detach --name $containerName --publish 443:443 -e GROUPER_SELF_SIGNED_CERT=true $imageName ws
docker run --detach --name $containerName --publish 443:443 -e GROUPER_SELF_SIGNED_CERT=true -e GROUPER_APACHE_SERVER_NAME=https://a.b.c:443 $imageName ws
sleep $globalSleepSecondsAfterRun

assertFileExists /opt/grouper/grouperWebapp/WEB-INF/libWs/axis2-kernel-1.6.4.jar
Expand Down Expand Up @@ -44,6 +44,10 @@ testContainerWs() {
assertFileContains /etc/httpd/conf.d/grouper-www.conf "3600"
assertFileNotContains /etc/httpd/conf.d/grouper-www.conf "__"

assertFileContains /etc/httpd/conf.d/grouper-www.conf "ServerName https://a.b.c:443"
assertFileContains /etc/httpd/conf.d/grouper-www.conf "UseCanonicalName On"

assertEnvVar GROUPER_APACHE_SERVER_NAME https://a.b.c:443
assertEnvVar GROUPERSCIM_PROXY_PASS "#"
assertEnvVar GROUPERSCIM_URL_CONTEXT "grouper-ws-scim"
assertEnvVar GROUPERWS_PROXY_PASS ""
Expand Down
17 changes: 17 additions & 0 deletions container_files/usr-local-bin/librarySetupFilesApache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ setupFilesApache_ssl() {
fi
}



setupFilesApache_serverName() {
if [ "$GROUPER_RUN_APACHE" = "true" ] && [ ! -z "$GROUPER_APACHE_SERVER_NAME" ] && [ "$GROUPER_APACHE_SERVER_NAME" != "" ] && [ -f /etc/httpd/conf.d/grouper-www.conf ]
then
echo >> /etc/httpd/conf.d/grouper-www.conf
echo "ServerName $GROUPER_APACHE_SERVER_NAME" >> /etc/httpd/conf.d/grouper-www.conf
echo "UseCanonicalName On" >> /etc/httpd/conf.d/grouper-www.conf
echo >> /etc/httpd/conf.d/grouper-www.conf
fi

}


setupFilesApache_logging() {
if [ "$GROUPER_RUN_APACHE" = "true" ]
then
Expand Down Expand Up @@ -59,6 +73,7 @@ setupFilesApache() {
setupFilesApache_selfSignedCert
setupFilesApache_ports
setupFilesApache_ssl
setupFilesApache_serverName
}

setupFilesApache_unsetAll() {
Expand All @@ -69,6 +84,7 @@ setupFilesApache_unsetAll() {
unset -f setupFilesApache_ssl
unset -f setupFilesApache_supervisor
unset -f setupFilesApache_unsetAll
unset -f setupFilesApache_serverName
}

setupFilesApache_exportAll() {
Expand All @@ -79,6 +95,7 @@ setupFilesApache_exportAll() {
export -f setupFilesApache_ssl
export -f setupFilesApache_supervisor
export -f setupFilesApache_unsetAll
export -f setupFilesApache_serverName
}

# export everything
Expand Down
7 changes: 1 addition & 6 deletions container_files/usr-local-bin/librarySetupFilesTomcat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ setupFilesTomcat_context() {
if [ -f /opt/tomee/conf/Catalina/localhost/grouper.xml ]
then
# ws only and scim only dont have cookies
if [ "$GROUPER_CONTEXT_COOKIES" = "false" ]
then
sed -i "s|__GROUPER_CONTEXT_COOKIES__|$GROUPER_CONTEXT_COOKIES|g" /opt/tomee/conf/Catalina/localhost/grouper.xml
else
sed -i "s|__GROUPER_CONTEXT_COOKIES__||g" /opt/tomee/conf/Catalina/localhost/grouper.xml
fi
sed -i "s|__GROUPER_CONTEXT_COOKIES__|$GROUPER_CONTEXT_COOKIES|g" /opt/tomee/conf/Catalina/localhost/grouper.xml

# setup context
sed -i "s|__GROUPER_TOMCAT_CONTEXT__|$GROUPER_TOMCAT_CONTEXT|g" /opt/tomee/conf/Catalina/localhost/grouper.xml
Expand Down

0 comments on commit fe11ba5

Please sign in to comment.