[Windows] Security model for files permissions - STEP 1 (#6893)

This PR is the first part of #6497 to ease the integration, following the new plan propose by @bmw here: #6497 (comment)

This step 1 refactor existing certbot.compat module into certbot.compat.misc, without any logic changed. Package certbot.compat will host the new modules that constitute the security model for Windows.

* Create the certbot.compat package. Move logic in certbot.compat.misc

* Add doc

* Fix lint

* Correct mypy

* Update client.py
This commit is contained in:
Adrien Ferrand
2019-03-28 15:51:48 -07:00
committed by Brad Warren
parent b0fb570c1c
commit 6ce6c67932
26 changed files with 123 additions and 136 deletions
+3 -2
View File
@@ -13,6 +13,7 @@ and properly flushed before program exit.
"""
from __future__ import print_function
import functools
import logging
import logging.handlers
@@ -23,10 +24,10 @@ import traceback
from acme import messages
from certbot import compat
from certbot import constants
from certbot import errors
from certbot import util
from certbot.compat import misc
# Logging format
CLI_FMT = "%(message)s"
@@ -134,7 +135,7 @@ def setup_log_file_handler(config, logfile, fmt):
# TODO: logs might contain sensitive data such as contents of the
# private key! #525
util.set_up_core_dir(
config.logs_dir, 0o700, compat.os_geteuid(), config.strict_permissions)
config.logs_dir, 0o700, misc.os_geteuid(), config.strict_permissions)
log_file_path = os.path.join(config.logs_dir, logfile)
try:
handler = logging.handlers.RotatingFileHandler(