Ejemplo n.º 1
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'pass='******'-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Moodle Password",
            "Enter new password for the Moodle 'admin' account.")

    salt = _get_passwordsalt()
    hashpass = hashlib.md5((password + salt).encode('utf8')).hexdigest()

    m = MySQL()
    m.execute('UPDATE moodle.user SET password=%s WHERE username=\"admin\";',
              (hashpass, ))
Ejemplo n.º 2
0
def main():
    signal.signal(signal.SIGINT, signal.SIG_IGN)
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "hp:", ['help', 'pass='******'-h', '--help'):
            usage()
        elif opt in ('-p', '--pass'):
            password = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "%s Password" % username.capitalize(),
            "Please enter new password for the %s user account. This password"
            " will also be used for the Sempahore 'admin' user." % username)

    command = ["chpasswd"]
    input = ":".join([username, password])

    salt = bcrypt.gensalt()
    hashpass = bcrypt.hashpw(password.encode('utf8'), salt).decode('utf8')

    m = MySQL()
    m.execute('UPDATE semaphore.user SET password=%s WHERE id=1;',
              (hashpass, ))

    p = subprocess.Popen(command, stdin=PIPE, shell=False)
    p.stdin.write(input.encode())
    p.stdin.close()
    err = p.wait()
    if err:
        fatal(err)
    """use ssh-keygen to create an rsa key pair using the same password"""
    subprocess.call([
        'su', username, '-c',
        'ssh-keygen -q -b 4096 -t rsa -f $HOME/.ssh/id_rsa -N %s' %
        pipes.quote(password)
    ])
    if err:
        fatal(err)
Ejemplo n.º 3
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'domain='])
    except getopt.GetoptError as e:
        usage(e)

    password = ""
    domain = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--domain':
            domain = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "SuiteCRM Password",
            "Enter new password for the SuiteCRM 'admin' account.")

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "SuiteCRM Domain",
            "Enter the domain to serve SuiteCRM.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    with open('/var/www/suitecrm/config.php', 'r') as fob:
        filedata = fob.read()
        filedata = filedata.replace('http://127.0.0.1', domain)
    with open('/var/www/suitecrm/config.php', 'w') as fob:
        fob.write(filedata)

    hash_pass = hashlib.md5(password.encode('utf8')).hexdigest()

    m = MySQL()
    m.execute('UPDATE suitecrm.users SET user_hash=%s WHERE user_name=\"admin\";', (hash_pass,))
Ejemplo n.º 4
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email=', 'domain='])
    except getopt.GetoptError as e:
        usage(e)

    email = ""
    domain = ""
    password = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val
        elif opt == '--domain':
            domain = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "PHPlist Password",
            "Enter new password for the PHPlist 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "PHPlist Email",
            "Enter email address for the PHPlist 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "PHPlist Domain",
            "Enter the domain to serve PHPlist.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    inithooks_cache.write('APP_DOMAIN', domain)

    m = MySQL()
    m.execute('UPDATE phplist.admin SET password=%s WHERE loginname=\"admin\";', (password,))
    m.execute('UPDATE phplist.admin SET email=%s WHERE loginname=\"admin\";', (email,))
    m.execute('UPDATE phplist.config SET value=%s WHERE item=\"website\";', (domain,))
Ejemplo n.º 5
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email='])
    except getopt.GetoptError as e:
        usage(e)

    password = ""
    email = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Redmine Password",
            "Enter new password for the Redmine 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Redmine Email",
            "Enter email address for the Redmine 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    salt = "".join(random.choice(string.ascii_letters) for line in range(16))
    pw_with_salt = salt + hashlib.sha1(password.encode('utf-8')).hexdigest()
    hashpass = hashlib.sha1(pw_with_salt.encode('utf-8')).hexdigest()
    user_id = 1

    m = MySQL()
    m.execute(
        'UPDATE redmine_production.email_addresses SET address=\"%s\" WHERE user_id=%i;'
        % (email, user_id))
    m.execute(
        'UPDATE redmine_production.users SET salt=\"%s\" WHERE login=\"admin\" AND id=%i;'
        % (salt, user_id))
    m.execute(
        'UPDATE redmine_production.users SET hashed_password=\"%s\" WHERE login=\"admin\" AND id = %i;'
        % (hashpass, user_id))
Ejemplo n.º 6
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'pass='******'-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Zoneminder Password",
            "Enter new password for the Zoneminder 'admin' account.")

    m = MySQL()
    m.execute(
        'UPDATE zm.Users SET Password=PASSWORD(%s) WHERE Username=\"admin\";',
        (password, ))
Ejemplo n.º 7
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email='])
    except getopt.GetoptError as e:
        usage(e)

    email = ""
    password = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Invoice Ninja Password",
            "Enter new password for the Invoice Ninja 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Invoice Ninja Email",
            "Enter email address for the Invoice Ninja 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    salt = bcrypt.gensalt()
    hashpass = bcrypt.hashpw(password.encode('utf8'), salt).decode('utf8')

    m = MySQL()
    m.execute('UPDATE ninja.users SET password=%s WHERE id=1;', (hashpass, ))
    m.execute('UPDATE ninja.users SET username=%s WHERE id=1;', (email, ))
    m.execute('UPDATE ninja.users SET email=%s WHERE id=1;', (email, ))
Ejemplo n.º 8
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email='])
    except getopt.GetoptError as e:
        usage(e)

    password = ""
    email = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Joomla Password",
            "Enter new password for the Joomla 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Joomla Email",
            "Enter email address for the Joomla 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    salt_chars = string.ascii_letters + string.digits
    salt = "".join(random.choice(salt_chars) for c in range(32))
    cryptpass = "******" % (hashlib.md5(
        (password + salt).encode('utf8')).hexdigest(), salt)

    m = MySQL()
    m.execute('UPDATE joomla.jos_users SET email=%s WHERE username=\"admin\";',
              (email, ))
    m.execute(
        'UPDATE joomla.jos_users SET password=%s WHERE username=\"admin\";',
        (cryptpass, ))
Ejemplo n.º 9
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email='])
    except getopt.GetoptError as e:
        usage(e)

    email = ""
    password = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "GNU social Password",
            "Enter new password for the GNU Social 'administrator' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "GNU social Email",
            "Please enter email address for the GNU Social 'administrator' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    hashpass = crypt.crypt(password, crypt.METHOD_SHA512)

    m = MySQL()
    m.execute(
        'UPDATE gnusocial.user SET email=%s WHERE nickname=\"administrator\";',
        (email, ))
    m.execute(
        'UPDATE gnusocial.user SET password=%s WHERE nickname=\"administrator\";',
        (hashpass, ))
Ejemplo n.º 10
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email='])
    except getopt.GetoptError as e:
        usage(e)

    password = ""
    email = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Mantis Password",
            "Enter new password for the Mantis 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Mantis Email",
            "Enter email address for the Mantis 'admin' account.",
            "*****@*****.**")

    hashpass = hashlib.md5(password.encode('utf8')).hexdigest()

    m = MySQL()
    m.execute(
        'UPDATE mantis.mantis_user_table SET email=%s WHERE username=\"admin\";',
        (email, ))
    m.execute(
        'UPDATE mantis.mantis_user_table SET password=%s WHERE username=\"admin\";',
        (hashpass, ))
Ejemplo n.º 11
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email='])
    except getopt.GetoptError as e:
        usage(e)

    password = ""
    email = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Wordpress Password",
            "Enter new password for the Wordpress 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Wordpress Email",
            "Please enter email address for the Wordpress 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)
    
    hashpass = hashlib.md5(password.encode('utf8')).hexdigest()

    m = MySQL()
    m.execute('UPDATE wordpress.wp_users SET user_email=\"%s\" WHERE user_nicename=\"admin\";' % email)
    m.execute('UPDATE wordpress.wp_users SET user_pass=\"%s\" WHERE user_nicename=\"admin\";' % hashpass)
Ejemplo n.º 12
0
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Kliqqi Password",
            "Enter new password for the Kliqqi 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Kliqqi Email",
            "Enter email address for the Kliqqi 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    salt = ''.join((random.choice(string.letters+string.digits) for x in range(9)))
    hash = salt + hashlib.sha1(salt + password).hexdigest()

    m = MySQL()
    m.execute('UPDATE kliqqi.users SET user_pass=\"%s\" WHERE user_login=\"admin\";' % hash)
    m.execute('UPDATE kliqqi.users SET user_email=\"%s\" WHERE user_login=\"admin\";' % email)

if __name__ == "__main__":
    main()

Ejemplo n.º 13
0
            "Magento Email",
            "Enter email address for the Magento 'admin' account.",
            "*****@*****.**")
    
    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "Magento Domain",
            "Enter the domain to serve Magento.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    hashpass = hashlib.md5("qX" + password).hexdigest() + ":qX"

    m = MySQL()
    m.execute('UPDATE magento.admin_user SET email=\"%s\" WHERE username=\"admin\";' % email)
    m.execute('UPDATE magento.admin_user SET password=\"%s\" WHERE username=\"admin\";' % hashpass)
    m.execute('UPDATE magento.core_config_data SET value=\"http://%s/\" WHERE path=\"web/unsecure/base_url\";' % (domain))
    m.execute('UPDATE magento.core_config_data SET value=\"https://%s/\" WHERE path=\"web/secure/base_url\";' % (domain))

    # delete cache so it will be rebuilt for new domain
    shutil.rmtree("/var/www/magento/var/cache", ignore_errors=True)

if __name__ == "__main__":
    main()

Ejemplo n.º 14
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'pass='******'-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "ZMUSER Password",
            "Enter new password for the ZMUSER database connection.")

    m = MySQL()
    m.execute('grant all on zm.* to zmuser@localhost identified by \"%s\";' %
              password)
    subprocess.call('/usr/lib/inithooks/bin/zoneminder.sh %s' %
                    (str(password)),
                    shell=True)


if __name__ == "__main__":
    main()
Ejemplo n.º 15
0
    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Drupal8 Password",
            "Enter new password for the Drupal8 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Drupal8 Email",
            "Enter email address for the Drupal8 'admin' account.",

            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    m = MySQL()
    m.execute('UPDATE drupal8.users_field_data SET mail=\"%s\" WHERE name=\"admin\";' % email)
    m.execute('UPDATE drupal8.users_field_data SET init=\"%s\" WHERE name=\"admin\";' % email)
    system("/usr/local/bin/drush -y config-set contact.form.feedback recipients %s" % email)
    system("/usr/local/bin/drush -y config-set update.settings notification.emails.0 %s" % email)
    system("/usr/local/bin/drush -y config-set system.site mail %s" % email)
    system("/usr/local/bin/drush cache-rebuild")
    system("/usr/local/bin/drush user-password admin --password='******'" % password)

if __name__ == "__main__":
    main()

Ejemplo n.º 16
0
        email = d.get_email(
            "Vanilla Email",
            "Enter email address for the Vanilla 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    command = ["php", join(dirname(__file__), 'vanilla_pass.php'), password]
    p = subprocess.Popen(command, stdin=PIPE, stdout=PIPE, shell=False)
    stdout, stderr = p.communicate()
    if stderr:
        fatal(stderr)

    cryptpass = stdout.strip()

    m = MySQL()
    m.execute(
        'UPDATE vanilla.GDN_User SET Password=\"%s\" WHERE Name=\"admin\";' %
        cryptpass)
    m.execute(
        'UPDATE vanilla.GDN_User SET Email=\"%s\" WHERE Name=\"admin\";' %
        email)

    CONFIG = "/var/www/vanilla/conf/config.php"
    old = file(CONFIG).read()
    new = re.sub("\['SupportAddress.*;", "['SupportAddress'] = '%s';" % email,
                 old)
    file(CONFIG, "w").write(new)


if __name__ == "__main__":
Ejemplo n.º 17
0
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Phreedom Password",
            "Enter new password for the Phreedom 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Phreedom Email",
            "Enter email address for the Phreedom 'admin' account.",
            "*****@*****.**")

    salt = ''.join((random.choice(string.letters+string.digits) for x in range(2)))
    hash = ':'.join([hashlib.md5(salt+password).hexdigest(), salt])

    m = MySQL()
    m.execute('UPDATE phreedom.users SET admin_pass=\"%s\" WHERE admin_name=\"admin\";' % hash)
    m.execute('UPDATE phreedom.users SET admin_email=\"%s\" WHERE admin_name=\"admin\";' % email)


if __name__ == "__main__":
    main()

Ejemplo n.º 18
0
    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Mambo Password",
            "Enter new password for the Mambo 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Mambo Email",
            "Enter email address for the Mambo 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    hash = hashlib.md5(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE mambo.users SET password=\"%s\" WHERE username=\"admin\";' % hash)
    m.execute('UPDATE mambo.users SET email=\"%s\" WHERE username=\"admin\";' % email)

    config = "/var/www/mambo/configuration.php"
    system("sed -i \"s|mailfrom =.*|mailfrom = '%s';|\" %s" % (email, config))


if __name__ == "__main__":
    main()

            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Wordpress Password",
            "Enter new password for the Wordpress 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Wordpress Email",
            "Please enter email address for the Wordpress 'admin' account.",
            "*****@*****.**")
    
    hashpass = hashlib.md5(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE wordpress.wp_users SET user_email=\"%s\" WHERE user_nicename=\"admin\";' % email)
    m.execute('UPDATE wordpress.wp_users SET user_pass=\"%s\" WHERE user_nicename=\"admin\";' % hashpass)

if __name__ == "__main__":
    main()

Ejemplo n.º 20
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'pass='******'-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "SugarCRM Password",
            "Enter new password for the SugarCRM 'admin' account.")

    hash_pass = hashlib.md5(password).hexdigest()

    m = MySQL()
    m.execute(
        'UPDATE sugarcrm.users SET user_hash=\"%s\" WHERE user_name=\"admin\";'
        % hash_pass)


if __name__ == "__main__":
    main()
Ejemplo n.º 21
0
Archivo: elgg.py Proyecto: iitians/elgg
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email=', 'domain='])
    except getopt.GetoptError as e:
        usage(e)

    email = ""
    domain = ""
    password = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val
        elif opt == '--domain':
            domain = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Elgg Password",
            "Enter new password for the Elgg 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Elgg Email", "Enter email address for the Elgg 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "Elgg Domain",
            "Enter the domain to serve Elgg. Note: Elgg does not support http without further configuration, domain will default to https.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    fqdn = re.compile(r"https?://")
    fqdn = fqdn.sub('', domain).strip('/')
    domain = ("https://%s/" % fqdn)

    inithooks_cache.write('APP_DOMAIN', fqdn)

    salt = bcrypt.gensalt(10)
    hashpass = bcrypt.hashpw(password.encode('utf8'), salt)

    m = MySQL()

    try:
        with m.connection.cursor() as cursor:
            cursor.execute(
                'SELECT guid FROM elgg.elgg_entities WHERE type="user" AND owner_guid="0"'
            )
            admin_guid = cursor.fetchone()['guid']
            cursor.execute(
                'SELECT name FROM elgg.elgg_metadata WHERE entity_guid=%s',
                (admin_guid, ))
            assert (cursor.fetchone()['name'])
            # sanity check, if this fails, look at the database. You'll probably need to update
            # all of this database stuff
            cursor.execute(
                'UPDATE elgg.elgg_metadata SET value=%s WHERE entity_guid=%s AND name="password_hash"',
                (
                    hashpass,
                    admin_guid,
                ))
            cursor.execute(
                'UPDATE elgg.elgg_metadata SET value=%s WHERE entity_guid=%s AND name="email"',
                (
                    email,
                    admin_guid,
                ))
            cursor.execute(
                'UPDATE elgg.elgg_metadata SET value=%s WHERE entity_guid=1 AND name="email"',
                (email, ))
            m.connection.commit()
    finally:
        m.connection.close()

    with open('/etc/cron.d/elgg', 'r') as fob:
        contents = fob.read()

    contents = re.sub("ELGG='.*'", "ELGG='%s'" % domain, contents)

    with open('/etc/cron.d/elgg', 'w') as fob:
        fob.write(contents)

    elgg_conf = "/var/www/elgg/elgg-config/settings.php"
    subprocess.run([
        "sed", "-i",
        '\|^\$CONFIG->wwwroot|s|=.*|= "%s";|' % domain.strip('/'), elgg_conf
    ])

    apache_conf = "/etc/apache2/sites-available/elgg.conf"
    subprocess.run([
        "sed", "-i",
        "\|RewriteRule|s|https://.*|https://%s/\$1 [R,L]|" % fqdn, apache_conf
    ])
    subprocess.run(
        ["sed", "-i",
         "\|RewriteCond|s|!^.*|!^%s$|" % fqdn, apache_conf])
    subprocess.run(["service", "apache2", "restart"])
Ejemplo n.º 22
0
            "Enter new password for the SilverStripe 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "SilverStripe Email",
            "Enter email address for the SilverStripe 'admin' account.",
            "*****@*****.**")

    salt = bcrypt.gensalt(10)
    hash = bcrypt.hashpw(password, salt)

    # munge the salt and hash, argh!
    _salt = salt[4:]
    _hash = "$2y$" + hash[4:]

    m = MySQL()
    m.execute('UPDATE silverstripe.Member SET Salt=\"%s\" WHERE ID=1;' % _salt)
    m.execute('UPDATE silverstripe.Member SET Password=\"%s\" WHERE ID=1;' % _hash)
    m.execute('UPDATE silverstripe.Member SET Email=\"%s\" WHERE ID=1;' % email)

    m.execute('UPDATE silverstripe.MemberPassword SET Salt=\"%s\" WHERE ID=1;' % _salt)
    m.execute('UPDATE silverstripe.MemberPassword SET Password=\"%s\" WHERE ID=1;' % _hash)


if __name__ == "__main__":
    main()

Ejemplo n.º 23
0
            "Enter email address for the ClipBucket 'admin' account.",
            "*****@*****.**")

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "ClipBucket Domain",
            "Enter the domain to serve ClipBucket.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    hash = clipbucket_hash(password)

    m = MySQL()
    m.execute('UPDATE clipbucket.users SET password=\"%s\", email=\"%s\" WHERE username=\"admin\";' % (hash, email))

    m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"support_email\";' % email)
    m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"website_email\";' % email)
    m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"welcome_email\";' % email)

    m.execute('UPDATE clipbucket.config SET value=\"http://%s\" WHERE name=\"baseurl\";' % domain)
    

if __name__ == "__main__":
    main()

Ejemplo n.º 24
0
    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "eZ Platform Password",
            "Enter new password for the eZ Platform 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "eZ Platform Email",
            "Enter email address for the eZ Platform 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)
    # tweak configuration files
    # calculate password hash and tweak database
    hash = hashlib.md5("admin\n%s" % password).hexdigest()

    m = MySQL()
    m.execute('UPDATE ezplatform.ezuser SET password_hash="%s" WHERE login="******";' % hash)
    m.execute('UPDATE ezplatform.ezuser SET email="%s" WHERE login="******";' % email)

    m.execute('UPDATE ezplatform.ezcontentobject_name SET name="TurnKey Linux eZ Platform" WHERE contentobject_id="1"')

if __name__ == "__main__":
    main()

Ejemplo n.º 25
0
    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "Elgg Domain",
            "Enter the domain to serve Elgg.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    domain = domain.strip("/")
    if not domain.startswith("http://"):
        domain = "http://%s/" % domain

    salt = "".join(random.choice(string.letters) for line in range(8))
    hashpass = hashlib.md5(password + salt).hexdigest()

    m = MySQL()
    m.execute('UPDATE elgg.elgg_users_entity SET salt=\"%s\" WHERE username=\"admin\";' % salt)
    m.execute('UPDATE elgg.elgg_users_entity SET password=\"%s\" WHERE username=\"admin\";' % hashpass)
    m.execute('UPDATE elgg.elgg_users_entity SET email=\"%s\" WHERE username=\"admin\";' % email)

    m.execute('UPDATE elgg.elgg_metastrings SET string=\"%s\" WHERE string LIKE \"%%@%%\";' % email)
    m.execute('UPDATE elgg.elgg_sites_entity SET url=\"%s\" WHERE url LIKE \"http://%%\";' % domain)

if __name__ == "__main__":
    main()

Ejemplo n.º 26
0
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "b2evolution Password",
            "Enter new password for the b2evolution 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "b2evolution Email",
            "Enter email address for the b2evolution 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    hash = hashlib.md5(password).hexdigest()

    m = MySQL()
    for username in ('admin', 'ablogger', 'demouser'):
        m.execute('UPDATE b2evolution.users SET user_pass=\"%s\", user_email=\"%s\", user_unsubscribe_key=\"%s\" WHERE user_login=\"%s\";' % (hash, email, randomkey(), username))


if __name__ == "__main__":
    main()

Ejemplo n.º 27
0
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Concrete5 Email",
            "Enter email address for the Concrete5 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    salt = ''
    config = '/var/www/concrete5/config/site.php'
    for s in file(config).readlines():
        s = s.strip()
        m = re.match("define\('PASSWORD_SALT', '(.*)'\);", s)
        if m:
            salt = m.group(1)
            break

    if not salt:
        usage("Could not identify salt from: %s" % config)

    hashpass = hashlib.md5(':'.join([password, salt])).hexdigest()

    m = MySQL()
    m.execute('UPDATE concrete5.Users SET uPassword=\"%s\" WHERE uName=\"admin\";' % hashpass)
    m.execute('UPDATE concrete5.Users SET uEmail=\"%s\" WHERE uName=\"admin\";' % email)

if __name__ == "__main__":
    main()

Ejemplo n.º 28
0
    sed("AdminEmail=", email, conf)

    conf = "/var/www/ezpublish/settings/siteaccess/site/site.ini.append.php"
    sed("SiteURL=", domain, conf)
    sed("ActionURL=", "http://%s/index.php/site_admin/user/login" % domain, conf)
    sed("AdminEmail=", email, conf)

    conf = "/var/www/ezpublish/settings/siteaccess/site_admin/site.ini.append.php"
    sed("SiteURL=", domain, conf)
    sed("AdminEmail=", email, conf)

    conf = "/var/www/ezpublish/settings/override/site.ini.append.php"
    sed("AdminEmail=", email, conf)
    
    # calculate password hash and tweak database
    hash = hashlib.md5("admin\n%s" % password).hexdigest()

    m = MySQL()
    m.execute('UPDATE ezpublish.ezuser SET password_hash=\"%s\" WHERE login=\"admin\";' % hash)
    m.execute('UPDATE ezpublish.ezuser SET email=\"%s\" WHERE login=\"admin\";' % email)

    m.execute('UPDATE ezpublish.ezcontentobject_attribute SET data_text=\"%s\" WHERE id=175;' % email)
    m.execute('UPDATE ezpublish.ezcontentobject_attribute SET data_text=\"%s\" WHERE id=176;' % domain)

    # clear cache
    system("cd /var/www/ezpublish; su www-data -c \"php5 bin/php/ezcache.php --quiet --clear-all --purge\"")

if __name__ == "__main__":
    main()

Ejemplo n.º 29
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email=', 'domain='])
    except getopt.GetoptError as e:
        usage(e)

    password = ""
    email = ""
    domain = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val
        elif opt == '--domain':
            domain = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')

        password = d.get_password(
            "OpenCart Password",
            "Enter new password for the OpenCart 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "OpenCart Email",
            "Enter email address for the OpenCart 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')
        domain = d.get_input("OpenCart domain",
                             "Enter domain to serve OpenCart", DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    inithooks_cache.write('APP_DOMAIN', domain)

    def php_uniqid(prefix=''):
        return prefix + hex(int(time.time()))[2:10] + hex(
            int(time.time() * 1000000) % 0x100000)[2:7]

    subprocess.run([
        "sed", "-ri",
        "s|('HTTP(S?)_SERVER',) '.*'|\\1 'http\\L\\2://%s/'|g" % domain,
        "/var/www/opencart/config.php"
    ])
    subprocess.run([
        "sed", "-ri",
        "s|('HTTP(S?)_SERVER',) '.*'|\\1 'http\\L\\2://%s/admin/'|g" % domain,
        "/var/www/opencart/admin/config.php"
    ])
    subprocess.run([
        "sed", "-ri",
        "s|('HTTP(S?)_CATALOG',) '.*'|\\1 'http\\L\\2://%s/'|g" % domain,
        "/var/www/opencart/admin/config.php"
    ])
    salt = hashlib.md5(
        php_uniqid(str(randint(100000000,
                               999999999))).encode('utf8')).hexdigest()[:9]

    apache_conf = "/etc/apache2/sites-available/opencart.conf"
    subprocess.run([
        "sed", "-i",
        "\|RewriteRule|s|https://.*|https://%s/\$1 [R,L]|" % domain,
        apache_conf
    ])
    subprocess.run(
        ["sed", "-i",
         "\|RewriteCond|s|!^.*|!^%s$|" % domain, apache_conf])
    subprocess.run(["service", "apache2", "restart"])

    password_hash = hashlib.sha1(password.encode('utf8')).hexdigest()
    password_hash = hashlib.sha1(
        (salt + password_hash).encode('utf8')).hexdigest()
    password_hash = hashlib.sha1(
        (salt + password_hash).encode('utf8')).hexdigest()

    m = MySQL()
    m.execute('UPDATE opencart.oc_user SET email=%s WHERE username="******"',
              (email, ))
    m.execute('UPDATE opencart.oc_user SET password=%s WHERE username="******"',
              (password_hash, ))
    m.execute('UPDATE opencart.oc_user SET salt=%s WHERE username="******"',
              (salt, ))
Ejemplo n.º 30
0
    if not email:
        d = Dialog('TurnKey Linux - First boot configuration')
        email = d.get_email(
            "Bugzilla Email",
            "Enter email address for the Bugzilla 'admin' account.",
            "*****@*****.**")

    if not password:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        password = d.get_password(
            "Bugzilla Password",
            "Enter new password for the Bugzilla '%s' account." % email)

    command = [join(dirname(__file__), 'bz_crypt.pl'), password]
    p = subprocess.Popen(command, stdin=PIPE, stdout=PIPE, shell=False)
    stdout, stderr = p.communicate()
    if stderr:
        fatal(stderr)

    cryptpass = stdout.strip()

    m = MySQL()
    m.execute('UPDATE bugzilla.profiles SET cryptpassword=\"%s\" WHERE userid=\"1\";' % cryptpass)
    m.execute('UPDATE bugzilla.profiles SET login_name=\"%s\" WHERE userid=\"1\";' % email)

if __name__ == "__main__":
    main()

Ejemplo n.º 31
0
        domain = d.get_input(
            "PrestaShop Domain",
            "Enter the domain to serve Prestashop.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    inithooks_cache.write('APP_DOMAIN', domain)

    for line in file('/var/www/prestashop/config/settings.inc.php').readlines():
        m = re.match("define\('_COOKIE_KEY_', '(.*)'", line.strip())
        if m:
            cookie_key = m.group(1)

    hashpass = hashlib.md5(cookie_key + password).hexdigest()

    m = MySQL()
    m.execute('UPDATE prestashop.ps_employee SET email=\"%s\" WHERE id_employee=\"1\";' % email)
    m.execute('UPDATE prestashop.ps_employee SET passwd=\"%s\" WHERE id_employee=\"1\";' % hashpass)
    m.execute('UPDATE prestashop.ps_configuration SET value=\"%s\" WHERE name=\"PS_SHOP_DOMAIN\";' % domain)
    m.execute('UPDATE prestashop.ps_configuration SET value=\"%s\" WHERE name=\"PS_SHOP_DOMAIN_SSL\";' % domain)
    m.execute('UPDATE prestashop.ps_shop_url SET domain=\"%s\" WHERE id_shop_url=\"1\";' % domain)
    m.execute('UPDATE prestashop.ps_shop_url SET domain_ssl=\"%s\" WHERE id_shop_url=\"1\";' % domain)



if __name__ == "__main__":
    main()

Ejemplo n.º 32
0
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "SimpleInvoices Password",
            "Enter new password for the 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "SimpleInvoices Email",
            "Enter email address for the 'admin' account.",
            "*****@*****.**")

    hash = hashlib.md5(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE simpleinvoices.si_user SET password=\"%s\" WHERE id=1;' % hash)
    m.execute('UPDATE simpleinvoices.si_user SET email=\"%s\" WHERE id=1;' % email)


if __name__ == "__main__":
    main()

Ejemplo n.º 33
0
    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "GNU social Password",
            "Enter new password for the GNU Social 'administrator' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "GNU social Email",
            "Please enter email address for the GNU Social 'administrator' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    hashpass = hashlib.md5(password + '1').hexdigest()  # userid

    m = MySQL()
    m.execute(
        'UPDATE gnusocial.user SET email=\"%s\" WHERE nickname=\"administrator\";'
        % email)
    m.execute(
        'UPDATE gnusocial.user SET password=\"%s\" WHERE nickname=\"administrator\";'
        % hashpass)


if __name__ == "__main__":
    main()
Ejemplo n.º 34
0
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Tracks Password",
            "Enter new password for the Tracks 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Tracks Email",
            "Enter email address for the Tracks 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    hashpass = bcrypt.hashpw(password, bcrypt.gensalt(prefix=b"2a"))
    token = hashlib.sha1(os.urandom(128)).hexdigest()

    m = MySQL()
    m.execute(
        'UPDATE tracks_production.users SET crypted_password="******", token="%s" WHERE login="******";'
        % (hashpass, token))

    config = "/var/www/tracks/config/site.yml"
    system('sed -i "/^admin_email/s|: .*$|: %s|" %s' % (email, config))


if __name__ == "__main__":
    main()
Ejemplo n.º 35
0
    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Rhodecode Email",
            "Enter email address for the Rhodecode 'admin' account.",
            "*****@*****.**")
    
    # salt = "".join(random.choice(string.letters) for line in range(16))
    hashpass = bcrypt.hashpw(password, bcrypt.gensalt(10))

    salt = _RandomNameSequence().next()
    admin_apikey = hashlib.sha1('admin' + salt).hexdigest()
    salt = _RandomNameSequence().next()
    default_apikey = hashlib.sha1('default' + salt).hexdigest()

    m = MySQL()
    m.execute('UPDATE rhodecode.users SET email=\"%s\" WHERE username=\"admin\";' % email)
    m.execute('UPDATE rhodecode.users SET password=\"%s\" WHERE username=\"admin\";' % hashpass)
    m.execute('UPDATE rhodecode.users SET api_key=\"%s\" WHERE username=\"admin\";' % admin_apikey)
    m.execute('UPDATE rhodecode.users SET api_key=\"%s\" WHERE username=\"default\";' % default_apikey)

    script = os.path.join(os.path.dirname(__file__), 'rhodecode-reinit.sh')
    os.system(script)

if __name__ == "__main__":
    main()

Ejemplo n.º 36
0
        if opt in ("-h", "--help"):
            usage()
        elif opt == "--pass":
            password = val
        elif opt == "--email":
            email = val

    if not password:
        d = Dialog("TurnKey Linux - First boot configuration")
        password = d.get_password("ProcessMaker Password", "Enter new password for the ProcessMaker 'admin' account.")

    if not email:
        if "d" not in locals():
            d = Dialog("TurnKey Linux - First boot configuration")

        email = d.get_email(
            "ProcessMaker Email", "Enter email address for the ProcessMaker 'admin' account.", "*****@*****.**"
        )

    hashpass = hashlib.md5(password).hexdigest()

    m = MySQL()

    for database in ("wf_workflow", "rb_workflow"):
        m.execute('UPDATE %s.USERS SET USR_PASSWORD="******" WHERE USR_USERNAME="******";' % (database, hashpass))
        m.execute('UPDATE %s.USERS SET USR_EMAIL="%s" WHERE USR_USERNAME="******";' % (database, email))


if __name__ == "__main__":
    main()
Ejemplo n.º 37
0
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Zoneminder Password",
            "Enter new password for the Zoneminder 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Zoneminder Email",
            "Enter email address for the Zoneminder alerts.",

            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)




    m = MySQL()
    hash=m.execute('')
    m.execute('UPDATE zm.Users SET Password=PASSWORD(\"%s\") WHERE Username=\"admin\";' % password )
    m.execute('UPDATE zm.Config SET Value=\"%s\" WHERE Name=\"ZM_EMAIL_ADDRESS\";' % email)

if __name__ == "__main__":
    main()
Ejemplo n.º 38
0
    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "iceScrum Domain",
            "Enter the domain to serve iceScrum.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    hash = hashlib.sha256(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE icescrum.icescrum2_user SET passwd=\"%s\" WHERE username=\"admin\";' % hash)
    m.execute('UPDATE icescrum.icescrum2_user SET email=\"%s\" WHERE username=\"admin\";' % email)

    config = "/etc/icescrum/config.groovy"
    system("sed -i \"s|serverURL =.*|serverURL = \\\"http://%s\\\"|\" %s" % (domain, config))

    # restart tomcat if running so changes will take effect
    try:
        system("/etc/init.d/tomcat7 status >/dev/null")
        system("/etc/init.d/tomcat7 restart")
    except:
        pass


if __name__ == "__main__":
Ejemplo n.º 39
0
            "*****@*****.**")

    if not password:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        password = d.get_password(
            "Vtiger Password",
            "Enter new password for the Vtiger 'admin' account.")


    hashpass = hashlib.md5(password).hexdigest()

    command = ["php", join(dirname(__file__), 'vt_crypt.php'), "admin", password]
    p = subprocess.Popen(command, stdin=PIPE, stdout=PIPE, shell=False)
    stdout, stderr = p.communicate()
    if stderr:
        fatal(stderr)

    cryptpass = stdout.strip()

    m = MySQL()
    m.execute('UPDATE vtigercrm.vtiger_users SET email1=\"%s\" WHERE user_name=\"admin\";' % email)
    m.execute('UPDATE vtigercrm.vtiger_users SET user_hash=\"%s\" WHERE user_name=\"admin\";' % hashpass)
    m.execute('UPDATE vtigercrm.vtiger_users SET user_password=\"%s\" WHERE user_name=\"admin\";' % cryptpass)


if __name__ == "__main__":
    main()

Ejemplo n.º 40
0
            "Enter new password for the ProjectPier 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "ProjectPier Email",
            "Please enter email address for the ProjectPier 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    pos = random.randrange(25)
    salt = hashlib.sha1(str(uuid.uuid4())).hexdigest()[pos:pos+13]

    token = hashlib.sha1(salt + password).hexdigest()

    x = [str(i) for i in range(10)]
    random.shuffle(x)
    twister = ''.join(x)

    m = MySQL()
    m.execute('UPDATE projectpier.users SET email = "%s", token = "%s", salt = "%s", twister = "%s", updated_on = NOW() WHERE id = 1;' % (email, token, salt, twister))
    m.execute('UPDATE projectpier.contacts SET email="%s", updated_on=NOW() WHERE user_id = 1;')

if __name__ == "__main__":
    main()


Ejemplo n.º 41
0
            "Enter the domain to serve Elgg. Note: Elgg does not support http without further configuration, domain will default to https.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    fqdn = re.compile(r"https?://")
    fqdn = fqdn.sub('', domain).strip('/')
    domain = "https://%s/" % fqdn

    inithooks_cache.write('APP_DOMAIN', fqdn)

    salt = bcrypt.gensalt(10) 
    hashpass = bcrypt.hashpw(password, salt)

    m = MySQL()
    m.execute('UPDATE elgg.elgg_users_entity SET password_hash=\"%s\" WHERE username=\"admin\";' % hashpass)

    m.execute('UPDATE elgg.elgg_users_entity SET email=\"%s\" WHERE username=\"admin\";' % email)

    m.execute('UPDATE elgg.elgg_metastrings SET string=\"%s\" WHERE string LIKE \"%%@%%\";' % email)
    m.execute('UPDATE elgg.elgg_sites_entity SET url=\"%s\" WHERE guid = 1;' % domain)

    with open('/etc/cron.d/elgg', 'r') as fob:
        contents = fob.read()

    contents = re.sub("ELGG='.*'", "ELGG='%s'" % domain, contents)

    with open('/etc/cron.d/elgg', 'w') as fob:
        fob.write(contents)
Ejemplo n.º 42
0
#    system("mv -f solr-ssl.pem /usr/local/solr/server/etc")

    # Solr - enable SSL.
#    system("echo 'SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks' >> /var/lib/solr/solr.in.sh")
#    system("echo 'SOLR_SSL_KEY_STORE_PASSWORD=%s' >> /var/lib/solr/solr.in.sh" % adminpass)
#    system("echo 'SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks' >> /var/lib/solr/solr.in.sh")
#    system("echo 'SOLR_SSL_TRUST_STORE_PASSWORD=%s' >> /var/lib/solr/solr.in.sh" % adminpass)
#    system("echo 'SOLR_SSL_NEED_CLIENT_AUTH=false' >> /var/lib/solr/solr.in.sh")
#    system("echo 'SOLR_SSL_WANT_CLIENT_AUTH=false' >> /var/lib/solr/solr.in.sh")
#    system("echo 'SOLR_SSL_OPTS=\"-Djavax.net.ssl.keyStore=etc/solr-ssl.keystore.jks -Djavax.net.ssl.trustStore=etc/solr-ssl.keystore.jks\"' >> /var/lib/solr/solr.in.sh")

    # Drupal - check change admin/password.
    try:
        pwd.getpwnam('admin')
        system("echo admin:%s | chpasswd" % adminpass)
        m = MySQL()
        m.execute('SET PASSWORD FOR drupal7@localhost = PASSWORD(%s) ;' % adminpass)
    except KeyError:
        system("useradd -g root -m -s /bin/bash admin")
        system("echo admin:%s | chpasswd" % adminpass)
        m = MySQL()
        m.execute('CREATE USER drupal7@localhost IDENTIFIED BY \"%s\";' % adminpass)

    # Drupal - check change cssadmin/password with toggle to create base site.
    try:
        # Check cssadmin exists with exception if not.
        pwd.getpwnam('cssadmin')

        # Change cssadmin password.
        system("echo cssadmin:%s | chpasswd" % adminpass)
Ejemplo n.º 43
0
        password = d.get_password(
            "LimeSurvey Password",
            "Enter new password for the LimeSurvey 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "LimeSurvey Email",
            "Enter email address for the LimeSurvey 'admin' account.",
            "*****@*****.**")

    hashpass = hashlib.sha256(password).hexdigest()

    m = MySQL()
    m.execute(
        'UPDATE limesurvey.users SET email=\"%s\" WHERE users_name=\"admin\";'
        % email)
    m.execute(
        'UPDATE limesurvey.users SET password=\"%s\" WHERE users_name=\"admin\";'
        % hashpass)

    # these settings don't exist until first login and browsing
    # just delete and recreate (supports re-initialization)
    m.execute(
        'DELETE FROM limesurvey.settings_global WHERE stg_name=\"siteadminemail\";'
    )
    m.execute(
        'DELETE FROM limesurvey.settings_global WHERE stg_name=\"siteadminbounce\";'
    )
Ejemplo n.º 44
0
        password = d.get_password(
            "ProcessMaker Password",
            "Enter new password for the ProcessMaker 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "ProcessMaker Email",
            "Enter email address for the ProcessMaker 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    hashpass = hashlib.md5(password).hexdigest()

    m = MySQL()

    for table in ('USERS', 'RBAC_USERS'):
        m.execute(
            'UPDATE wf_workflow.%s SET USR_PASSWORD=\"%s\" WHERE USR_USERNAME=\"admin\";'
            % (table, hashpass))
        m.execute(
            'UPDATE wf_workflow.%s SET USR_EMAIL=\"%s\" WHERE USR_USERNAME=\"admin\";'
            % (table, email))


if __name__ == "__main__":
    main()
Ejemplo n.º 45
0
            "ownCloud Password",
            "Enter new password for the ownCloud 'admin' account.")

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input("OwnCloud Domain",
                             "Enter the domain to serve OwnCloud.",
                             DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    # make sure MySQL is running when we call the OCServer hasher in owncloud_pass.php
    m = MySQL()

    command = ["php", join(dirname(__file__), 'owncloud_pass.php'), password]
    p = Popen(command, stdin=PIPE, stdout=PIPE)
    stdout, stderr = p.communicate()
    if stderr:
        fatal(stderr)

    cryptpass = stdout.strip()

    sedcom = """
        /0 => '127.0.0.1',/ a\
    '1' => '%s',
    """

    call(['sed', '-i', "/^'1' => /d", '/usr/share/owncloud/config/config.php'])
Ejemplo n.º 46
0
            "e107 Password",
            "Enter new password for the e107 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "e107 Email", "Enter email address for the e107 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    hash = hashlib.md5(password).hexdigest()
    timestamp = int(mktime(datetime.now().timetuple()))

    m = MySQL()
    m.execute(
        'UPDATE e107.e107_user SET user_password=\"%s\" WHERE user_loginname=\"admin\";'
        % hash)
    m.execute(
        'UPDATE e107.e107_user SET user_email=\"%s\" WHERE user_loginname=\"admin\";'
        % email)
    m.execute(
        'UPDATE e107.e107_user SET user_pwchange=\"%s\" WHERE user_loginname=\"admin\";'
        % timestamp)


if __name__ == "__main__":
    main()
Ejemplo n.º 47
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h",
                                       ['help', 'pass='******'email=', 'domain='])
    except getopt.GetoptError as e:
        usage(e)

    email = ""
    domain = ""
    password = ""
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val
        elif opt == '--domain':
            domain = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Gitea Password",
            "Enter new password for the Gitea 'admin' account.",
            pass_req=8,
            min_complexity=4)

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Gitea Email",
            "Enter email address for the Gitea 'admin' account.",
            "*****@*****.**")

    inithooks_cache.write('APP_EMAIL', email)

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input("Gitea Domain",
                             "Enter the domain to serve Gitea.",
                             DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    inithooks_cache.write('APP_DOMAIN', domain)

    config = "/etc/gitea/app.ini"
    subprocess.run([
        "su", "git", "-c",
        "cd /home/git && ./gitea admin change-password -u gitea -p %s" %
        password
    ])
    subprocess.run(['sed', '-i', "\|DOMAIN|s|=.*|= %s|" % domain, config])
    subprocess.run(
        ['sed', '-i',
         "\|ROOT_URL|s|=.*|= https://%s/|" % domain, config])
    subprocess.run(['sed', '-i', "\|FROM|s|=.*|= %s|" % email, config])

    m = MySQL()
    m.execute("UPDATE gitea.user SET email='%s' WHERE id=1;" % (email, ))

    subprocess.run(["systemctl", "restart", "gitea"])
Ejemplo n.º 48
0
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Collabtive Password",
            "Enter new password for the Collabtive 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Collabtive Email",
            "Enter email address for the Collabtive 'admin' account.",
            "*****@*****.**")

    hash = hashlib.sha1(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE collabtive.user SET pass=\"%s\", email=\"%s\" WHERE name=\"admin\";' % (hash, email))
    m.execute('UPDATE collabtive.settings SET settingsValue=\"%s\" WHERE settingsKey=\"mailfrom\";' % email)


if __name__ == "__main__":
    main()

Ejemplo n.º 49
0
    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "Piwik Domain",
            "Enter the domain to serve Piwik.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    domain = domain.strip("/")
    if not domain.startswith("http://"):
        domain = "http://%s/" % domain

    m = MySQL()
    m.execute('UPDATE piwik.piwik_option SET option_value=\"%s\" WHERE option_name=\"piwikUrl\";' % domain)
    piwik_config.update("[General]", "trusted_hosts[]", domain)

    hash = hashlib.md5(password).hexdigest()
    token = hashlib.md5('admin' + hash).hexdigest()

    m.execute('UPDATE piwik.piwik_user SET password=\"%s\", token_auth=\"%s\" WHERE login = \"admin\" AND superuser_access = 1;' % (hash, token))
    m.execute('UPDATE piwik.piwik_user SET email=\"%s\" WHERE login = \"admin\" AND superuser_access = 1;' % email)

if __name__ == "__main__":
    main()

Ejemplo n.º 50
0
            "TomatoCart Password",
            "Enter new password for the 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email("TomatoCart Email",
                            "Enter email address for the 'admin' account.",
                            "*****@*****.**")

    salt = ''.join(
        (random.choice(string.letters + string.digits) for x in range(2)))
    hash = ':'.join([hashlib.md5(salt + password).hexdigest(), salt])

    m = MySQL()
    m.execute(
        'UPDATE tomatocart.administrators SET user_password=\"%s\",email_address=\"%s\" WHERE user_name=\"admin\";'
        % (hash, email))

    m.execute(
        'UPDATE tomatocart.configuration SET configuration_value=\"%s\" WHERE configuration_key=\"STORE_OWNER_EMAIL_ADDRESS\";'
        % email)

    m.execute(
        'UPDATE tomatocart.configuration SET configuration_value=\"\\"Store Owner\\" <%s>\" WHERE configuration_key=\"EMAIL_FROM\";'
        % email)

    # delete cache
    system("rm -f /var/cache/tomatocart/*")
Ejemplo n.º 51
0
    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "SimpleMachines Domain",
            "Enter the domain to serve SimpleMachines.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    hash = hashlib.sha1('admin' + password).hexdigest()

    m = MySQL()
    m.execute('UPDATE simplemachines.members SET passwd=\"%s\" WHERE member_name=\"admin\";' % hash)
    m.execute('UPDATE simplemachines.members SET email_address=\"%s\" WHERE member_name=\"admin\";' % email)

    m.execute('UPDATE simplemachines.settings SET value=\"http://%s/Smileys\" WHERE variable=\"smileys_url\";' % domain)
    m.execute('UPDATE simplemachines.settings SET value=\"http://%s/avatars\" WHERE variable=\"avatar_url\";' % domain)
    
    m.execute('UPDATE simplemachines.themes SET value=\"http://%s/Themes/default\" WHERE variable=\"theme_url\" AND id_theme=1;' % domain)
    m.execute('UPDATE simplemachines.themes SET value=\"http://%s/Themes/default/images\" WHERE variable=\"images_url\" AND id_theme=1;' % domain)
    m.execute('UPDATE simplemachines.themes SET value=\"http://%s/Themes/core\" WHERE variable=\"theme_url\" AND id_theme=2;' % domain)
    m.execute('UPDATE simplemachines.themes SET value=\"http://%s/Themes/core/images\" WHERE variable=\"images_url\" AND id_theme=2;' % domain)

    config = "/var/www/simplemachines/Settings.php"
    system("sed -i \"s|boardurl.*|boardurl = 'http://%s';|\" %s" % (domain, config))
    system("sed -i \"s|webmaster_email.*|webmaster_email = '%s';|\" %s" % (email, config))
Ejemplo n.º 52
0
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "PHPNuke Password",
            "Enter new password for the PHPNuke 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "PHPNuke Email",
            "Enter email address for the PHPNuke 'admin' account.",
            "*****@*****.**")

    hash = hashlib.md5(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE phpnuke.nuke_authors SET pwd=\"%s\" WHERE aid=\"admin\";' % hash)
    m.execute('UPDATE phpnuke.nuke_authors SET email=\"%s\" WHERE aid=\"admin\";' % email)

    m.execute('UPDATE phpnuke.nuke_config SET adminmail=\"%s\";' % email)
    m.execute('UPDATE phpnuke.nuke_config SET notify_email=\"%s\";' % email)


if __name__ == "__main__":
    main()

Ejemplo n.º 53
0
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input("Piwik Domain",
                             "Enter the domain to serve Piwik.",
                             DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    inithooks_cache.write('APP_DOMAIN', domain)

    domain = domain.strip("/")
    if not domain.startswith("http://"):
        domain = "http://%s/" % domain

    m = MySQL()
    m.execute(
        'UPDATE piwik.piwik_option SET option_value=\"%s\" WHERE option_name=\"piwikUrl\";'
        % domain)
    piwik_config.update("[General]", "trusted_hosts[]", domain)

    hash = bcrypt.hashpw(hashlib.md5(password).hexdigest(), bcrypt.gensalt())

    m.execute(
        'UPDATE piwik.piwik_user SET password=\"%s\" WHERE login = \"admin\" AND superuser_access = 1;'
        % hash)
    m.execute(
        'UPDATE piwik.piwik_user SET email=\"%s\" WHERE login = \"admin\" AND superuser_access = 1;'
        % email)

Ejemplo n.º 54
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'pass='******'-h', '--help'):
            usage()
        elif opt == '--pass':
            password = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Observium Password",
            "Enter new password for the Observium 'admin' account.")

    random = SystemRandom()
    salt = hashlib.sha1(str(random.random())).hexdigest()[:8]
    hash = crypt.crypt(password, "$1$" + salt + "$")

    m = MySQL()
    m.execute('UPDATE observium.users SET password=\"%s\" WHERE username=\"admin\";' % hash)


if __name__ == "__main__":
    main()

Ejemplo n.º 55
0
            "PunBB Domain",
            "Enter the domain to serve PunBB.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    inithooks_cache.write('APP_DOMAIN', domain)

    def sha1(s):
        return hashlib.sha1(s).hexdigest()
    
    salt = ''.join((random.choice(string.letters+string.digits) for x in range(12)))
    hash = sha1(salt + sha1(password))

    m = MySQL()
    m.execute('UPDATE punbb.users SET password=\"%s\", salt=\"%s\", email=\"%s\" WHERE username=\"admin\";' % (hash, salt, email))

    m.execute('UPDATE punbb.config SET conf_value=\"%s\" WHERE conf_name=\"o_mailing_list\";' % email)
    m.execute('UPDATE punbb.config SET conf_value=\"%s\" WHERE conf_name=\"o_admin_email\";' % email)
    m.execute('UPDATE punbb.config SET conf_value=\"%s\" WHERE conf_name=\"o_webmaster_email\";' % email)

    conf = "/var/www/punbb/config.php"
    system("sed -i \"s|base_url.*|base_url = 'https://%s';|\" %s" % (domain, conf))

    apache_conf = "/etc/apache2/sites-available/punbb.conf"
    system("sed -i \"s|https://.*|https://%s/\$1 [R,L]|\" %s" % (domain, apache_conf))

    system("service apache2 restart")

if __name__ == "__main__":