Package com.netscape.cms.servlet.csadmin
Class Configurator
- java.lang.Object
-
- com.netscape.cms.servlet.csadmin.Configurator
-
public class Configurator extends java.lang.Object
Utility class for functions to be used by the RESTful installer.- Author:
- alee
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
AUTH_FAILURE
static java.math.BigInteger
BIG_ZERO
static ConfigCertApprovalCallback
certApprovalCallback
protected EngineConfig
cs
static java.lang.String
DBUSER
static java.lang.String
ECC_INTERNAL_ADMIN_CERT_PROFILE
protected CMSEngine
engine
static java.lang.String
FAILURE
static org.slf4j.Logger
logger
static java.lang.Long
MINUS_ONE
static java.lang.String
RSA_INTERNAL_ADMIN_CERT_PROFILE
protected ServerXml
serverXml
static java.lang.String
SUCCESS
-
Constructor Summary
Constructors Constructor Description Configurator(CMSEngine engine)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.mozilla.jss.netscape.security.x509.X509CertImpl
createAdminCertificate(com.netscape.certsrv.system.AdminSetupRequest request)
void
createAdminUser(com.netscape.certsrv.system.AdminSetupRequest request)
static com.netscape.certsrv.client.PKIClient
createClient(java.lang.String serverURL, java.lang.String clientnickname, org.mozilla.jss.ssl.SSLCertificateApprovalCallback certApprovalCallback)
java.security.KeyPair
createECCKeyPair(org.mozilla.jss.crypto.CryptoToken token, java.lang.String curveName, java.lang.String ct)
org.mozilla.jss.netscape.security.x509.X509CertImpl
createRemoteAdminCert(com.netscape.certsrv.system.AdminSetupRequest request, java.lang.String ca_hostname, int ca_port, java.lang.String profileId, java.lang.String subjectDN)
java.security.KeyPair
createRSAKeyPair(org.mozilla.jss.crypto.CryptoToken token, int keysize, java.lang.String ct)
void
createSecurityDomain()
boolean
deleteDir(java.io.File dir)
void
finalizeConfiguration(com.netscape.certsrv.system.FinalizeConfigRequest request)
save variables needed for cloning and remove preopsvoid
generateCert(com.netscape.certsrv.system.CertificateSetupRequest request, java.security.KeyPair keyPair, Cert cert)
void
generateCertRequest(java.security.KeyPair keyPair, Cert cert)
void
generateRemoteCert(java.lang.String hostname, int port, java.lang.String sessionID, java.security.KeyPair keyPair, Cert cert)
java.lang.String
getContentValue(java.lang.String body, java.lang.String header)
void
getDatabaseGroups(java.util.Collection<java.lang.String> groups)
com.netscape.certsrv.system.SecurityDomainHost
getHostInfo(com.netscape.certsrv.system.DomainInfo domainInfo, java.lang.String csType, java.lang.String hostname, int securePort)
java.lang.String
getInstallToken(java.lang.String sdhost, int sdport, java.lang.String user, java.lang.String passwd)
java.lang.String
getNickname(java.lang.String certTag)
java.lang.String
getOldCookie(java.lang.String sdhost, int sdport, java.lang.String user, java.lang.String passwd)
java.lang.String
getSubsystemCert()
org.mozilla.jss.netscape.security.x509.X509CertImpl
getSubsystemCert(java.lang.String host, int port)
void
importLDIFS(LDAPConfigurator ldapConfigurator, java.lang.String param)
void
importLDIFS(LDAPConfigurator ldapConfigurator, java.lang.String param, boolean ignoreErrors)
void
injectSANExtension(java.lang.String[] dnsNames, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> content)
boolean
isSDHostDomainMaster(com.netscape.certsrv.system.DomainInfo domainInfo)
void
loadCert(Cert cert, org.mozilla.jss.crypto.X509Certificate x509Cert)
java.security.KeyPair
loadKeyPair(java.lang.String nickname, java.lang.String token)
Cert
processCert(com.netscape.certsrv.system.CertificateSetupRequest request, java.security.KeyPair keyPair, com.netscape.certsrv.system.SystemCertData certData)
java.security.KeyPair
processKeyPair(com.netscape.certsrv.system.SystemCertData certData)
void
registerUser(com.netscape.certsrv.system.FinalizeConfigRequest request, java.net.URI secdomainURI, java.net.URI targetURI, java.lang.String targetType)
void
removeOldDBUsers(java.lang.String subjectDN)
void
setConfigStore(EngineConfig cs)
void
setServerXml(ServerXml serverXml)
void
setSubsystemEnabled(java.lang.String id, boolean enabled)
Set whether the given subsystem is enabled.void
setupAdminUser(com.netscape.certsrv.system.AdminSetupRequest request, org.mozilla.jss.netscape.security.x509.X509CertImpl cert)
Cert
setupCert(com.netscape.certsrv.system.CertificateSetupRequest request)
void
setupClientAuthUser()
void
setupDatabaseUser()
void
setupSecurityDomain(com.netscape.certsrv.system.SecurityDomainSetupRequest request)
void
setupSubsystemUser(org.mozilla.jss.netscape.security.x509.X509CertImpl cert)
void
setupUser(java.lang.String id, org.mozilla.jss.netscape.security.x509.X509CertImpl cert, java.lang.String groupName)
void
updateAdminUserCert(com.netscape.certsrv.system.AdminSetupRequest request, org.mozilla.jss.netscape.security.x509.X509CertImpl adminCert)
void
updateDomainXML(java.lang.String hostname, int port, boolean https, java.lang.String servlet, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> content, boolean useClientAuth)
void
updateNextRanges()
void
updateSecurityDomain(com.netscape.certsrv.system.SecurityDomainSetupRequest request)
-
-
-
Field Detail
-
logger
public static final org.slf4j.Logger logger
-
ECC_INTERNAL_ADMIN_CERT_PROFILE
public static final java.lang.String ECC_INTERNAL_ADMIN_CERT_PROFILE
- See Also:
- Constant Field Values
-
RSA_INTERNAL_ADMIN_CERT_PROFILE
public static final java.lang.String RSA_INTERNAL_ADMIN_CERT_PROFILE
- See Also:
- Constant Field Values
-
SUCCESS
public static java.lang.String SUCCESS
-
FAILURE
public static java.lang.String FAILURE
-
AUTH_FAILURE
public static java.lang.String AUTH_FAILURE
-
BIG_ZERO
public static final java.math.BigInteger BIG_ZERO
-
MINUS_ONE
public static final java.lang.Long MINUS_ONE
-
DBUSER
public static final java.lang.String DBUSER
- See Also:
- Constant Field Values
-
certApprovalCallback
public static ConfigCertApprovalCallback certApprovalCallback
-
engine
protected CMSEngine engine
-
cs
protected EngineConfig cs
-
serverXml
protected ServerXml serverXml
-
-
Constructor Detail
-
Configurator
public Configurator(CMSEngine engine)
-
-
Method Detail
-
createClient
public static com.netscape.certsrv.client.PKIClient createClient(java.lang.String serverURL, java.lang.String clientnickname, org.mozilla.jss.ssl.SSLCertificateApprovalCallback certApprovalCallback) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setConfigStore
public void setConfigStore(EngineConfig cs)
-
setServerXml
public void setServerXml(ServerXml serverXml) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getInstallToken
public java.lang.String getInstallToken(java.lang.String sdhost, int sdport, java.lang.String user, java.lang.String passwd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getOldCookie
public java.lang.String getOldCookie(java.lang.String sdhost, int sdport, java.lang.String user, java.lang.String passwd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getContentValue
public java.lang.String getContentValue(java.lang.String body, java.lang.String header)
-
getHostInfo
public com.netscape.certsrv.system.SecurityDomainHost getHostInfo(com.netscape.certsrv.system.DomainInfo domainInfo, java.lang.String csType, java.lang.String hostname, int securePort) throws java.lang.Exception
- Throws:
java.lang.Exception
-
importLDIFS
public void importLDIFS(LDAPConfigurator ldapConfigurator, java.lang.String param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
importLDIFS
public void importLDIFS(LDAPConfigurator ldapConfigurator, java.lang.String param, boolean ignoreErrors) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteDir
public boolean deleteDir(java.io.File dir)
-
loadKeyPair
public java.security.KeyPair loadKeyPair(java.lang.String nickname, java.lang.String token) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createECCKeyPair
public java.security.KeyPair createECCKeyPair(org.mozilla.jss.crypto.CryptoToken token, java.lang.String curveName, java.lang.String ct) throws java.security.NoSuchAlgorithmException, org.mozilla.jss.NoSuchTokenException, org.mozilla.jss.crypto.TokenException, org.mozilla.jss.NotInitializedException, EPropertyNotFound, EBaseException
- Throws:
java.security.NoSuchAlgorithmException
org.mozilla.jss.NoSuchTokenException
org.mozilla.jss.crypto.TokenException
org.mozilla.jss.NotInitializedException
EPropertyNotFound
EBaseException
-
createRSAKeyPair
public java.security.KeyPair createRSAKeyPair(org.mozilla.jss.crypto.CryptoToken token, int keysize, java.lang.String ct) throws java.lang.Exception
- Throws:
java.lang.Exception
-
processKeyPair
public java.security.KeyPair processKeyPair(com.netscape.certsrv.system.SystemCertData certData) throws java.lang.Exception
- Throws:
java.lang.Exception
-
generateRemoteCert
public void generateRemoteCert(java.lang.String hostname, int port, java.lang.String sessionID, java.security.KeyPair keyPair, Cert cert) throws java.lang.Exception
- Throws:
java.lang.Exception
-
generateCert
public void generateCert(com.netscape.certsrv.system.CertificateSetupRequest request, java.security.KeyPair keyPair, Cert cert) throws java.lang.Exception
- Throws:
java.lang.Exception
-
injectSANExtension
public void injectSANExtension(java.lang.String[] dnsNames, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> content) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getNickname
public java.lang.String getNickname(java.lang.String certTag) throws EBaseException
- Throws:
EBaseException
-
generateCertRequest
public void generateCertRequest(java.security.KeyPair keyPair, Cert cert) throws java.lang.Exception
- Throws:
java.lang.Exception
-
loadCert
public void loadCert(Cert cert, org.mozilla.jss.crypto.X509Certificate x509Cert) throws java.lang.Exception
- Throws:
java.lang.Exception
-
processCert
public Cert processCert(com.netscape.certsrv.system.CertificateSetupRequest request, java.security.KeyPair keyPair, com.netscape.certsrv.system.SystemCertData certData) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setupCert
public Cert setupCert(com.netscape.certsrv.system.CertificateSetupRequest request) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createAdminCertificate
public org.mozilla.jss.netscape.security.x509.X509CertImpl createAdminCertificate(com.netscape.certsrv.system.AdminSetupRequest request) throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateAdminUserCert
public void updateAdminUserCert(com.netscape.certsrv.system.AdminSetupRequest request, org.mozilla.jss.netscape.security.x509.X509CertImpl adminCert) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setupAdminUser
public void setupAdminUser(com.netscape.certsrv.system.AdminSetupRequest request, org.mozilla.jss.netscape.security.x509.X509CertImpl cert) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createAdminUser
public void createAdminUser(com.netscape.certsrv.system.AdminSetupRequest request) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createRemoteAdminCert
public org.mozilla.jss.netscape.security.x509.X509CertImpl createRemoteAdminCert(com.netscape.certsrv.system.AdminSetupRequest request, java.lang.String ca_hostname, int ca_port, java.lang.String profileId, java.lang.String subjectDN) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setupSecurityDomain
public void setupSecurityDomain(com.netscape.certsrv.system.SecurityDomainSetupRequest request) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createSecurityDomain
public void createSecurityDomain() throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateSecurityDomain
public void updateSecurityDomain(com.netscape.certsrv.system.SecurityDomainSetupRequest request) throws java.lang.Exception
- Throws:
java.lang.Exception
-
isSDHostDomainMaster
public boolean isSDHostDomainMaster(com.netscape.certsrv.system.DomainInfo domainInfo) throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateDomainXML
public void updateDomainXML(java.lang.String hostname, int port, boolean https, java.lang.String servlet, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> content, boolean useClientAuth) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setupSubsystemUser
public void setupSubsystemUser(org.mozilla.jss.netscape.security.x509.X509CertImpl cert) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setupClientAuthUser
public void setupClientAuthUser() throws java.lang.Exception
- Throws:
java.lang.Exception
-
setupUser
public void setupUser(java.lang.String id, org.mozilla.jss.netscape.security.x509.X509CertImpl cert, java.lang.String groupName) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getSubsystemCert
public org.mozilla.jss.netscape.security.x509.X509CertImpl getSubsystemCert(java.lang.String host, int port) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setupDatabaseUser
public void setupDatabaseUser() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getDatabaseGroups
public void getDatabaseGroups(java.util.Collection<java.lang.String> groups) throws java.lang.Exception
- Throws:
java.lang.Exception
-
registerUser
public void registerUser(com.netscape.certsrv.system.FinalizeConfigRequest request, java.net.URI secdomainURI, java.net.URI targetURI, java.lang.String targetType) throws java.lang.Exception
- Throws:
java.lang.Exception
-
removeOldDBUsers
public void removeOldDBUsers(java.lang.String subjectDN) throws EBaseException, netscape.ldap.LDAPException
- Throws:
EBaseException
netscape.ldap.LDAPException
-
getSubsystemCert
public java.lang.String getSubsystemCert() throws EBaseException, org.mozilla.jss.NotInitializedException, org.mozilla.jss.crypto.ObjectNotFoundException, org.mozilla.jss.crypto.TokenException, java.security.cert.CertificateEncodingException, java.io.IOException
- Throws:
EBaseException
org.mozilla.jss.NotInitializedException
org.mozilla.jss.crypto.ObjectNotFoundException
org.mozilla.jss.crypto.TokenException
java.security.cert.CertificateEncodingException
java.io.IOException
-
updateNextRanges
public void updateNextRanges() throws EBaseException, netscape.ldap.LDAPException
- Throws:
EBaseException
netscape.ldap.LDAPException
-
finalizeConfiguration
public void finalizeConfiguration(com.netscape.certsrv.system.FinalizeConfigRequest request) throws java.lang.Exception
save variables needed for cloning and remove preops- Throws:
EBaseException
java.lang.Exception
-
setSubsystemEnabled
public void setSubsystemEnabled(java.lang.String id, boolean enabled) throws EBaseException
Set whether the given subsystem is enabled.- Parameters:
id
- The subsystem ID.enabled
- Whether the subsystem is enabled- Throws:
EBaseException
-
-