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( "Foswiki Password", "Enter new password for the Foswiki 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Foswiki Email", "Enter email address for the Foswiki '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("Foswiki Domain", "Enter the domain to serve Foswiki.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN inithooks_cache.write('APP_DOMAIN', domain) if not (domain.startswith('http://') or domain.startswith('https://')): domain = 'https://' + domain check_output([ 'perl', '-CA', '/var/www/foswiki/tools/configure', '-save', '-set', '{Password}=%s' % password, '-set', '{WebMasterEmail}=%s' % email, '-set', '{DefaultUrlHost}=%s' % domain ])
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,))
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( "Foodsoft Password", "Enter new password for the Foodsoft 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Foodsoft Email", "Enter email address for the Foodsoft 'admin' account.", "*****@*****.**") inithooks_cache.write('APP_EMAIL', email) print("Please wait ...") # need mysql running for these updates popen('service mysql status >/dev/null || service mysql start').wait() # initialize admin account from Rails console runner_script = """ " u = User.where(id: 1).first; u.password = '******'; u.email = '%s'; u.save! " """ % (password, email) popen("bundle exec rails r %s" % runner_script).wait() # running as root may have cached classes popen('chown -R www-data:www-data tmp/').wait() popen('systemctl restart apache2')
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))
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, ))
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, ))
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( "Bagisto Password", "Enter new password for the Bagisto 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Bagisto Email", "Enter email address for the Bagisto '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 bagisto.admins SET password=%s WHERE id=1;', (hashpass, )) m.execute('UPDATE bagisto.admins SET email=%s WHERE id=1;', (email, ))
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, ))
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)
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 email: d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "PrestaShop Email", "Enter email address for the PrestaShop 'admin' account.", "*****@*****.**") inithooks_cache.write('APP_EMAIL', email) if not password: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "PrestaShop Password", "Enter new password for the PrestaShop '%s' account." % email, pass_req=8) if not domain: if 'd' not in locals():
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 = 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)
"Choose a profile for this server.\n\n* Gateway: clients will be configured to route all\n their traffic through the VPN.", [ ('server', 'Accept VPN connections from clients'), ('gateway', 'Accept VPN connections from clients*'), ('client', 'Initiate VPN connections to a server') ]) if not profile in ('server', 'gateway', 'client'): fatal('invalid profile: %s' % profile) if profile == "client": return if not key_email: key_email = dialog.get_email( "OpenVPN Email", "Enter email address for the OpenVPN server key.", "*****@*****.**") if not public_address: public_address = dialog.get_input( "OpenVPN Public Address", "Enter FQDN or IP address of server reachable by clients", "vpn.example.com") auto_virtual_subnet = "10.%d.%d.0/24" % (r(2, 254), r(2, 254)) if not virtual_subnet: virtual_subnet = dialog.get_input( "OpenVPN Virtual Subnet", "Enter CIDR subnet address pool to allocate to clients. This server will be configured with x.x.x.1. The CIDR must not be in-use on your network.", auto_virtual_subnet)
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("GitLab Password", "Enter new password for the GitLab 'admin' account.") if not email: if "d" not in locals(): d = Dialog("TurnKey Linux - First boot configuration") email = d.get_email("GitLab Email", "Enter email address for the GitLab '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("GitLab Domain", "Enter the domain to serve GitLab.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN inithooks_cache.write("APP_DOMAIN", domain) system_gitlab(
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "eZPublish Password", "Enter new password for the eZPublish 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "eZPublish Email", "Enter email address for the eZPublish 'admin' account.", "*****@*****.**") if not domain: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') domain = d.get_input( "eZPublish Domain", "Enter the domain to serve eZPublish.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN def sed(var, val, conf):
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 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)
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()
password = val elif opt == '--email': 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()
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"])
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "SilverStripe Password", "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)
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "ClipBucket Password", "Enter new password for the ClipBucket 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "ClipBucket Email", "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)
email = val elif opt == '--variant': variant = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Foodsoft Password", "Enter new password for the Foodsoft 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Foodsoft Email", "Enter email address for the Foodsoft 'admin' account.", "*****@*****.**") inithooks_cache.write('APP_EMAIL', email) if variant == "DEFAULT": variant = DEFAULT_VARIANT variant_cur = os.path.basename(os.path.realpath(APP_DEFAULT_PATH)) variant_avail = map(lambda d: os.path.basename(d), glob.glob(os.path.join(APPS_PATH, 'foodsoft-*'))) if len(variant_avail) == 1: variant = variant_avail[0] elif not variant: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration')
password = val elif opt == '--email': email = val 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()
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Rhodecode Password", "Enter new password for the Rhodecode 'admin' account.") 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)
password = val elif opt == '--email': email = val if not password: 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))
elif opt == '--email': 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()
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 email: d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Vtiger Email", "Enter email address for the Vtiger 'admin' account.", "*****@*****.**") 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)
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( "Canvas Password", "Enter new password for the Canvas 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Canvas Email", "Enter email address for the Canvas '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("Canvas Domain", "Enter the domain to serve Canvas.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN inithooks_cache.write('APP_DOMAIN', domain) salt = "".join(random.choice(string.ascii_letters) for line in range(20)) hash = password + salt for i in range(20): hash = hashlib.sha512(hash.encode('utf-8')).hexdigest() access_token = "".join( random.choice(string.ascii_letters) for line in range(20)) conn = psycopg2.connect("dbname=canvas_production user=root") c = conn.cursor() c.execute('UPDATE users SET name=%s, sortable_name=%s WHERE id=1;', (email, email)) c.execute( 'UPDATE pseudonyms SET unique_id=%s, crypted_password=%s, password_salt=%s, single_access_token=%s WHERE user_id=1;', (email, hash, salt, access_token)) c.execute('UPDATE communication_channels SET path=%s WHERE id=1;', (email, )) conn.commit() c.close() conn.close() config = "/var/www/canvas/config/outgoing_mail.yml" subprocess.run( ["sed", "-ri", 's|domain:.*|domain: "%s"|' % domain, config]) subprocess.run([ "sed", "-ri", 's|outgoing_address:.*|outgoing_address: "%s"|' % email, config ]) config = "/var/www/canvas/config/dynamic_settings.yml" subprocess.run( ["sed", "-ri", 's|app-host:.*|app-host: "%s:3000"|' % domain, config]) config = "/var/www/canvas/config/domain.yml" subprocess.run( ["sed", "-ri", 's|domain:.*|domain: "%s"|' % domain, config]) config = "/var/www/canvas/config/initializers/outgoing_mail.rb" subprocess.run( ["sed", "-ri", 's|:domain => .*|:domain => "%s",|' % domain, config]) print("Restarting services; please wait...") for service in ['canvas_init', 'apache2']: subprocess.run(['systemctl', 'restart', service])
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()
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "iceScrum Password", "Enter new password for the iceScrum 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "iceScrum Email", "Enter email address for the iceScrum 'admin' account.", "*****@*****.**") 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()
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()
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Concrete5 Password", "Enter new password for the Concrete5 'admin' account.") if not email: if 'd' not in locals(): 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)
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Magento Password", "Enter new password for the Magento 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "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"
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "YouPHPTube Password", "Enter new password for the YouPHPTube 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "YouPHPTube Email", "Please enter email address for the YouPHPTube 'admin' account.", "*****@*****.**") inithooks_cache.write('APP_EMAIL', email) hashpass = hashlib.md5(password).hexdigest() m = MySQL() m.execute('UPDATE yphptube.users SET email=\"%s\" WHERE user=\"admin\";' % email) m.execute( 'UPDATE yphptube.users SET password=\"%s\" WHERE user=\"admin\";' % hashpass) if __name__ == "__main__":
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Vanilla Password", "Enter new password for the Vanilla 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') 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\";' %
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Mattermost Admin Password", "Enter new password for Mattermost 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Mattermost Administrator's Email", "Enter email address for Mattermost '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( "Mattermost domain", "Enter domain to serve Mattermost", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN
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()
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
email="" passw="" for opt, val in opts: if opt in ('-h', '--help'): usage() elif opt == '--email': gmail_user = val elif opt == '--passw': gmail_pass = val d = Dialog('TurnKey B-Translator - First boot configuration') if not email: email = d.get_email( "Email of the gmail account", "Emails from the server are sent through the SMTP of a GMAIL account.\n" + "Please enter the full email of the gmail account:", "*****@*****.**") if not passw: passw = d.get_password( "Password of the gmail account", "Emails from the server are sent through the SMTP of a GMAIL account.\n" + "Please enter the password of the gmail account:") domain = email.split('@')[1] try: d.infobox("Modifying ssmtp configuration files...") # modify conf file /etc/ssmtp/ssmtp.conf config_file = '/etc/ssmtp/ssmtp.conf'
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') 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(
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "ProjectPier Password", "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))
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"])
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.", "*****@*****.**") 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))
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 elif opt == '--schema': schema = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "GitLab Password", "Enter new password for the GitLab 'root' account.", pass_req=8) if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "GitLab Email", "Enter email address for the GitLab 'root' 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("GitLab Domain", "Enter the domain to serve GitLab.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN inithooks_cache.write('APP_DOMAIN', domain) print("Reconfiguring GitLab. This might take a while. Please wait.") config = "/etc/gitlab/gitlab.rb" domain = "http://%s" % domain subprocess.run( ["sed", "-i", "/^external_url/ s|'.*|'%s'|" % domain, config]) subprocess.run([ "sed", "-i", "/^gitlab_rails\['gitlab_email_from'\]/ s|=.*|= '%s'|" % email, config ]) subprocess.run(["gitlab-ctl", "reconfigure"]) print( "Setting GitLab 'root' user password and email in database. This might take a while too. Please wait (again)." ) tmp_dir = '/run/user/0' tmp_file = '.gitlab-init.rb' if not os.path.exists(tmp_dir): os.makedirs(tmp_dir) tmp_path = '/'.join([tmp_dir, tmp_file]) # include token resetting here now (just before 'exit'); should fix #1315/#1342 for good! tmp_contents = """ ActiveRecord::Base.logger.level = 1 u = User.where(id: 1).first u.password = u.password_confirmation = '{}' u.email = '{}' u.skip_reconfirmation! u.save! ApplicationSetting.current.reset_runners_registration_token! exit """ flags = os.O_WRONLY | os.O_CREAT with os.fdopen(os.open(tmp_path, flags, 0o600), 'w') as fob: fob.write(tmp_contents.format(password, email)) uid = pwd.getpwnam('git').pw_uid os.chown(tmp_path, uid, 0) try: subprocess.run( ["gitlab-rails", "runner", "-e", "production", tmp_path]) print("Done.") finally: os.remove(tmp_path)
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "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(
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Piwik Password", "Enter new password for the Piwik 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Piwik Email", "Enter email address for Piwik 'admin' account.", "*****@*****.**") 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("/")
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()
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "SimpleMachines Password", "Enter new password for the SMF 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "SimpleMachines Email", "Enter email address for the SMF 'admin' account.", "*****@*****.**") 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()
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "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)
profile = dialog.menu( "OpenVPN Profile", "Choose a profile for this server.\n\n* Gateway: clients will be configured to route all\n their traffic through the VPN.", [('server', 'Accept VPN connections from clients'), ('gateway', 'Accept VPN connections from clients*'), ('client', 'Initiate VPN connections to a server')]) if not profile in ('server', 'gateway', 'client'): fatal('invalid profile: %s' % profile) if profile == "client": return if not key_email: key_email = dialog.get_email( "OpenVPN Email", "Enter email address for the OpenVPN server key.", "*****@*****.**") inithooks_cache.write('APP_EMAIL', key_email) if not public_address: public_address = dialog.get_input( "OpenVPN Public Address", "Enter FQDN or IP address of server reachable by clients", "vpn.example.com") auto_virtual_subnet = "10.%d.%d.0/24" % (r(2, 254), r(2, 254)) if not virtual_subnet: virtual_subnet = dialog.get_input( "OpenVPN Virtual Subnet", "Enter CIDR subnet address pool to allocate to clients. This server will be configured with x.x.x.1. The CIDR must not be in-use on your network.",
password = val elif opt == '--email': email = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "DokuWiki Password", "Enter new password for the DokuWiki 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "DokuWiki Email", "Enter email address for the DokuWiki 'admin' account.", "*****@*****.**") inithooks_cache.write('APP_EMAIL', email) authfile = "/var/lib/dokuwiki/acl/users.auth.php" hashpass = hashlib.md5(password).hexdigest() new = [] for line in file(authfile).readlines(): line = line.strip() if not line: continue username, password, name, mailaddr, groups = line.split(":") if username == "admin":
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Piwik Password", "Enter new password for the Piwik 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email("Piwik Email", "Enter email address for Piwik '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("Piwik Domain", "Enter the domain to serve Piwik.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN
password = val 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()
email = val elif opt == '--domain': domain = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "PunBB Password", "Enter new password for the PunBB 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "PunBB Email", "Enter email address for the PunBB '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( "PunBB Domain", "Enter the domain to serve PunBB.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN