diff options
author | Endi S. Dewata <edewata@redhat.com> | 2013-11-28 03:25:24 -0500 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2014-03-17 11:22:15 -0400 |
commit | 4c1ce953681c3cac9c6d0b4325a48ba66619f553 (patch) | |
tree | 6dc07525b8f2bbf295450c6b883c9a682f927628 | |
parent | ae38b34e717b386f06407db9e5a4723472b77775 (diff) | |
download | pki-4c1ce953681c3cac9c6d0b4325a48ba66619f553.tar.gz pki-4c1ce953681c3cac9c6d0b4325a48ba66619f553.tar.xz pki-4c1ce953681c3cac9c6d0b4325a48ba66619f553.zip |
Removed config path from web.xml.
Previously the CMSStartServlet always requires a cfgPath parameter
pointing to the CS.cfg location. By default the parameter points to
<instance>/conf/<subsystem>/CS.cfg unless it's manually changed by
the admin after installation.
Recently the servlet has been modified such that if the parameter
is not specified it will generate the default path automatically.
So it is no longer necessary to keep the cfgPath parameter in the
web.xml templates because it will point to the same location.
This patch removes the cfgPath parameters from all web.xml templates.
This way newly created subsystems will not have this parameter, which
will help direct deployment in the future. An upgrade script has been
added to remove the parameter from existing instances if it points to
the default location. If the parameter points to a different location
that means the subsystem has been customized so it will not be changed.
Ticket #748, #499
-rw-r--r-- | base/ca/shared/webapps/ca/WEB-INF/web.xml | 2 | ||||
-rw-r--r-- | base/kra/shared/webapps/kra/WEB-INF/web.xml | 2 | ||||
-rw-r--r-- | base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml | 2 | ||||
-rwxr-xr-x | base/server/upgrade/10.1.99/05-RemoveConfigPathFromWebXML | 80 | ||||
-rw-r--r-- | base/tks/shared/webapps/tks/WEB-INF/web.xml | 2 |
5 files changed, 80 insertions, 8 deletions
diff --git a/base/ca/shared/webapps/ca/WEB-INF/web.xml b/base/ca/shared/webapps/ca/WEB-INF/web.xml index 5f20ed194..508c31694 100644 --- a/base/ca/shared/webapps/ca/WEB-INF/web.xml +++ b/base/ca/shared/webapps/ca/WEB-INF/web.xml @@ -351,8 +351,6 @@ <servlet-class> com.netscape.cms.servlet.base.CMSStartServlet </servlet-class> <init-param><param-name> AuthzMgr </param-name> <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> castart </param-value> </init-param> <load-on-startup> 1 </load-on-startup> diff --git a/base/kra/shared/webapps/kra/WEB-INF/web.xml b/base/kra/shared/webapps/kra/WEB-INF/web.xml index 0a5f92ae2..d0573d5d4 100644 --- a/base/kra/shared/webapps/kra/WEB-INF/web.xml +++ b/base/kra/shared/webapps/kra/WEB-INF/web.xml @@ -576,8 +576,6 @@ <servlet-class> com.netscape.cms.servlet.base.CMSStartServlet </servlet-class> <init-param><param-name> AuthzMgr </param-name> <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> krastart </param-value> </init-param> <load-on-startup> 1 </load-on-startup> diff --git a/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml b/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml index 249f1eb1b..21067d7d8 100644 --- a/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml +++ b/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml @@ -96,8 +96,6 @@ <servlet-class> com.netscape.cms.servlet.base.CMSStartServlet </servlet-class> <init-param><param-name> AuthzMgr </param-name> <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> ocspstart </param-value> </init-param> <load-on-startup> 1 </load-on-startup> diff --git a/base/server/upgrade/10.1.99/05-RemoveConfigPathFromWebXML b/base/server/upgrade/10.1.99/05-RemoveConfigPathFromWebXML new file mode 100755 index 000000000..959cac878 --- /dev/null +++ b/base/server/upgrade/10.1.99/05-RemoveConfigPathFromWebXML @@ -0,0 +1,80 @@ +#!/usr/bin/python +# Authors: +# Endi S. Dewata <edewata@redhat.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2014 Red Hat, Inc. +# All rights reserved. +# + +import os +from lxml import etree + +import pki.server.upgrade + + +class RemoveConfigPathFromWebXML(pki.server.upgrade.PKIServerUpgradeScriptlet): + + def __init__(self): + + self.message = 'Remove config path from web.xml' + + def upgrade_subsystem(self, instance, subsystem): + + default_cs_cfg = os.path.join(instance.base_dir, 'conf', subsystem.name, 'CS.cfg') + web_xml = os.path.join(instance.base_dir, 'webapps', subsystem.name, 'WEB-INF', 'web.xml') + + if not os.path.exists(web_xml): + return + + self.backup(web_xml) + + document = etree.parse(web_xml) + self.remove_config_path(document, default_cs_cfg) + + with open(web_xml, 'w') as f: + f.write(etree.tostring(document, pretty_print=True)) + + def remove_config_path(self, document, default_cs_cfg): + + context = document.getroot() + + # find CMSStartServlet servlet + for servlet in context.findall('servlet'): + + servlet_class = servlet.find('servlet-class') + value = servlet_class.text.strip() + + if value != 'com.netscape.cms.servlet.base.CMSStartServlet': + continue + + # servlet found, find cfgPath parameter + for init_param in servlet.findall('init-param'): + + param_name = init_param.find('param-name') + value = param_name.text.strip() + + if value != 'cfgPath': + continue + + # parameter found, check value + param_value = init_param.find('param-value') + value = param_value.text.strip() + + # if cfgPath points to the default CS.cfg, remove the parameter + if value == default_cs_cfg: + servlet.remove(init_param) + + return diff --git a/base/tks/shared/webapps/tks/WEB-INF/web.xml b/base/tks/shared/webapps/tks/WEB-INF/web.xml index e4650475d..0642faea1 100644 --- a/base/tks/shared/webapps/tks/WEB-INF/web.xml +++ b/base/tks/shared/webapps/tks/WEB-INF/web.xml @@ -40,8 +40,6 @@ <servlet-class> com.netscape.cms.servlet.base.CMSStartServlet </servlet-class> <init-param><param-name> AuthzMgr </param-name> <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> tksstart </param-value> </init-param> <load-on-startup> 1 </load-on-startup> |