diff --git a/Dockerfile b/Dockerfile index 6001a68..68f75e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,8 @@ LABEL author="tier-packaging@internet2.edu " \ ARG GROUPER_CONTAINER_VERSION -ENV GROUPER_VERSION=4.3.0 \ - GROUPER_CONTAINER_VERSION=4.3.1 \ +ENV GROUPER_VERSION=4.3.2 \ + GROUPER_CONTAINER_VERSION=4.3.2 \ JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto \ PATH=$PATH:$JAVA_HOME/bin \ GROUPER_HOME=/opt/grouper/grouperWebapp/WEB-INF diff --git a/container_files/tomcat/conf/createPatches.txt b/container_files/tomcat/conf/createPatches.txt index c00b298..564d3d3 100644 --- a/container_files/tomcat/conf/createPatches.txt +++ b/container_files/tomcat/conf/createPatches.txt @@ -1,4 +1,2 @@ # note: get the server.xml into the original, make sure it ends with newline if the file does -diff -u server.xml.original server.xml.turnOnAjp > server.xml.turnOnAjp.patch -diff -u server.xml.turnOnAjp server.xml.loggingpipe > server.xml.loggingpipe.patch -diff -u server.xml.turnOnAjp server.xml.nologging > server.xml.nologging.patch +diff -u server.xml.original server.xml.grouper > server.xml.grouper.patch diff --git a/container_files/tomcat/conf/server.xml.nologging b/container_files/tomcat/conf/server.xml.grouper similarity index 95% rename from container_files/tomcat/conf/server.xml.nologging rename to container_files/tomcat/conf/server.xml.grouper index f462a22..5cc1afe 100644 --- a/container_files/tomcat/conf/server.xml.nologging +++ b/container_files/tomcat/conf/server.xml.grouper @@ -120,8 +120,16 @@ --> - - + + + + - - - + diff --git a/container_files/tomcat/conf/server.xml.grouper.patch b/container_files/tomcat/conf/server.xml.grouper.patch new file mode 100644 index 0000000..0196ac5 --- /dev/null +++ b/container_files/tomcat/conf/server.xml.grouper.patch @@ -0,0 +1,37 @@ +--- server.xml.original 2023-06-27 13:54:24.000000000 -0400 ++++ server.xml.grouper 2023-07-03 02:37:07.000000000 -0400 +@@ -69,7 +69,7 @@ + + + +- ++ ++ + ++ + + +- ++ + + + diff --git a/container_files/tomcat/conf/server.xml.loggingpipe b/container_files/tomcat/conf/server.xml.loggingpipe deleted file mode 100644 index 721a15e..0000000 --- a/container_files/tomcat/conf/server.xml.loggingpipe +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/container_files/tomcat/conf/server.xml.loggingpipe.patch b/container_files/tomcat/conf/server.xml.loggingpipe.patch deleted file mode 100644 index 7322471..0000000 --- a/container_files/tomcat/conf/server.xml.loggingpipe.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- server.xml.turnOnAjp 2023-06-28 15:00:26.000000000 -0400 -+++ server.xml.loggingpipe 2023-06-28 15:00:26.000000000 -0400 -@@ -163,9 +163,9 @@ - -- -+ - - - diff --git a/container_files/tomcat/conf/server.xml.nologging.patch b/container_files/tomcat/conf/server.xml.nologging.patch deleted file mode 100644 index 0239eca..0000000 --- a/container_files/tomcat/conf/server.xml.nologging.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- server.xml.turnOnAjp 2023-06-28 15:00:26.000000000 -0400 -+++ server.xml.nologging 2023-06-28 15:00:26.000000000 -0400 -@@ -163,9 +163,9 @@ - -- -+ -+ -+ - - - diff --git a/container_files/tomcat/conf/server.xml.turnOnAjp b/container_files/tomcat/conf/server.xml.turnOnAjp deleted file mode 100644 index b218269..0000000 --- a/container_files/tomcat/conf/server.xml.turnOnAjp +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/container_files/tomcat/conf/server.xml.turnOnAjp.patch b/container_files/tomcat/conf/server.xml.turnOnAjp.patch deleted file mode 100644 index 70115aa..0000000 --- a/container_files/tomcat/conf/server.xml.turnOnAjp.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- server.xml.original 2023-06-27 13:54:24.000000000 -0400 -+++ server.xml.turnOnAjp 2023-06-28 15:00:26.000000000 -0400 -@@ -69,7 +69,7 @@ - - - - - -- -+ - - ' /opt/tomcat/conf/server.xml) -ge 1 ]; then + + sed -i 's|||g' /opt/tomcat/conf/server.xml + returnCode=$? + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_remoteCidrValve) Apply remote CIDR valve: sed -i 's|||g' /opt/tomcat/conf/server.xml, result: $returnCode" + if [ $returnCode != 0 ]; then exit $returnCode; fi + + sed -i "s|__GROUPER_TOMCAT_REMOTE_CIDR_VALVE_ALLOW__|$GROUPER_TOMCAT_REMOTE_CIDR_VALVE_ALLOW|g" /opt/tomcat/conf/server.xml + returnCode=$? + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_remoteCidrValve) Apply remote CIDR valve value: sed -i \"s|__GROUPER_TOMCAT_REMOTE_CIDR_VALVE_ALLOW__|$GROUPER_TOMCAT_REMOTE_CIDR_VALVE_ALLOW|g\" /opt/tomcat/conf/server.xml, result: $returnCode" + if [ $returnCode != 0 ]; then exit $returnCode; fi + + + else + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_remoteCidrValve) /opt/tomcat/conf/server.xml does not contain so will not have remote CIDR valve applied" + fi + + fi + +} + +setupFilesTomcat_serverXml() { if [ "$GROUPER_ORIGFILE_SERVER_XML" = "true" ]; then cp /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.currentOriginalInContainer returnCode=$? - echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_turnOnAjp) cp /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.currentOriginalInContainer , result: $returnCode" + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_serverXml) cp /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.currentOriginalInContainer , result: $returnCode" + if [ $returnCode != 0 ]; then exit $returnCode; fi + + patch /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.grouper.patch + returnCode=$? + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_serverXml) Patch server.xml to apply grouper settings: patch /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.grouper.patch, result: $returnCode" if [ $returnCode != 0 ]; then exit $returnCode; fi + else + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_serverXml) /opt/tomcat/conf/server.xml is not the original file so will not be edited" + fi + +} + + +setupFilesTomcat_turnOnAjp() { - patch /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.turnOnAjp.patch + if [ $(grep -c '' /opt/tomcat/conf/server.xml) -ge 1 ]; then + + sed -i 's|||g' /opt/tomcat/conf/server.xml returnCode=$? - echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_turnOnAjp) Patch server.xml to turn on ajp: patch /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.turnOnAjp.patch, result: $returnCode" + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_turnOnAjp) Apply AJP: sed -i 's|||g' /opt/tomcat/conf/server.xml, result: $returnCode" if [ $returnCode != 0 ]; then exit $returnCode; fi else - echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_turnOnAjp) /opt/tomcat/conf/server.xml is not the original file so will not be edited" + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_turnOnAjp) /opt/tomcat/conf/server.xml does not contain so will not have AJP connector applied" fi } setupFilesTomcat_accessLogs() { - if [ "$GROUPER_ORIGFILE_SERVER_XML" = "true" ]; then - if [ "$GROUPER_TOMCAT_LOG_ACCESS" = "true" ]; then + if [ "$GROUPER_TOMCAT_LOG_ACCESS" = "true" ]; then + if [ $(grep -c '' /opt/tomcat/conf/server.xml) -ge 1 ]; then - # this patch happens after the last patch - patch /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.loggingpipe.patch + sed -i 's|||g' /opt/tomcat/conf/server.xml returnCode=$? - echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_accessLogs) Patch server.xml to log access: patch /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.loggingpipe.patch , result: $returnCode" + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_accessLogs) Apply access logs: sed -i 's|||g' /opt/tomcat/conf/server.xml, result: $returnCode" if [ $returnCode != 0 ]; then exit $returnCode; fi - - else - - patch /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.nologging.patch - returnCode=$? - echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_accessLogs) Patch server.xml to not log access: patch /opt/tomcat/conf/server.xml /opt/tomcat/conf/server.xml.nologging.patch , result: $returnCode" - if [ $returnCode != 0 ]; then exit $returnCode; fi - + else + echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_accessLogs) /opt/tomcat/conf/server.xml does not contain so will not have access logs applied" fi - else - echo "grouperContainer; INFO: (librarySetupFilesTomcat.sh-setupFilesTomcat_accessLogs) /opt/tomcat/conf/server.xml is not the original file so will not be edited" fi } @@ -321,6 +353,8 @@ setupFilesTomcat_unsetAll() { unset -f setupFilesTomcat_authn unset -f setupFilesTomcat_context unset -f setupFilesTomcat_ports + unset -f setupFilesTomcat_remoteCidrValve + unset -f setupFilesTomcat_serverXml unset -f setupFilesTomcat_ssl unset -f setupFilesTomcat_sslCertsAnchors unset -f setupFilesTomcat_sslCertsClient @@ -338,6 +372,8 @@ setupFilesTomcat_exportAll() { export -f setupFilesTomcat_authn export -f setupFilesTomcat_context export -f setupFilesTomcat_ports + export -f setupFilesTomcat_remoteCidrValve + export -f setupFilesTomcat_serverXml export -f setupFilesTomcat_ssl export -f setupFilesTomcat_sslCertsAnchors export -f setupFilesTomcat_sslCertsClient