[Windows] Security model for files permissions - STEP 2 (#6895)

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

This PR creates the module certbot.compat.os, that delegates everything to os, and that will be the safeguard against problematic methods of the standard module. On top of that, a quality check wrapper is called in the lint tox environment. This wrapper calls pylint and ensures that standard os module is no used directly in the certbot codebase.

Finally local oldest requirements are updated to ensure that tests will take the new logic when running.

* Add executable permissions

* Add the delegate certbot.compat.os module, add check coding style to enforce usage of certbot.compat.os instead of standard os

* Load certbot.compat.os instead of os

* Move existing compat test

* Update local oldest requirements

* Import sys

* Update account_test.py

* Update os.py

* Update os.py

* Update local oldest requirements

* Implement the new linter_plugin

* Fix local oldest for nginx

* Remove check coding style

* Update linter_plugin.py

* Add several comments

* Update the setup.py

* Add documentation

* Update acme dependencies

* Update certbot/compat/os.py

* Update docs/contributing.rst

* Update linter_plugin.py

* Handle os.path. Simplify checker.

* Add a comment to a reference implementation

* Update changelog

* Fix module registering

* Update docs/contributing.rst

* Update config and changelog
This commit is contained in:
Adrien Ferrand
2019-04-12 13:32:51 -07:00
committed by Brad Warren
parent 9c54f3dec8
commit d5de24d9fc
133 changed files with 321 additions and 240 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ persistent=yes
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
load-plugins=linter_plugin
[MESSAGES CONTROL]
+18
View File
@@ -14,6 +14,8 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
configuration test error is detected. This has to be done due to the way
Fedora now generates the self signed certificate files upon first
restart.
* Updated Certbot and its plugins to improve the handling of file system permissions
on Windows as a step towards adding proper Windows support to Certbot.
### Fixed
@@ -23,7 +25,23 @@ Despite us having broken lockstep, we are continuing to release new versions of
all Certbot components during releases for the time being, however, the only
package with changes other than its version number was:
* certbot
* certbot-apache
* certbot-dns-cloudflare
* certbot-dns-cloudxns
* certbot-dns-digitalocean
* certbot-dns-dnsimple
* certbot-dns-dnsmadeeasy
* certbot-dns-gehirn
* certbot-dns-google
* certbot-dns-linode
* certbot-dns-luadns
* certbot-dns-nsone
* certbot-dns-ovh
* certbot-dns-rfc2136
* certbot-dns-route53
* certbot-dns-sakuracloud
* certbot-nginx
More details about these changes can be found on our GitHub repo.
+2 -1
View File
@@ -1,8 +1,9 @@
""" Utility functions for certbot-apache plugin """
import binascii
import os
from certbot import util
from certbot.compat import os
def get_mod_deps(mod_name):
"""Get known module dependencies.
@@ -3,7 +3,6 @@
import copy
import fnmatch
import logging
import os
import re
import socket
import time
@@ -17,13 +16,14 @@ import zope.component
import zope.interface
from acme import challenges
from acme.magic_typing import Any, DefaultDict, Dict, List, Set, Union # pylint: disable=unused-import, no-name-in-module
from acme.magic_typing import DefaultDict, Dict, List, Set, Union # pylint: disable=unused-import, no-name-in-module
from certbot import errors
from certbot import interfaces
from certbot import util
from certbot.achallenges import KeyAuthorizationAnnotatedChallenge # pylint: disable=unused-import
from certbot.compat import os
from certbot.plugins import common
from certbot.plugins.util import path_surgery
from certbot.plugins.enhancements import AutoHSTSEnhancement
+2 -4
View File
@@ -1,14 +1,12 @@
"""Contains UI methods for Apache operations."""
import logging
import os
import zope.component
import certbot.display.util as display_util
from certbot import errors
from certbot import interfaces
import certbot.display.util as display_util
from certbot.compat import os
logger = logging.getLogger(__name__)
+4 -1
View File
@@ -1,15 +1,18 @@
"""A class that performs HTTP-01 challenges for Apache"""
import logging
import os
from acme.magic_typing import List, Set # pylint: disable=unused-import, no-name-in-module
from certbot import errors
from certbot.compat import os
from certbot.plugins import common
from certbot_apache.obj import VirtualHost # pylint: disable=unused-import
from certbot_apache.parser import get_aug_path
logger = logging.getLogger(__name__)
class ApacheHttp01(common.TLSSNI01):
"""Class that performs HTTP-01 challenges within the Apache configurator."""
@@ -1,19 +1,20 @@
""" Distribution specific override class for Debian family (Ubuntu/Debian) """
import logging
import os
import pkg_resources
import pkg_resources
import zope.interface
from certbot import errors
from certbot import interfaces
from certbot import util
from certbot.compat import os
from certbot_apache import apache_util
from certbot_apache import configurator
logger = logging.getLogger(__name__)
@zope.interface.provider(interfaces.IPluginFactory)
class DebianConfigurator(configurator.ApacheConfigurator):
"""Debian specific ApacheConfigurator override class"""
+2 -1
View File
@@ -2,7 +2,6 @@
import copy
import fnmatch
import logging
import os
import re
import subprocess
import sys
@@ -10,7 +9,9 @@ import sys
import six
from acme.magic_typing import Dict, List, Set # pylint: disable=unused-import, no-name-in-module
from certbot import errors
from certbot.compat import os
logger = logging.getLogger(__name__)
@@ -1,11 +1,11 @@
"""Test for certbot_apache.augeas_configurator."""
import os
import shutil
import unittest
import mock
from certbot import errors
from certbot.compat import os
from certbot_apache.tests import util
@@ -1,12 +1,14 @@
"""Test for certbot_apache.configurator for CentOS 6 overrides"""
import os
import unittest
from certbot.compat import os
from certbot.errors import MisconfigurationError
from certbot_apache import obj
from certbot_apache import override_centos
from certbot_apache import parser
from certbot_apache.tests import util
from certbot.errors import MisconfigurationError
def get_vh_truth(temp_dir, config_name):
"""Return the ground truth for the specified directory."""
@@ -1,15 +1,16 @@
"""Test for certbot_apache.configurator for Centos overrides"""
import os
import unittest
import mock
from certbot import errors
from certbot.compat import os
from certbot_apache import obj
from certbot_apache import override_centos
from certbot_apache.tests import util
def get_vh_truth(temp_dir, config_name):
"""Return the ground truth for the specified directory."""
prefix = os.path.join(
@@ -1,9 +1,9 @@
"""Tests for certbot_apache.parser."""
import os
import shutil
import unittest
from certbot import errors
from certbot.compat import os
from certbot_apache.tests import util
@@ -1,7 +1,6 @@
# pylint: disable=too-many-public-methods,too-many-lines
"""Test for certbot_apache.configurator."""
import copy
import os
import shutil
import socket
import tempfile
@@ -16,15 +15,14 @@ from acme import challenges
from certbot import achallenges
from certbot import crypto_util
from certbot import errors
from certbot.compat import os
from certbot.tests import acme_util
from certbot.tests import util as certbot_util
from certbot_apache import apache_util
from certbot_apache import constants
from certbot_apache import parser
from certbot_apache import obj
from certbot_apache import parser
from certbot_apache.tests import util
@@ -1,11 +1,11 @@
"""Test for certbot_apache.configurator for Debian overrides"""
import os
import shutil
import unittest
import mock
from certbot import errors
from certbot.compat import os
from certbot_apache import apache_util
from certbot_apache import obj
@@ -1,15 +1,16 @@
"""Test for certbot_apache.configurator for Gentoo overrides"""
import os
import unittest
import mock
from certbot import errors
from certbot.compat import os
from certbot_apache import override_gentoo
from certbot_apache import obj
from certbot_apache import override_gentoo
from certbot_apache.tests import util
def get_vh_truth(temp_dir, config_name):
"""Return the ground truth for the specified directory."""
prefix = os.path.join(
@@ -1,5 +1,4 @@
"""Test for certbot_apache.http_01."""
import os
import unittest
import mock
@@ -8,8 +7,9 @@ from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-
from certbot import achallenges
from certbot import errors
from certbot.compat import os
from certbot.tests import acme_util
from certbot_apache.parser import get_aug_path
from certbot_apache.tests import util
@@ -1,5 +1,4 @@
"""Tests for certbot_apache.parser."""
import os
import shutil
import unittest
@@ -7,6 +6,7 @@ import augeas
import mock
from certbot import errors
from certbot.compat import os
from certbot_apache.tests import util
+1 -3
View File
@@ -1,5 +1,4 @@
"""Common utilities for certbot_apache."""
import os
import shutil
import sys
import unittest
@@ -9,10 +8,9 @@ import josepy as jose
import mock
import zope.component
from certbot.compat import os
from certbot.display import util as display_util
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot_apache import configurator
+1 -1
View File
@@ -13,7 +13,7 @@
# serve to show the default.
import sys
import os
from certbot.compat import os
import shlex
import mock
+2 -2
View File
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.25.0
certbot[dev]==0.26.0
acme[dev]==0.29.0
-e .[dev]
+2 -2
View File
@@ -9,8 +9,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version.
install_requires = [
'acme>=0.25.0',
'certbot>=0.26.0',
'acme>=0.29.0',
'certbot>=0.34.0.dev0',
'mock',
'python-augeas',
'setuptools',
@@ -1,12 +1,12 @@
"""Tests for certbot_dns_cloudflare.dns_cloudflare."""
import os
import unittest
import CloudFlare
import mock
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.21.1
certbot[dev]==0.21.1
acme[dev]==0.29.0
-e .[dev]
+2 -2
View File
@@ -7,8 +7,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version.
install_requires = [
'acme>=0.21.1',
'certbot>=0.21.1',
'acme>=0.29.0',
'certbot>=0.34.0.dev0',
'cloudflare>=1.5.1',
'mock',
'setuptools',
@@ -1,11 +1,11 @@
"""Tests for certbot_dns_cloudxns.dns_cloudxns."""
import os
import unittest
import mock
from requests.exceptions import HTTPError, RequestException
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
+1 -1
View File
@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version.
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock',
'setuptools',
@@ -1,12 +1,12 @@
"""Tests for certbot_dns_digitalocean.dns_digitalocean."""
import os
import unittest
import digitalocean
import mock
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.21.1
certbot[dev]==0.21.1
acme[dev]==0.29.0
-e .[dev]
+2 -2
View File
@@ -7,8 +7,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version.
install_requires = [
'acme>=0.21.1',
'certbot>=0.21.1',
'acme>=0.29.0',
'certbot>=0.34.0.dev0',
'mock',
'python-digitalocean>=1.11',
'setuptools',
@@ -1,11 +1,11 @@
"""Tests for certbot_dns_dnsimple.dns_dnsimple."""
import os
import unittest
import mock
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
+1 -1
View File
@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version.
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock',
'setuptools',
@@ -1,11 +1,11 @@
"""Tests for certbot_dns_dnsmadeeasy.dns_dnsmadeeasy."""
import os
import unittest
import mock
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
+1 -1
View File
@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version.
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock',
'setuptools',
@@ -1,11 +1,11 @@
"""Tests for certbot_dns_gehirn.dns_gehirn."""
import os
import unittest
import mock
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
+1 -1
View File
@@ -7,7 +7,7 @@ version = '0.34.0.dev0'
# Please update tox.ini when modifying dependency version requirements
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.1.22',
'mock',
'setuptools',
@@ -1,6 +1,5 @@
"""Tests for certbot_dns_google.dns_google."""
import os
import unittest
import mock
@@ -10,6 +9,7 @@ from googleapiclient.http import HttpMock
from httplib2 import ServerNotFoundError
from certbot import errors
from certbot.compat import os
from certbot.errors import PluginError
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.21.1
certbot[dev]==0.21.1
acme[dev]==0.29.0
-e .[dev]
+2 -2
View File
@@ -7,8 +7,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version.
install_requires = [
'acme>=0.21.1',
'certbot>=0.21.1',
'acme>=0.29.0',
'certbot>=0.34.0.dev0',
# 1.5 is the first version that supports oauth2client>=2.0
'google-api-python-client>=1.5',
'mock',
@@ -1,10 +1,10 @@
"""Tests for certbot_dns_linode.dns_linode."""
import os
import unittest
import mock
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
+1 -1
View File
@@ -6,7 +6,7 @@ version = '0.34.0.dev0'
# Please update tox.ini when modifying dependency version requirements
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.2.1',
'mock',
'setuptools',
@@ -1,11 +1,11 @@
"""Tests for certbot_dns_luadns.dns_luadns."""
import os
import unittest
import mock
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
+1 -1
View File
@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version.
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock',
'setuptools',
@@ -1,11 +1,11 @@
"""Tests for certbot_dns_nsone.dns_nsone."""
import os
import unittest
import mock
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
+1 -1
View File
@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version.
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock',
'setuptools',
@@ -1,11 +1,11 @@
"""Tests for certbot_dns_ovh.dns_ovh."""
import os
import unittest
import mock
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
@@ -1,4 +1,4 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
dns-lexicon==2.7.14
+1 -1
View File
@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version.
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.7.14', # Correct proxy use on OVH provider
'mock',
'setuptools',
@@ -1,6 +1,5 @@
"""Tests for certbot_dns_rfc2136.dns_rfc2136."""
import os
import unittest
import dns.flags
@@ -9,6 +8,7 @@ import dns.tsig
import mock
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.21.1
certbot[dev]==0.21.1
acme[dev]==0.29.0
-e .[dev]
+2 -2
View File
@@ -7,8 +7,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version.
install_requires = [
'acme>=0.21.1',
'certbot>=0.21.1',
'acme>=0.29.0',
'certbot>=0.34.0.dev0',
'dnspython',
'mock',
'setuptools',
@@ -1,12 +1,12 @@
"""Tests for certbot_dns_route53.dns_route53.Authenticator"""
import os
import unittest
import mock
from botocore.exceptions import NoCredentialsError, ClientError
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.25.0
certbot[dev]==0.21.1
acme[dev]==0.29.0
-e .[dev]
+2 -2
View File
@@ -6,8 +6,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version.
install_requires = [
'acme>=0.25.0',
'certbot>=0.21.1',
'acme>=0.29.0',
'certbot>=0.34.0.dev0',
'boto3',
'mock',
'setuptools',
@@ -1,11 +1,11 @@
"""Tests for certbot_dns_sakuracloud.dns_sakuracloud."""
import os
import unittest
import mock
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0
certbot[dev]==0.31.0
-e .[dev]
+1 -1
View File
@@ -7,7 +7,7 @@ version = '0.34.0.dev0'
# Please update tox.ini when modifying dependency version requirements
install_requires = [
'acme>=0.31.0',
'certbot>=0.31.0',
'certbot>=0.34.0.dev0',
'dns-lexicon>=2.1.23',
'mock',
'setuptools',
+1 -1
View File
@@ -1,6 +1,5 @@
"""Nginx Configuration"""
import logging
import os
import re
import socket
import subprocess
@@ -20,6 +19,7 @@ from certbot import errors
from certbot import interfaces
from certbot import util
from certbot.compat import misc
from certbot.compat import os
from certbot.plugins import common
from certbot_nginx import constants
+1 -1
View File
@@ -1,12 +1,12 @@
"""A class that performs HTTP-01 challenges for Nginx"""
import logging
import os
from acme import challenges
from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module
from certbot import errors
from certbot.compat import os
from certbot.plugins import common
from certbot_nginx import obj
+1 -1
View File
@@ -3,13 +3,13 @@ import copy
import functools
import glob
import logging
import os
import re
import pyparsing
import six
from certbot import errors
from certbot.compat import os
from certbot_nginx import obj
from certbot_nginx import nginxparser
@@ -1,17 +1,16 @@
# pylint: disable=too-many-public-methods
"""Test for certbot_nginx.configurator."""
import os
import unittest
import mock
import OpenSSL
import mock
from acme import challenges
from acme import messages
from certbot import achallenges
from certbot import crypto_util
from certbot import errors
from certbot.compat import os
from certbot.tests import util as certbot_test_util
from certbot_nginx import constants
@@ -1,17 +1,18 @@
"""Tests for certbot_nginx.parser."""
import glob
import os
import re
import shutil
import unittest
from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module
from certbot import errors
from certbot.compat import os
from certbot_nginx import nginxparser
from certbot_nginx import obj
from certbot_nginx import parser
from certbot_nginx.tests import util
from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module
class NginxParserTest(util.NginxTest): #pylint: disable=too-many-public-methods
+1 -1
View File
@@ -1,6 +1,5 @@
"""Common utilities for certbot_nginx."""
import copy
import os
import shutil
import tempfile
import unittest
@@ -12,6 +11,7 @@ import pkg_resources
import zope.component
from certbot import configuration
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
+1 -1
View File
@@ -13,7 +13,7 @@
# serve to show the default.
import sys
import os
from certbot.compat import os
import shlex
+1 -1
View File
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.29.0
certbot[dev]==0.33.0
-e .[dev]
+1 -1
View File
@@ -10,7 +10,7 @@ version = '0.34.0.dev0'
# acme/certbot version.
install_requires = [
'acme>=0.29.0',
'certbot>=0.33.0',
'certbot>=0.34.0.dev0',
'mock',
'PyOpenSSL',
'pyparsing>=1.5.5', # Python3 support; perhaps unnecessary?
+7 -7
View File
@@ -1,24 +1,24 @@
"""certbot installer plugin for postfix."""
import logging
import os
import zope.interface
import zope.component
import six
import zope.component
import zope.interface
# pylint: disable=unused-import, no-name-in-module
from acme.magic_typing import Callable, Dict, List
# pylint: enable=unused-import, no-name-in-module
from certbot import errors
from certbot import interfaces
from certbot import util as certbot_util
from certbot.compat import os
from certbot.plugins import common as plugins_common
from certbot_postfix import constants
from certbot_postfix import postconf
from certbot_postfix import util
# pylint: disable=unused-import, no-name-in-module
from acme.magic_typing import Callable, Dict, List
# pylint: enable=unused-import, no-name-in-module
logger = logging.getLogger(__name__)
@zope.interface.implementer(interfaces.IInstaller)
@@ -1,16 +1,16 @@
"""Tests for certbot_postfix.installer."""
import copy
import functools
import os
import unittest
from contextlib import contextmanager
import mock
import pkg_resources
import six
from acme.magic_typing import Dict, Tuple # pylint: disable=unused-import, no-name-in-module
from acme.magic_typing import Dict, Tuple # pylint: disable=unused-import,no-name-in-module
from certbot import errors
from certbot.compat import os
from certbot.tests import util as certbot_test_util
+1 -1
View File
@@ -12,7 +12,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
from certbot.compat import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below.
acme[dev]==0.25.0
certbot[dev]==0.23.0
acme[dev]==0.29.0
-e .[dev]
+2 -2
View File
@@ -5,8 +5,8 @@ from setuptools import find_packages
version = '0.26.0.dev0'
install_requires = [
'acme>=0.25.0',
'certbot>=0.23.0',
'acme>=0.29.0',
'certbot>=0.34.0.dev0',
'setuptools',
'six',
'zope.component',
+1 -1
View File
@@ -3,7 +3,6 @@ import datetime
import functools
import hashlib
import logging
import os
import shutil
import socket
@@ -22,6 +21,7 @@ from certbot import errors
from certbot import interfaces
from certbot import util
from certbot.compat import misc
from certbot.compat import os
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -1,7 +1,6 @@
"""Tools for managing certificates."""
import datetime
import logging
import os
import re
import traceback
@@ -17,6 +16,7 @@ from certbot import ocsp
from certbot import storage
from certbot import util
from certbot.compat import misc
from certbot.compat import os
from certbot.display import util as display_util
logger = logging.getLogger(__name__)
+4 -7
View File
@@ -1,19 +1,17 @@
"""Certbot command line argument & config processing."""
# pylint: disable=too-many-lines
from __future__ import print_function
import argparse
import copy
import glob
import logging
import logging.handlers
import os
import sys
import configargparse
import six
import zope.component
import zope.interface
from zope.interface import interfaces as zope_interfaces
from acme import challenges
@@ -22,18 +20,17 @@ from acme.magic_typing import Any, Dict, Optional
# pylint: enable=unused-import, no-name-in-module
import certbot
import certbot.plugins.enhancements as enhancements
import certbot.plugins.selection as plugin_selection
from certbot import constants
from certbot import crypto_util
from certbot import errors
from certbot import hooks
from certbot import interfaces
from certbot import util
from certbot.compat import os
from certbot.display import util as display_util
from certbot.plugins import disco as plugins_disco
import certbot.plugins.enhancements as enhancements
import certbot.plugins.selection as plugin_selection
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -1,7 +1,6 @@
"""Certbot client API."""
import datetime
import logging
import os
import platform
import OpenSSL
@@ -32,6 +31,7 @@ from certbot import reverter
from certbot import storage
from certbot import util
from certbot.compat import misc
from certbot.compat import os
from certbot.display import enhancements
from certbot.display import ops as display_ops
from certbot.plugins import selection as plugin_selection
+4 -4
View File
@@ -2,14 +2,14 @@
This compat module handles various platform specific calls that do not fall into one
particular category.
"""
import os
import select
import sys
import errno
import ctypes
import errno
import select
import stat
import sys
from certbot import errors
from certbot.compat import os
UNPRIVILEGED_SUBCOMMANDS_ALLOWED = [
'certificates', 'enhance', 'revoke', 'delete',
+31
View File
@@ -0,0 +1,31 @@
"""
This compat modules is a wrapper of the core os module that forbids usage of specific operations
(eg. chown, chmod, getuid) that would be harmful to the Windows file security model of Certbot.
This module is intended to replace standard os module throughout certbot projects (except acme).
"""
from __future__ import absolute_import
# First round of wrapping: we import statically all public attributes exposed by the os module
# This allows in particular to have pylint, mypy, IDEs be aware that most of os members are
# available in certbot.compat.os.
from os import * # type: ignore # pylint: disable=wildcard-import,unused-wildcard-import,redefined-builtin,os-module-forbidden
# Second round of wrapping: we import dynamically all attributes from the os module that have not
# yet been imported by the first round (static import). This covers in particular the case of
# specific python 3.x versions where not all public attributes are in the special __all__ of os,
# and so not in `from os import *`.
import os as std_os # pylint: disable=os-module-forbidden
import sys as std_sys
ourselves = std_sys.modules[__name__]
for attribute in dir(std_os):
# Check if the attribute does not already exist in our module. It could be internal attributes
# of the module (__name__, __doc__), or attributes from standard os already imported with
# `from os import *`.
if not hasattr(ourselves, attribute):
setattr(ourselves, attribute, getattr(std_os, attribute))
# Similar to os.path, allow certbot.compat.os.path to behave as a module
std_sys.modules[__name__ + '.path'] = path
# Clean all remaining importables that are not from the core os module.
del ourselves, std_os, std_sys
+1 -1
View File
@@ -1,6 +1,5 @@
"""Certbot user-supplied configuration."""
import copy
import os
import zope.interface
from six.moves.urllib import parse # pylint: disable=relative-import
@@ -10,6 +9,7 @@ from certbot import errors
from certbot import interfaces
from certbot import util
from certbot.compat import misc
from certbot.compat import os
@zope.interface.implementer(interfaces.IConfig)
+1 -1
View File
@@ -1,12 +1,12 @@
"""Certbot constants."""
import logging
import os
import pkg_resources
from acme import challenges
from certbot.compat import misc
from certbot.compat import os
SETUPTOOLS_PLUGINS_ENTRY_POINT = "certbot.plugins"
"""Setuptools entry point group name for plugins."""
+1 -1
View File
@@ -6,7 +6,6 @@
"""
import hashlib
import logging
import os
import warnings
import pyrfc3339
@@ -30,6 +29,7 @@ from certbot import errors
from certbot import interfaces
from certbot import util
from certbot.compat import misc
from certbot.compat import os
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -1,6 +1,5 @@
"""Contains UI methods for LE user operations."""
import logging
import os
import zope.component
@@ -8,6 +7,7 @@ from certbot import errors
from certbot import interfaces
from certbot import util
from certbot.compat import misc
from certbot.compat import os
from certbot.display import util as display_util
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -1,6 +1,5 @@
"""Certbot display."""
import logging
import os
import sys
import textwrap
@@ -10,6 +9,7 @@ from certbot import constants
from certbot import errors
from certbot import interfaces
from certbot.compat import misc
from certbot.compat import os
from certbot.display import completer
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -1,7 +1,6 @@
"""Registers functions to be called if an exception or signal occurs."""
import functools
import logging
import os
import signal
import traceback
@@ -10,6 +9,7 @@ from acme.magic_typing import Any, Callable, Dict, List, Union
# pylint: enable=unused-import, no-name-in-module
from certbot import errors
from certbot.compat import os
logger = logging.getLogger(__name__)
+3 -4
View File
@@ -2,14 +2,13 @@
from __future__ import print_function
import logging
import os
from subprocess import Popen, PIPE
from acme.magic_typing import Set, List # pylint: disable=unused-import, no-name-in-module
from acme.magic_typing import Set, List # pylint: disable=unused-import, no-name-in-module
from certbot import errors
from certbot import util
from certbot.compat import os
from certbot.plugins import util as plug_util
logger = logging.getLogger(__name__)
+3 -2
View File
@@ -1,7 +1,6 @@
"""Implements file locks compatible with Linux and Windows for locking files and directories."""
import errno
import logging
import os
try:
import fcntl # pylint: disable=import-error
except ImportError:
@@ -10,8 +9,10 @@ except ImportError:
else:
POSIX_MODE = True
from acme.magic_typing import Optional # pylint: disable=unused-import, no-name-in-module
from certbot import errors
from acme.magic_typing import Optional, Callable # pylint: disable=unused-import, no-name-in-module
from certbot.compat import os
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -17,7 +17,6 @@ from __future__ import print_function
import functools
import logging
import logging.handlers
import os
import sys
import tempfile
import traceback
@@ -28,6 +27,7 @@ from certbot import constants
from certbot import errors
from certbot import util
from certbot.compat import misc
from certbot.compat import os
# Logging format
CLI_FMT = "%(message)s"
+1 -1
View File
@@ -4,7 +4,6 @@ from __future__ import print_function
import functools
import logging.handlers
import os
import sys
import configobj
@@ -33,6 +32,7 @@ from certbot import storage
from certbot import updater
from certbot import util
from certbot.compat import misc
from certbot.compat import os
from certbot.display import util as display_util, ops as display_ops
from certbot.plugins import disco as plugins_disco
from certbot.plugins import enhancements
+2 -2
View File
@@ -1,6 +1,5 @@
"""Plugin common functions."""
import logging
import os
import re
import shutil
import tempfile
@@ -12,6 +11,7 @@ import zope.interface
from josepy import util as jose_util
from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module
from certbot import achallenges # pylint: disable=unused-import
from certbot import constants
from certbot import crypto_util
@@ -19,7 +19,7 @@ from certbot import errors
from certbot import interfaces
from certbot import reverter
from certbot import util
from certbot.compat import os
from certbot.plugins.storage import PluginStorage
logger = logging.getLogger(__name__)
+2 -3
View File
@@ -1,20 +1,19 @@
"""Tests for certbot.plugins.common."""
import functools
import os
import shutil
import tempfile
import unittest
import OpenSSL
import josepy as jose
import mock
import OpenSSL
from acme import challenges
from certbot import achallenges
from certbot import crypto_util
from certbot import errors
from certbot.compat import os
from certbot.tests import acme_util
from certbot.tests import util as test_util
+2 -1
View File
@@ -2,16 +2,17 @@
import abc
import logging
import os
import stat
from time import sleep
import configobj
import zope.interface
from acme import challenges
from certbot import errors
from certbot import interfaces
from certbot.compat import os
from certbot.display import ops
from certbot.display import util as display_util
from certbot.plugins import common
+1 -1
View File
@@ -2,12 +2,12 @@
import collections
import logging
import os
import unittest
import mock
from certbot import errors
from certbot.compat import os
from certbot.display import util as display_util
from certbot.plugins import dns_common
from certbot.plugins import dns_test_common
+2 -2
View File
@@ -1,14 +1,14 @@
"""Base test class for DNS authenticators."""
import os
import configobj
import josepy as jose
import mock
import six
from acme import challenges
from certbot import achallenges
from certbot.compat import os
from certbot.tests import acme_util
from certbot.tests import util as test_util
+2 -3
View File
@@ -1,6 +1,4 @@
"""Manual authenticator plugin"""
import os
import zope.component
import zope.interface
@@ -8,10 +6,11 @@ from acme import challenges
from acme.magic_typing import Dict # pylint: disable=unused-import, no-name-in-module
from certbot import achallenges # pylint: disable=unused-import
from certbot import interfaces
from certbot import errors
from certbot import hooks
from certbot import interfaces
from certbot import reverter
from certbot.compat import os
from certbot.plugins import common
+3 -4
View File
@@ -1,15 +1,14 @@
"""Tests for certbot.plugins.manual"""
import os
import unittest
import sys
import six
import mock
import six
from acme import challenges
from certbot import errors
from certbot.compat import os
from certbot.tests import acme_util
from certbot.tests import util as test_util
@@ -73,7 +72,7 @@ class AuthenticatorTest(test_util.TempDirTestCase):
self.config.manual_public_ip_logging_ok = True
self.config.manual_auth_hook = (
'{0} -c "from __future__ import print_function;'
'import os; print(os.environ.get(\'CERTBOT_DOMAIN\'));'
'from certbot.compat import os; print(os.environ.get(\'CERTBOT_DOMAIN\'));'
'print(os.environ.get(\'CERTBOT_TOKEN\', \'notoken\'));'
'print(os.environ.get(\'CERTBOT_VALIDATION\', \'novalidation\'));"'
.format(sys.executable))

Some files were not shown because too many files have changed in this diff Show More