aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xexmachina.py13
-rwxr-xr-xinit_test.sh2
2 files changed, 9 insertions, 6 deletions
diff --git a/exmachina.py b/exmachina.py
index 35559da..fc04beb 100755
--- a/exmachina.py
+++ b/exmachina.py
@@ -88,6 +88,9 @@ class ExMachinaHandler(bjsonrpc.handlers.BaseHandler):
self.augeas = augeas.Augeas()
def authenticate(self, secret_key):
+ if not self.secret_key:
+ log.warn("Unecessary authentication attempt")
+ return
if not secret_key.strip() == self.secret_key.strip():
# fail hard
log.error("Authentication failed!")
@@ -300,7 +303,7 @@ def main():
default="/tmp/exmachina.sock",
help="UNIX Domain socket file path to listen on",
metavar="FILE")
- parser.add_option("--pid-file",
+ parser.add_option("--pidfile",
default=None,
help="Daemonize and write pid to this file",
metavar="FILE")
@@ -333,14 +336,14 @@ def main():
secret_key = sys.stdin.readline().strip()
log.debug("Got it!")
- if options.pid_file:
- with open(options.pid_file, 'w') as pfile:
+ if options.pidfile:
+ with open(options.pidfile, 'w') as pfile:
# ensure file is available/writable
pass
- os.unlink(options.pid_file)
+ os.unlink(options.pidfile)
daemonize()
pid = os.getpid()
- with open(options.pid_file, 'w') as pfile:
+ with open(options.pidfile, 'w') as pfile:
pfile.write("%s" % pid)
log.info("Daemonized, pid is %s" % pid)
diff --git a/init_test.sh b/init_test.sh
index 4a00734..ab4e717 100755
--- a/init_test.sh
+++ b/init_test.sh
@@ -6,7 +6,7 @@ export key=`./exmachina.py --random-key`
echo $key | ./exmachina.py -vk --pid-file /tmp/exmachina_test.pid
sleep 1
-echo $key | sudo -u www-data ./test_exmachina.py -k
+echo $key | sudo -u www-data -g www-data ./test_exmachina.py -k
kill `cat /tmp/exmachina_test.pid` && rm /tmp/exmachina_test.pid
sleep 1