summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvakwetu <vakwetu@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2010-09-15 16:42:56 +0000
committervakwetu <vakwetu@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2010-09-15 16:42:56 +0000
commit2daf8672f4b55b2a06bcd89041d4ab48691261e5 (patch)
treeda8852fae16fc81bdecce03f38e6fd17c69cd040
parentae73bc8273fd1bb9f4d10a06545a19947f91e485 (diff)
downloadpki-2daf8672f4b55b2a06bcd89041d4ab48691261e5.tar.gz
pki-2daf8672f4b55b2a06bcd89041d4ab48691261e5.tar.xz
pki-2daf8672f4b55b2a06bcd89041d4ab48691261e5.zip
Bugzilla Bug 607380 - CC: Make sure Java Console can configure all security relevant config items
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1295 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
-rw-r--r--pki/base/common/src/com/netscape/certsrv/common/Constants.java9
-rw-r--r--pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java7
-rw-r--r--pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java7
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java64
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java58
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java13
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java6
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java173
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java39
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java254
-rw-r--r--pki/base/console/src/com/netscape/certsrv/common/Constants.java9
-rw-r--r--pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java17
-rw-r--r--pki/base/kra/src/com/netscape/kra/StorageKeyUnit.java4
13 files changed, 655 insertions, 5 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/common/Constants.java b/pki/base/common/src/com/netscape/certsrv/common/Constants.java
index c8503746..3c2f2b23 100644
--- a/pki/base/common/src/com/netscape/certsrv/common/Constants.java
+++ b/pki/base/common/src/com/netscape/certsrv/common/Constants.java
@@ -187,6 +187,10 @@ public interface Constants {
public static final String PR_LOG_TRANSACTIONS = "Transactions";
public static final String PR_LOG_SYSTEM = "System";
+ public static final String PR_DEBUG_LOG_SHOWCALLER = "debug.showcaller";
+ public static final String PR_DEBUG_LOG_ENABLE = "debug.enabled";
+ public static final String PR_DEBUG_LOG_LEVEL = "debug.level";
+
/*========================================================
* LDAP Publishing
*========================================================*/
@@ -238,7 +242,9 @@ public interface Constants {
public final static String PR_BIND_DN = "ldapauth.bindDN";
public final static String PR_BIND_PASSWD = "ldapauth.bindPassword";
public final static String PR_BIND_PASSWD_AGAIN = "bindPasswdAgain";
-
+ public final static String PR_LDAP_MAX_CONNS = "maxConns";
+ public final static String PR_LDAP_MIN_CONNS = "minConns";
+
public final static String PR_BASE_DN = "baseDN";
public final static String PR_DNCOMPS = "dnComps";
public final static String PR_FILTERCOMPS = "filterComps";
@@ -354,6 +360,7 @@ public interface Constants {
public final static String PR_RECOVERY_AGENT = "recoveryAgent";
public final static String PR_OLD_AGENT_PWD = "oldAgentPwd";
public final static String PR_AGENT_PWD = "agentPwd";
+ public final static String PR_NO_OF_REQUIRED_RECOVERY_AGENTS = "noOfRequiredRecoveryAgents";
/*========================================================
* Status
diff --git a/pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java b/pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java
index ddb5deb0..b2d02f2a 100644
--- a/pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java
+++ b/pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java
@@ -142,6 +142,13 @@ public interface IKeyRecoveryAuthority extends ISubsystem {
public int getNoOfRequiredAgents() throws EBaseException;
/**
+ * Sets the number of required recovery agents
+ *
+ * @param number number of agents
+ */
+ public void setNoOfRequiredAgents(int number) throws EBaseException;
+
+ /**
* Returns the current recovery identifier.
*
* @return recovery identifier
diff --git a/pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java b/pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java
index 90579d93..0b484bdc 100644
--- a/pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java
+++ b/pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java
@@ -55,6 +55,13 @@ public interface IStorageKeyUnit extends IEncryptionUnit {
public int getNoOfRequiredAgents() throws EBaseException;
/**
+ * Sets the numer of required recovery agents
+ *
+ * @param number number of required agents
+ */
+ public void setNoOfRequiredAgents(int number);
+
+ /**
* Retrieves a list of agents in this unit.
*
* @return a list of string-based agent identifiers
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java
index e51ef1ae..d1ddf6f4 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java
@@ -124,6 +124,9 @@ public class KRAAdminServlet extends AdminServlet {
} else if (scope.equals(ScopeDef.SC_NOTIFICATION_RIQ)) {
getNotificationRIQConfig(req, resp);
return;
+ } else if (scope.equals(ScopeDef.SC_GENERAL)) {
+ getGeneralConfig(req, resp);
+ return;
}
} else if (op.equals(OpDef.OP_MODIFY)) {
mOp = "modify";
@@ -145,6 +148,8 @@ public class KRAAdminServlet extends AdminServlet {
} else if (scope.equals(ScopeDef.SC_NOTIFICATION_RIQ)) {
setNotificationRIQConfig(req, resp);
return;
+ } else if (scope.equals(ScopeDef.SC_GENERAL)) {
+ setGeneralConfig(req,resp);
}
}
} catch (EBaseException e) {
@@ -160,6 +165,65 @@ public class KRAAdminServlet extends AdminServlet {
null, resp);
}
+ private void getGeneralConfig(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
+ IOException, EBaseException {
+
+ NameValuePairs params = new NameValuePairs();
+ int value = 1;
+
+ value = mKRA.getNoOfRequiredAgents();
+ params.add(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, Integer.toString(value));
+
+ sendResponse(SUCCESS, null, params, resp);
+ }
+
+ private void setGeneralConfig(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
+ IOException, EBaseException {
+ Enumeration enum1 = req.getParameterNames();
+ boolean restart = false;
+
+ String auditMessage = null;
+ String auditSubjectID = auditSubjectID();
+
+ while (enum1.hasMoreElements()) {
+ String key = (String) enum1.nextElement();
+ String value = req.getParameter(key);
+
+ if (key.equals(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS)) {
+ try {
+ int number = Integer.parseInt(value);
+ mKRA.setNoOfRequiredAgents(number);
+ } catch (NumberFormatException e) {
+ auditMessage = CMS.getLogMessage(
+ LOGGING_SIGNED_AUDIT_CONFIG_DRM,
+ auditSubjectID,
+ ILogger.FAILURE,
+ auditParams(req));
+
+ audit(auditMessage);
+ throw new EBaseException("Number of agents must be an integer");
+ }
+ }
+ }
+
+ commit(true);
+
+ auditMessage = CMS.getLogMessage(
+ LOGGING_SIGNED_AUDIT_CONFIG_DRM,
+ auditSubjectID,
+ ILogger.SUCCESS,
+ auditParams(req));
+
+ audit(auditMessage);
+
+ if (restart)
+ sendResponse(RESTART, null, null, resp);
+ else
+ sendResponse(SUCCESS, null, null, resp);
+ }
+
/**
* Changes M-N scheme.
* <P>
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java
index 2725884b..e99bf3e5 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java
@@ -149,6 +149,8 @@ public class LogAdminServlet extends AdminServlet {
} else if (scope.equals(ScopeDef.SC_LOG_RULES)) {
getInstConfig(req, resp);
return;
+ } else if (scope.equals(ScopeDef.SC_GENERAL)) {
+ getGeneralConfig(req, resp);
} else {
sendResponse(ERROR,
CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_INVALID_OP_SCOPE"),
@@ -210,6 +212,8 @@ public class LogAdminServlet extends AdminServlet {
if (scope.equals(ScopeDef.SC_LOG_RULES)) {
modLogInst(req, resp, scope);
return;
+ } else if (scope.equals(ScopeDef.SC_GENERAL)) {
+ setGeneralConfig(req, resp);
} else {
sendResponse(ERROR,
CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_INVALID_OP_SCOPE"),
@@ -2487,5 +2491,59 @@ public class LogAdminServlet extends AdminServlet {
return expirationTime;
}
+
+ private void getGeneralConfig(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
+ IOException, EBaseException {
+
+ NameValuePairs params = new NameValuePairs();
+ String value = "false";
+
+ value = mConfig.getString(Constants.PR_DEBUG_LOG_ENABLE, "false");
+ params.add(Constants.PR_DEBUG_LOG_ENABLE, value);
+
+ value = mConfig.getString(Constants.PR_DEBUG_LOG_LEVEL, "0");
+ params.add(Constants.PR_DEBUG_LOG_LEVEL, value);
+
+ sendResponse(SUCCESS, null, params, resp);
+ }
+
+ private void setGeneralConfig(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
+ IOException, EBaseException {
+
+ Enumeration enum1 = req.getParameterNames();
+ boolean restart = false;
+
+ while (enum1.hasMoreElements()) {
+ String key = (String) enum1.nextElement();
+ String value = req.getParameter(key);
+
+ if (key.equals(Constants.PR_DEBUG_LOG_ENABLE)) {
+ if (value.equals("true") || value.equals("false")) {
+ mConfig.putString(Constants.PR_DEBUG_LOG_ENABLE, value);
+ } else {
+ CMS.debug("setGeneralConfig: Invalid value for " + Constants.PR_DEBUG_LOG_ENABLE + ": " + value);
+ throw new EBaseException("Invalid value for " + Constants.PR_DEBUG_LOG_ENABLE);
+ }
+ } else if (key.equals(Constants.PR_DEBUG_LOG_LEVEL)) {
+ try {
+ int number = Integer.parseInt(value);
+ mConfig.putString(Constants.PR_DEBUG_LOG_LEVEL, value);
+ } catch (NumberFormatException e) {
+ CMS.debug("setGeneralConfig: Invalid value for " + Constants.PR_DEBUG_LOG_LEVEL + ": " + value);
+ throw new EBaseException("Invalid value for " + Constants.PR_DEBUG_LOG_LEVEL);
+ }
+ }
+ }
+
+ mConfig.commit(true);
+
+ if (restart)
+ sendResponse(RESTART, null, null, resp);
+ else
+ sendResponse(SUCCESS, null, null, resp);
+ }
+
}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java b/pki/base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java
index b3260a6a..9c3ae6e0 100644
--- a/pki/base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java
+++ b/pki/base/console/src/com/netscape/admin/certsrv/CMSEAUILoader.java
@@ -85,7 +85,18 @@ public class CMSEAUILoader implements ISubSystemUILoader {
* protected methods
*==========================================================*/
protected void populateConfigContent(CMSBaseResourceModel model) {
- return;
+ CMSResourceObject list, node;
+ CMSTabPanel tabPane;
+
+ //ca node
+ list = new CMSResourceObject("EACONFIG");
+ tabPane = new CMSTabPanel(model, list);
+ tabPane.addTab(new CMSEAGeneralPanel(tabPane));
+ list.setIcon( CMSAdminUtil.getImage(CMSAdminResources.IMAGE_FOLDER));
+ list.setAllowsChildren(false);
+ list.setCustomPanel(tabPane);
+
+ model.addSubSystemNode(list);
}
/*
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java b/pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java
index 200089b7..2c4de161 100644
--- a/pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java
+++ b/pki/base/console/src/com/netscape/admin/certsrv/CMSKernelUILoader.java
@@ -108,6 +108,12 @@ public class CMSKernelUILoader implements ISubSystemUILoader {
tabPane.addTab(new CMSSMTPPanel(tabPane));
tabPane.addTab(new CMSSelfTestsPanel(tabPane));
+ // The log panel would only really be useful if we were able to
+ // enable or disable debug without restarting. If we can do this,
+ // then we can enable this tab.
+ //
+ // tabPane.addTab(new GeneralLogPanel(tabPane));
+
root.setCustomPanel(tabPane);
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java
new file mode 100644
index 00000000..6130f931
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSEAGeneralPanel.java
@@ -0,0 +1,173 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// 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.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.math.*;
+
+/**
+ * KRA General Setting
+ *
+ * @author Ade Lee
+ * @version $Revision: 1211 $, $Date: 2010-08-18 13:15:37 -0400 (Wed, 18 Aug 2010) $
+ */
+public class CMSEAGeneralPanel extends CMSBaseTab implements ItemListener {
+
+ private static String PANEL_NAME = "EAGENERAL";
+ private static CMSBaseResourceModel mModel;
+ protected AdminConnection mAdmin;
+ private JTextField mNumberOfAgentsText;
+ private CMSTabPanel mParent;
+ private static final String EAHELPINDEX =
+ "configuration-ea-general-help";
+
+ public CMSEAGeneralPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ mHelpToken = EAHELPINDEX;
+ }
+
+ public void init() {
+ Debug.println("CMSEAGeneral: init()");
+ mAdmin = mModel.getServerInfo().getAdmin();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+
+ JPanel agentsPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ agentsPanel.setLayout(gb2);
+ agentsPanel.setBorder(makeTitledBorder("AGENTS"));
+
+ CMSAdminUtil.resetGBC(gbc);
+ mCenterPanel.setLayout(gb);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(agentsPanel, gbc);
+ mCenterPanel.add(agentsPanel);
+
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel numberLabel = makeJLabel("NUMBER");
+ mNumberOfAgentsText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(agentsPanel, numberLabel, mNumberOfAgentsText, gbc);
+
+ refresh();
+ }
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.add(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, "1");
+
+ try {
+ NameValuePairs val = mAdmin.read(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ String defaultAlgorithm = "";
+ for (int i=0; i<nvps.size(); i++) {
+ NameValuePair nvp = nvps.elementAt(i);
+ String name = nvp.getName();
+ if (name.equals(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS)) {
+ mNumberOfAgentsText.setText(nvp.getValue());
+ }
+ }
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ String numberOfAgents = mNumberOfAgentsText.getText().trim();
+
+ if (numberOfAgents.equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ try {
+ int num = Integer.parseInt(numberOfAgents);
+ if (num < 1) {
+ showMessageDialog("NUMBERRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.add(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS,
+ numberOfAgents);
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(DestDef.DEST_KRA_ADMIN,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java
index 06011fb4..85596d55 100644
--- a/pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java
+++ b/pki/base/console/src/com/netscape/admin/certsrv/config/CMSLDAPSettingPanel.java
@@ -39,6 +39,8 @@ public class CMSLDAPSettingPanel extends CMSBaseTab {
private JTextField mHostNameText;
private JTextField mPortText;
private JTextField mBindAsText;
+ private JTextField mMaxConnsText;
+ private JTextField mMinConnsText;
private JPasswordField mPasswordText;
private JPasswordField mPasswordAgainText;
private JCheckBox mEnable;
@@ -157,6 +159,18 @@ public class CMSLDAPSettingPanel extends CMSBaseTab {
dummy, gbc);
*/
+ // add maxconns label text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel maxConnsLabel = makeJLabel("MAXCONNS");
+ mMaxConnsText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(serverInfo, maxConnsLabel, mMaxConnsText, gbc);
+
+ // add maxconns label text field
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel minConnsLabel = makeJLabel("MINCONNS");
+ mMinConnsText = makeJTextField(30);
+ CMSAdminUtil.addEntryField(serverInfo, minConnsLabel, mMinConnsText, gbc);
+
refresh();
}
@@ -169,6 +183,8 @@ public class CMSLDAPSettingPanel extends CMSBaseTab {
//nvps.add(Constants.PR_BASE_DN, "");
nvps.add(Constants.PR_BIND_DN, "");
nvps.add(Constants.PR_LDAP_VERSION, "");
+ nvps.add(Constants.PR_LDAP_MAX_CONNS, "");
+ nvps.add(Constants.PR_LDAP_MIN_CONNS, "");
try {
NameValuePairs val = mAdmin.read(mServletName,
@@ -219,7 +235,12 @@ public class CMSLDAPSettingPanel extends CMSBaseTab {
mEnable.setSelected(false);
} else if (name.equals(Constants.PR_LDAP_VERSION)) {
version = nvp.getValue();
+ } else if (name.equals(Constants.PR_LDAP_MIN_CONNS)) {
+ mMinConnsText.setText(nvp.getValue());
+ } else if (name.equals(Constants.PR_LDAP_MAX_CONNS)) {
+ mMaxConnsText.setText(nvp.getValue());
}
+
}
/*
@@ -246,10 +267,12 @@ public class CMSLDAPSettingPanel extends CMSBaseTab {
String port = mPortText.getText().trim();
//String baseDN = mBaseDNText.getText().trim();
String bindAs = mBindAsText.getText().trim();
+ String maxConns = mMaxConnsText.getText().trim();
+ String minConns = mMinConnsText.getText().trim();
//if (host.equals("") || port.equals("") || baseDN.equals("") ||
// bindAs.equals("")) {
- if (host.equals("") || port.equals("") || bindAs.equals("")) {
+ if (host.equals("") || port.equals("") || bindAs.equals("") || maxConns.equals("") || minConns.equals("")) {
showMessageDialog("BLANKFIELD");
return false;
}
@@ -265,11 +288,25 @@ public class CMSLDAPSettingPanel extends CMSBaseTab {
return false;
}
+ try {
+ int max = Integer.parseInt(maxConns);
+ int min = Integer.parseInt(minConns);
+ if ((max < min) || (max <0) || (min <0)) {
+ showMessageDialog("MAXMINRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("MAXMINNUMBERFORMAT");
+ return false;
+ }
+
NameValuePairs nvps = new NameValuePairs();
nvps.add(Constants.PR_HOST_NAME, host);
nvps.add(Constants.PR_LDAP_PORT, port);
//nvps.add(Constants.PR_BASE_DN, baseDN);
nvps.add(Constants.PR_BIND_DN, bindAs);
+ nvps.add(Constants.PR_LDAP_MAX_CONNS, maxConns);
+ nvps.add(Constants.PR_LDAP_MIN_CONNS, minConns);
/*
nvps.add(Constants.PR_LDAP_VERSION,
(String)mVersionBox.getSelectedItem());
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java
new file mode 100644
index 00000000..8765f08e
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/config/GeneralLogPanel.java
@@ -0,0 +1,254 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// 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.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.config;
+
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.admin.certsrv.ug.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.admin.certsrv.connection.*;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * LDAP server setting tab
+ *
+ * @author Ade Lee
+ * @version $Revision: 1211 $, $Date: 2010-08-18 13:15:37 -0400 (Wed, 18 Aug 2010) $
+ */
+public class GeneralLogPanel extends CMSBaseTab {
+
+ private static String PANEL_NAME = "GENERALLOG";
+ private static final String HELPINDEX =
+ "configuration-general-logs-settings-help";
+ private JCheckBox mEnable;
+ private Color mActiveColor;
+ private JLabel mLevelLabel;
+ private JTextField mLevelText;
+ private JCheckBox mShowCaller;
+
+ protected AdminConnection mAdmin;
+ protected CMSBaseResourceModel mModel;
+ private String mServletName;
+ private CMSTabPanel mParent;
+
+ public GeneralLogPanel(CMSTabPanel parent) {
+ super(PANEL_NAME, parent);
+ mHelpToken = HELPINDEX;
+ mServletName = DestDef.DEST_LOG_ADMIN;
+ mModel = parent.getResourceModel();
+ mParent = parent;
+ }
+
+ public void init() {
+ mAdmin = mModel.getServerInfo().getAdmin();
+ JPanel serverInfo = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ mCenterPanel.setLayout(gb);
+
+ //add the enable checkbox
+ mEnable = makeJCheckBox("ENABLE");
+ mEnable.setSelected(true);
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTHWEST;
+ gbc.fill = gbc.NONE;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.insets = new Insets(DIFFERENT_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE,
+ 0,
+ DIFFERENT_COMPONENT_SPACE);
+ gb.setConstraints(mEnable, gbc);
+ mCenterPanel.add(mEnable);
+
+ //add the debug properties panel
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(serverInfo, gbc);
+ mCenterPanel.add(serverInfo);
+
+ GridBagLayout gb1 = new GridBagLayout();
+ serverInfo.setLayout(gb1);
+ serverInfo.setBorder(makeTitledBorder("DEBUG"));
+
+ // add frequency label and text field
+ CMSAdminUtil.resetGBC(gbc);
+ mLevelLabel = makeJLabel("LEVEL");
+ mLevelText = makeJTextField(30);
+ mActiveColor = mLevelText.getBackground();
+ CMSAdminUtil.addEntryField(serverInfo,
+ mLevelLabel, mLevelText, gbc);
+
+ // add show caller checkbox
+ /*
+ CMSAdminUtil.resetGBC(gbc);
+ mShowCaller = makeJCheckBox("SHOWCALLER");
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,0,COMPONENT_SPACE);
+ gb1.setConstraints(mShowCaller, gbc);
+ serverInfo.add(mShowCaller);
+ */
+ refresh();
+ }
+
+
+ public void refresh() {
+ mModel.progressStart();
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.add(Constants.PR_DEBUG_LOG_ENABLE, "true");
+ nvps.add(Constants.PR_DEBUG_LOG_LEVEL, "0");
+ /*nvps.add(Constants.PR_DEBUG_LOG_SHOWCALLER, ""); */
+
+ try {
+ NameValuePairs val = mAdmin.read(mServletName,
+ ScopeDef.SC_GENERAL, Constants.RS_ID_CONFIG, nvps);
+
+ populate(val);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ }
+ mModel.progressStop();
+ clearDirtyFlag();
+ mParent.setOKCancel();
+ }
+
+ private void enableFields(boolean enable, Color color) {
+ mLevelText.setEnabled(enable);
+ mLevelText.setEditable(enable);
+ mLevelText.setBackground(color);
+ mLevelLabel.setEnabled(enable);
+ mLevelLabel.setBackground(color);
+
+ mLevelLabel.invalidate();
+ mLevelLabel.validate();
+ mLevelLabel.repaint(1);
+ }
+
+ protected void populate(NameValuePairs nvps) {
+ String version = "";
+ for (int i=0; i<nvps.size(); i++) {
+ NameValuePair nvp = nvps.elementAt(i);
+ String name = nvp.getName();
+ if (name.equals(Constants.PR_DEBUG_LOG_ENABLE)) {
+ if (nvp.getValue().equals(Constants.TRUE))
+ mEnable.setSelected(true);
+ else
+ mEnable.setSelected(false);
+ } else if (name.equals(Constants.PR_DEBUG_LOG_LEVEL)) {
+ mLevelText.setText(nvp.getValue());
+ }
+
+ /* else if (name.equals(Constants.PR_DEBUG_LOG_SHOWCALLER)) {
+ if (nvp.getValue().equals(Constants.TRUE))
+ mShowCaller.setSelected(true);
+ else
+ mShowCaller.setSelected(false);
+ } */
+
+ }
+
+ if (mEnable.isSelected())
+ enableFields(true, mActiveColor);
+ else
+ enableFields(false, getBackground());
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (mEnable.isSelected()) {
+ enableFields(true, mActiveColor);
+ } else {
+ enableFields(false, getBackground());
+ }
+ }
+
+ /**
+ * Implementation for saving panel information
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean applyCallback() {
+ // check blank fields
+ String level = mLevelText.getText().trim();
+
+ if (mEnable.isSelected() && level.equals("")) {
+ showMessageDialog("BLANKFIELD");
+ return false;
+ }
+
+ try {
+ int num = Integer.parseInt(level);
+ if (num < 0) {
+ showMessageDialog("LEVELRANGE");
+ return false;
+ }
+ } catch (NumberFormatException e) {
+ showMessageDialog("NUMBERFORMAT");
+ return false;
+ }
+
+ NameValuePairs nvps = new NameValuePairs();
+ nvps.add(Constants.PR_DEBUG_LOG_LEVEL, level);
+
+ /*
+ if (mShowCaller.isSelected())
+ nvps.add(Constants.PR_DEBUG_LOG_SHOWCALLER, Constants.TRUE);
+ else
+ nvps.add(Constants.PR_DEBUG_LOG_SHOWCALLER, Constants.FALSE);
+ */
+
+ if (mEnable.isSelected())
+ nvps.add(Constants.PR_DEBUG_LOG_ENABLE, Constants.TRUE);
+ else
+ nvps.add(Constants.PR_DEBUG_LOG_ENABLE, Constants.FALSE);
+
+ mModel.progressStart();
+ try {
+ mAdmin.modify(mServletName, ScopeDef.SC_GENERAL,
+ Constants.RS_ID_CONFIG, nvps, false);
+ } catch (EAdminException e) {
+ showErrorDialog(e.toString());
+ mModel.progressStop();
+ return false;
+ }
+
+ mModel.progressStop();
+ clearDirtyFlag();
+ return true;
+ }
+
+ /**
+ * Implementation for reset values
+ * @return true if save successful; otherwise, false.
+ */
+ public boolean resetCallback() {
+ refresh();
+ return true;
+ }
+}
+
diff --git a/pki/base/console/src/com/netscape/certsrv/common/Constants.java b/pki/base/console/src/com/netscape/certsrv/common/Constants.java
index ede0c0eb..5dcf5081 100644
--- a/pki/base/console/src/com/netscape/certsrv/common/Constants.java
+++ b/pki/base/console/src/com/netscape/certsrv/common/Constants.java
@@ -189,6 +189,10 @@ public interface Constants {
public static final String PR_LOG_TRANSACTIONS = "Transactions";
public static final String PR_LOG_SYSTEM = "System";
+ public static final String PR_DEBUG_LOG_SHOWCALLER = "debug.showcaller";
+ public static final String PR_DEBUG_LOG_ENABLE = "debug.enabled";
+ public static final String PR_DEBUG_LOG_LEVEL = "debug.level";
+
/*========================================================
* LDAP Publishing
*========================================================*/
@@ -240,7 +244,9 @@ public interface Constants {
public final static String PR_BIND_DN = "ldapauth.bindDN";
public final static String PR_BIND_PASSWD = "ldapauth.bindPassword";
public final static String PR_BIND_PASSWD_AGAIN = "bindPasswdAgain";
-
+ public final static String PR_LDAP_MAX_CONNS = "maxConns";
+ public final static String PR_LDAP_MIN_CONNS = "minConns";
+
public final static String PR_BASE_DN = "baseDN";
public final static String PR_DNCOMPS = "dnComps";
public final static String PR_FILTERCOMPS = "filterComps";
@@ -356,6 +362,7 @@ public interface Constants {
public final static String PR_RECOVERY_AGENT = "recoveryAgent";
public final static String PR_OLD_AGENT_PWD = "oldAgentPwd";
public final static String PR_AGENT_PWD = "agentPwd";
+ public final static String PR_NO_OF_REQUIRED_RECOVERY_AGENTS = "noOfRequiredRecoveryAgents";
/*========================================================
* Status
diff --git a/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java b/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java
index 857aa414..44fec8f3 100644
--- a/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java
+++ b/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java
@@ -538,7 +538,7 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove
* @exception EBaseException failed to retrieve info
*/
public int getNoOfRequiredAgents() throws EBaseException {
- if (mConfig.getBoolean("keySplitting")) {
+ if (mConfig.getBoolean("keySplitting", false)) {
return mStorageKeyUnit.getNoOfRequiredAgents();
} else {
int ret = -1;
@@ -551,6 +551,21 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove
}
/**
+ * Sets number of required agents for
+ * recovery operation
+ *
+ * @return none
+ * @exception EBaseException invalid setting
+ */
+ public void setNoOfRequiredAgents(int number) throws EBaseException {
+ if (mConfig.getBoolean("keySplitting")) {
+ mStorageKeyUnit.setNoOfRequiredAgents(number);
+ } else {
+ mConfig.putInteger("noOfRequiredRecoveryAgents", number);
+ }
+ }
+
+ /**
* Distributed recovery.
*/
public String getRecoveryID() {
diff --git a/pki/base/kra/src/com/netscape/kra/StorageKeyUnit.java b/pki/base/kra/src/com/netscape/kra/StorageKeyUnit.java
index c3693823..fff1eea7 100644
--- a/pki/base/kra/src/com/netscape/kra/StorageKeyUnit.java
+++ b/pki/base/kra/src/com/netscape/kra/StorageKeyUnit.java
@@ -636,6 +636,10 @@ public class StorageKeyUnit extends EncryptionUnit implements
return mStorageConfig.getInteger(PROP_M);
}
+ public void setNoOfRequiredAgents(int number) {
+ mStorageConfig.putInteger(PROP_M, number);
+ }
+
public CryptoToken getInternalToken() {
try {
return CryptoManager.getInstance().getInternalKeyStorageToken();