mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:31:51 +02:00
Merge branch 'master' of github.com:research/chocolate
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
from chocolate_protocol_pb2 import chocolatemessage
|
from chocolate_protocol_pb2 import chocolatemessage
|
||||||
from Crypto.Hash import SHA256
|
from Crypto.Hash import SHA256
|
||||||
import M2Crypto
|
import M2Crypto
|
||||||
import urllib2, os, sys, time, random, CSR
|
import urllib2, os, sys, time, random, CSR, sys
|
||||||
|
|
||||||
def sha256(m):
|
def sha256(m):
|
||||||
return SHA256.new(m).hexdigest()
|
return SHA256.new(m).hexdigest()
|
||||||
@@ -53,13 +53,36 @@ while r.proceed.IsInitialized():
|
|||||||
r = decode(do(k))
|
r = decode(do(k))
|
||||||
print r
|
print r
|
||||||
|
|
||||||
|
if r.failure.IsInitialized():
|
||||||
|
print "Server reported failure."
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
sni_todo = []
|
sni_todo = []
|
||||||
for chall in r.challenge:
|
for chall in r.challenge:
|
||||||
print chall
|
print chall
|
||||||
if chall.type == r.DomainValidateSNI:
|
if chall.type == r.DomainValidateSNI:
|
||||||
key = M2Crypto.RSA.load_key_string(open("key.pem").read())
|
|
||||||
dvsni_nonce, dvsni_y, dvsni_ext = chall.data
|
dvsni_nonce, dvsni_y, dvsni_ext = chall.data
|
||||||
dvsni_r = key.private_decrypt(dvsni_y, M2Crypto.RSA.pkcs1_oaep_padding)
|
# key = M2Crypto.RSA.load_key_string(open("key.pem").read())
|
||||||
sni_todo.append( (chall.name, dvsni_nonce, dvsni_r) )
|
# dvsni_r = key.private_decrypt(dvsni_y, M2Crypto.RSA.pkcs1_oaep_padding)
|
||||||
|
sni_todo.append( (chall.name, dvsni_y, dvsni_nonce, dvsni_ext) )
|
||||||
|
|
||||||
print sni_todo
|
print sni_todo
|
||||||
|
import sni_challenge
|
||||||
|
|
||||||
|
sni_challenge.perform_sni_cert_challenge(sni_todo, "req.pem", "key.pem")
|
||||||
|
|
||||||
|
r=decode(do(k))
|
||||||
|
print r
|
||||||
|
while r.challenge or r.proceed.IsInitialized():
|
||||||
|
print "waiting", 5
|
||||||
|
time.sleep(5)
|
||||||
|
k.session = r.session
|
||||||
|
r = decode(do(k))
|
||||||
|
print r
|
||||||
|
|
||||||
|
if r.success.IsInitialized():
|
||||||
|
open("cert.pem", "w").write(r.success.certificate)
|
||||||
|
print "Server issued certificate; certificate written to cert.pem"
|
||||||
|
elif r.failure.IsInitialized():
|
||||||
|
print "Server reported failure."
|
||||||
|
sys.exit(1)
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ def getChocCertFile(nonce):
|
|||||||
|
|
||||||
def findApacheConfigFile():
|
def findApacheConfigFile():
|
||||||
#This needs to be fixed to account for multiple httpd.conf files
|
#This needs to be fixed to account for multiple httpd.conf files
|
||||||
|
# TODO: reliably and quickly find the httpd.conf anywher on the system?
|
||||||
try:
|
try:
|
||||||
p = subprocess.check_output(["sudo", "find", "/", "-name", "httpd.conf"], stderr=open("/dev/null"))
|
p = subprocess.check_output(["sudo", "find", "/etc", "-name", "httpd.conf"], stderr=open("/dev/null"))
|
||||||
p = p[:len(p)-1]
|
p = p[:len(p)-1]
|
||||||
print "Apache Config: ", p
|
print "Apache Config: ", p
|
||||||
return p
|
return p
|
||||||
@@ -41,7 +42,7 @@ LimitRequestBody 1048576 \n \
|
|||||||
\n \
|
\n \
|
||||||
Include " + OPTIONS_SSL_CONF + " \n \
|
Include " + OPTIONS_SSL_CONF + " \n \
|
||||||
SSLCertificateFile " + getChocCertFile(nonce) + " \n \
|
SSLCertificateFile " + getChocCertFile(nonce) + " \n \
|
||||||
SSLCertificateKeyFile " + key + " \n \
|
SSLCertificateKeyFile " + CHOC_DIR + key + " \n \
|
||||||
\n \
|
\n \
|
||||||
DocumentRoot " + CHOC_DIR + "challenge_page/ \n \
|
DocumentRoot " + CHOC_DIR + "challenge_page/ \n \
|
||||||
</VirtualHost> \n\n "
|
</VirtualHost> \n\n "
|
||||||
|
|||||||
Reference in New Issue
Block a user