[Windows] Fix account paths on Windows when colons are involved (#6711)

The account path used to store user credentials is calculated from the domain used to contact the relevant ACME CA server.

For instance, if the directory URL is https://my.domain.net/directory, then the account path will be $CONFIG_DIR/accounts/my.domain.net.

However, if non standard HTTP/HTTPS port need to be used, colons will be involved. For instance, https://my.domain.net:14000/directory will give $CONFIG_DIR/accounts/my.domain.net:14000.

Colons in paths are supported on POSIX systems, but not on Windows (it is reserved for the root drive letter).

This PR replaces colons by underscores for account paths on Windows, and leaves them untouched on Linux.

* Fix account path on Windows when colons are involved

* Protect colon in drive letter

* Refactor compat platform specific logic
This commit is contained in:
Adrien Ferrand
2019-01-31 14:53:32 -08:00
committed by Brad Warren
parent 0484b1554d
commit 8f7b280106
5 changed files with 40 additions and 11 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ class AccountFileStorage(interfaces.AccountStorage):
def __init__(self, config):
self.config = config
util.make_or_verify_dir(config.accounts_dir, 0o700, compat.os_geteuid(),
self.config.strict_permissions)
self.config.strict_permissions)
def _account_dir_path(self, account_id):
return self._account_dir_path_for_server_path(account_id, self.config.server_path)