From 636f5aa313a617c296251886eb3d58bf4dc32657 Mon Sep 17 00:00:00 2001 From: yan Date: Fri, 17 Apr 2015 23:21:55 -0700 Subject: [PATCH] Remove commented-out code in nginx dvsni.py --- letsencrypt/client/plugins/nginx/dvsni.py | 110 ---------------------- 1 file changed, 110 deletions(-) diff --git a/letsencrypt/client/plugins/nginx/dvsni.py b/letsencrypt/client/plugins/nginx/dvsni.py index 9535a90c7..7233d7c62 100644 --- a/letsencrypt/client/plugins/nginx/dvsni.py +++ b/letsencrypt/client/plugins/nginx/dvsni.py @@ -28,17 +28,6 @@ class NginxDvsni(ApacheDvsni): """ - VHOST_TEMPLATE = """\ - - ServerName {server_name} - Include {ssl_options_conf_path} - SSLCertificateFile {cert_path} - SSLCertificateKeyFile {key_path} - DocumentRoot {document_root} - - -""" - def perform(self): """Perform a DVSNI challenge on Nginx.""" if not self.achalls: @@ -47,7 +36,6 @@ class NginxDvsni(ApacheDvsni): self.configurator.save() addresses = [] - # default_addr = "*:443" for achall in self.achalls: vhost = self.configurator.choose_vhost(achall.domain) if vhost is None: @@ -57,11 +45,6 @@ class NginxDvsni(ApacheDvsni): logging.error("No default 443 nginx vhost exists") logging.error("Please specify servernames in the Nginx config") return None - - # for addr in vhost.addrs: - # if "_default_" == addr.get_addr(): - # addresses.append([default_addr]) - # break else: addresses.append(list(vhost.addrs)) @@ -78,96 +61,3 @@ class NginxDvsni(ApacheDvsni): self.configurator.save("SNI Challenge", True) return responses - -# def _setup_challenge_cert(self, achall, s=None): -# # pylint: disable=invalid-name -# """Generate and write out challenge certificate.""" -# cert_path = self.get_cert_file(achall) -# # Register the path before you write out the file -# self.configurator.reverter.register_file_creation(True, cert_path) -# -# cert_pem, response = achall.gen_cert_and_response(s) -# -# # Write out challenge cert -# with open(cert_path, "w") as cert_chall_fd: -# cert_chall_fd.write(cert_pem) -# -# return response -# -# def _mod_config(self, ll_addrs): -# """Modifies Nginx config files to include challenge vhosts. -# -# Result: Nginx config includes virtual servers for issued challs -# -# :param list ll_addrs: list of list of -# :class:`letsencrypt.client.plugins.nginx.obj.Addr` to apply -# -# """ -# # TODO: Use ip address of existing vhost instead of relying on FQDN -# config_text = "\n" -# for idx, lis in enumerate(ll_addrs): -# config_text += self._get_config_text(self.achalls[idx], lis) -# config_text += "\n" -# -# self._conf_include_check(self.configurator.parser.loc["default"]) -# self.configurator.reverter.register_file_creation( -# True, self.challenge_conf) -# -# with open(self.challenge_conf, "w") as new_conf: -# new_conf.write(config_text) -# -# def _conf_include_check(self, main_config): -# """Adds DVSNI challenge conf file into configuration. -# -# Adds DVSNI challenge include file if it does not already exist -# within mainConfig -# -# :param str main_config: file path to main user nginx config file -# -# """ -# if len(self.configurator.parser.find_dir( -# parser.case_i("Include"), self.challenge_conf)) == 0: -# # print "Including challenge virtual host(s)" -# self.configurator.parser.add_dir( -# parser.get_aug_path(main_config), -# "Include", self.challenge_conf) -# -# def _get_config_text(self, achall, ip_addrs): -# """Chocolate virtual server configuration text -# -# :param achall: Annotated DVSNI challenge. -# :type achall: :class:`letsencrypt.client.achallenges.DVSNI` -# -# :param list ip_addrs: addresses of challenged domain -# :class:`list` of type :class:`~nginx.obj.Addr` -# -# :returns: virtual host configuration text -# :rtype: str -# -# """ -# ips = " ".join(str(i) for i in ip_addrs) -# document_root = os.path.join( -# self.configurator.config.config_dir, "dvsni_page/") -# # TODO: Python docs is not clear how mutliline string literal -# # newlines are parsed on different platforms. At least on -# # Linux (Debian sid), when source file uses CRLF, Python still -# # parses it as "\n"... c.f.: -# # https://docs.python.org/2.7/reference/lexical_analysis.html -# return self.VHOST_TEMPLATE.format( -# vhost=ips, server_name=achall.nonce_domain, -# ssl_options_conf_path=self.configurator.parser.loc["ssl_options"], -# cert_path=self.get_cert_file(achall), key_path=achall.key.file, -# document_root=document_root).replace("\n", os.linesep) -# -# def get_cert_file(self, achall): -# """Returns standardized name for challenge certificate. -# -# :param achall: Annotated DVSNI challenge. -# :type achall: :class:`letsencrypt.client.achallenges.DVSNI` -# -# :returns: certificate file name -# :rtype: str -# -# """ -# return os.path.join( -# self.configurator.config.work_dir, achall.nonce_domain + ".crt")