Blob Blame History Raw
commit bf6e05e1ebb3e36de4e1e5641046a6adc648dd5b
Author: Andy Grover <agrover@redhat.com>
Date:   Tue Apr 16 12:59:31 2013 -0700

    Fail if password not set in config file
    
    Signed-off-by: Andy Grover <agrover@redhat.com>

diff --git a/targetd b/targetd
index 9e85e16..cd5cb2b 100755
--- a/targetd
+++ b/targetd
@@ -43,7 +43,7 @@ config_path = "/etc/target/targetd.yaml"
 default_config = dict(
     pool_name = "vg-targetd",
     user = "admin",
-    password = "targetd",
+    # security: no default password
     target_name = "iqn.2003-01.org.linux-iscsi.%s:targetd" % socket.gethostname(),
     ssl = False,
     ssl_cert = "/etc/target/targetd_cert.pem",
@@ -64,6 +64,10 @@ if os.getuid() != 0:
     print "targetd must run as root."
     sys.exit(-1)
 
+if not config.get('password', None):
+    print "password not set in %s, aborting" % config_path
+    sys.exit(-1)
+
 # fail early if can't access vg
 test_vg = lvm.vgOpen(config['pool_name'], "w")
 test_vg.close()