Separate error for -d with an IP address

This commit is contained in:
Seth Schoen
2016-02-11 09:10:25 -08:00
parent 78bd8fb98f
commit 104fa3ad55
+10
View File
@@ -6,6 +6,7 @@ import logging
import os
import platform
import re
import socket
import stat
import subprocess
import sys
@@ -317,6 +318,15 @@ def enforce_domain_sanity(domain):
# Remove trailing dot
domain = domain[:-1] if domain.endswith('.') else domain
# Explain separately that IP addresses aren't allowed (apart from not
# being FQDNs) because hope springs eternal on this point
try:
socket.inet_aton(domain)
raise errors.ConfigurationError("Requested name {0} is an IP address. The Let's Encrypt certificate authority will not issue certificates for a bare IP address.".format(domain))
except socket.error:
# It wasn't an IP address, so that's good
pass
# FQDN checks from
# http://www.mkyong.com/regular-expressions/domain-name-regular-expression-example/
# Characters used, domain parts < 63 chars, tld > 1 < 64 chars