Permalink
Browse files

CC-3520: Change default password of monit

-fixed
  • Loading branch information...
1 parent e1fd581 commit 57f782d3c23b6a14e592e4d1b7a9b514321a3569 @mkonecny mkonecny committed Apr 1, 2012
@@ -10,7 +10,7 @@ public static function GetMonitStatus($p_ip){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_USERPWD, "admin:monit");
+ curl_setopt($ch, CURLOPT_USERPWD, "guest:airtime");
$result = curl_exec($ch);
curl_close($ch);
@@ -1,6 +1,9 @@
import os
import shutil
import sys
+import subprocess
+import random
+import string
from configobj import ConfigObj
if os.geteuid() != 0:
@@ -25,6 +28,9 @@ def create_dir(path):
except Exception, e:
pass
+def get_rand_string(length=10):
+ return ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(length))
+
PATH_INI_FILE = '/etc/airtime/media-monitor.cfg'
try:
@@ -43,6 +49,7 @@ def create_dir(path):
#copy monit files
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
+ subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True)
if os.environ["disable_auto_start_services"] == "f":
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
@@ -1,5 +1,6 @@
- set daemon 10 # Poll at 5 second intervals
+ set daemon 10 # Poll at 10 second intervals
set logfile /var/log/monit.log
set httpd port 2812
- allow admin:monit
+ allow admin:$admin_pass
+ allow guest:airtime read-only
@@ -1,6 +1,9 @@
import os
import shutil
import sys
+import subprocess
+import random
+import string
from configobj import ConfigObj
if os.geteuid() != 0:
@@ -24,6 +27,9 @@ def create_dir(path):
os.makedirs(path)
except Exception, e:
pass
+
+def get_rand_string(length=10):
+ return ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(length))
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
@@ -43,6 +49,7 @@ def create_dir(path):
#copy monit files
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
+ subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True)
shutil.copy('%s/../../monit/monit-airtime-rabbitmq-server.cfg'%current_script_dir, '/etc/monit/conf.d/')
if os.environ["disable_auto_start_services"] == "f":
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')

0 comments on commit 57f782d

Please sign in to comment.