From e9a6d6039bb2a3acc53175a829a262f2c31edf17 Mon Sep 17 00:00:00 2001 From: James Kasten Date: Wed, 28 Jan 2015 16:18:40 -0800 Subject: [PATCH 1/3] Remove half-implemented code... leave TODO --- letsencrypt/client/client.py | 50 ------------------------------------ letsencrypt/scripts/main.py | 7 +++-- 2 files changed, 5 insertions(+), 52 deletions(-) diff --git a/letsencrypt/client/client.py b/letsencrypt/client/client.py index 0f5166399..223a1ce3a 100644 --- a/letsencrypt/client/client.py +++ b/letsencrypt/client/client.py @@ -4,8 +4,6 @@ import csv import logging import os import shutil -import socket -import string import sys import M2Crypto @@ -25,11 +23,6 @@ from letsencrypt.client import revoker from letsencrypt.client.apache import configurator -# it's weird to point to ACME servers via raw IPv6 addresses, and -# such addresses can be %SCARY in some contexts, so out of paranoia -# let's disable them by default -ALLOW_RAW_IPV6_SERVER = False - class Client(object): """ACME protocol client. @@ -96,8 +89,6 @@ class Client(object): logging.warning("Unable to obtain a certificate, because client " "does not have a valid auth handler.") - sanity_check_names(domains) - # Request Challenges for name in domains: self.auth_handler.add_chall_msg( @@ -401,47 +392,6 @@ def csr_pem_to_der(csr): return Client.CSR(csr.file, csr_obj.as_der(), "der") -def sanity_check_names(names): - """Make sure host names are valid. - - :param list names: List of host names - - """ - for name in names: - if not is_hostname_sane(name): - logging.fatal("%r is an impossible hostname", name) - sys.exit(81) - - -def is_hostname_sane(hostname): - """Make sure the given host name is sane. - - Do enough to avoid shellcode from the environment. There's - no need to do more. - - :param str hostname: Host name to validate - - :returns: True if hostname is valid, otherwise false. - :rtype: bool - - """ - # hostnames & IPv4 - allowed = string.ascii_letters + string.digits + "-." - if all([c in allowed for c in hostname]): - return True - - if not ALLOW_RAW_IPV6_SERVER: - return False - - # ipv6 is messy and complicated, can contain %zoneindex etc. - try: - # is this a valid IPv6 address? - socket.getaddrinfo(hostname, 443, socket.AF_INET6) - return True - except socket.error: - return False - - # This should be controlled by commandline parameters def determine_authenticator(): """Returns a valid IAuthenticator.""" diff --git a/letsencrypt/scripts/main.py b/letsencrypt/scripts/main.py index 4dfa70764..d9658238e 100755 --- a/letsencrypt/scripts/main.py +++ b/letsencrypt/scripts/main.py @@ -1,5 +1,9 @@ #!/usr/bin/env python -"""Parse command line and call the appropriate functions.""" +"""Parse command line and call the appropriate functions. + +..todo:: Sanity check all input. Be sure to avoid shell code ect... + +""" import argparse import logging import os @@ -165,7 +169,6 @@ def get_all_names(installer): """ names = list(installer.get_all_names()) - client.sanity_check_names(names) if not names: logging.fatal("No domain names were found in your installation") From a5f65dcfd820167ed7d79905b564a5dd3c85df04 Mon Sep 17 00:00:00 2001 From: James Kasten Date: Wed, 28 Jan 2015 16:20:09 -0800 Subject: [PATCH 2/3] pep8 - remove extra whitespace --- letsencrypt/scripts/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/letsencrypt/scripts/main.py b/letsencrypt/scripts/main.py index d9658238e..2997d9188 100755 --- a/letsencrypt/scripts/main.py +++ b/letsencrypt/scripts/main.py @@ -180,7 +180,6 @@ def get_all_names(installer): return names - def read_file(filename): """Returns the given file's contents with universal new line support. From f6f6b792215fa3e6991e080a9f3a2a3cdf940538 Mon Sep 17 00:00:00 2001 From: James Kasten Date: Thu, 29 Jan 2015 00:17:45 -0800 Subject: [PATCH 3/3] fix comment spelling --- letsencrypt/scripts/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/letsencrypt/scripts/main.py b/letsencrypt/scripts/main.py index 2997d9188..20d3022f6 100755 --- a/letsencrypt/scripts/main.py +++ b/letsencrypt/scripts/main.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """Parse command line and call the appropriate functions. -..todo:: Sanity check all input. Be sure to avoid shell code ect... +..todo:: Sanity check all input. Be sure to avoid shell code etc... """ import argparse