Move relevant constants to acme module.

This commit is contained in:
Jakub Warmuz 2015-04-28 17:51:46 +00:00
parent 1d8281d15d
commit bf5d132582
No known key found for this signature in database
GPG key ID: 2A7BAD3A489B52EA
3 changed files with 5 additions and 15 deletions

View file

@ -88,6 +88,9 @@ class DVSNI(DVChallenge):
NONCE_SIZE = 16
"""Required size of the :attr:`nonce` in bytes."""
PORT = 443
"""Port to perform DVSNI challenge."""
r = jose.Field("r", encoder=jose.b64encode, # pylint: disable=invalid-name
decoder=functools.partial(jose.decode_b64jose, size=R_SIZE))
nonce = jose.Field("nonce", encoder=binascii.hexlify,

View file

@ -4,14 +4,6 @@ import pkg_resources
from letsencrypt.acme import challenges
S_SIZE = 32
"""Size (in bytes) of secret base64-encoded octet string "s" used in
challenges."""
NONCE_SIZE = 16
"""Size of nonce used in JWS objects (in bytes)."""
EXCLUSIVE_CHALLENGES = frozenset([frozenset([
challenges.DVSNI, challenges.SimpleHTTPS])])
"""Mutually exclusive challenges."""
@ -46,10 +38,6 @@ NGINX_MOD_SSL_CONF = pkg_resources.resource_filename(
distribution."""
DVSNI_CHALLENGE_PORT = 443
"""Port to perform DVSNI challenge."""
TEMP_CHECKPOINT_DIR = "temp_checkpoint"
"""Temporary checkpoint directory (relative to IConfig.work_dir)."""

View file

@ -15,7 +15,6 @@ import zope.interface
from letsencrypt.acme import challenges
from letsencrypt.client import achallenges
from letsencrypt.client import constants
from letsencrypt.client import interfaces
@ -362,7 +361,7 @@ class StandaloneAuthenticator(object):
results_if_failure.append(False)
if not self.tasks:
raise ValueError("nothing for .perform() to do")
if self.already_listening(constants.DVSNI_CHALLENGE_PORT):
if self.already_listening(challenges.DVSNI.PORT):
# If we know a process is already listening on this port,
# tell the user, and don't even attempt to bind it. (This
# test is Linux-specific and won't indicate that the port
@ -370,7 +369,7 @@ class StandaloneAuthenticator(object):
return results_if_failure
# Try to do the authentication; note that this creates
# the listener subprocess via os.fork()
if self.start_listener(constants.DVSNI_CHALLENGE_PORT, key):
if self.start_listener(challenges.DVSNI.PORT, key):
return results_if_success
else:
# TODO: This should probably raise a DVAuthError exception