mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 18:04:31 +02:00
Added enable_site and enable_mod_ssl
This commit is contained in:
@@ -20,8 +20,6 @@ class VH(object):
|
|||||||
class Configurator(object):
|
class Configurator(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.hasSSLServer = False
|
|
||||||
self.isModSSLLoaded = False
|
|
||||||
# TODO: this instantiation can be optimized to only load Httd
|
# TODO: this instantiation can be optimized to only load Httd
|
||||||
# relevant files
|
# relevant files
|
||||||
# Set Augeas flags to save backup
|
# Set Augeas flags to save backup
|
||||||
@@ -324,6 +322,33 @@ class Configurator(object):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def enable_site(self, avail_fp):
|
||||||
|
"""
|
||||||
|
Enables an available site, Apache restart required
|
||||||
|
"""
|
||||||
|
if "/sites-available/" in avail_fp:
|
||||||
|
index = avail_fp.rfind("/")
|
||||||
|
os.symlink(avail_fp, BASE_DIR + "sites-enabled/" + avail_fp[index:])
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def enable_mod_ssl(self):
|
||||||
|
"""
|
||||||
|
Enables mod_ssl
|
||||||
|
TODO: TEST
|
||||||
|
"""
|
||||||
|
subprocess.call(["sudo", "a2enmod", "ssl"])
|
||||||
|
subprocess.call(["sudo", "/etc/init.d/apache2", "reload"])
|
||||||
|
"""
|
||||||
|
a_conf = BASE_DIR + "mods-available/ssl.conf"
|
||||||
|
a_load = BASE_DIR + "mods-available/ssl.load"
|
||||||
|
if os.path.exists(a_conf) and os.path.exists(a_load):
|
||||||
|
os.symlink(a_conf, BASE_DIR + "mods-enabled/ssl.conf")
|
||||||
|
os.symlink(a_load, BASE_DIR + "mods-enabled/ssl.load")
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
"""
|
||||||
|
|
||||||
# Go down the Include rabbit hole
|
# Go down the Include rabbit hole
|
||||||
# TODO: REMOVE... use find_directive
|
# TODO: REMOVE... use find_directive
|
||||||
def search_include(self, includeArg, searchStr):
|
def search_include(self, includeArg, searchStr):
|
||||||
@@ -429,7 +454,6 @@ def main():
|
|||||||
|
|
||||||
config.parse_file("/etc/apache2/ports_test.conf")
|
config.parse_file("/etc/apache2/ports_test.conf")
|
||||||
|
|
||||||
|
|
||||||
#for m in config.aug.match("/augeas/load/Httpd/incl"):
|
#for m in config.aug.match("/augeas/load/Httpd/incl"):
|
||||||
# print m, config.aug.get(m)
|
# print m, config.aug.get(m)
|
||||||
#config.add_name_vhost("example2.com:443")
|
#config.add_name_vhost("example2.com:443")
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ import augeas
|
|||||||
import configurator
|
import configurator
|
||||||
#import dns.resolver
|
#import dns.resolver
|
||||||
|
|
||||||
#CHOC_DIR = "/home/ubuntu/chocolate/client-webserver/"
|
CHOC_DIR = "/home/ubuntu/chocolate/client-webserver/"
|
||||||
CHOC_DIR = "/home/james/Documents/apache_choc/"
|
|
||||||
CHOC_CERT_CONF = "choc_cert_extensions.cnf"
|
CHOC_CERT_CONF = "choc_cert_extensions.cnf"
|
||||||
OPTIONS_SSL_CONF = CHOC_DIR + "options-ssl.conf"
|
OPTIONS_SSL_CONF = CHOC_DIR + "options-ssl.conf"
|
||||||
APACHE_CHALLENGE_CONF = CHOC_DIR + "choc_sni_cert_challenge.conf"
|
APACHE_CHALLENGE_CONF = CHOC_DIR + "choc_sni_cert_challenge.conf"
|
||||||
@@ -277,8 +276,8 @@ def main():
|
|||||||
|
|
||||||
config = configurator.Configurator()
|
config = configurator.Configurator()
|
||||||
|
|
||||||
#challenges = [("example.com", y, nonce, "1.3.3.7"), ("www.example.com",y2, nonce2, "1.3.3.7")]
|
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")]
|
#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)
|
perform_sni_cert_challenge(challenges, csr, key, config)
|
||||||
|
|
||||||
# Waste some time without importing time module... just for testing
|
# Waste some time without importing time module... just for testing
|
||||||
|
|||||||
Reference in New Issue
Block a user