| | |
| | | + "ds-cfg-trust-store-type: JCEKS" + NEW_LINE |
| | | + "ds-cfg-trust-store-file: config/truststore" + NEW_LINE; |
| | | |
| | | private static final String DN_ADMIN_TRUST_MANAGER = "cn=Administration,cn=Trust Manager Providers," + DN_CONFIG_ROOT; |
| | | private static final String DN_ADMIN_KEY_MANAGER = "cn=Administration,cn=Key Manager Providers," + DN_CONFIG_ROOT; |
| | | |
| | | /** The DN of the configuration entry defining the LDAP connection handler. */ |
| | |
| | | putKeyManagerConfigAttribute(enableStartTLS, DN_LDAP_CONNECTION_HANDLER); |
| | | putKeyManagerConfigAttribute(ldapsPort, DN_LDAPS_CONNECTION_HANDLER); |
| | | putKeyManagerConfigAttribute(ldapsPort, DN_HTTP_CONNECTION_HANDLER); |
| | | if (StaticUtils.isFips()) { |
| | | putAdminKeyManagerConfigAttribute(ldapsPort, DN_ADMIN_KEY_MANAGER); |
| | | } |
| | | |
| | | if (keyManagerPath.isPresent()) |
| | | { |
| | |
| | | throw new ConfigureDSException(e, LocalizableMessage.raw(e.toString())); |
| | | } |
| | | } |
| | | |
| | | if (StaticUtils.isFips()) { |
| | | putAdminKeyManagerConfigAttribute(keyManagerProviderDN, DN_ADMIN_KEY_MANAGER); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void putAdminKeyManagerConfigAttribute(final Argument arg, final String attributeDN) |
| | | private void putAdminKeyManagerConfigAttribute(final Argument keyManagerProviderDN, final String attributeDN) |
| | | throws ConfigureDSException |
| | | { |
| | | if (arg.isPresent()) |
| | | if (keyManagerProviderDN.isPresent()) |
| | | { |
| | | try |
| | | { |
| | | updateConfigEntryByRemovingAttribute(attributeDN, ATTR_KEYSTORE_TYPE); |
| | | updateConfigEntryByRemovingAttribute(attributeDN, ATTR_KEYSTORE_FILE); |
| | | boolean isBcfks = keyManagerProviderDN.getValue().toLowerCase().startsWith("cn=bcfks"); |
| | | if (isBcfks) { |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_KEYSTORE_TYPE, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | "BCFKS"); |
| | | |
| | | updateConfigEntryWithObjectClasses( |
| | | attributeDN, |
| | | "top", "ds-cfg-pkcs11-key-manager-provider", "ds-cfg-key-manager-provider"); |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_KEYSTORE_FILE, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | keyManagerPath.getValue()); |
| | | |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_KEYMANAGER_CLASS, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | "org.opends.server.extensions.PKCS11KeyManagerProvider"); |
| | | |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_KEYSTORE_PIN_FILE, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | "config/keystore.pin"); |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_KEYSTORE_PIN_FILE, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | "config/keystore.pin"); |
| | | } else { |
| | | updateConfigEntryByRemovingAttribute(attributeDN, ATTR_KEYSTORE_TYPE); |
| | | updateConfigEntryByRemovingAttribute(attributeDN, ATTR_KEYSTORE_FILE); |
| | | |
| | | updateConfigEntryWithObjectClasses( |
| | | attributeDN, |
| | | "top", "ds-cfg-pkcs11-key-manager-provider", "ds-cfg-key-manager-provider"); |
| | | |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_KEYMANAGER_CLASS, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | "org.opends.server.extensions.PKCS11KeyManagerProvider"); |
| | | |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_KEYSTORE_PIN_FILE, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | "config/keystore.pin"); |
| | | } |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | removeSSLCertNicknameAttribute(DN_HTTP_CONNECTION_HANDLER); |
| | | removeSSLCertNicknameAttribute(DN_JMX_CONNECTION_HANDLER); |
| | | } |
| | | |
| | | if (StaticUtils.isFips()) { |
| | | putAdminTrustManagerConfigAttribute(trustManagerProviderDN, DN_ADMIN_TRUST_MANAGER); |
| | | } |
| | | } |
| | | |
| | | private void putTrustManagerAttribute(final Argument arg, final String attributeDN) throws ConfigureDSException |
| | |
| | | } |
| | | } |
| | | |
| | | private void putAdminTrustManagerConfigAttribute(final Argument trustManagerProviderDN, final String attributeDN) |
| | | throws ConfigureDSException |
| | | { |
| | | if (keyManagerProviderDN.isPresent()) |
| | | { |
| | | try |
| | | { |
| | | boolean isBcfks = keyManagerProviderDN.getValue().toLowerCase().startsWith("cn=bcfks"); |
| | | if (isBcfks) { |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_TRUSTSTORE_TYPE, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | "BCFKS"); |
| | | |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_TRUSTSTORE_FILE, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | keyManagerPath.getValue()); |
| | | |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_TRUSTSTORE_PIN_FILE, |
| | | CoreSchema.getDirectoryStringSyntax(), |
| | | "config/keystore.pin"); |
| | | } |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | throw new ConfigureDSException(e, ERR_CONFIGDS_CANNOT_UPDATE_TRUSTMANAGER_REFERENCE.get(e)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void updateCertNicknameEntry(final Argument arg, final String attributeDN, |
| | | final String attrName, final List<String> attrValues) throws ConfigureDSException |
| | | { |