summaryrefslogtreecommitdiffstats
path: root/base/ca/src/com/netscape/ca
diff options
context:
space:
mode:
authorChristina Fu <cfu@redhat.com>2015-09-30 13:55:05 +0200
committerMatthew Harmsen <mharmsen@redhat.com>2015-10-01 14:58:58 -0600
commit6f971cb664dc639398ae3c9c83f8c152883c365d (patch)
treec42f26737a92c07f094fac87dc23ff96cf870c45 /base/ca/src/com/netscape/ca
parent175805ab7e115bc9b031af9b4f23d2520d33275a (diff)
downloadpki-6f971cb664dc639398ae3c9c83f8c152883c365d.tar.gz
pki-6f971cb664dc639398ae3c9c83f8c152883c365d.tar.xz
pki-6f971cb664dc639398ae3c9c83f8c152883c365d.zip
Ticket #1593 auto-shutdown - for HSM failover support
This is an interim solution for supporting HSM failover by automatically shutting down the server when signing key becomes inaccessible. At auto-shutdown, a crumb fiile will be left in the instance directory for an external daemon to detect and restart, if necessary. Due to limitation of the watch dog (nuxwdog) at present time, the restart option currently only works if started with watch dog (nuxwdog), and it will prompt for passwords on the terminals. The restart counter is to prevent the server from going into an infinite restart loop. Administrator will have to reset autoShutdown.restart.count to 0 when max is reached. (cherry picked from commit 5a9ecad9172f76ca1b94b40aedcdd49d009aceb1)
Diffstat (limited to 'base/ca/src/com/netscape/ca')
-rw-r--r--base/ca/src/com/netscape/ca/SigningUnit.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/base/ca/src/com/netscape/ca/SigningUnit.java b/base/ca/src/com/netscape/ca/SigningUnit.java
index 0410bd290..0ac4b7a1c 100644
--- a/base/ca/src/com/netscape/ca/SigningUnit.java
+++ b/base/ca/src/com/netscape/ca/SigningUnit.java
@@ -278,6 +278,16 @@ public final class SigningUnit implements ISigningUnit {
signer.initSign(mPrivk);
signer.update(data);
+
+ /* debugging
+ boolean testAutoShutdown = false;
+ testAutoShutdown = mConfig.getBoolean("autoShutdown.test", false);
+ if (testAutoShutdown) {
+ CMS.debug("SigningUnit.sign: test auto shutdown");
+ CMS.checkForAndAutoShutdown();
+ }
+ */
+
// XXX add something more descriptive.
CMS.debug("Signing Certificate");
return signer.sign();
@@ -295,6 +305,8 @@ public final class SigningUnit implements ISigningUnit {
throw new EBaseException(e.toString());
} catch (SignatureException e) {
log(ILogger.LL_FAILURE, CMS.getLogMessage("OPERATION_ERROR", e.toString()));
+ CMS.debug("SigningUnit.sign: " + e.toString());
+ CMS.checkForAndAutoShutdown();
// XXX fix this exception later.
throw new EBaseException(e.toString());
}
@@ -334,6 +346,7 @@ public final class SigningUnit implements ISigningUnit {
throw new EBaseException(e.toString());
} catch (SignatureException e) {
log(ILogger.LL_FAILURE, CMS.getLogMessage("OPERATION_ERROR", e.toString()));
+ CMS.checkForAndAutoShutdown();
// XXX fix this exception later.
throw new EBaseException(e.toString());
}