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(): # ensure virtuoso is using new ini file # os.system('service virtuoso-opensource-6.1 restart') d = Dialog("TurnKey Linux - First boot configuration") eldis = d.yesno("ELDIS data", "Mirror ELDIS data on this server, this will take some time.") r4d = d.yesno("R4D data", "Mirror R4D data on this server, this will take some time.") if eldis: eldis_setup() if r4d: r4d_setup()
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='******'-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(): signal.signal(signal.SIGINT, signal.SIG_IGN) try: opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help']) except getopt.GetoptError as e: usage(e) for opt, val in opts: if opt in ('-h', '--help'): usage() d = Dialog("TurnKey GNU/Linux - First boot configuration") install = d.yesno("Security updates", TEXT, "Install", "Skip") if not install: sys.exit(1) try: check_output(["host", "-W", "2", "archive.turnkeylinux.org"]) except CalledProcessError as e: d.error(CONNECTIVITY_ERROR) sys.exit(1)
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='******'-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'])
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(): response = "" if not response: d = Dialog('Insta-Snorby - First boot configuration') response = d.yesno("Automatically Update Rules Everyday?","Snorby can update the configured ruleset on a daily basis. Snorby supports this through intergration with Pulled Pork, a simple popular Snort rule update script\n\nEnable Pulled Pork?") if response: d.infobox('Configuring Pulled Pork to run everyday at 2:00AM local time') system("crontab -l > /root/crontmp") system("echo '0 2 * * * /root/pulledpork-0.6.1/pulledpork.pl -c /root/pulledpork-0.6.1/etc/pulledpork.conf -H -v >> /var/log/pulledpork 2>&1 #Update Snort Rules' >> /root/crontmp") system("crontab /root/crontmp") d.infobox('Running Pulled Pork now! Logs are stored at /var/log/pulledpork') system("/root/pulledpork-0.6.1/pulledpork.pl -c /root/pulledpork-0.6.1/etc/pulledpork.conf -H -v >> /var/log/pulledpork 2>&1")
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(): 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='******'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(): signal.signal(signal.SIGINT, signal.SIG_IGN) try: l_opts = ["help", "email=", "email-placeholder="] opts, args = getopt.gnu_getopt(sys.argv[1:], "h", l_opts) except getopt.GetoptError as e: usage(e) email = "" email_placeholder = "" for opt, val in opts: if opt in ("-h", "--help"): usage() elif opt == "--email": email = val elif opt == "--email-placeholder": email_placeholder = val if email and not email_re.match(email): fatal("email is not valid") if not email: d = Dialog("TurnKey Linux - First boot configuration") email = email_placeholder while 1: retcode, email = d.inputbox(TITLE, TEXT, email, "Enable", "Skip") dia_log(("secalerts.main():\n\tretcode:`{}'\n\temail:`{}'").format( retcode, email)) if retcode == 'cancel': email = "" break if not email_re.match(email): d.error('Email is not valid') continue if d.yesno("Is your email correct?", email): break if email: cmd = os.path.join(os.path.dirname(__file__), 'secalerts.sh') dia_log("\tcmd:`{}'".format(cmd)) subprocess.run([cmd, email], check=True)
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(): response = "" if not response: d = Dialog('Insta-Snorby - First boot configuration') response = d.yesno( "Automatically Update Rules Everyday?", "Snorby can update the configured ruleset on a daily basis. Snorby supports this through intergration with Pulled Pork, a simple popular Snort rule update script\n\nEnable Pulled Pork?" ) if response: d.infobox( 'Configuring Pulled Pork to run everyday at 2:00AM local time') system("crontab -l > /root/crontmp") system( "echo '0 2 * * * /root/pulledpork-0.6.1/pulledpork.pl -c /root/pulledpork-0.6.1/etc/pulledpork.conf -H -v >> /var/log/pulledpork 2>&1 #Update Snort Rules' >> /root/crontmp" ) system("crontab /root/crontmp") d.infobox( 'Running Pulled Pork now! Logs are stored at /var/log/pulledpork' ) system( "/root/pulledpork-0.6.1/pulledpork.pl -c /root/pulledpork-0.6.1/etc/pulledpork.conf -H -v >> /var/log/pulledpork 2>&1" )
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='******'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(): 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])
elif opt == '--apikey': apikey = val elif opt == '--fqdn': fqdn = val if apikey: system('tklbam-init', apikey) if fqdn: system('hubdns-init', apikey, fqdn) system('hubdns-update') return initialized_tklbam = False d = Dialog('TurnKey Linux - First boot configuration') while 1: retcode, apikey = d.inputbox("Initialize Hub services", TEXT_SERVICES, apikey, "Apply", "Skip") if not apikey or retcode == 1: break d.infobox("Linking TKLBAM to the TurnKey Hub...") try: getoutput("host -W 2 hub.turnkeylinux.org") except ExecError, e: d.error(CONNECTIVITY_ERROR) break
redirect_client_gateway = "" for opt, val in opts: if opt in ('-h', '--help'): usage() elif opt == '--profile': profile = val elif opt == '--key-email': key_email = val elif opt == '--public-address': public_address = val elif opt == '--virtual-subnet': virtual_subnet = val elif opt == '--private-subnet': private_subnet = val dialog = Dialog('TurnKey Linux - First boot configuration') if not profile: 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":
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( "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("/etc/init.d/couchdb status >/dev/null 2>&1") system("/etc/init.d/couchdb restart")
elif opt == '--pass': admin_password = val elif opt == '--realm': realm = val DEFAULT_DOMAIN = realm.split('.')[0].upper() elif opt == '--domain': domain = val elif opt == '--join': join = val elif opt == '--join_ns': join_nameserver = val while 1: if not join: d = Dialog('Turnkey Linux - First boot configuration') join = d.yesno( "Join existing AD?", "You can create the Active Directory or join existing.", "Join", "Create") if not realm: d = Dialog('Turnkey Linux - First boot configuration') realm = d.get_input("Samba/Kerberos Realm", "Enter realm you would like to use.", DEFAULT_REALM) DEFAULT_DOMAIN = realm.split('.')[0].upper() if not domain: d = Dialog('TurnKey Linux - First boot configuration') domain = d.get_input("Samba Domain",
['help', 'pass='******'email=']) except getopt.GetoptError, 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)
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 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)
def usage(e=None): if e: 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')
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()
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( "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)
except getopt.GetoptError, e: usage(e) 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([
['help', 'pass='******'email=']) 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( "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])
['help', 'pass='******'domain=']) except getopt.GetoptError, 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 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")
server = "" password = "" for opt, val in opts: if opt in ('-h', '--help'): usage() elif opt == '--pass': password = val elif opt == '--server': server = val elif opt == '--base': ldap_base = val elif opt == '--binddn': ldap_user = val if not ldap_base: d = Dialog('TurnKey Linux - First boot configuration') ldap_base = d.get_input( "LDAP Base", "Enter the LDAP Base DN.", DEFAULT_BASE) if ldap_base == "DEFAULT": ldap_base = DEFAULT_BASE if not ldap_user: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') ldap_user = d.get_input( "LDAP User",
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():
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( "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")
opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'domain=']) except getopt.GetoptError, e: usage(e) domain = "" for opt, val in opts: if opt in ('-h', '--help'): usage() elif opt == '--domain': domain = val if not domain: if 'd' not in locals(): d = Dialog('TurnKey Linux - First boot configuration') domain = d.get_input( "EspoCRM URL", "Example: www.mydomain.com or mydomain.com", DEFAULT_DOMAIN) if domain == "DEFAULT": domain = DEFAULT_DOMAIN conf = "/var/www/espocrm/data/config.php" system("sed -i \"s|siteUrl.*|siteUrl' => 'http://%s',|\" %s" % (domain, conf))
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("Git Smart HTTP(S) Password", "Enter new admin password for git.") command = ['openssl', 'passwd', '-apr1', password] with open('/etc/apache2/htpasswd', 'w') as of: of.write('admin:') of.flush() subprocess.call(command, stdin=PIPE, stdout=of, shell=False) if __name__ == "__main__": main()
['help', 'pass='******'email=']) 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( "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)
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()
['help', 'pass='******'email=']) 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( "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)
['help', 'pass='******'email=']) 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( "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()
elif opt in ('-p', '--pass'): rootpass = val elif opt in ('-r', '--rpass'): rounduppass = val elif opt in ('-s', '--sipass'): simpleinvoicespass = val elif opt in ('-t', '--tld'): tld = val elif opt in ('-u', '--user'): username = val elif opt in ('-z', '--zpass'): toolspass = val if not tld: sitename = "" d = Dialog('TurnKey Linux - First boot configuration') tld = d.get_input("Set tld (top level domain) in http://www.basesitename.TLD", "Please enter top level domain (tld) without a dot (e.g. com, org, net).") if not sitename: d = Dialog('TurnKey Linux - First boot configuration') sitename = d.get_input("Set base site name in http://www.BASESITENAME.%s" % tld, "Please enter base site name without 'http://www.' or '.%s'." % tld) lowername = sitename.replace(" ","").lower() tld = tld.lower() hostname = ".".join([lowername,tld]) if not email: email = "@".join(['admin',hostname]) # Set root password. if not username:
['help', 'pass='******'email=']) 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( "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))
['help', 'pass='******'email=']) 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( "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()
usage(e) 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)
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()
username="******" password="" 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()
['help', 'pass='******'email=']) 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( "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():
['help', 'pass='******'email=']) 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( "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()
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()
['help', 'pass='******'email=']) 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( "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)
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( "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():
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()
['help', 'email=', 'passw=']) except getopt.GetoptError, e: usage(e) 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: