summaryrefslogtreecommitdiffstats
path: root/base/ca/src
diff options
context:
space:
mode:
authorJack Magne <jmagne@localhost.localdomain>2015-05-01 10:12:06 -0700
committerJack Magne <jmagne@localhost.localdomain>2015-05-01 15:20:13 -0700
commit31d96e0ba756fd05bad0c9a577bf27ef9041d490 (patch)
treedfa26d09c0d58d2f297462c076921a7a37db2893 /base/ca/src
parentdca532a48524ee6be1c7522cf11fef062c27f2bb (diff)
downloadpki-31d96e0ba756fd05bad0c9a577bf27ef9041d490.tar.gz
pki-31d96e0ba756fd05bad0c9a577bf27ef9041d490.tar.xz
pki-31d96e0ba756fd05bad0c9a577bf27ef9041d490.zip
OCSP and CA minor cloning fixes
Tickets #1294, #1058 The patch does the following: 1. Allows an OCSP clone to actually install and operate. It also sets a param appropriate for an OCSP clone. Ticket #1058 The controversial part of this one is the fact that I have disabled having OCSP clones register themselves to the CA as publishing target. The master is already getting the updates and we rely upon replication to keep the clones updated. The current downside is the master is on an island with respect to updates and could be considered a single point of failure. Thus my proposal for this simple patch is to get the OCSP clone working as in existing functionality. Then we come back and propose a ticket to allow the installer OCSP clones to set up the publishers in such a way that all clones and master are registered, but when it is actually time to publish, the CRL publisher has the smarts to know that members of a clone cluster are in a group and the first successfull publish should end the processing of that group. 2. Allows the CA clone to set some params to disable certain things that a clone should not do. This was listed as a set of misc post install tasks that we are trying to automate. Code tested to work. 1. OCSP clones can be installed and the CRL were checked to be in sync when an update occured to the master. 2. The CA clone has been seen to have the required params and it looks to come up just fine. Final review minor changes to tickets, 1294, and 1058.
Diffstat (limited to 'base/ca/src')
-rw-r--r--base/ca/src/org/dogtagpki/server/ca/rest/CAInstallerService.java71
1 files changed, 53 insertions, 18 deletions
diff --git a/base/ca/src/org/dogtagpki/server/ca/rest/CAInstallerService.java b/base/ca/src/org/dogtagpki/server/ca/rest/CAInstallerService.java
index 883ab3779..355e744a3 100644
--- a/base/ca/src/org/dogtagpki/server/ca/rest/CAInstallerService.java
+++ b/base/ca/src/org/dogtagpki/server/ca/rest/CAInstallerService.java
@@ -20,6 +20,8 @@ package org.dogtagpki.server.ca.rest;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.StringTokenizer;
import netscape.ldap.LDAPAttribute;
@@ -39,7 +41,6 @@ import com.netscape.cms.servlet.csadmin.ConfigurationUtils;
import com.netscape.cmscore.base.LDAPConfigStore;
import com.netscape.cmscore.profile.LDAPProfileSubsystem;
-
/**
* @author alee
*
@@ -55,9 +56,9 @@ public class CAInstallerService extends SystemConfigService {
super.finalizeConfiguration(request);
try {
- if (!request.isClone()) {
- ConfigurationUtils.updateNextRanges();
- }
+ if (!request.isClone()) {
+ ConfigurationUtils.updateNextRanges();
+ }
} catch (Exception e) {
CMS.debug(e);
@@ -75,6 +76,10 @@ public class CAInstallerService extends SystemConfigService {
cs.putString("securitydomain.select", "new");
}
+ if (request.isClone()) {
+ disableCRLCachingAndGenerationForClone(request);
+ }
+
} catch (Exception e) {
CMS.debug(e);
throw new PKIException("Errors in determining if security domain host is a master CA");
@@ -105,16 +110,16 @@ public class CAInstallerService extends SystemConfigService {
/**
* Import profiles from the filesystem into the database.
*
- * @param configRoot Where to look for the profile files. For a
- * fresh installation this should be
- * "/usr/share/pki". For existing installations it
- * should be CMS.getConfigStore().getString("instanceRoot").
+ * @param configRoot Where to look for the profile files. For a
+ * fresh installation this should be
+ * "/usr/share/pki". For existing installations it
+ * should be CMS.getConfigStore().getString("instanceRoot").
*
*/
public void importProfiles(String configRoot)
throws EBaseException, ELdapException {
IPluginRegistry registry = (IPluginRegistry)
- CMS.getSubsystem(CMS.SUBSYSTEM_REGISTRY);
+ CMS.getSubsystem(CMS.SUBSYSTEM_REGISTRY);
IConfigStore profileCfg = cs.getSubStore("profile");
String profileIds = profileCfg.getString("list", "");
StringTokenizer st = new StringTokenizer(profileIds, ",");
@@ -146,10 +151,10 @@ public class CAInstallerService extends SystemConfigService {
/**
* Import one profile from the filesystem into the database.
*
- * @param dbFactory LDAP connection factory.
- * @param classId The profile class of the profile to import.
- * @param profileId The ID of the profile to import.
- * @param profilePath Path to the on-disk profile configuration.
+ * @param dbFactory LDAP connection factory.
+ * @param classId The profile class of the profile to import.
+ * @param profileId The ID of the profile to import.
+ * @param profilePath Path to the on-disk profile configuration.
*/
public void importProfile(
ILdapConnFactory dbFactory, String classId,
@@ -160,15 +165,15 @@ public class CAInstallerService extends SystemConfigService {
String dn = "cn=" + profileId + ",ou=certificateProfiles,ou=ca," + basedn;
- String[] objectClasses = {"top", "certProfile"};
+ String[] objectClasses = { "top", "certProfile" };
LDAPAttribute[] createAttrs = {
- new LDAPAttribute("objectclass", objectClasses),
- new LDAPAttribute("cn", profileId),
- new LDAPAttribute("classId", classId)
+ new LDAPAttribute("objectclass", objectClasses),
+ new LDAPAttribute("cn", profileId),
+ new LDAPAttribute("classId", classId)
};
IConfigStore configStore = new LDAPConfigStore(
- dbFactory, dn, createAttrs, "certProfileConfig");
+ dbFactory, dn, createAttrs, "certProfileConfig");
try {
FileInputStream input = new FileInputStream(profilePath);
@@ -181,4 +186,34 @@ public class CAInstallerService extends SystemConfigService {
configStore.commit(false /* no backup */);
}
+
+ private void disableCRLCachingAndGenerationForClone(ConfigurationRequest data) throws MalformedURLException {
+
+ CMS.debug("CAInstallerService:disableCRLCachingAndGenerationForClone entering.");
+ if (!data.isClone())
+ return;
+
+ //Now add some well know entries that we need to disable CRL functionality.
+ //With well known values to disable and well known master CRL ID.
+
+ cs.putInteger("ca.certStatusUpdateInterval", 0);
+ cs.putBoolean("ca.listenToCloneModifications", false);
+ cs.putBoolean("ca.crl.MasterCRL.enableCRLCache", false);
+ cs.putBoolean("ca.crl.MasterCRL.enableCRLUpdates", false);
+
+ String cloneUri = data.getCloneUri();
+ URL url = null;
+
+ url = new URL(cloneUri);
+
+ String masterHost = url.getHost();
+ int masterPort = url.getPort();
+
+ CMS.debug("CAInstallerService:disableCRLCachingAndGenerationForClone: masterHost: " + masterHost
+ + " masterPort: " + masterPort);
+
+ cs.putString("master.ca.agent.host", masterHost);
+ cs.putInteger("master.ca.agent.port", masterPort);
+
+ }
}