Package com.sun.enterprise.admin.servermgmt.pe

Examples of com.sun.enterprise.admin.servermgmt.pe.PEFileLayout


     * @throws RepositoryException
     */
    protected void createSSLCertificateDatabase(RepositoryConfig config,
            String masterPassword) {
        try {
          final PEFileLayout layout = getFileLayout(config);
            final File keystore = layout.getKeyStore();
            createKeyStore(keystore, config, masterPassword);
            createTrustStore(config, masterPassword);
        }
        catch (RepositoryException re) {
            String msg = _strMgr.getString("SomeProblemWithKeytool", re.getMessage());
            System.err.println(msg);
            try {
                PEFileLayout lo = getFileLayout(config);
                File src = lo.getKeyStoreTemplate();
                File dest = lo.getKeyStore();
                FileUtils.copy(src, dest); //keystore goes first
                src = lo.getTrustStoreTemplate();
                dest = lo.getTrustStore();
                FileUtils.copy(src, dest); //and then cacerts with CA-signed certs
            }
            catch (Exception e) {
                getLogger().log(Level.SEVERE, UNHANDLED_EXCEPTION, e);
            }
View Full Code Here


     * @throws RepositoryException
     */
    protected void createTrustStore(
            RepositoryConfig config, String masterPassword) throws RepositoryException {
        //copy the default truststore from the installation template directory
        final PEFileLayout layout = getFileLayout(config);
        final File src = layout.getTrustStoreTemplate();
        final File truststore = layout.getTrustStore();

        try {
            FileUtils.copy(src, truststore);
        }
        catch (IOException ioe) {
            throw new RepositoryException(
                    _strMgr.getString("trustStoreNotCreated", truststore), ioe);
        }

        changeKeystorePassword(DEFAULT_MASTER_PASSWORD, masterPassword, truststore);

        copyCert(layout.getConfigRoot(), CERTIFICATE_ALIAS, masterPassword);
        copyCert(layout.getConfigRoot(), INSTANCE_SECURE_ADMIN_ALIAS, masterPassword);
    }
View Full Code Here

     */
    protected void changeS1ASAliasPassword(RepositoryConfig config,
            String storePassword, String oldKeyPassword, String newKeyPassword)
            throws RepositoryException {
        if (!storePassword.equals(oldKeyPassword) && !oldKeyPassword.equals(newKeyPassword)) {
            final PEFileLayout layout = getFileLayout(config);
            final File keystore = layout.getKeyStore();
            //First see if the alias exists. The user could have deleted it. Any failure in the
            //command indicates that the alias does not exist, so we return without error.
            String keyStoreType = System.getProperty("javax.net.ssl.keyStoreType");
            if (keyStoreType == null) {
                keyStoreType = KeyStore.getDefaultType();
View Full Code Here

     * @param oldKeyPassword
     * @param newKeyPassword
     */
    protected void changeSSLCertificateDatabasePassword(RepositoryConfig config,
            String oldPassword, String newPassword) throws RepositoryException {
        final PEFileLayout layout = getFileLayout(config);
        File keystore = layout.getKeyStore();
        File truststore = layout.getTrustStore();

        if (keystore.exists()) {
            //Change the password on the keystore
            changeKeystorePassword(oldPassword, newPassword, keystore);
            //Change the s1as alias password in the keystore...The assumption
View Full Code Here

        return MASTER_PASSWORD_ALIAS.toCharArray();
    }
   
    protected void deleteMasterPasswordFile(RepositoryConfig config)
    {
        final PEFileLayout layout = getFileLayout(config);
        final File pwdFile = layout.getMasterPasswordFile();   
        FileUtils.deleteFile(pwdFile);
    }
View Full Code Here

     */   
    protected void createMasterPasswordFile(
        RepositoryConfig config, String masterPassword)
        throws RepositoryException
    {
        final PEFileLayout layout = getFileLayout(config);
        final File pwdFile = layout.getMasterPasswordFile();                    
        try {                   
            PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(),
                getMasterPasswordPassword(config));
            p.setPasswordForAlias(MASTER_PASSWORD_ALIAS, masterPassword.getBytes());
            chmod("600", pwdFile);
View Full Code Here

     * @return
     */   
    public String readMasterPasswordFile(
        RepositoryConfig config) throws RepositoryException
    {              
        final PEFileLayout layout = getFileLayout(config);
        final File pwdFile = layout.getMasterPasswordFile();       
        if (pwdFile.exists()) {           
            try {                   
                PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(),
                    getMasterPasswordPassword(config));
                return p.getPasswordForAlias(MASTER_PASSWORD_ALIAS);
View Full Code Here

    }
    
    protected PEFileLayout getFileLayout(RepositoryConfig config)
    {
        if (_fileLayout == null) {
            _fileLayout = new PEFileLayout(config);
        }
        return _fileLayout;
    }        
View Full Code Here

            createTrustStore(config, masterPassword);
        } catch(RepositoryException re) {
            String msg = _strMgr.getString("SomeProblemWithKeytool", re.getMessage());
            System.err.println(msg);
            try {
                PEFileLayout lo = getFileLayout(config);
                File src  = lo.getKeyStoreTemplate();
                File dest = lo.getKeyStore();
                FileUtils.copy(src, dest); //keystore goes first
                src  = lo.getTrustStoreTemplate();
                dest = lo.getTrustStore();
                FileUtils.copy(src, dest); //and then cacerts with CA-signed certs
            } catch(Exception e) {
                e.printStackTrace(); //this was best case effort, anyway
            }
           
View Full Code Here

     */
    protected void createKeyStore(
        RepositoryConfig config, String masterPassword) throws RepositoryException
    {
        //Generate a new self signed certificate with s1as as the alias
        final PEFileLayout layout = getFileLayout(config);  
        final File keystore = layout.getKeyStore();
        //Create the default self signed cert
        final String dasCertDN = getDASCertDN(config);
        System.out.println(_strMgr.getString("CertificateDN", dasCertDN));
        addSelfSignedCertToKeyStore(keystore, CERTIFICATE_ALIAS, masterPassword, dasCertDN);

View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.servermgmt.pe.PEFileLayout

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.