IInstaller.deploy_cert docs/naming fixes

This commit is contained in:
Jakub Warmuz
2015-05-28 18:31:06 +00:00
parent 8d1135c049
commit d01b17f1e2
3 changed files with 13 additions and 21 deletions
+5 -4
View File
@@ -193,12 +193,13 @@ class IInstaller(IPlugin):
def get_all_names(): def get_all_names():
"""Returns all names that may be authenticated.""" """Returns all names that may be authenticated."""
def deploy_cert(domain, cert, key, cert_chain=None): def deploy_cert(domain, cert_path, key_path, chain_path=None):
"""Deploy certificate. """Deploy certificate.
:param str domain: domain to deploy certificate :param str domain: domain to deploy certificate file
:param str cert: certificate filename :param str cert_path: absolute path to the certificate file
:param str key: private key filename :param str key_path: absolute path to the private key file
:param str chain_path: absolute path to the certificate chain file
""" """
+3 -8
View File
@@ -146,7 +146,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
temp_install(self.conf('mod-ssl-conf')) temp_install(self.conf('mod-ssl-conf'))
def deploy_cert(self, domain, cert_path, key, chain_path=None): def deploy_cert(self, domain, cert_path, key_path, chain_path=None):
"""Deploys certificate to specified virtual host. """Deploys certificate to specified virtual host.
Currently tries to find the last directives to deploy the cert in Currently tries to find the last directives to deploy the cert in
@@ -161,11 +161,6 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
.. todo:: Might be nice to remove chain directive if none exists .. todo:: Might be nice to remove chain directive if none exists
This shouldn't happen within letsencrypt though This shouldn't happen within letsencrypt though
:param str domain: domain to deploy certificate
:param str cert_path: certificate filename
:param str key: private key filename
:param str chain_path: certificate chain filename
""" """
vhost = self.choose_vhost(domain) vhost = self.choose_vhost(domain)
# TODO(jdkasten): vhost might be None # TODO(jdkasten): vhost might be None
@@ -192,7 +187,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
logging.info("Deploying Certificate to VirtualHost %s", vhost.filep) logging.info("Deploying Certificate to VirtualHost %s", vhost.filep)
self.aug.set(path["cert_path"][0], cert_path) self.aug.set(path["cert_path"][0], cert_path)
self.aug.set(path["cert_key"][0], key) self.aug.set(path["cert_key"][0], key_path)
if chain_path is not None: if chain_path is not None:
if not path["chain_path"]: if not path["chain_path"]:
self.parser.add_dir( self.parser.add_dir(
@@ -204,7 +199,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
(vhost.filep, (vhost.filep,
", ".join(str(addr) for addr in vhost.addrs))) ", ".join(str(addr) for addr in vhost.addrs)))
self.save_notes += "\tSSLCertificateFile %s\n" % cert_path self.save_notes += "\tSSLCertificateFile %s\n" % cert_path
self.save_notes += "\tSSLCertificateKeyFile %s\n" % key self.save_notes += "\tSSLCertificateKeyFile %s\n" % key_path
if chain_path is not None: if chain_path is not None:
self.save_notes += "\tSSLCertificateChainFile %s\n" % chain_path self.save_notes += "\tSSLCertificateChainFile %s\n" % chain_path
+5 -9
View File
@@ -105,7 +105,7 @@ class NginxConfigurator(common.Plugin):
temp_install(self.conf('mod-ssl-conf')) temp_install(self.conf('mod-ssl-conf'))
# Entry point in main.py for installing cert # Entry point in main.py for installing cert
def deploy_cert(self, domain, cert, key, cert_chain=None): def deploy_cert(self, domain, cert_path, key_path, chain_path=None):
# pylint: disable=unused-argument # pylint: disable=unused-argument
"""Deploys certificate to specified virtual host. """Deploys certificate to specified virtual host.
@@ -118,14 +118,10 @@ class NginxConfigurator(common.Plugin):
.. note:: This doesn't save the config files! .. note:: This doesn't save the config files!
:param str domain: domain to deploy certificate
:param str cert: certificate filename
:param str key: private key filename
:param str cert_chain: certificate chain filename
""" """
vhost = self.choose_vhost(domain) vhost = self.choose_vhost(domain)
directives = [['ssl_certificate', cert], ['ssl_certificate_key', key]] directives = [['ssl_certificate', cert_path],
['ssl_certificate_key', key_path]]
try: try:
self.parser.add_server_directives(vhost.filep, vhost.names, self.parser.add_server_directives(vhost.filep, vhost.names,
@@ -143,8 +139,8 @@ class NginxConfigurator(common.Plugin):
self.save_notes += ("Changed vhost at %s with addresses of %s\n" % self.save_notes += ("Changed vhost at %s with addresses of %s\n" %
(vhost.filep, (vhost.filep,
", ".join(str(addr) for addr in vhost.addrs))) ", ".join(str(addr) for addr in vhost.addrs)))
self.save_notes += "\tssl_certificate %s\n" % cert self.save_notes += "\tssl_certificate %s\n" % cert_path
self.save_notes += "\tssl_certificate_key %s\n" % key self.save_notes += "\tssl_certificate_key %s\n" % key_path
####################### #######################
# Vhost parsing methods # Vhost parsing methods