diff --git a/CASA-auth-token/server-java/Svc/linux/CasaIsWebServerAvailable.sh b/CASA-auth-token/server-java/Svc/linux/CasaIsWebServerAvailable.sh new file mode 100755 index 00000000..c785fe4a --- /dev/null +++ b/CASA-auth-token/server-java/Svc/linux/CasaIsWebServerAvailable.sh @@ -0,0 +1,52 @@ +#!/bin/sh +######################################################################## +# +# Copyright (C) 2006 Novell, Inc. All Rights Reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; version 2.1 +# of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, +# you may find current contact information at www.novell.com. +# +# Author: Juan Carlos Luciani +# +######################################################################## + +######################################################################## +# +# Script for determining whether Apache is installed with mod_proxy_ajp +# support. +# +######################################################################## + + +# Determine if Apache is intalled with mod_proxy_ajp support +APACHE_SYSCONFIG_FILE_PATH=/etc/sysconfig/apache2 +if [ -f $APACHE_SYSCONFIG_FILE_PATH ]; then + echo "Apache installed" + # Check if the mod_proxy_ajp module is configured to be loaded + TEST_PROXY_AJP=$(grep -i proxy_ajp $APACHE_SYSCONFIG_FILE_PATH | cut -c1-14 | grep -i APACHE_MODULES) + if [ -z "${TEST_PROXY_AJP}" ]; then + echo "mod_proxy_ajp not configured to be loaded" + retVal=1 + else + echo "mod_proxy_ajp configured to be loaded" + retVal=0 + fi +else + echo "Apache not installed" + retVal=1 +fi + +exit $retVal diff --git a/CASA-auth-token/server-java/Svc/linux/CasaTomcatConnectorEditor.sh b/CASA-auth-token/server-java/Svc/linux/CasaTomcatConnectorEditor.sh index ebf1fec9..2b4f52c3 100644 --- a/CASA-auth-token/server-java/Svc/linux/CasaTomcatConnectorEditor.sh +++ b/CASA-auth-token/server-java/Svc/linux/CasaTomcatConnectorEditor.sh @@ -32,6 +32,86 @@ # Source our environment variables file . /etc/CASA/authtoken/svc/envvars -# Perform the operation requested -$JAVA_HOME/bin/java -jar /usr/share/java/CASA/authtoken/bin/CasaTomcatConnectorEditor.jar $* +# Check if we need to determine which server.xml file to use +if [ -f /srv/www/casaats/conf/server.xml ]; then + # No need to determine which file to use + SERVER_XML_FILE_PATH=/srv/www/casaats/conf/server.xml +else + # Determine which server.xml file to use + TEST_IBM_JVM=$($JAVA_HOME/bin/java -version 2>&1 | grep -i ibm) + if [ -z "${TEST_IBM_JVM}" ]; then + # Assume Sun JVM + # Use PKCS12 version if PKCS12 store exists + if [ -f /etc/ssl/servercerts/keystore.p12 ]; then + SERVER_XML_FILE_PATH=/srv/www/casaats/conf/server-pkcs12-sun.xml + else + SERVER_XML_FILE_PATH=/srv/www/casaats/conf/server-sun.xml + fi + else + # IBM JVM + # Use PKCS12 version if PKCS12 store exists + if [ -f /etc/ssl/servercerts/keystore.p12 ]; then + SERVER_XML_FILE_PATH=/srv/www/casaats/conf/server-pkcs12-ibm.xml + else + SERVER_XML_FILE_PATH=/srv/www/casaats/conf/server-ibm.xml + fi + fi +fi + +echo "server.xml path = "$SERVER_XML_FILE_PATH + + +SSL_CONNECTOR_BEGIN="" +SSL_CONNECTOR_END="" +SSL_CONNECTOR_COMMENT_BEGIN="" +AJP_CONNECTOR_BEGIN="" +AJP_CONNECTOR_END="" +AJP_CONNECTOR_COMMENT_BEGIN="" + + +# Perform the operation requested +if [ $# -eq 2 ]; then + if [ $1 = "-e" ]; then + if [ $2 = "ssl" ]; then + echo "Enabling ssl connector" + sed -i s:$SSL_CONNECTOR_COMMENT_BEGIN:$SSL_CONNECTOR_BEGIN:g SERVER_XML_FILE_PATH + sed -i s:$SSL_CONNECTOR_COMMENT_END:$SSL_CONNECTOR_END:g SERVER_XML_FILE_PATH + else + if [ $2 = "ajp" ]; then + echo "Enabling ajp connector" + sed -i s:$AJP_CONNECTOR_COMMENT_BEGIN:$AJP_CONNECTOR_BEGIN:g SERVER_XML_FILE_PATH + sed -i s:$AJP_CONNECTOR_COMMENT_END:$AJP_CONNECTOR_END:g SERVER_XML_FILE_PATH + else + echo "Connector type not supported" + fi + fi + else + if [ $1 = "-d" ]; then + if [ $2 = "ssl" ]; then + echo "Disabling ssl connector" + sed -i s:$SSL_CONNECTOR_BEGIN:$SSL_CONNECTOR_COMMENT_BEGIN:g SERVER_XML_FILE_PATH + sed -i s:$SSL_CONNECTOR_END:$SSL_CONNECTOR_COMMENT_END:g SERVER_XML_FILE_PATH + else + if [ $2 = "ajp" ]; then + echo "Disabling ajp connector" + sed -i s:$AJP_CONNECTOR_BEGIN:$AJP_CONNECTOR_COMMENT_BEGIN:g SERVER_XML_FILE_PATH + sed -i s:$AJP_CONNECTOR_END:$AJP_CONNECTOR_COMMENT_END:g SERVER_XML_FILE_PATH + else + echo "Connector type not supported" + fi + fi + else + if [ $1 = "-file" ]; then + echo "Process properties file" + $JAVA_HOME/bin/java -jar /usr/share/java/CASA/authtoken/bin/CasaTomcatConnectorEditor.jar $* + else + echo "Invalid operation requested" + fi + fi + fi +else + echo "Invalid number of parameters" +fi diff --git a/CASA-auth-token/server-java/Svc/linux/Makefile.am b/CASA-auth-token/server-java/Svc/linux/Makefile.am index 1387b490..cfe0e9ba 100644 --- a/CASA-auth-token/server-java/Svc/linux/Makefile.am +++ b/CASA-auth-token/server-java/Svc/linux/Makefile.am @@ -40,6 +40,8 @@ EXTRA_DIST = CasaAuthtokenSvcD \ CasaSvcSettingsEditor.sh \ CasaTomcatConnectorEditor.sh \ CasaIaRealmsEditor.sh \ + casaats.conf \ + CasaIswebServerAvailable.sh \ log4j.properties ROOT = ../.. diff --git a/CASA-auth-token/server-java/Svc/linux/casaats.conf b/CASA-auth-token/server-java/Svc/linux/casaats.conf new file mode 100644 index 00000000..5b22de3d --- /dev/null +++ b/CASA-auth-token/server-java/Svc/linux/casaats.conf @@ -0,0 +1,6 @@ +# Apache to casaats hook + + ProxyPreserveHost On + ProxyPass /CasaAuthTokenSvc/ ajp://localhost:9595/CasaAuthTokenSvc/ + + diff --git a/CASA-auth-token/server-java/Svc/tomcat5/conf/linux/server-ibm.xml b/CASA-auth-token/server-java/Svc/tomcat5/conf/linux/server-ibm.xml index d8f0b0f6..19f9e4a6 100644 --- a/CASA-auth-token/server-java/Svc/tomcat5/conf/linux/server-ibm.xml +++ b/CASA-auth-token/server-java/Svc/tomcat5/conf/linux/server-ibm.xml @@ -78,6 +78,7 @@ to 0 --> + + + + + + + + + + + + + + + + + + + + + + + + + + + +