diff --git a/CREDITS b/CREDITS index 1e590de8d..f0e45a381 100644 --- a/CREDITS +++ b/CREDITS @@ -1,3 +1,11 @@ +======= +CREDITS +======= +Version 2.0.3 +------------- +Same as previous version. + + ======= CREDITS ======= diff --git a/changelog b/changelog index 66a9dadff..7e73679ef 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +2.0.3 - April 3rd, 2012 + * Bug Fixes: + * monit user should have read-only permissions by default + * pypo user's shell should be /bin/false by default + 2.0.2 - February 28, 2012 * Bug Fixes: * Fixed Airtime could stop automatically playing after 24 hours if the web interface isn't used (regression in 2.0.1). @@ -8,6 +13,7 @@ * Other * Various optimizations to make Airtime feel snappier in the browser. Various views should load much quicker. + 2.0.1 - February 14, 2012 * Changes: * Widgets should have a version string so users can make sure widgets are up to date diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index 51c3d5f79..950712d88 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -2,7 +2,7 @@ #-e Causes bash script to exit if any of the installers #return with a non-zero return value. -if [ `whoami` != 'root' ]; then +if [[ $EUID -ne 0 ]]; then echo "Please run as root user." exit 1 fi diff --git a/install_minimal/airtime-uninstall b/install_minimal/airtime-uninstall index fb5af754f..b99f04246 100755 --- a/install_minimal/airtime-uninstall +++ b/install_minimal/airtime-uninstall @@ -1,7 +1,7 @@ #!/bin/bash #Check if root user -if [ `whoami` != 'root' ]; then +if [[ $EUID -ne 0 ]]; then echo "Please run as root user." exit 1 fi diff --git a/install_minimal/include/AirtimeInstall.php b/install_minimal/include/AirtimeInstall.php index 6cd5cc8fa..aa9ebc545 100644 --- a/install_minimal/include/AirtimeInstall.php +++ b/install_minimal/include/AirtimeInstall.php @@ -33,7 +33,7 @@ class AirtimeInstall public static function ExitIfNotRoot() { // Need to check that we are superuser before running this. - if(exec("whoami") != "root"){ + if(posix_geteuid() != 0){ echo "Must be root user.\n"; exit(1); } diff --git a/install_minimal/include/airtime-copy-files.sh b/install_minimal/include/airtime-copy-files.sh index 4591d10f9..9689bc2ea 100755 --- a/install_minimal/include/airtime-copy-files.sh +++ b/install_minimal/include/airtime-copy-files.sh @@ -2,7 +2,7 @@ #-e Causes bash script to exit if any of the installers #return with a non-zero return value. -if [ `whoami` != 'root' ]; then +if [[ $EUID -ne 0 ]]; then echo "Please run as root user." exit 1 fi diff --git a/install_minimal/include/airtime-initialize.sh b/install_minimal/include/airtime-initialize.sh index 8db2d825a..5383ff311 100755 --- a/install_minimal/include/airtime-initialize.sh +++ b/install_minimal/include/airtime-initialize.sh @@ -2,7 +2,7 @@ #-e Causes bash script to exit if any of the installers #return with a non-zero return value. -if [ `whoami` != 'root' ]; then +if [[ $EUID -ne 0 ]]; then echo "Please run as root user." exit 1 fi diff --git a/install_minimal/include/airtime-remove-files.sh b/install_minimal/include/airtime-remove-files.sh index 05ac815bc..afd54e60d 100755 --- a/install_minimal/include/airtime-remove-files.sh +++ b/install_minimal/include/airtime-remove-files.sh @@ -2,7 +2,7 @@ #-e Causes bash script to exit if any of the installers #return with a non-zero return value. -if [ `whoami` != 'root' ]; then +if [[ $EUID -ne 0 ]]; then echo "Please run as root user." exit 1 fi diff --git a/install_minimal/include/airtime-uninitialize.sh b/install_minimal/include/airtime-uninitialize.sh index d26256367..1713ae7f2 100755 --- a/install_minimal/include/airtime-uninitialize.sh +++ b/install_minimal/include/airtime-uninitialize.sh @@ -2,7 +2,7 @@ #-e Causes bash script to exit if any of the installers #return with a non-zero return value. -if [ `whoami` != 'root' ]; then +if [[ $EUID -ne 0 ]]; then echo "Please run as root user." exit 1 fi diff --git a/install_minimal/include/airtime-upgrade.php b/install_minimal/include/airtime-upgrade.php index e819db8ce..7b1ce115f 100644 --- a/install_minimal/include/airtime-upgrade.php +++ b/install_minimal/include/airtime-upgrade.php @@ -11,7 +11,7 @@ require_once(__DIR__.'/airtime-constants.php'); require_once(dirname(__FILE__).'/AirtimeIni.php'); require_once(dirname(__FILE__).'/AirtimeInstall.php'); -if(exec("whoami") != "root"){ +if(posix_geteuid() != 0){ echo "Must be root user.\n"; exit(1); } @@ -111,10 +111,13 @@ if (strcmp($version, "2.0.2") < 0){ passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.2/airtime-upgrade.php"); pause(); } -if (strcmp($version, "2.1.0") < 0){ - passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.0/airtime-upgrade.php"); +if (strcmp($version, "2.0.3") < 0){ + passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.3/airtime-upgrade.php"); pause(); } +if (strcmp($version, "2.1.0") < 0){ + passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.0/airtime-upgrade.php"); +} //set the new version in the database. $sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'"; diff --git a/install_minimal/upgrades/airtime-2.0.3/airtime-upgrade.php b/install_minimal/upgrades/airtime-2.0.3/airtime-upgrade.php new file mode 100644 index 000000000..dffd187f8 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.3/airtime-upgrade.php @@ -0,0 +1,75 @@ +/dev/null 2>&1', 'w') - p.write('pypo\n') - p.write('pypo\n') - p.close() + os.system("adduser --system --quiet --group "+username) else: print "User already exists." #add pypo to audio group diff --git a/python_apps/media-monitor/install/media-monitor-copy-files.py b/python_apps/media-monitor/install/media-monitor-copy-files.py index d61491da3..736456db9 100644 --- a/python_apps/media-monitor/install/media-monitor-copy-files.py +++ b/python_apps/media-monitor/install/media-monitor-copy-files.py @@ -50,7 +50,6 @@ try: #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-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/') #create log dir diff --git a/python_apps/media-monitor/install/media-monitor-uninitialize.py b/python_apps/media-monitor/install/media-monitor-uninitialize.py index f147673c8..a7cca67dc 100644 --- a/python_apps/media-monitor/install/media-monitor-uninitialize.py +++ b/python_apps/media-monitor/install/media-monitor-uninitialize.py @@ -9,7 +9,7 @@ if os.geteuid() != 0: try: print "Waiting for media-monitor processes to stop...", if (os.path.exists('/etc/init.d/airtime-media-monitor')): - p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True) + p = Popen("invoke-rc.d airtime-media-monitor stop", shell=True) sts = os.waitpid(p.pid, 0)[1] print "OK" else: diff --git a/python_apps/media-monitor/install/media-monitor-uninstall.py b/python_apps/media-monitor/install/media-monitor-uninstall.py index ed6fa4195..d2a201316 100644 --- a/python_apps/media-monitor/install/media-monitor-uninstall.py +++ b/python_apps/media-monitor/install/media-monitor-uninstall.py @@ -29,7 +29,7 @@ try: print 'Error loading config file: ', e sys.exit(1) - os.system("/etc/init.d/airtime-media-monitor stop") + os.system("invoke-rc.d airtime-media-monitor stop") os.system("rm -f /etc/init.d/airtime-media-monitor") os.system("update-rc.d -f airtime-media-monitor remove >/dev/null 2>&1") diff --git a/python_apps/pypo/install/pypo-copy-files.py b/python_apps/pypo/install/pypo-copy-files.py index 1048621c2..61f4c5aed 100644 --- a/python_apps/pypo/install/pypo-copy-files.py +++ b/python_apps/pypo/install/pypo-copy-files.py @@ -27,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)) def get_rand_string(length=10): return ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(length)) diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index 26f905392..b62c2b3a7 100644 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -224,10 +224,6 @@ class PypoPush(Thread): problem_start_time = queue_item['start'] break iteration+=1 - - - - return (problem_at_iteration, problem_start_time) diff --git a/utils/airtime-check-system.php b/utils/airtime-check-system.php index 25ec6c4a4..736aac80c 100644 --- a/utils/airtime-check-system.php +++ b/utils/airtime-check-system.php @@ -33,8 +33,9 @@ class AirtimeCheck { public static function ExitIfNotRoot() { // Need to check that we are superuser before running this. - $user = exec("whoami"); - if($user != "root" && $user != "www-data"){ + $euid = posix_geteuid(); + $user = posix_getlogin(); + if($euid != 0 && $user != "www-data"){ echo "Must be root user.\n"; exit(1); } diff --git a/utils/airtime-import/airtime-import.py b/utils/airtime-import/airtime-import.py index 083156192..ee1fb6cdf 100644 --- a/utils/airtime-import/airtime-import.py +++ b/utils/airtime-import/airtime-import.py @@ -18,7 +18,7 @@ logging.disable(50) # add ch to logger logger.addHandler(ch) -if (commands.getoutput("whoami") != 'root'): +if (os.geteuid() != 0): print 'Must be a root user.' sys.exit() diff --git a/utils/airtime-log.php b/utils/airtime-log.php index 2b26d9282..b98cc34c0 100644 --- a/utils/airtime-log.php +++ b/utils/airtime-log.php @@ -30,7 +30,7 @@ array_filter($log_files, "file_exists"); function exitIfNotRoot() { // Need to check that we are superuser before running this. - if(exec("whoami") != "root"){ + if(posix_geteuid() != 0){ echo "Must be root user.\n"; exit(1); } diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php index 98bc242f5..3a0e6526a 100644 --- a/utils/phone_home_stat.php +++ b/utils/phone_home_stat.php @@ -101,7 +101,7 @@ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ function exitIfNotRoot() { // Need to check that we are superuser before running this. - if(exec("whoami") != "root"){ + if(posix_geteuid() != 0){ echo "Must be root user.\n"; exit(1); }