From 7c814bd7b13062cf1b3d9c49709bf93ce4a2d23a Mon Sep 17 00:00:00 2001 From: James Kasten Date: Wed, 8 Aug 2012 20:06:41 -0400 Subject: [PATCH] Fixed SERVER_ROOT directory, improved sni_challenge test --- client-webserver/CONFIG.py | 5 ++++- client-webserver/sni_challenge.py | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/client-webserver/CONFIG.py b/client-webserver/CONFIG.py index a3940c030..ac94d2783 100644 --- a/client-webserver/CONFIG.py +++ b/client-webserver/CONFIG.py @@ -1,5 +1,5 @@ # Apache server root directory -SERVER_ROOT = "/etc/apache2" +SERVER_ROOT = "/etc/apache2/" # Configuration file directory for trustify CONFIG_DIR = "/etc/trustify/" # Working directory for trustify @@ -14,3 +14,6 @@ APACHE_CHALLENGE_CONF = CONFIG_DIR + "choc_sni_cert_challenge.conf" # Byte size of S and Nonce S_SIZE = 32 NONCE_SIZE = 32 + +# bits of hashcash to generate +difficulty = 23 diff --git a/client-webserver/sni_challenge.py b/client-webserver/sni_challenge.py index f73c8d5ac..25b6ad9af 100644 --- a/client-webserver/sni_challenge.py +++ b/client-webserver/sni_challenge.py @@ -281,15 +281,17 @@ def main(): challenges = [("example.com", y, nonce, "1.3.3.7"), ("www.example.com",y2, nonce2, "1.3.3.7")] #challenges = [("127.0.0.1", y, nonce, "1.3.3.7"), ("localhost", y2, nonce2, "1.3.3.7")] - perform_sni_cert_challenge(challenges, csr, key, config) + if perform_sni_cert_challenge(challenges, csr, key, config): + + # Waste some time without importing time module... just for testing + for i in range(0, 12000): + if i % 2000 == 0: + print "Waiting:", i - # Waste some time without importing time module... just for testing - for i in range(0, 12000): - if i % 2000 == 0: - print "Waiting:", i - - print "Cleaning up" - cleanup(challenges, config) + print "Cleaning up" + cleanup(challenges, config) + else: + print "Failed SNI challenge..." if __name__ == "__main__": main()