def main(): fpcuser = "" fpcpassword = "" if not fpcpassword and not fpcuser: d = Dialog('Insta-Snorby - First boot configuration') response = d.yesno("Enable OpenFPC?","Snorby supports intergration with OpenFPC, a lightweight full-packet network traffic recorder & buffering system.\nInsta-Snorby can install and configure OpenFPC so that full pcaps of alerts will be made available inside the Snorby application.\n\n Would you like to enable OpenFPC?") if response: fpcuser = d.inputbox("Create OpenFPC Username","Please enter your desired OpenFPC username.") fpcpassword = d.get_password("Create OpenFPC password", "Please enter your desired OpenFPC password.") if fpcuser and fpcpassword: ipaddress = get_ip_address('eth0') d.infobox('Installing OpenFPC 0.6-314') system('htpasswd -b -c /etc/openfpc/apache2.passwd %s %s > /dev/null' % (fpcuser[1], fpcpassword) ) system('cd /root/openfpc-0.6-314/ && /root/openfpc-0.6-314/openfpc-install.sh install > /dev/null') system("sed -i 's/GUIUSER=openfpc/#GUIUSER=openfpc/g' /etc/openfpc/openfpc-default.conf") system("sed -i 's/GUIPASS=openfpc/#GUIUSER=openfpc/g' /etc/openfpc/openfpc-default.conf") system("sed -i 's/USER=openfpc=openfpc/USER=%s=%s/g' /etc/openfpc/openfpc-default.conf" % (fpcuser[1], fpcpassword)) system("sed -i 's/AuthType Basic/#AuthType Basic/g' /etc/apache2/sites-enabled/openfpc.apache2.site") system("sed -i 's/AuthName/#AuthName/g' /etc/apache2/sites-enabled/openfpc.apache2.site") system("sed -i 's/AuthUserFile/#AuthUserFile/g' /etc/apache2/sites-enabled/openfpc.apache2.site") system("sed -i 's/Require valid-user/#Require valid-user/g' /etc/apache2/sites-enabled/openfpc.apache2.site") d.infobox('Starting OpenFPC 0.6-314') system("openfpc -action start > /dev/null") d.infobox('Configuring Snorby...') system("cd /var/www/snorby && /usr/local/bin/rails runner 'Setting.set(:packet_capture, 1)' > /dev/null 2>&1") system("cd /var/www/snorby && /usr/local/bin/rails runner \"Setting.set(:packet_capture_url, 'https://%s/openfpc/cgi-bin/extract.cgi')\" > /dev/null 2>&1" % ipaddress) system("cd /var/www/snorby && /usr/local/bin/rails runner \"Setting.set(:packet_capture_type, 'openfpc')\" > /dev/null 2>&1")
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( "Syncthing Password", "Enter new password for the 'syncthing' Web UI user.") hashpw = bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode() # Assign password to user syncthing based off input & restart subprocess.run([ 'sed', '-i', '\|<user>syncthing</user>|!b;n;c \\\t<password>%s</password>' % hashpw, '/home/syncthing/.config/syncthing/config.xml' ]) subprocess.run(['systemctl', 'restart', '*****@*****.**'])
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: from dialog_wrapper import Dialog d = Dialog('TurnKey GNU/Linux - First boot configuration') password = d.get_password( "%s Password" % username.capitalize(), "Please enter new password for the %s account." % username) command = ["chpasswd"] input = ":".join([username, password]) p = subprocess.Popen(command, stdin=PIPE, shell=False) p.stdin.write(input) p.stdin.close() err = p.wait() if err: fatal(err)
def main(): import signal signal.signal(signal.SIGINT, signal.SIG_IGN) 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( "web2py password", "Enter new password for the web2py admin console.") fpath = "/var/www/web2py/parameters_443.py" os.chdir('/var/www/web2py') subprocess.run([ 'python', '-c', "from gluon.main import save_password; save_password(\"%s\", 443)" % password ]) subprocess.run(["chown", "www-data:www-data", fpath]) subprocess.run(["chmod", "640", fpath])
def main(): signal.signal(signal.SIGINT, signal.SIG_IGN) try: opts, args = getopt.gnu_getopt(sys.argv[1:], "hu:p:", ['help', 'user='******'pass='******'-h', '--help'): usage() elif opt in ('-u', '--user'): username = val elif opt in ('-p', '--pass'): password = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "PostgreSQL Password", "Please enter new password for the '%s' account." % username) p = PostgreSQL() # set password p.execute(("alter user %s with encrypted password E\'%s\';" % (username, escape_chars(password))).encode('utf8'))
def main(): fpcuser = "" fpcpassword = "" if not fpcpassword and not fpcuser: d = Dialog('Insta-Snorby - First boot configuration') response = d.yesno("Enable OpenFPC?","Snorby supports intergration with OpenFPC, a lightweight full-packet network traffic recorder & buffering system.\nInsta-Snorby can install and configure OpenFPC so that full pcaps of alerts will be made available inside the Snorby application.\n\n Would you like to enable OpenFPC?") if response: fpcuser = d.inputbox("Create OpenFPC Username","Please enter your desired OpenFPC username.") fpcpassword = d.get_password("Create OpenFPC password", "Please enter your desired OpenFPC password.") if fpcuser and fpcpassword: ipaddress = get_ip_address('eth0') d.infobox('Installing OpenFPC 0.6-314') system('htpasswd -b -c /etc/openfpc/apache2.passwd %s %s > /dev/null' % (fpcuser[1], fpcpassword) ) system('cd /root/openfpc-0.6-314/ && /root/openfpc-0.6-314/openfpc-install.sh install > /dev/null') system("sed -i 's/GUIUSER=openfpc/#GUIUSER=openfpc/g' /etc/openfpc/openfpc-default.conf") system("sed -i 's/GUIPASS=openfpc/#GUIUSER=openfpc/g' /etc/openfpc/openfpc-default.conf") system("sed -i 's/USER=openfpc=openfpc/USER=%s=%s/g' /etc/openfpc/openfpc-default.conf" % (fpcuser[1], fpcpassword)) system("sed -i 's/AuthType Basic/#AuthType Basic/g' /etc/apache2/sites-enabled/openfpc.apache2.site") system("sed -i 's/AuthName/#AuthName/g' /etc/apache2/sites-enabled/openfpc.apache2.site") system("sed -i 's/AuthUserFile/#AuthUserFile/g' /etc/apache2/sites-enabled/openfpc.apache2.site") system("sed -i 's/Require valid-user/#Require valid-user/g' /etc/apache2/sites-enabled/openfpc.apache2.site") d.infobox('Starting OpenFPC 0.6-314') system("openfpc -action start > /dev/null") d.infobox('Configuring Snorby...') system("cd /var/www/snorby && /usr/local/bin/rails runner 'Setting.set(:packet_capture, 1)' > /dev/null 2>&1") system("cd /var/www/snorby && /usr/local/bin/rails runner \"Setting.set(:packet_capture_url, 'https://%s/openfpc/cgi-bin/extract.cgi')\" > /dev/null 2>&1" % ipaddress) system("cd /var/www/snorby && /usr/local/bin/rails runner \"Setting.set(:packet_capture_type, 'openfpc')\" > /dev/null 2>&1") system("cd /var/www/snorby && /usr/local/bin/rails runner 'Setting.set(:packet_capture_auto_auth, 1)' > /dev/null 2>&1") system("cd /var/www/snorby && /usr/local/bin/rails runner \"Setting.set(:packet_capture_user, '%s')\" > /dev/null 2>&1" % fpcuser[1]) system("cd /var/www/snorby && /usr/local/bin/rails runner \"Setting.set(:packet_capture_password, '%s')\" > /dev/null 2>&1" % fpcpassword)
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, ))
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: from dialog_wrapper import Dialog d = Dialog('TurnKey GNU/Linux - First boot configuration') password = d.get_password( "%s Samba Password" % username.capitalize(), "Please enter new password for the Samba {0} account. Note: the Linux {0}" .format(username) + " user password will NOT be changed.") subprocess.run(['smbpasswd', '-a', '-s', username], f'{password}\n{password}\n', text=True)
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='******'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 GNU/Linux - First boot configuration') password = d.get_password( "Nextcloud Password", "Enter new password for the Nextcloud 'admin' account.") if not domain: if 'd' not in locals(): d = Dialog('TurnKey GNU/Linux - First boot configuration') domain = d.get_input("Nextcloud Domain", "Enter the domain to serve Nextcloud.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN sedcom = """ /0 => 'localhost',/ a\ 1 => '%s', """ conf = '/var/www/nextcloud/config/config.php' call(['sed', '-i', "/1 => /d", conf]) call(['sed', '-i', sedcom % domain, conf]) call([ '/usr/local/bin/turnkey-occ', 'user:resetpassword', '--password-from-env', 'admin' ], cwd='/var/www/nextcloud', env={"OC_PASS": password})
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)
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='******'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,))
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='******'-h', '--help'): usage() elif opt == '--pass': password = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Trac Password", "Enter new password for the Trac 'admin' account.") subprocess.run(["htpasswd", "-cb", "/etc/trac/htpasswd", "admin", "%s" % password])
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) 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='******'-h', '--help'): usage() elif opt == '--pass': password = val if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password("Mumble Server SuperUser Password", "Enter SuperUser Password.") subprocess.run( ['murmurd', '-ini', '/etc/mumble-server.ini', '-supw', password]) subprocess.run(['service', 'mumble-server', 'restart'])
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)
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: from dialog_wrapper import Dialog d = Dialog('TurnKey GNU/Linux - First boot configuration') password = d.get_password( "%s Password" % username.capitalize(), "Please enter new password for the %s account." % username) err = subprocess.run( ['chpasswd'], input = f'{username}:{password}\n', text = True, ).returncode if err: fatal(err) subprocess.run( ['smbpasswd', '-a', '-s', username], input = f'{password}\n{password}\n', text = True )
def main(): signal.signal(signal.SIGINT, signal.SIG_IGN) 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( "Tomcat Password", "Enter new password for the Tomcat 'admin' account.") tomcat_user_conf = f"/etc/{TOMCAT}/tomcat-users.xml" doc = xml.dom.minidom.parse(tomcat_user_conf).documentElement users = doc.getElementsByTagName('user') for user in users: if not user.getAttribute('username') == 'admin': continue user.setAttribute('password', password) with open(tomcat_user_conf, 'w') as fob: fob.write("<?xml version='1.0' encoding='utf-8'?>\n") doc.writexml(fob) fob.write("\n") # restart tomcat if running so password change will take effect tomcat_status = ['systemctl', '-q', 'is-active', f'{TOMCAT}.service'] tomcat_stopped = subprocess.run(tomcat_status).returncode if not tomcat_stopped: subprocess.run(['systemctl', 'restart', f'{TOMCAT}.service'])
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, ))
def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'pass='******'domain=']) except getopt.GetoptError as e: usage(e) domain = "" password = "" 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( "OpenLDAP Password", "Enter new password for the OpenLDAP 'admin' account.") if not domain: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') domain = d.get_input("OpenLDAP Domain", "Enter the OpenLDAP domain.", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN inithooks_cache.write('APP_DOMAIN', domain) script = os.path.join(os.path.dirname(__file__), 'openldap-reinit.sh') subprocess.check_output([script, domain, password])
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( "Mumble Ice Secret Write For ICE Administration", "Enter icesecretwrite.") subprocess.run(['sed', '-i', "s/.*icesecretwrite=.*/icesecretwrite=%s/g" % password, '/etc/mumble-server.ini']) for i in ('mumble-server', 'apache2'): subprocess.run(['service', i, 'restart'])
sys.exit(1) def main(): 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("Torrent Server Password", "Enter new admin password for MLDonkey.") command = ["/usr/local/bin/mldonkey-config", password] p = subprocess.Popen(command, stdin=PIPE, stdout=PIPE, shell=False) stderr = p.wait() if stderr: fatal(stderr) if __name__ == "__main__": main()
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: from dialog_wrapper import Dialog d = Dialog('TurnKey GNU/Linux - First boot configuration') password = d.get_password( "%s Samba Password" % username.capitalize(), "Please enter new password for the Samba {0} account. Note: the Linux {0}" .format(username) + " user password will NOT be changed.") system("(echo \"{0}\" ; echo \"{0}\" ) | smbpasswd -a -s {1}".format( password, username)) if __name__ == "__main__": main()
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( "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()
queries=[] for opt, val in opts: if opt in ('-h', '--help'): usage() elif opt in ('-u', '--user'): username = val elif opt in ('-p', '--pass'): password = val elif opt in ('--query'): queries.append(val) if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "MySQL Password", "Please enter new password for the MySQL '%s' account." % username) m = MySQL() #Set Proxy URL m.execute('INSERT INTO psiphon.proxy (name, hostname, login_url) VALUES(\"%s\", \"%s\", \"%s\");' % (proxyname, hostname, login_url)) # set password m.execute('update mysql.user set Password=PASSWORD(\"%s\") where User=\"%s\"; flush privileges;' % (escape_chars(password), username)) # edge case: update DEBIAN_CNF if username == "debian-sys-maint": old = file(DEBIAN_CNF).read() new = re.sub("password = (.*)\n", "password = %s\n" % password, old) file(DEBIAN_CNF, "w").write(new)
if len(args) != 1: usage() username = args[0] password = "" for opt, val in opts: if opt in ('-h', '--help'): usage() elif opt in ('-p', '--pass'): password = val if not password: from dialog_wrapper import Dialog d = Dialog('TurnKey GNU/Linux - First boot configuration') password = d.get_password( "%s Password" % username.capitalize(), "Please enter new password for the %s account." % username) command = ["chpasswd"] input = ":".join([username, password]) p = subprocess.Popen(command, stdin=PIPE, shell=False) p.stdin.write(input) p.stdin.close() err = p.wait() if err: fatal(err) if __name__ == "__main__": main()
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( "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()
def usage(s=None): if s: print >>sys.stderr, "Error:", s print >>sys.stderr, "Syntax: %s [options]" % sys.argv[0] print >>sys.stderr, __doc__ sys.exit(1) def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help", "pass="******"" for opt, val in opts: if opt in ("-h", "--help"): usage() elif opt == "--pass": password = val if not password: d = Dialog("TurnKey Linux - First boot configuration") password = d.get_password("Trac Password", "Enter new password for the Trac 'admin' account.") getoutput("htpasswd -cb /etc/trac/htpasswd admin %s" % password) if __name__ == "__main__": main()
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( "CouchDB Password", "Enter new password for the CouchDB 'admin' account.") salt = str(uuid4()).replace('-', '') hash = hashlib.sha1(password + salt).hexdigest() hashpass = "******" % (hash, salt) conf = "/etc/couchdb/local.ini" system("sed -i \"s|^admin =.*|admin = %s|\" %s" % (hashpass, conf)) # restart couchdb if running so change takes effect try: system("systemctl is-active --quiet couchdb.service") system("service couchdb restart") except ExecError, e: pass
if not ldap_user: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') ldap_user = d.get_input( "LDAP User", "Enter the LDAP User for owncloud connections.", "cn=owncloud," + ldap_base) if not password: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "LDAP User Password", "Enter the password for the " + ldap_user + " user account.") if not server: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') server = d.get_input( "LDAP Server", "Enter the LDAP Server.", DEFAULT_SERVER) script = os.path.join(os.path.dirname(__file__), 'owncloud_ldap-reinit.sh') system(script, server, ldap_base, ldap_user, password) if __name__ == "__main__":
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( "%s Password" % username.capitalize(), "Enter password for the %s McMyAdmin account." % username) """ command = "cd /home/minecraft/.minecraft; ./MCMA2_Linux_x86_64 -configonly -setpass %s" % password os.system(command) """ if __name__ == "__main__": main()
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( "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)
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) 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__":
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( "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()
elif opt == '--domain': domain = val if not domain: d = Dialog('TurnKey Linux - First boot configuration') domain = d.get_input( "Samba Domain", "Enter domain you would like to use.", DEFAULT_DOMAIN) if not password: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( "Samba Password", "Enter new password for the samba 'administrator' account.") system("/etc/init.d/samba stop >/dev/null || true") # set domain if domain == "DEFAULT": domain = DEFAULT_DOMAIN new = [] smbconf = "/etc/samba/smb.conf" for s in file(smbconf).readlines(): s = s.rstrip() s = re.sub("workgroup = (.*)", "workgroup = %s" % domain.upper(), s) new.append(s)
print >> sys.stderr, "Syntax: %s [options]" % sys.argv[0] print >> sys.stderr, __doc__ sys.exit(1) 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( "Odoo Database Managment Screen Password", "Enter new database management screen password. This is used for Odoo database functions.") config = "/etc/odoo/openerp-server.conf" system("sed -i \"s|admin_passwd =.*|admin_passwd = \"%s\"|\" %s" % (password, config)) if __name__ == "__main__": main()
print >> sys.stderr, "Error:", e print >> sys.stderr, "Syntax: %s" % sys.argv[0] print >> sys.stderr, __doc__ sys.exit(1) def main(): try: #note none used at present opts, args = getopt.gnu_getopt(sys.argv[1:], "hp:", ['help', 'pass='******'TurnKey Linux - First boot configuration') password = d.get_password( "", "Please enter new password for the virtuoso.") f = open('/usr/lib/inithooks/firstboot.d/setpass', 'w') isql = """set password "dba" \"""" + password + """\"; update DB.DBA.SYS_USERS set U_PASSWORD='******' where U_NAME='dav'; exit;""" f.write(isql) f.close() #open default conection to isql and run commands in a file command = "isql-vt 1111 dba dba /usr/lib/inithooks/firstboot.d/setpass > /root/setpass" os.system(command) #os.system('rm -f /usr/lib/inithooks/firstboot.d/setpass') #we need to know the password for future use in scripts so we write it to a file
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( "Mahara Password", "Enter new password for the Mahara 'admin' account.") if not email: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') email = d.get_email( "Mahara Email", "Enter email address for the Mahara 'admin' account.", "*****@*****.**") sitesalt = "" for line in file("/var/www/mahara/config.php", "r").readlines(): m = re.match(r"\$cfg->passwordsaltmain = '(.*)';", line.strip()) if m:
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(): d = Dialog('TurnKey Linux - First boot configuration') 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)
except getopt.GetoptError, 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("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))
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( "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))
print >> sys.stderr, "Syntax: %s [options]" % sys.argv[0] print >> sys.stderr, __doc__ sys.exit(1) 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( "Mibew Password", "Enter new password for the Mibew 'admin' account.") system('/usr/lib/inithooks/bin/eddit_mibew_pass.sh -p {PASSWORD} '.format(PASSWORD = password)) if __name__ == "__main__": main()
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( "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()
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( "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')
if len(args) != 1: usage() username = args[0] password = "" for opt, val in opts: if opt in ('-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 account." % username) command = ["chpasswd"] input = ":".join([username, password]) p = subprocess.Popen(command, stdin=PIPE, shell=False) p.stdin.write(input) 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' % password
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' getoutput('sed -e "/^root=/ c root=%s" -i %s' % (email, config_file)) getoutput('sed -e "/^AuthUser=/ c AuthUser=%s" -i %s' % (email, config_file)) getoutput('sed -e "/^AuthPass=/ c AuthPass=%s" -i %s' % (passw, config_file)) getoutput('sed -e "/^rewriteDomain=/ c rewriteDomain=%s" -i %s' % (domain, config_file)) getoutput('sed -e "/^hostname=/ c hostname=%s" -i %s' % (email, config_file))
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( "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)
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( "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')
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( "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)
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( "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]
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( "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()
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( "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'
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()
lowername = sitename.replace(" ","").lower() tld = tld.lower() hostname = ".".join([lowername,tld]) if not email: email = "@".join(['admin',hostname]) # Set root password. if not username: username = "******" system("/usr/lib/inithooks/bin/setpass.py %s --pass=%s" % (username,rootpass)) if not adminpass: d = Dialog('TurnKey Linux - First boot configuration') adminpass = d.get_password("Drupal/Solr admin and Drupal cssadmin Password", "Please enter password for the Drupal/Solr admin accounts.") if not dbpass: d = Dialog('TurnKey Linux - First boot configuration') dbpass = d.get_password("MySQL root Password", "Please enter password for the MySQL root account.") # MySQL password. system("/usr/lib/inithooks/bin/mysqlconf.py --user=root --pass=%s" % dbpass) # Roundup password. system("/usr/lib/inithooks/bin/roundup.py --pass=%s --email=%s" % (rounduppass,email)) # Simple Invoices password. system("/usr/lib/inithooks/bin/simpleinvoices.py --pass=%s --email=%s" % (simpleinvoicespass,email)) # Tools password.