diff options
author | dakkar <dakkar@thenautilus.net> | 2015-12-11 11:59:41 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2015-12-11 12:03:52 +0000 |
commit | 3c677b8d1b30ca02f9c15a38e737cbea7f610d3f (patch) | |
tree | 10afaadd98d39fa01ebb12cf8f287bdaf6984689 /yubiserve.py | |
parent | more placeholders (diff) | |
download | yubico-yubiserve-3c677b8d1b30ca02f9c15a38e737cbea7f610d3f.tar.gz yubico-yubiserve-3c677b8d1b30ca02f9c15a38e737cbea7f610d3f.tar.bz2 yubico-yubiserve-3c677b8d1b30ca02f9c15a38e737cbea7f610d3f.zip |
allow listening on only HTTP or only HTTPSdakkar
Diffstat (limited to 'yubiserve.py')
-rwxr-xr-x | yubiserve.py | 27 |
1 files changed, 13 insertions, 14 deletions
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) - |