diff --git a/CASA-auth-token/server-java/Svc/TODO b/CASA-auth-token/server-java/Svc/TODO index 2c9e1219..446de73b 100644 --- a/CASA-auth-token/server-java/Svc/TODO +++ b/CASA-auth-token/server-java/Svc/TODO @@ -10,11 +10,6 @@ This file contains a list of the items still outstanding for AuthTokenSvc. OUTSTANDING ITEMS -- Add code to verify that client/server communications occur over HTTPS. - Create plug-in API for Identity Token Providers. -- Change printfs used for debugging into a suitable mechanism. -- Create tool to connect Tomcat instance to Apache Server and disabling port 2645 listener. -- Create tool to help administrators import certificates into the ATS's key store. -- Create tool to easily edit the iaRealms file. - Add identity token encryption capabilities. diff --git a/CASA-auth-token/server-java/Svc/linux/CasaIsWebServerAvailable.sh b/CASA-auth-token/server-java/Svc/linux/CasaIsWebServerAvailable.sh index c785fe4a..7e613a21 100755 --- a/CASA-auth-token/server-java/Svc/linux/CasaIsWebServerAvailable.sh +++ b/CASA-auth-token/server-java/Svc/linux/CasaIsWebServerAvailable.sh @@ -39,14 +39,14 @@ if [ -f $APACHE_SYSCONFIG_FILE_PATH ]; then 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 + retVal=0 else echo "mod_proxy_ajp configured to be loaded" - retVal=0 + retVal=1 fi else echo "Apache not installed" - retVal=1 + retVal=0 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 2b4f52c3..78edfa05 100644 --- a/CASA-auth-token/server-java/Svc/linux/CasaTomcatConnectorEditor.sh +++ b/CASA-auth-token/server-java/Svc/linux/CasaTomcatConnectorEditor.sh @@ -71,47 +71,81 @@ AJP_CONNECTOR_COMMENT_BEGIN="" +# Assume success +retVal=0 + # 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 + 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 + 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 + ln -s /etc/CASA/authtoken/svc/casaats.conf /etc/apache2/conf.d/casaats.conf else echo "Connector type not supported" + retVal=1 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 + 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 + rm -f /etc/apache2/conf.d/casaats.conf 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 + 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" + retVal=1 fi fi else - if [ $1 = "-file" ]; then - echo "Process properties file" - $JAVA_HOME/bin/java -jar /usr/share/java/CASA/authtoken/bin/CasaTomcatConnectorEditor.jar $* + if [ $1 = "-s" ]; then + if [ $2 = "ssl" ]; then + echo "Checking ssl connector status" + TEST_SSL_CONNECTOR=$(grep "$SSL_CONNECTOR_BEGIN" $SERVER_XML_FILE_PATH) + if [ -z "${TEST_SSL_CONNECTOR}" ]; then + echo "Connector disabled" + else + echo "Connector enabled" + fi + else + if [ $2 = "ajp" ]; then + echo "Checking ajp connector status" + TEST_AJP_CONNECTOR=$(grep "$AJP_CONNECTOR_BEGIN" $SERVER_XML_FILE_PATH) + if [ -z "${TEST_AJP_CONNECTOR}" ]; then + echo "Connector disabled" + else + echo "Connector enabled" + fi + else + echo "Connector type not supported" + retVal=1 + fi + fi else - echo "Invalid operation requested" - fi + 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" + retVal=1 + fi + fi fi fi else echo "Invalid number of parameters" + retVal=1 fi 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 19f9e4a6..253cb5f9 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 @@ -77,6 +77,12 @@ + + + + + + + + - + - + - - - - - @@ -29,9 +21,18 @@ UserDatabaseRealm to authenticate users --> + description="User database that can be updated and saved"> + + + + factory + org.apache.catalina.users.MemoryUserDatabaseFactory + + + pathname + conf/tomcat-users.xml + + @@ -73,37 +74,43 @@ IP address of the remote client. --> + - - + + + + + + + - - + + + + - - - - - - - - - - - + debug="0" resourceName="UserDatabase"/> - - - - - - - - - - - - - + + diff --git a/CASA-auth-token/server-java/package/linux/CASA_auth_token_svc_4zen.spec.in b/CASA-auth-token/server-java/package/linux/CASA_auth_token_svc_4zen.spec.in index 44571a5b..d6f187ff 100644 --- a/CASA-auth-token/server-java/package/linux/CASA_auth_token_svc_4zen.spec.in +++ b/CASA-auth-token/server-java/package/linux/CASA_auth_token_svc_4zen.spec.in @@ -187,11 +187,11 @@ install -m 755 Svc/linux/CasaAuthtokenSvcD %{buildroot}/etc/init.d/casa_atsd # Tomcat Base files install -m 600 Svc/tomcat5/conf/catalina.policy %{buildroot}/srv/www/casaats/conf/catalina.policy -install -m 600 Svc/tomcat5/conf/linux/zen/catalina.properties %{buildroot}/srv/www/casaats/conf/catalina.properties +install -m 600 Svc/tomcat5/conf/catalina.properties %{buildroot}/srv/www/casaats/conf/catalina.properties install -m 600 Svc/tomcat5/conf/jk2.properties %{buildroot}/srv/www/casaats/conf/jk2.properties install -m 600 Svc/tomcat5/conf/linux/server-ibm.xml %{buildroot}/srv/www/casaats/conf/server-ibm.xml install -m 600 Svc/tomcat5/conf/linux/server-pkcs12-ibm.xml %{buildroot}/srv/www/casaats/conf/server-pkcs12-ibm.xml -install -m 600 Svc/tomcat5/conf/linux/zen/server.xml %{buildroot}/srv/www/casaats/conf/server-sun.xml +install -m 600 Svc/tomcat5/conf/linux/server-sun.xml %{buildroot}/srv/www/casaats/conf/server-sun.xml install -m 600 Svc/tomcat5/conf/linux/server-pkcs12-sun.xml %{buildroot}/srv/www/casaats/conf/server-pkcs12-sun.xml install -m 600 Svc/tomcat5/conf/tomcat-users.xml %{buildroot}/srv/www/casaats/conf/tomcat-users.xml install -m 600 Svc/tomcat5/conf/web.xml %{buildroot}/srv/www/casaats/conf/web.xml diff --git a/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp b/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp index 4054efd0..5bc35b23 100644 --- a/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp +++ b/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp @@ -58,6 +58,8 @@ string authPolicyEditor = "/usr/share/java/CASA/authtoken/bin/CasaAuthPolicyEdit string iaRealmsFile = "/etc/CASA/authtoken/svc/iaRealms.xml"; string iaRealmsEditor = "/usr/share/java/CASA/authtoken/bin/CasaIaRealmsEditor.sh"; string trustedServerCertsFolder = "/etc/CASA/authtoken/keys/trustedATSCerts"; +string tomcatConnectorEditor = "/usr/share/java/CASA/authtoken/bin/CasaTomcatConnectorEditor.sh"; +string webServerIsAvailableChecker = "/usr/share/java/CASA/authtoken/bin/CasaIsWebServerAvailable.sh"; /** * Settings Map @@ -190,16 +192,13 @@ global boolean Read() { // Set defaults Settings["CONFIG_CASAATS_ENABLE"] = false; - Settings["CONFIG_CASAATS_DIRECT_ACCESS"] = true; + Settings["CONFIG_CASAATS_DIRECT_ACCESS"] = true;; Settings["CONFIG_CASAATS_WEB_ACCESS"] = false; Settings["CONFIG_CASAATS_RECONFIG_INTERVAL"] = 60; if (FileUtils::Exists("/etc/sysconfig/casa-ats")) { Settings["CONFIG_CASAATS_ENABLE"] = tolower((string)SCR::Read(.sysconfig.casa-ats.CONFIG_CASAATS_ENABLE)) == "yes"; if ((Settings["CONFIG_CASAATS_ENABLE"]:false) == true) { - Settings["CONFIG_CASAATS_DIRECT_ACCESS"] = tolower((string)SCR::Read(.sysconfig.casa-ats.CONFIG_CASAATS_DIRECT_ACCESS)) == "yes"; - Settings["CONFIG_CASAATS_WEB_ACCESS"] = tolower((string)SCR::Read(.sysconfig.casa-ats.CONFIG_CASAATS_WEB_ACCESS)) == "yes"; - cmd = svcSettingsEditor + " -get ReconfigureInterval -file " + svcSettingsFile; ret = (map) SCR::Execute(.target.bash_output, cmd); integer exit = ret["exit"]:-1; @@ -377,6 +376,57 @@ global boolean Read() { Settings["CONFIG_CASAATS_REALMS"] = realms; } + + // Get the Tomcat SSL connector statuses + cmd = tomcatConnectorEditor + " -s ssl"; + ret = (map) SCR::Execute(.target.bash_output, cmd); + exit = ret["exit"]:-1; + if (exit != 0) + y2error("Failed to read ssl connector status"); + else { + string cmd_output = ret["stdout"]:""; + list lines = splitstring(cmd_output, "\n"); + string statusLine = lines[2]:""; + if (statusLine == "Connector enabled") { + y2milestone("SSL connector enabled"); + Settings["CONFIG_CASAATS_DIRECT_ACCESS"] = true; + } + else { + y2milestone("SSL connector disabled"); + Settings["CONFIG_CASAATS_DIRECT_ACCESS"] = false; + } + } + + // Get the Tomcat AJP connector statuses + cmd = tomcatConnectorEditor + " -s ajp"; + ret = (map) SCR::Execute(.target.bash_output, cmd); + exit = ret["exit"]:-1; + if (exit != 0) + y2error("Failed to read ajp connector status"); + else { + string cmd_output = ret["stdout"]:""; + list lines = splitstring(cmd_output, "\n"); + string statusLine = lines[2]:""; + if (statusLine == "Connector enabled") { + y2milestone("AJP connector enabled"); + Settings["CONFIG_CASAATS_WEB_ACCESS"] = true; + } + else { + y2milestone("AJP connector disabled"); + Settings["CONFIG_CASAATS_WEB_ACCESS"] = false; + } + } + + // Get the Web Server status + integer status = (integer) SCR::Execute(.target.bash, webServerIsAvailableChecker); + if (status == 1) { + y2milestone("Web server available"); + Settings["WEB_SERVER_AVAILABLE"] = true; + } + else { + y2milestone("Web server un-available"); + Settings["WEB_SERVER_AVAILABLE"] = false; + } } // read firewall settings @@ -523,8 +573,6 @@ global boolean Write() { if(Abort()) return false; Progress::NextStage(); SCR::Write(.sysconfig.casa-ats.CONFIG_CASAATS_ENABLE, Settings["CONFIG_CASAATS_ENABLE"]:false ? "yes" : "no"); - SCR::Write(.sysconfig.casa-ats.CONFIG_CASAATS_DIRECT_ACCESS, Settings["CONFIG_CASAATS_DIRECT_ACCESS"]:true ? "yes" : "no"); - SCR::Write(.sysconfig.casa-ats.CONFIG_CASAATS_WEB_ACCESS, Settings["CONFIG_CASAATS_WEB_ACCESS"]:false ? "yes" : "no"); if (false) Report::Error (_("Cannot sysconfig settings.")); sleep(sl); @@ -661,6 +709,36 @@ global boolean Write() { // Refresh the server Keystore SCR::Execute(.target.bash, "/usr/share/java/CASA/authtoken/bin/refresh_server_keystore.sh"); + // Adjust the Tomcat connectors + // + // First disable them both and then re-enable as necessary + cmd = tomcatConnectorEditor + " -d ssl"; + exit = (integer) SCR::Execute(.target.bash, cmd); + if (exit != 0) + y2error("Failed to disable the SSL connector"); + else { + if ((Settings["CONFIG_CASAATS_DIRECT_ACCESS"]:false) == true) { + cmd = tomcatConnectorEditor + " -e ssl"; + exit = (integer) SCR::Execute(.target.bash, cmd); + if (exit != 0) + y2error("Failed to enable the SSL connector"); + } + } + + cmd = tomcatConnectorEditor + " -d ajp"; + exit = (integer) SCR::Execute(.target.bash, cmd); + if (exit != 0) + y2error("Failed to disable the AJP connector"); + else { + if (Settings["CONFIG_CASAATS_WEB_ACCESS"]:false == true) + { + cmd = tomcatConnectorEditor + " -e ajp"; + exit = (integer) SCR::Execute(.target.bash, cmd); + if (exit != 0) + y2error("Failed to enable the AJP connector"); + } + } + // Adjust firewall as needed if (Abort()) return false; Progress::NextStage(); diff --git a/CASA-auth-token/yast2-casa-ats/src/dialogs.ycp b/CASA-auth-token/yast2-casa-ats/src/dialogs.ycp index 568cd037..2c364602 100644 --- a/CASA-auth-token/yast2-casa-ats/src/dialogs.ycp +++ b/CASA-auth-token/yast2-casa-ats/src/dialogs.ycp @@ -738,8 +738,8 @@ zero means that the server only reads its configuration during start up.

integer items = 0; map realms = (map) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:$[]; list table_items = []; - boolean direct_access = CasaAts::Settings["CONFIG_CASAATS_DIRECT_ACCESS"]:true; - boolean web_access = false; + boolean direct_access = CasaAts::Settings["CONFIG_CASAATS_DIRECT_ACCESS"]:false; + boolean web_access = CasaAts::Settings["CONFIG_CASAATS_WEB_ACCESS"]:false; integer reconfig_interval = CasaAts::Settings["CONFIG_CASAATS_RECONFIG_INTERVAL"]:60; // Read list of search roots already configured for this realm @@ -752,29 +752,59 @@ zero means that the server only reads its configuration during start up.

}); /* Dialog contents */ - term contents = `HBox( - `HSpacing(5), - `VBox( - `VStretch(), - `Frame(_("Authentication Realms"), - `VBox( - `Table(`id(`table), `opt(`notify), `header(_("Realm")), []), - `HBox(`PushButton(`id(`add), _("Ad&d")), - `PushButton(`id(`edit), `opt(`disabled), _("&Edit")), - `PushButton(`id(`delete), `opt(`disabled), _("De&lete")) + term contents = nil; + if (CasaAts::Settings["WEB_SERVER_AVAILABLE"]:false == true) + { + contents = `HBox( + `HSpacing(5), + `VBox( + `VStretch(), + `Frame(_("Authentication Realms"), + `VBox( + `Table(`id(`table), `opt(`notify), `header(_("Realm")), []), + `HBox(`PushButton(`id(`add), _("Ad&d")), + `PushButton(`id(`edit), `opt(`disabled), _("&Edit")), + `PushButton(`id(`delete), `opt(`disabled), _("De&lete")) + ) ) - ) + ), + `VSpacing(1), + `Left(`CheckBox(`id(`direct), `opt(`notify), _("Direc&t Access"))), + `VSpacing(1), + `Left(`CheckBox(`id(`web), _("&Web Server Access"))), + `VSpacing(1), + `Left(`TextEntry(`id(`interval), _("Recon&figure Interval"))), + `VStretch() ), - `VSpacing(1), - `Left(`CheckBox(`id(`direct), `opt(`notify), _("Direc&t Access"))), - `VSpacing(1), - `Left(`CheckBox(`id(`web), _("&Web Server Access"))), - `VSpacing(1), - `Left(`TextEntry(`id(`interval), _("Recon&figure Interval"))), - `VStretch() - ), - `HSpacing(5) - ); + `HSpacing(5) + ); + } + else + { + contents = `HBox( + `HSpacing(5), + `VBox( + `VStretch(), + `Frame(_("Authentication Realms"), + `VBox( + `Table(`id(`table), `opt(`notify), `header(_("Realm")), []), + `HBox(`PushButton(`id(`add), _("Ad&d")), + `PushButton(`id(`edit), `opt(`disabled), _("&Edit")), + `PushButton(`id(`delete), `opt(`disabled), _("De&lete")) + ) + ) + ), + `VSpacing(1), + `Left(`CheckBox(`id(`direct), `opt(`notify), _("Direc&t Access"))), + `VSpacing(1), + `Left(`CheckBox(`id(`web), `opt(`disabled), _("&Web Server Access"))), + `VSpacing(1), + `Left(`TextEntry(`id(`interval), _("Recon&figure Interval"))), + `VStretch() + ), + `HSpacing(5) + ); + } boolean set_initial_focus = true; any ret = nil; @@ -897,12 +927,6 @@ zero means that the server only reads its configuration during start up.

reconfig_interval = CasaAts::Settings["CONFIG_CASAATS_RECONFIG_INTERVAL"]:60; continue; } - /* Verify that web server access has not been selected */ - if (web_access == true) { - Report::Error(_("Web server access is not yet supported.")); - web_access = false; - continue; - } /* Verify that the server can be accessed */ if (direct_access != true && web_access != true) { Report::Error(_("Specify server access type.")); @@ -917,6 +941,7 @@ zero means that the server only reads its configuration during start up.

// Save the server variables CasaAts::Settings["CONFIG_CASAATS_REALMS"] = realms; CasaAts::Settings["CONFIG_CASAATS_DIRECT_ACCESS"] = direct_access; + CasaAts::Settings["CONFIG_CASAATS_WEB_ACCESS"] = web_access; CasaAts::Settings["CONFIG_CASAATS_RECONFIG_INTERVAL"] = reconfig_interval; CasaAts::Settings["CONFIG_CASAATS_REALMS"] = realms; break;