mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 00:35:50 +02:00
Separate error for -d with an IP address
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user