diff --git a/letsencrypt/client/client.py b/letsencrypt/client/client.py index d939022ed..a4e98fa41 100644 --- a/letsencrypt/client/client.py +++ b/letsencrypt/client/client.py @@ -63,7 +63,7 @@ class Client(object): # TODO: Allow for other alg types besides RS256 self.network = network2.Network( - "https://" + config.server, jwk.JWKRSA.load(self.account.key.pem)) + config.server_url, jwk.JWKRSA.load(self.account.key.pem)) self.config = config diff --git a/letsencrypt/client/configuration.py b/letsencrypt/client/configuration.py index df00ee3aa..14c7b23cd 100644 --- a/letsencrypt/client/configuration.py +++ b/letsencrypt/client/configuration.py @@ -28,6 +28,8 @@ class NamespaceConfig(object): zope.interface.implements(interfaces.IConfig) def __init__(self, namespace): + assert not namespace.server.startswith('https://') + assert not namespace.server.startswith('http://') self.namespace = namespace def __getattr__(self, name): @@ -42,24 +44,32 @@ class NamespaceConfig(object): def in_progress_dir(self): # pylint: disable=missing-docstring return os.path.join(self.namespace.work_dir, constants.IN_PROGRESS_DIR) + @property + def server_path(self): + """File path based on ``server``.""" + return self.namespace.server.replace('/', os.path.sep) + + @property + def server_url(self): + """Full server URL (including HTTPS scheme).""" + return 'https://' + self.namespace.server + @property def cert_key_backup(self): # pylint: disable=missing-docstring return os.path.join( self.namespace.work_dir, constants.CERT_KEY_BACKUP_DIR, - self.namespace.server.partition(":")[0]) + self.server_path) @property def accounts_dir(self): #pylint: disable=missing-docstring return os.path.join( - self.namespace.config_dir, constants.ACCOUNTS_DIR, - self.namespace.server.replace(':', '-').replace('/', '-')) + self.namespace.config_dir, constants.ACCOUNTS_DIR, self.server_path) @property def account_keys_dir(self): #pylint: disable=missing-docstring return os.path.join( self.namespace.config_dir, constants.ACCOUNTS_DIR, - self.namespace.server.replace(':', '-').replace('/', '-'), - constants.ACCOUNT_KEYS_DIR) + self.server_path, constants.ACCOUNT_KEYS_DIR) # TODO: This should probably include the server name @property