Esempio n. 1
0
def _set_domain_passwords():
    """
  Security configuration

  """
    asadmin_exec("stop-domain")

    # Change master password, default=empty
    asadmin_exec(
        "change-master-password --savemasterpassword=true ",
        admin_port=None,
        events={
            "(?i)Enter the current master password.*": "changeit\n",
            "(?i)Enter the new master password.*": app.get_glassfish_master_password() + "\n",
            "(?i)Enter the new master password again.*": app.get_glassfish_master_password() + "\n",
        },
    )

    # Create new cert for https
    os.chdir(GLASSFISH_DOMAINS_PATH + "/domain1/config/")
    x(
        "/usr/java/latest/bin/keytool -delete -alias gtecybertrust5ca -keystore cacerts.jks -storepass '"
        + app.get_glassfish_master_password()
        + "'"
    )

    asadmin_exec("start-domain ")

    # Change admin password
    asadmin_exec(
        "change-admin-password",
        admin_port=None,
        events={
            "(?i)Enter admin user name.*": "admin\n",
            "(?i)Enter the admin password.*": "\n",
            "(?i)Enter the new admin password.*": app.get_glassfish_admin_password() + "\n",
            "(?i)Enter the new admin password again.*": app.get_glassfish_admin_password() + "\n",
        },
    )

    # Stores login info for glassfish user in /home/glassfish/.asadminpass
    asadmin_exec(
        "login",
        events={
            "Enter admin user name.*": "admin\n",
            "Enter admin password.*": app.get_glassfish_admin_password() + "\n",
        },
    )

    # Enabling admin on port 4848 from external ip
    asadmin_exec(
        " --host 127.0.0.1 --port 4848 enable-secure-admin",
        events={
            "Enter admin user name.*": "admin\n",
            "Enter admin password.*": app.get_glassfish_admin_password() + "\n",
        },
    )
    asadmin_exec("stop-domain ")
    asadmin_exec("start-domain ")
Esempio n. 2
0
def _set_domain_passwords():
    '''
  Security configuration

  '''
    asadmin_exec("stop-domain")

    # Change master password, default=empty
    asadmin_exec("change-master-password --savemasterpassword=true ",
                 admin_port=None,
                 events={
                     "(?i)Enter the current master password.*":
                     "changeit\n",
                     "(?i)Enter the new master password.*":
                     app.get_glassfish_master_password() + "\n",
                     "(?i)Enter the new master password again.*":
                     app.get_glassfish_master_password() + "\n"
                 })

    # Create new cert for https
    os.chdir(GLASSFISH_DOMAINS_PATH + "/domain1/config/")
    x("/usr/java/latest/bin/keytool -delete -alias gtecybertrust5ca -keystore cacerts.jks -storepass '"
      + app.get_glassfish_master_password() + "'")

    asadmin_exec("start-domain ")

    # Change admin password
    asadmin_exec("change-admin-password",
                 admin_port=None,
                 events={
                     "(?i)Enter admin user name.*":
                     "admin\n",
                     "(?i)Enter the admin password.*":
                     "\n",
                     "(?i)Enter the new admin password.*":
                     app.get_glassfish_admin_password() + "\n",
                     "(?i)Enter the new admin password again.*":
                     app.get_glassfish_admin_password() + "\n"
                 })

    # Stores login info for glassfish user in /home/glassfish/.asadminpass
    asadmin_exec("login",
                 events={
                     "Enter admin user name.*":
                     "admin\n",
                     "Enter admin password.*":
                     app.get_glassfish_admin_password() + "\n"
                 })

    #Enabling admin on port 4848 from external ip
    asadmin_exec(" --host 127.0.0.1 --port 4848 enable-secure-admin",
                 events={
                     "Enter admin user name.*":
                     "admin\n",
                     "Enter admin password.*":
                     app.get_glassfish_admin_password() + "\n"
                 })
    asadmin_exec("stop-domain ")
    asadmin_exec("start-domain ")
Esempio n. 3
0
def initialize_passwords():
    '''
  Initialize all passwords that used by the script.

  This is done in the beginning of the script.
  '''
    app.get_glassfish_master_password()
    app.get_glassfish_admin_password()
Esempio n. 4
0
def initialize_passwords():
  '''
  Initialize all passwords that used by the script.

  This is done in the beginning of the script.
  '''
  app.get_glassfish_master_password()
  app.get_glassfish_admin_password()
Esempio n. 5
0
def initialize_passwords():
    """
    Initialize all passwords that used by the script.

    This is done in the beginning of the script to prevent the script from
    stopping in the middle asking user for password.

    """
    app.get_glassfish_master_password()
    app.get_glassfish_admin_password()
Esempio n. 6
0
def initialize_passwords():
    """
    Initialize all passwords that used by the script.

    This is done in the beginning of the script to prevent the script from
    stopping in the middle asking user for password.

    """
    app.get_glassfish_master_password()
    app.get_glassfish_admin_password()
Esempio n. 7
0
def _set_domain_passwords():
    """Security configuration"""
    asadmin_exec("stop-domain")

    # Change master password, default=empty
    asadmin_exec("change-master-password --savemasterpassword=true ",
                 admin_port=None,
                 events={
                     "(?i)Enter the current master password.*":
                     "changeit\n",
                     "(?i)Enter the new master password.*":
                     app.get_glassfish_master_password() + "\n",
                     "(?i)Enter the new master password again.*":
                     app.get_glassfish_master_password() + "\n"
                 })

    asadmin_exec("start-domain ")

    # Change admin password
    asadmin_exec("change-admin-password",
                 admin_port=None,
                 events={
                     "(?i)Enter admin user name.*":
                     "admin\n",
                     "(?i)Enter the admin password.*":
                     "\n",
                     "(?i)Enter the new admin password.*":
                     app.get_glassfish_admin_password() + "\n",
                     "(?i)Enter the new admin password again.*":
                     app.get_glassfish_admin_password() + "\n"
                 })

    # Stores login info for glassfish user in /home/glassfish/.asadminpass
    asadmin_exec("login",
                 events={
                     "Enter admin user name.*":
                     "admin\n",
                     "Enter admin password.*":
                     app.get_glassfish_admin_password() + "\n"
                 })

    # Enabling admin on port 4848 from external ip
    asadmin_exec(" --host 127.0.0.1 --port 4848 enable-secure-admin",
                 events={
                     "Enter admin user name.*":
                     "admin\n",
                     "Enter admin password.*":
                     app.get_glassfish_admin_password() + "\n"
                 })
Esempio n. 8
0
def _set_domain_passwords():
    """Security configuration"""
    asadmin_exec("stop-domain")

    # Change master password, default=empty
    asadmin_exec(
        "change-master-password --savemasterpassword=true ",
        admin_port=None,
        events={
            "(?i)Enter the current master password.*": "changeit\n",
            "(?i)Enter the new master password.*": app.get_glassfish_master_password() + "\n",
            "(?i)Enter the new master password again.*": app.get_glassfish_master_password() + "\n"
        }
    )

    asadmin_exec("start-domain ")

    # Change admin password
    asadmin_exec(
        "change-admin-password",
        admin_port=None,
        events={
            "(?i)Enter admin user name.*": "admin\n",
            "(?i)Enter the admin password.*": "\n",
            "(?i)Enter the new admin password.*": app.get_glassfish_admin_password() + "\n",
            "(?i)Enter the new admin password again.*": app.get_glassfish_admin_password() + "\n"
        }
    )

    # Stores login info for glassfish user in /home/glassfish/.asadminpass
    asadmin_exec(
        "login",
        events={
            "Enter admin user name.*": "admin\n",
            "Enter admin password.*": app.get_glassfish_admin_password() + "\n"
        }
    )

    # Enabling admin on port 4848 from external ip
    asadmin_exec(
        " --host 127.0.0.1 --port 4848 enable-secure-admin",
        events={
            "Enter admin user name.*": "admin\n",
            "Enter admin password.*": app.get_glassfish_admin_password() + "\n"
        }
    )
Esempio n. 9
0
def _set_domain_passwords(domain_name, admin_port):
  '''
  Security configuration

  '''
  asadmin_exec("stop-domain " + domain_name)

  # Change master password, default=empty
  asadmin_exec("change-master-password --savemasterpassword=true " + domain_name,
    admin_port=None,
    events={
      "(?i)Enter the current master password.*": "changeit\n",
      "(?i)Enter the new master password.*": app.get_glassfish_master_password() + "\n",
      "(?i)Enter the new master password again.*": app.get_glassfish_master_password() + "\n"
    }
  )

  # Create new cert for https
  os.chdir(GLASSFISH_DOMAINS_PATH + domain_name + "/config/")
  x("keytool -delete -alias s1as -keystore keystore.jks -storepass '" + app.get_glassfish_master_password() +"'", user="******")
  x(
    'keytool -keysize 2048 -genkey -alias s1as -keyalg RSA -dname "' +
    'CN=' + config.general.get_organization_name() +
    ',O=' + config.general.get_organization_name() +
    ',L=' + config.general.get_locality() +
    ',S=' + config.general.get_state() +
    ',C=' + config.general.get_country_name() +
    '" -validity 3650' +
    " -keypass '" + app.get_glassfish_master_password() + "'" +
    ' -keystore keystore.jks' +
    " -storepass '" + app.get_glassfish_master_password() + "'",
    user="******"
  )
  x("keytool -list -keystore keystore.jks -storepass '" + app.get_glassfish_master_password() + "'", user="******")

  asadmin_exec("start-domain " + domain_name)

  # Change admin password
  asadmin_exec(" change-admin-password",
    admin_port,
    events={
      '(?i)Enter admin user name \[default: admin\]> ': "admin\n",
      '(?i)Enter admin password> ': "\n",
      '(?i)Enter new admin password> ': app.get_glassfish_admin_password() + "\n",
      '(?i)Enter new admin password again> ': app.get_glassfish_admin_password() + "\n"
    }
  )

  # Stores login info for glassfish user in /home/glassfish/.asadminpass
  asadmin_exec("login",
    admin_port,
    events={
      "Enter admin user name \[default: admin\]> ": "admin\n",
      "Enter admin password> ": app.get_glassfish_admin_password() + "\n"
    }
  )
Esempio n. 10
0
def passwords(args):
  app.print_verbose("Set all passwords used by syco")
  app.init_all_passwords()
  print "root: ", app.get_root_password()
  print "svn: ", app.get_svn_password()
  print "ldap_admin: ", app.get_ldap_admin_password()
  print "ldap_sssd: ", app.get_ldap_sssd_password()
  print "glassfish_master: ", app.get_glassfish_master_password()
  print "glassfish_admin: ", app.get_glassfish_admin_password()
  print "glassfish_user: "******"glassfish")
  print "mysql_root: ", app.get_mysql_root_password()
  print "mysql_int: ", app.get_mysql_integration_password()
  print "mysql_stable: ", app.get_mysql_stable_password()
  print "mysql_uat: ", app.get_mysql_uat_password()
  print "mysql_prod: ", app.get_mysql_production_password()
Esempio n. 11
0
def _set_domain_passwords(domain_name, admin_port):
  '''
  Security configuration

  '''
  asadmin_exec("stop-domain " + domain_name)

  # Change master password, default=empty
  asadmin_exec("change-master-password --savemasterpassword=true " + domain_name,
    admin_port=None,
    events={
      "(?i)Enter the current master password.*": "changeit\n",
      "(?i)Enter the new master password.*": app.get_glassfish_master_password() + "\n",
      "(?i)Enter the new master password again.*": app.get_glassfish_master_password() + "\n"
    }
  )

  # Create new cert for https
  os.chdir(GLASSFISH_DOMAINS_PATH + domain_name + "/config/")
  x("keytool -delete -alias s1as -keystore keystore.jks -storepass '" + app.get_glassfish_master_password() +"'", user="******")
  x(
    'keytool -keysize 2048 -genkey -alias s1as -keyalg RSA -dname "' +
    'CN=' + config.general.get_organization_name() +
    ',O=' + config.general.get_organization_name() +
    ',L=' + config.general.get_locality() +
    ',S=' + config.general.get_state() +
    ',C=' + config.general.get_country_name() +
    '" -validity 3650' +
    " -keypass '" + app.get_glassfish_master_password() + "'" +
    ' -keystore keystore.jks' +
    " -storepass '" + app.get_glassfish_master_password() + "'",
    user="******"
  )
  x("keytool -list -keystore keystore.jks -storepass '" + app.get_glassfish_master_password() + "'", user="******")

  asadmin_exec("start-domain " + domain_name)

  # Change admin password
  asadmin_exec(" change-admin-password",
    admin_port,
    events={
      '(?i)Enter admin user name \[default: admin\]> ': "admin\n",
      '(?i)Enter admin password> ': "\n",
      '(?i)Enter new admin password> ': app.get_glassfish_admin_password() + "\n",
      '(?i)Enter new admin password again> ': app.get_glassfish_admin_password() + "\n"
    }
  )

  # Stores login info for glassfish user in /home/glassfish/.asadminpass
  asadmin_exec("login",
    admin_port,
    events={
      "Enter admin user name \[default: admin\]> ": "admin\n",
      "Enter admin password> ": app.get_glassfish_admin_password() + "\n"
    }
  )
Esempio n. 12
0
def passwords(args):
    app.print_verbose("Set all passwords used by syco")
    app.init_all_passwords()
    print "root: ", app.get_root_password()
    print "svn: ", app.get_svn_password()
    print "ldap_admin: ", app.get_ldap_admin_password()
    print "ldap_sssd: ", app.get_ldap_sssd_password()
    print "glassfish_master: ", app.get_glassfish_master_password()
    print "glassfish_admin: ", app.get_glassfish_admin_password()
    print "glassfish_user: "******"glassfish")
    print "mysql_root: ", app.get_mysql_root_password()
    print "mysql_int: ", app.get_mysql_integration_password()
    print "mysql_stable: ", app.get_mysql_stable_password()
    print "mysql_uat: ", app.get_mysql_uat_password()
    print "mysql_prod: ", app.get_mysql_production_password()
    print "mysql_backup: ", app.get_mysql_backup_password()
    print "mysql_monitor: ", app.get_mysql_monitor_password()
    print "switch_icmp: ", app.get_switch_icmp_password()
Esempio n. 13
0
def _set_domain_passwords():
    """Security configuration"""
    asadmin_exec("stop-domain")

    # Change master password, default=empty
    asadmin_exec("change-master-password --savemasterpassword=true ",
                 admin_port=None,
                 events={
                     "(?i)Enter the current master password.*":
                     "changeit\n",
                     "(?i)Enter the new master password.*":
                     app.get_glassfish_master_password() + "\n",
                     "(?i)Enter the new master password again.*":
                     app.get_glassfish_master_password() + "\n"
                 })
    #The following custom cert creation didnt work, causing internal server error when login to glassfish. javax.net.ssl.SSLHandshakeException:
    # sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
    # unable to find valid certification path to requested target
    # Create new cert for https
    #    os.chdir("/usr/local/glassfish4/glassfish/domains/domain1/config/")
    #    x("keytool -delete -alias s1as -keystore keystore.jks -storepass '" + app.get_glassfish_master_password() + "'", user="******")
    #    x(
    #        'keytool -keysize 2048 -genkey -alias s1as -keyalg RSA -dname "' +
    #        'CN=' + config.general.get_organization_name() +
    #        ',O=' + config.general.get_organization_name() +
    #        ',L=' + config.general.get_locality() +
    #        ',S=' + config.general.get_state() +
    #        ',C=' + config.general.get_country_name() +
    #        '" -validity 3650' +
    #        " -keypass '" + app.get_glassfish_master_password() + "'" +
    #        ' -keystore keystore.jks' +
    #        " -storepass '" + app.get_glassfish_master_password() + "'",
    #        user="******"
    #    )

    #
    asadmin_exec("start-domain ")

    # Change admin password
    asadmin_exec("change-admin-password",
                 admin_port=None,
                 events={
                     "(?i)Enter admin user name.*":
                     "admin\n",
                     "(?i)Enter the admin password.*":
                     "\n",
                     "(?i)Enter the new admin password.*":
                     app.get_glassfish_admin_password() + "\n",
                     "(?i)Enter the new admin password again.*":
                     app.get_glassfish_admin_password() + "\n"
                 })

    # Stores login info for glassfish user in /home/glassfish/.asadminpass
    asadmin_exec("login",
                 events={
                     "Enter admin user name.*":
                     "admin\n",
                     "Enter admin password.*":
                     app.get_glassfish_admin_password() + "\n"
                 })

    # Enabling admin on port 4848 from external ip
    asadmin_exec(" --host 127.0.0.1 --port 4848 enable-secure-admin",
                 events={
                     "Enter admin user name.*":
                     "admin\n",
                     "Enter admin password.*":
                     app.get_glassfish_admin_password() + "\n"
                 })
    asadmin_exec("stop-domain ")
    asadmin_exec("start-domain ")
Esempio n. 14
0
def _set_domain_passwords():
    """Security configuration"""
    asadmin_exec("stop-domain")

    # Change master password, default=empty
    asadmin_exec(
        "change-master-password --savemasterpassword=true ",
        admin_port=None,
        events={
            "(?i)Enter the current master password.*": "changeit\n",
            "(?i)Enter the new master password.*": app.get_glassfish_master_password() + "\n",
            "(?i)Enter the new master password again.*": app.get_glassfish_master_password() + "\n"
        }
    )
#The following custom cert creation didnt work, causing internal server error when login to glassfish. javax.net.ssl.SSLHandshakeException:
# sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
# unable to find valid certification path to requested target
    # Create new cert for https
#    os.chdir("/usr/local/glassfish4/glassfish/domains/domain1/config/")
#    x("keytool -delete -alias s1as -keystore keystore.jks -storepass '" + app.get_glassfish_master_password() + "'", user="******")
#    x(
#        'keytool -keysize 2048 -genkey -alias s1as -keyalg RSA -dname "' +
#        'CN=' + config.general.get_organization_name() +
#        ',O=' + config.general.get_organization_name() +
#        ',L=' + config.general.get_locality() +
#        ',S=' + config.general.get_state() +
#        ',C=' + config.general.get_country_name() +
#        '" -validity 3650' +
#        " -keypass '" + app.get_glassfish_master_password() + "'" +
#        ' -keystore keystore.jks' +
#        " -storepass '" + app.get_glassfish_master_password() + "'",
#        user="******"
#    )

    #
    x("keytool -delete -alias gtecybertrust5ca -keystore cacerts.jks -storepass '" + app.get_glassfish_master_password() +"'")

    asadmin_exec("start-domain ")

    # Change admin password
    asadmin_exec(
        "change-admin-password",
        admin_port=None,
        events={
            "(?i)Enter admin user name.*": "admin\n",
            "(?i)Enter the admin password.*": "\n",
            "(?i)Enter the new admin password.*": app.get_glassfish_admin_password() + "\n",
            "(?i)Enter the new admin password again.*": app.get_glassfish_admin_password() + "\n"
        }
    )

    # Stores login info for glassfish user in /home/glassfish/.asadminpass
    asadmin_exec(
        "login",
        events={
            "Enter admin user name.*": "admin\n",
            "Enter admin password.*": app.get_glassfish_admin_password() + "\n"
        }
    )

    # Enabling admin on port 4848 from external ip
    asadmin_exec(
        " --host 127.0.0.1 --port 4848 enable-secure-admin",
        events={
            "Enter admin user name.*": "admin\n",
            "Enter admin password.*": app.get_glassfish_admin_password() + "\n"
        }
    )
    asadmin_exec("stop-domain ")
    asadmin_exec("start-domain ")