summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2015-12-11 11:59:41 +0000
committerdakkar <dakkar@thenautilus.net>2015-12-11 12:03:52 +0000
commit3c677b8d1b30ca02f9c15a38e737cbea7f610d3f (patch)
tree10afaadd98d39fa01ebb12cf8f287bdaf6984689
parentmore placeholders (diff)
downloadyubico-yubiserve-dakkar.tar.gz
yubico-yubiserve-dakkar.tar.bz2
yubico-yubiserve-dakkar.zip
allow listening on only HTTP or only HTTPSdakkar
-rw-r--r--yubiserve.cfg2
-rwxr-xr-xyubiserve.py27
2 files changed, 14 insertions, 15 deletions
diff --git a/yubiserve.cfg b/yubiserve.cfg
index 569ade1..7ee344c 100644
--- a/yubiserve.cfg
+++ b/yubiserve.cfg
@@ -1,5 +1,5 @@
yubiservePORT = 8700;
-yubiserveSSLPORT = 8701;
+#yubiserveSSLPORT = 8701;
yubiserveHOST = '127.0.0.1';
yubiDB = 'sqlite';
#yubiDB = 'mysql';
diff --git a/yubiserve.py b/yubiserve.py
index 43f0d29..226f8c9 100755
--- a/yubiserve.py
+++ b/yubiserve.py
@@ -393,20 +393,19 @@ if config['yubiDB'] == 'mysql' and (config['yubiMySQLHost'] == '' or config['yub
print "Cannot continue without any MySQL configuration.\nPlease read README.\n\n"
quit()
-yubiserveHTTP = ThreadingHTTPServer((config['yubiserveHOST'], config['yubiservePORT']), YubiServeHandler)
-yubiserveSSL = ThreadingHTTPSServer((config['yubiserveHOST'], config['yubiserveSSLPORT']), YubiServeHandler)
-
-http_thread = Thread(target=yubiserveHTTP.serve_forever)
-ssl_thread = Thread(target=yubiserveSSL.serve_forever)
-
-http_thread.setDaemon(True)
-ssl_thread.setDaemon(True)
-
-http_thread.start()
-ssl_thread.start()
-
-print "HTTP Server is running."
+if config.has_key('yubiservePORT'):
+ yubiserveHTTP = ThreadingHTTPServer((config['yubiserveHOST'], config['yubiservePORT']), YubiServeHandler)
+ http_thread = Thread(target=yubiserveHTTP.serve_forever)
+ http_thread.setDaemon(True)
+ http_thread.start()
+ print "HTTP Server is listening on %s:%d" % (config['yubiserveHOST'],config['yubiservePORT'])
+
+if config.has_key('yubiserveSSLPORT'):
+ yubiserveSSL = ThreadingHTTPSServer((config['yubiserveHOST'], config['yubiserveSSLPORT']), YubiServeHandler)
+ ssl_thread = Thread(target=yubiserveSSL.serve_forever)
+ ssl_thread.setDaemon(True)
+ ssl_thread.start()
+ print "HTTPS Server is listening on %s:%d" % (config['yubiserveHOST'],config['yubiserveSSLPORT'])
while 1:
time.sleep(1)
-