summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java31
-rw-r--r--base/server/python/pki/server/deployment/scriptlets/slot_substitution.py14
-rw-r--r--base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py55
-rw-r--r--base/tps-tomcat/shared/conf/Catalina/localhost/tps.xml2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/WEB-INF/velocity.properties2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/WEB-INF/web.xml4
-rw-r--r--specs/pki-core.spec10
7 files changed, 83 insertions, 35 deletions
diff --git a/base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java b/base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java
index 60230dbab..ab29e2603 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java
@@ -21,7 +21,6 @@ import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -46,9 +45,27 @@ public class CMSStartServlet extends HttpServlet {
private static final long serialVersionUID = 515623839479425172L;
public final static String PROP_CMS_CFG = "cfgPath";
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- String path = config.getInitParameter(PROP_CMS_CFG);
+ public void init() throws ServletException {
+
+ // get web application context: /<subsystem>
+ String context = getServletContext().getContextPath();
+
+ // get subsystem name by removing the / prefix from the context
+ String subsystem = context.startsWith("/") ? context.substring(1) : context;
+
+ // get config path from web.xml
+ String path = getServletConfig().getInitParameter(PROP_CMS_CFG);
+
+ // if path not specified, use default path
+ if (path == null) {
+ // catalina.base points to instance dir
+ // it's defined as CATALINA_BASE in <instance>/conf/tomcat.conf
+ String instanceDir = System.getProperty("catalina.base");
+
+ // path: <instance>/conf/<subsystem>/CS.cfg
+ path = instanceDir + File.separator + "conf" + File.separator +
+ subsystem + File.separator + "CS.cfg";
+ }
File f = new File(path);
String old_path = "";
@@ -88,6 +105,7 @@ public class CMSStartServlet extends HttpServlet {
}
}
} catch (Exception e) {
+ e.printStackTrace();
}
}
}
@@ -95,12 +113,11 @@ public class CMSStartServlet extends HttpServlet {
try {
CMS.start(path);
} catch (EBaseException e) {
+ e.printStackTrace();
}
// Register realm for this subsystem
- String context = getServletContext().getContextPath();
- if (context.startsWith("/")) context = context.substring(1);
- ProxyRealm.registerRealm(context, new PKIRealm());
+ ProxyRealm.registerRealm(subsystem, new PKIRealm());
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
diff --git a/base/server/python/pki/server/deployment/scriptlets/slot_substitution.py b/base/server/python/pki/server/deployment/scriptlets/slot_substitution.py
index a6c21e166..cc54cc49c 100644
--- a/base/server/python/pki/server/deployment/scriptlets/slot_substitution.py
+++ b/base/server/python/pki/server/deployment/scriptlets/slot_substitution.py
@@ -67,10 +67,16 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
deployer.master_dict['pki_source_tomcat_conf'],
deployer.master_dict['pki_target_tomcat_conf'],
overwrite_flag=True)
- deployer.file.apply_slot_substitution(
- deployer.master_dict['pki_target_velocity_properties'])
- deployer.file.apply_slot_substitution(
- deployer.master_dict['pki_target_subsystem_web_xml'])
+
+ # Configure web.xml and velocity.properties for each subsystem.
+ # For TPS this is not necessary since the files are no longer
+ # copied to the target location in the instance directory.
+ if deployer.master_dict['pki_subsystem'] != "TPS":
+ deployer.file.apply_slot_substitution(
+ deployer.master_dict['pki_target_velocity_properties'])
+ deployer.file.apply_slot_substitution(
+ deployer.master_dict['pki_target_subsystem_web_xml'])
+
# Strip "<filter>" section from subsystem "web.xml"
# This is ONLY necessary because XML comments cannot be "nested"!
# deployer.file.copy(deployer.master_dict['pki_target_subsystem_web_xml'],
diff --git a/base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py b/base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py
index 975028d73..0f529a9a2 100644
--- a/base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py
+++ b/base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py
@@ -44,10 +44,40 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
config.pki_log.info(log.WEBAPP_DEPLOYMENT_SPAWN_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
+ # For TPS, deploy web application directly from /usr/share/pki.
+ if deployer.master_dict['pki_subsystem'] == "TPS":
+ deployer.file.copy(
+ os.path.join(
+ config.PKI_DEPLOYMENT_SOURCE_ROOT,
+ "tps",
+ "conf",
+ "Catalina",
+ "localhost",
+ "tps.xml"),
+ os.path.join(
+ deployer.master_dict['pki_instance_configuration_path'],
+ "Catalina",
+ "localhost",
+ "tps.xml"))
+ return self.rv
+
+ # For other subsystems, deploy web application into Tomcat instance.
+ deployer.directory.create(deployer.master_dict['pki_tomcat_webapps_subsystem_path'])
+
+ # Copy /usr/share/pki/<subsystem>/webapps/<subsystem>
+ # to <instance>/webapps/<subsystem>
+ deployer.directory.copy(
+ os.path.join(
+ config.PKI_DEPLOYMENT_SOURCE_ROOT,
+ deployer.master_dict['pki_subsystem'].lower(),
+ "webapps",
+ deployer.master_dict['pki_subsystem'].lower()),
+ deployer.master_dict['pki_tomcat_webapps_subsystem_path'],
+ overwrite_flag=True)
+
# Copy /usr/share/pki/server/webapps/pki/admin
# to <instance>/webapps/<subsystem>/admin
# TODO: common templates should be deployed in common webapp
- deployer.directory.create(deployer.master_dict['pki_tomcat_webapps_subsystem_path'])
deployer.directory.copy(
os.path.join(
config.PKI_DEPLOYMENT_SOURCE_ROOT,
@@ -60,17 +90,6 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
"admin"),
overwrite_flag=True)
- # Copy /usr/share/pki/<subsystem>/webapps/<subsystem>
- # to <instance>/webapps/<subsystem>
- deployer.directory.copy(
- os.path.join(
- config.PKI_DEPLOYMENT_SOURCE_ROOT,
- deployer.master_dict['pki_subsystem'].lower(),
- "webapps",
- deployer.master_dict['pki_subsystem'].lower()),
- deployer.master_dict['pki_tomcat_webapps_subsystem_path'],
- overwrite_flag=True)
-
deployer.directory.create(
deployer.master_dict['pki_tomcat_webapps_subsystem_webinf_classes_path'])
deployer.directory.create(
@@ -100,13 +119,12 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
elif deployer.master_dict['pki_subsystem'] == "TKS":
deployer.symlink.create(deployer.master_dict['pki_tks_jar'],
deployer.master_dict['pki_tks_jar_link'])
- elif deployer.master_dict['pki_subsystem'] == "TPS":
- deployer.symlink.create(deployer.master_dict['pki_tps_jar'],
- deployer.master_dict['pki_tps_jar_link'])
+
# set ownerships, permissions, and acls
deployer.directory.set_mode(deployer.master_dict['pki_tomcat_webapps_subsystem_path'])
- # Copy /usr/share/pki/<subsystem>/conf/Catalina/localhost/<subsystem>.xml
+ # Copy web application context file
+ # from /usr/share/pki/<subsystem>/conf/Catalina/localhost/<subsystem>.xml
# to <instance>/conf/Catalina/localhost/<subsystem>.xml
deployer.file.copy(
os.path.join(
@@ -137,7 +155,8 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
"localhost",
deployer.master_dict['pki_subsystem'].lower() + ".xml"))
- # Delete <instance>/webapps/<subsystem>
- deployer.directory.delete(deployer.master_dict['pki_tomcat_webapps_subsystem_path'])
+ # For subsystems other than TPS, delete <instance>/webapps/<subsystem>.
+ if deployer.master_dict['pki_subsystem'] != "TPS":
+ deployer.directory.delete(deployer.master_dict['pki_tomcat_webapps_subsystem_path'])
return self.rv
diff --git a/base/tps-tomcat/shared/conf/Catalina/localhost/tps.xml b/base/tps-tomcat/shared/conf/Catalina/localhost/tps.xml
index e838503a6..d80c1296d 100644
--- a/base/tps-tomcat/shared/conf/Catalina/localhost/tps.xml
+++ b/base/tps-tomcat/shared/conf/Catalina/localhost/tps.xml
@@ -22,7 +22,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<Context crossContext="true" allowLinking="true">
+<Context docBase="/usr/share/pki/tps/webapps/tps" crossContext="true" allowLinking="true">
<Manager
secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
diff --git a/base/tps-tomcat/shared/webapps/tps/WEB-INF/velocity.properties b/base/tps-tomcat/shared/webapps/tps/WEB-INF/velocity.properties
index 5cd0454cc..c1c6e4ea9 100644
--- a/base/tps-tomcat/shared/webapps/tps/WEB-INF/velocity.properties
+++ b/base/tps-tomcat/shared/webapps/tps/WEB-INF/velocity.properties
@@ -5,7 +5,7 @@
#
resource.loader = file
file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
-file.resource.loader.path = [PKI_INSTANCE_PATH]/[PKI_WEBAPPS_NAME]/[PKI_SUBSYSTEM_TYPE]
+file.resource.loader.path = /usr/share/pki/server/webapps/pki
file.resource.loader.cache = true
file.resource.loader.modificationCheckInterval = 2
input.encoding=UTF-8
diff --git a/base/tps-tomcat/shared/webapps/tps/WEB-INF/web.xml b/base/tps-tomcat/shared/webapps/tps/WEB-INF/web.xml
index 0fe3df4dc..11964a00b 100644
--- a/base/tps-tomcat/shared/webapps/tps/WEB-INF/web.xml
+++ b/base/tps-tomcat/shared/webapps/tps/WEB-INF/web.xml
@@ -43,10 +43,6 @@
<param-value>BasicAclAuthz</param-value>
</init-param>
<init-param>
- <param-name>cfgPath</param-name>
- <param-value>[PKI_INSTANCE_PATH]/conf/[PKI_SUBSYSTEM_TYPE]/CS.cfg</param-value>
- </init-param>
- <init-param>
<param-name>ID</param-name>
<param-value>tpsstart</param-value>
</init-param>
diff --git a/specs/pki-core.spec b/specs/pki-core.spec
index bdfea138a..6e10ac0e3 100644
--- a/specs/pki-core.spec
+++ b/specs/pki-core.spec
@@ -523,6 +523,16 @@ cd build
cd build
%{__make} install DESTDIR=%{buildroot} INSTALL="install -p"
+# Create symlinks for TPS web application
+%{__mkdir_p} %{buildroot}%{_datadir}/pki/tps/webapps/tps/WEB-INF/lib
+ln -s %{_javadir}/pki/pki-nsutil.jar %{buildroot}%{_datadir}/pki/tps/webapps/tps/WEB-INF/lib
+ln -s %{_javadir}/pki/pki-cmsutil.jar %{buildroot}%{_datadir}/pki/tps/webapps/tps/WEB-INF/lib
+ln -s %{_javadir}/pki/pki-certsrv.jar %{buildroot}%{_datadir}/pki/tps/webapps/tps/WEB-INF/lib
+ln -s %{_javadir}/pki/pki-cms.jar %{buildroot}%{_datadir}/pki/tps/webapps/tps/WEB-INF/lib
+ln -s %{_javadir}/pki/pki-cmscore.jar %{buildroot}%{_datadir}/pki/tps/webapps/tps/WEB-INF/lib
+ln -s %{_javadir}/pki/pki-cmsbundle.jar %{buildroot}%{_datadir}/pki/tps/webapps/tps/WEB-INF/lib
+ln -s %{_javadir}/pki/pki-tps.jar %{buildroot}%{_datadir}/pki/tps/webapps/tps/WEB-INF/lib
+
%if %{with server}
# Scanning the python code with pylint. A return value of 0 represents there are no