From f73b655466092169abac34833fb628fce1fcdebe Mon Sep 17 00:00:00 2001
From: jcduff <jcduff@localhost>
Date: Thu, 23 Oct 2008 14:04:24 +0000
Subject: [PATCH] The commit will bring the following features : - An updated version of the underlying database. BDB JE 3.3 is now used. - Attribute API refactoring providing a better abstraction and offering improved performances. - A new GUI called the Control-Panel to replace the Status-Panel: the specifications for this GUI are available on OpenDS Wiki and contains a link to a mockup. See <https://www.opends.org/wiki/page/ControlPanelUISpecification>. - Some changes in the replication protocol to implement "Assured Replication Mode". The specifications are on OpenDS Wiki at <https://www.opends.org/wiki/page/AssuredMode> and section 7 described some of the replication changes required to support this. Assured Replication is not finished, but the main replication protocol changes to support it are done. As explained by Gilles on an email on the Dev mailing list (http://markmail.org/message/46rgo3meq3vriy4a), with these changes the newer versions of OpenDS may not be able to replicate with OpenDS 1.0 instances. - Support for Service Tags on the platforms where the functionality is available and enabled. Specifications are published at <https://www.opends.org/wiki/page/OpenDSServiceTagEnabled>. For more information on Service Tags see <http://wikis.sun.com/display/ServiceTag/Sun+Service+Tag+FAQ>. - The Admin Connector service. In order to provide agentry of the OpenDS server at any time, a new service has been added, dedicated to the administration, configuration and monitoring of the server. An overview of the Admin Connector service and it's use is available on the OpenDS wiki <https://www.opends.org/wiki/page/ManagingAdministrationTrafficToTheServer> - Updates to the various command line tools to support the Admin Connector service. - Some internal re-architecting of the server to put the foundation of future developments such as virtual directory services. The new NetworkGroups and WorkFlow internal services which have been specified in <https://www.opends.org/wiki/page/BasicOperationRoutingThroughNetworkGroup> are now implemented. - Many bug fixes...
---
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 183 ++++++++++++++-------------------------------
1 files changed, 58 insertions(+), 125 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 1e793ac..3dd233e 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -27,12 +27,8 @@
package org.opends.quicksetup.installer;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
-import java.security.KeyStoreException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateEncodingException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -830,6 +826,8 @@
argList.add(getConfigurationFile());
argList.add("-p");
argList.add(String.valueOf(getUserData().getServerPort()));
+ argList.add("--adminConnectorPort");
+ argList.add(String.valueOf(getUserData().getAdminConnectorPort()));
SecurityOptions sec = getUserData().getSecurityOptions();
// TODO: even if the user does not configure SSL maybe we should choose
@@ -1025,7 +1023,7 @@
certManager.generateSelfSignedCertificate(SELF_SIGNED_CERT_ALIAS,
getSelfSignedCertificateSubjectDN(),
getSelfSignedCertificateValidity());
- exportCertificate(certManager, SELF_SIGNED_CERT_ALIAS,
+ SetupUtils.exportCertificate(certManager, SELF_SIGNED_CERT_ALIAS,
getTemporaryCertificatePath());
trustManager = new CertificateManager(
@@ -1044,7 +1042,7 @@
sec.getKeystorePath(),
CertificateManager.KEY_STORE_TYPE_JKS,
sec.getKeystorePassword());
- exportCertificate(certManager, sec.getAliasToUse(),
+ SetupUtils.exportCertificate(certManager, sec.getAliasToUse(),
getTemporaryCertificatePath());
trustManager = new CertificateManager(
@@ -1062,7 +1060,7 @@
sec.getKeystorePath(),
CertificateManager.KEY_STORE_TYPE_JCEKS,
sec.getKeystorePassword());
- exportCertificate(certManager, sec.getAliasToUse(),
+ SetupUtils.exportCertificate(certManager, sec.getAliasToUse(),
getTemporaryCertificatePath());
trustManager = new CertificateManager(
@@ -1080,7 +1078,7 @@
sec.getKeystorePath(),
CertificateManager.KEY_STORE_TYPE_PKCS12,
sec.getKeystorePassword());
- exportCertificate(certManager, sec.getAliasToUse(),
+ SetupUtils.exportCertificate(certManager, sec.getAliasToUse(),
getTemporaryCertificatePath());
trustManager = new CertificateManager(
@@ -1098,7 +1096,7 @@
CertificateManager.KEY_STORE_PATH_PKCS11,
CertificateManager.KEY_STORE_TYPE_PKCS11,
sec.getKeystorePassword());
- exportCertificate(certManager, sec.getAliasToUse(),
+ SetupUtils.exportCertificate(certManager, sec.getAliasToUse(),
getTemporaryCertificatePath());
trustManager = new CertificateManager(
@@ -1919,7 +1917,7 @@
getFormattedSummary(INFO_SUMMARY_CANCELING.get()));
Installation installation = getInstallation();
- String cmd = getPath(installation.getStatusPanelCommandFile());
+ String cmd = getPath(installation.getControlPanelCommandFile());
cmd = UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT);
hmSummary.put(InstallProgressStep.FINISHED_SUCCESSFULLY,
getFormattedSuccess(
@@ -1944,7 +1942,7 @@
Map<InstallProgressStep, Message> hmSummary)
{
Installation installation = getInstallation();
- String cmd = getPath(installation.getStatusPanelCommandFile());
+ String cmd = getPath(installation.getControlPanelCommandFile());
cmd = UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT);
Message status;
if (installation.getStatus().isServerRunning())
@@ -2922,6 +2920,45 @@
qs.displayFieldInvalid(FieldName.SERVER_PORT, true);
}
+ // Check the admin connector port
+ sPort = qs.getFieldStringValue(FieldName.ADMIN_CONNECTOR_PORT);
+ int adminConnectorPort = -1;
+ try
+ {
+ adminConnectorPort = Integer.parseInt(sPort);
+ if ((adminConnectorPort < MIN_PORT_VALUE) ||
+ (adminConnectorPort > MAX_PORT_VALUE))
+ {
+ errorMsgs.add(INFO_INVALID_PORT_VALUE_RANGE.get(
+ String.valueOf(MIN_PORT_VALUE),
+ String.valueOf(MAX_PORT_VALUE)));
+ qs.displayFieldInvalid(FieldName.ADMIN_CONNECTOR_PORT, true);
+ } else if (!canUseAsPort(adminConnectorPort))
+ {
+ if (isPriviledgedPort(adminConnectorPort))
+ {
+ errorMsgs.add(INFO_CANNOT_BIND_PRIVILEDGED_PORT.get(
+ String.valueOf(adminConnectorPort)));
+ } else
+ {
+ errorMsgs.add(INFO_CANNOT_BIND_PORT.get(
+ String.valueOf(adminConnectorPort)));
+ }
+ qs.displayFieldInvalid(FieldName.ADMIN_CONNECTOR_PORT, true);
+
+ } else
+ {
+ getUserData().setAdminConnectorPort(adminConnectorPort);
+ qs.displayFieldInvalid(FieldName.ADMIN_CONNECTOR_PORT, false);
+ }
+
+ } catch (NumberFormatException nfe)
+ {
+ errorMsgs.add(INFO_INVALID_PORT_VALUE_RANGE.get(
+ String.valueOf(MIN_PORT_VALUE), String.valueOf(MAX_PORT_VALUE)));
+ qs.displayFieldInvalid(FieldName.ADMIN_CONNECTOR_PORT, true);
+ }
+
// Check the secure port
SecurityOptions sec =
(SecurityOptions)qs.getFieldValue(FieldName.SECURITY_OPTIONS);
@@ -3061,8 +3098,6 @@
Integer port = null;
String dn = null;
String pwd = null;
- boolean isSecure = Boolean.TRUE.equals(qs.getFieldValue(
- FieldName.REMOTE_SERVER_IS_SECURE_PORT));
ArrayList<Message> errorMsgs = new ArrayList<Message>();
DataReplicationOptions.Type type = (DataReplicationOptions.Type)
@@ -3140,7 +3175,7 @@
}
auth.setDn(dn);
auth.setPwd(pwd);
- auth.setUseSecureConnection(isSecure);
+ auth.setUseSecureConnection(true);
DataReplicationOptions repl;
switch (type)
@@ -3290,18 +3325,8 @@
boolean[] hasGlobalAdministrators,
String[] effectiveDn) throws UserDataException
{
- String ldapUrl;
host = getHostNameForLdapUrl(host);
- boolean isSecure = Boolean.TRUE.equals(qs.getFieldValue(
- FieldName.REMOTE_SERVER_IS_SECURE_PORT));
- if (isSecure)
- {
- ldapUrl = "ldaps://"+host+":"+port;
- }
- else
- {
- ldapUrl = "ldap://"+host+":"+port;
- }
+ String ldapUrl = "ldaps://"+host+":"+port;
InitialLdapContext ctx = null;
ApplicationTrustManager trustManager = getTrustManager();
@@ -3312,16 +3337,8 @@
effectiveDn[0] = dn;
try
{
- if (isSecure)
- {
- ctx = createLdapsContext(ldapUrl, dn, pwd,
+ ctx = createLdapsContext(ldapUrl, dn, pwd,
getDefaultLDAPTimeout(), null, trustManager);
- }
- else
- {
- ctx = createLdapContext(ldapUrl, dn, pwd,
- getDefaultLDAPTimeout(), null);
- }
}
catch (Throwable t)
{
@@ -3330,16 +3347,8 @@
// Try using a global administrator
dn = ADSContext.getAdministratorDN(dn);
effectiveDn[0] = dn;
- if (isSecure)
- {
- ctx = createLdapsContext(ldapUrl, dn, pwd,
+ ctx = createLdapsContext(ldapUrl, dn, pwd,
getDefaultLDAPTimeout(), null, trustManager);
- }
- else
- {
- ctx = createLdapContext(ldapUrl, dn, pwd,
- getDefaultLDAPTimeout(), null);
- }
}
else
{
@@ -4072,83 +4081,11 @@
protected String getSelfSignedCertificatePwd()
{
if (selfSignedCertPw == null) {
- selfSignedCertPw = createSelfSignedCertificatePwd();
+ selfSignedCertPw = SetupUtils.createSelfSignedCertificatePwd();
}
return new String(selfSignedCertPw);
}
- /**
- * Returns a randomly generated password for the self-signed certificate
- * keystore.
- * @return a randomly generated password for the self-signed certificate
- * keystore.
- */
- private char[] createSelfSignedCertificatePwd() {
- int pwdLength = 50;
- char[] pwd = new char[pwdLength];
- Random random = new Random();
- for (int pos=0; pos < pwdLength; pos++) {
- int type = getRandomInt(random,3);
- char nextChar = getRandomChar(random,type);
- pwd[pos] = nextChar;
- }
- return pwd;
- }
-
- private void exportCertificate(CertificateManager certManager, String alias,
- String path) throws CertificateEncodingException, IOException,
- KeyStoreException
- {
- Certificate certificate = certManager.getCertificate(alias);
-
- byte[] certificateBytes = certificate.getEncoded();
-
- FileOutputStream outputStream = new FileOutputStream(path, false);
- outputStream.write(certificateBytes);
- outputStream.close();
- }
-
- /* The next two methods are used to generate the random password for the
- * self-signed certificate. */
- private char getRandomChar(Random random, int type)
- {
- char generatedChar;
- int next = random.nextInt();
- int d;
-
- switch (type)
- {
- case 0:
- // Will return a digit
- d = next % 10;
- if (d < 0)
- {
- d = d * (-1);
- }
- generatedChar = (char) (d+48);
- break;
- case 1:
- // Will return a lower case letter
- d = next % 26;
- if (d < 0)
- {
- d = d * (-1);
- }
- generatedChar = (char) (d + 97);
- break;
- default:
- // Will return a capital letter
- d = (next % 26);
- if (d < 0)
- {
- d = d * (-1);
- }
- generatedChar = (char) (d + 65) ;
- }
-
- return generatedChar;
- }
-
private Map<ServerDescriptor, AuthenticationData>
getRemoteWithNoReplicationPort(UserData userData)
{
@@ -4165,6 +4102,7 @@
ServerDescriptor.ServerProperty.IS_REPLICATION_SERVER);
if (!Boolean.TRUE.equals(v))
{
+
AuthenticationData authData = new AuthenticationData();
authData.setPort(Constants.DEFAULT_REPLICATION_PORT);
authData.setUseSecureConnection(false);
@@ -4177,13 +4115,13 @@
private InitialLdapContext createLocalContext() throws NamingException
{
- String ldapUrl = "ldap://"+
+ String ldapUrl = "ldaps://"+
getHostNameForLdapUrl(getUserData().getHostName())+":"+
- getUserData().getServerPort();
+ getUserData().getAdminConnectorPort();
String dn = getUserData().getDirectoryManagerDn();
String pwd = getUserData().getDirectoryManagerPwd();
- return createLdapContext(ldapUrl, dn, pwd,
- getDefaultLDAPTimeout(), null);
+ return createLdapsContext(ldapUrl, dn, pwd,
+ getDefaultLDAPTimeout(), null, null);
}
/**
@@ -4566,11 +4504,6 @@
return getUserData().getHostName()+":"+getUserData().getServerPort();
}
- private static int getRandomInt(Random random,int modulo)
- {
- return (random.nextInt() & modulo);
- }
-
private void resetGenerationId(InitialLdapContext ctx,
String suffixDn, String sourceServerDisplay)
throws ApplicationException
--
Gitblit v1.10.0