1
0
mirror of https://github.com/certbot/certbot.git synced 2025-08-09 15:02:48 +03:00

[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 22:32:52 +02:00
committed by Brad Warren
parent 9c54f3dec8
commit d5de24d9fc
133 changed files with 321 additions and 240 deletions

View File

@@ -22,7 +22,7 @@ persistent=yes
# List of plugins (as comma separated values of python modules names) to load, # List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers. # usually to register additional checkers.
load-plugins= load-plugins=linter_plugin
[MESSAGES CONTROL] [MESSAGES CONTROL]

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 configuration test error is detected. This has to be done due to the way
Fedora now generates the self signed certificate files upon first Fedora now generates the self signed certificate files upon first
restart. 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 ### 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 all Certbot components during releases for the time being, however, the only
package with changes other than its version number was: package with changes other than its version number was:
* certbot
* certbot-apache * 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. More details about these changes can be found on our GitHub repo.

View File

@@ -1,8 +1,9 @@
""" Utility functions for certbot-apache plugin """ """ Utility functions for certbot-apache plugin """
import binascii import binascii
import os
from certbot import util from certbot import util
from certbot.compat import os
def get_mod_deps(mod_name): def get_mod_deps(mod_name):
"""Get known module dependencies. """Get known module dependencies.

View File

@@ -3,7 +3,6 @@
import copy import copy
import fnmatch import fnmatch
import logging import logging
import os
import re import re
import socket import socket
import time import time
@@ -17,13 +16,14 @@ import zope.component
import zope.interface import zope.interface
from acme import challenges 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 errors
from certbot import interfaces from certbot import interfaces
from certbot import util from certbot import util
from certbot.achallenges import KeyAuthorizationAnnotatedChallenge # pylint: disable=unused-import from certbot.achallenges import KeyAuthorizationAnnotatedChallenge # pylint: disable=unused-import
from certbot.compat import os
from certbot.plugins import common from certbot.plugins import common
from certbot.plugins.util import path_surgery from certbot.plugins.util import path_surgery
from certbot.plugins.enhancements import AutoHSTSEnhancement from certbot.plugins.enhancements import AutoHSTSEnhancement

View File

@@ -1,14 +1,12 @@
"""Contains UI methods for Apache operations.""" """Contains UI methods for Apache operations."""
import logging import logging
import os
import zope.component import zope.component
import certbot.display.util as display_util
from certbot import errors from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot.compat import os
import certbot.display.util as display_util
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,15 +1,18 @@
"""A class that performs HTTP-01 challenges for Apache""" """A class that performs HTTP-01 challenges for Apache"""
import logging import logging
import os
from acme.magic_typing import List, Set # pylint: disable=unused-import, no-name-in-module from acme.magic_typing import List, Set # pylint: disable=unused-import, no-name-in-module
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.plugins import common from certbot.plugins import common
from certbot_apache.obj import VirtualHost # pylint: disable=unused-import from certbot_apache.obj import VirtualHost # pylint: disable=unused-import
from certbot_apache.parser import get_aug_path from certbot_apache.parser import get_aug_path
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class ApacheHttp01(common.TLSSNI01): class ApacheHttp01(common.TLSSNI01):
"""Class that performs HTTP-01 challenges within the Apache configurator.""" """Class that performs HTTP-01 challenges within the Apache configurator."""

View File

@@ -1,19 +1,20 @@
""" Distribution specific override class for Debian family (Ubuntu/Debian) """ """ Distribution specific override class for Debian family (Ubuntu/Debian) """
import logging import logging
import os
import pkg_resources
import pkg_resources
import zope.interface import zope.interface
from certbot import errors from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot import util from certbot import util
from certbot.compat import os
from certbot_apache import apache_util from certbot_apache import apache_util
from certbot_apache import configurator from certbot_apache import configurator
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@zope.interface.provider(interfaces.IPluginFactory) @zope.interface.provider(interfaces.IPluginFactory)
class DebianConfigurator(configurator.ApacheConfigurator): class DebianConfigurator(configurator.ApacheConfigurator):
"""Debian specific ApacheConfigurator override class""" """Debian specific ApacheConfigurator override class"""

View File

@@ -2,7 +2,6 @@
import copy import copy
import fnmatch import fnmatch
import logging import logging
import os
import re import re
import subprocess import subprocess
import sys import sys
@@ -10,7 +9,9 @@ import sys
import six import six
from acme.magic_typing import Dict, List, Set # pylint: disable=unused-import, no-name-in-module from acme.magic_typing import Dict, List, Set # pylint: disable=unused-import, no-name-in-module
from certbot import errors from certbot import errors
from certbot.compat import os
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,11 +1,11 @@
"""Test for certbot_apache.augeas_configurator.""" """Test for certbot_apache.augeas_configurator."""
import os
import shutil import shutil
import unittest import unittest
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot_apache.tests import util from certbot_apache.tests import util

View File

@@ -1,12 +1,14 @@
"""Test for certbot_apache.configurator for CentOS 6 overrides""" """Test for certbot_apache.configurator for CentOS 6 overrides"""
import os
import unittest import unittest
from certbot.compat import os
from certbot.errors import MisconfigurationError
from certbot_apache import obj from certbot_apache import obj
from certbot_apache import override_centos from certbot_apache import override_centos
from certbot_apache import parser from certbot_apache import parser
from certbot_apache.tests import util from certbot_apache.tests import util
from certbot.errors import MisconfigurationError
def get_vh_truth(temp_dir, config_name): def get_vh_truth(temp_dir, config_name):
"""Return the ground truth for the specified directory.""" """Return the ground truth for the specified directory."""

View File

@@ -1,15 +1,16 @@
"""Test for certbot_apache.configurator for Centos overrides""" """Test for certbot_apache.configurator for Centos overrides"""
import os
import unittest import unittest
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot_apache import obj from certbot_apache import obj
from certbot_apache import override_centos from certbot_apache import override_centos
from certbot_apache.tests import util from certbot_apache.tests import util
def get_vh_truth(temp_dir, config_name): def get_vh_truth(temp_dir, config_name):
"""Return the ground truth for the specified directory.""" """Return the ground truth for the specified directory."""
prefix = os.path.join( prefix = os.path.join(

View File

@@ -1,9 +1,9 @@
"""Tests for certbot_apache.parser.""" """Tests for certbot_apache.parser."""
import os
import shutil import shutil
import unittest import unittest
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot_apache.tests import util from certbot_apache.tests import util

View File

@@ -1,7 +1,6 @@
# pylint: disable=too-many-public-methods,too-many-lines # pylint: disable=too-many-public-methods,too-many-lines
"""Test for certbot_apache.configurator.""" """Test for certbot_apache.configurator."""
import copy import copy
import os
import shutil import shutil
import socket import socket
import tempfile import tempfile
@@ -16,15 +15,14 @@ from acme import challenges
from certbot import achallenges from certbot import achallenges
from certbot import crypto_util from certbot import crypto_util
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.tests import acme_util from certbot.tests import acme_util
from certbot.tests import util as certbot_util from certbot.tests import util as certbot_util
from certbot_apache import apache_util from certbot_apache import apache_util
from certbot_apache import constants from certbot_apache import constants
from certbot_apache import parser
from certbot_apache import obj from certbot_apache import obj
from certbot_apache import parser
from certbot_apache.tests import util from certbot_apache.tests import util

View File

@@ -1,11 +1,11 @@
"""Test for certbot_apache.configurator for Debian overrides""" """Test for certbot_apache.configurator for Debian overrides"""
import os
import shutil import shutil
import unittest import unittest
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot_apache import apache_util from certbot_apache import apache_util
from certbot_apache import obj from certbot_apache import obj

View File

@@ -1,15 +1,16 @@
"""Test for certbot_apache.configurator for Gentoo overrides""" """Test for certbot_apache.configurator for Gentoo overrides"""
import os
import unittest import unittest
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot_apache import override_gentoo
from certbot_apache import obj from certbot_apache import obj
from certbot_apache import override_gentoo
from certbot_apache.tests import util from certbot_apache.tests import util
def get_vh_truth(temp_dir, config_name): def get_vh_truth(temp_dir, config_name):
"""Return the ground truth for the specified directory.""" """Return the ground truth for the specified directory."""
prefix = os.path.join( prefix = os.path.join(

View File

@@ -1,5 +1,4 @@
"""Test for certbot_apache.http_01.""" """Test for certbot_apache.http_01."""
import os
import unittest import unittest
import mock 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 achallenges
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.tests import acme_util from certbot.tests import acme_util
from certbot_apache.parser import get_aug_path from certbot_apache.parser import get_aug_path
from certbot_apache.tests import util from certbot_apache.tests import util

View File

@@ -1,5 +1,4 @@
"""Tests for certbot_apache.parser.""" """Tests for certbot_apache.parser."""
import os
import shutil import shutil
import unittest import unittest
@@ -7,6 +6,7 @@ import augeas
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot_apache.tests import util from certbot_apache.tests import util

View File

@@ -1,5 +1,4 @@
"""Common utilities for certbot_apache.""" """Common utilities for certbot_apache."""
import os
import shutil import shutil
import sys import sys
import unittest import unittest
@@ -9,10 +8,9 @@ import josepy as jose
import mock import mock
import zope.component import zope.component
from certbot.compat import os
from certbot.display import util as display_util from certbot.display import util as display_util
from certbot.plugins import common from certbot.plugins import common
from certbot.tests import util as test_util from certbot.tests import util as test_util
from certbot_apache import configurator from certbot_apache import configurator

View File

@@ -13,7 +13,7 @@
# serve to show the default. # serve to show the default.
import sys import sys
import os from certbot.compat import os
import shlex import shlex
import mock import mock

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.25.0 acme[dev]==0.29.0
certbot[dev]==0.26.0 -e .[dev]

View File

@@ -9,8 +9,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum # Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.25.0', 'acme>=0.29.0',
'certbot>=0.26.0', 'certbot>=0.34.0.dev0',
'mock', 'mock',
'python-augeas', 'python-augeas',
'setuptools', 'setuptools',

View File

@@ -1,12 +1,12 @@
"""Tests for certbot_dns_cloudflare.dns_cloudflare.""" """Tests for certbot_dns_cloudflare.dns_cloudflare."""
import os
import unittest import unittest
import CloudFlare import CloudFlare
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.21.1 acme[dev]==0.29.0
certbot[dev]==0.21.1 -e .[dev]

View File

@@ -7,8 +7,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum # Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.21.1', 'acme>=0.29.0',
'certbot>=0.21.1', 'certbot>=0.34.0.dev0',
'cloudflare>=1.5.1', 'cloudflare>=1.5.1',
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,11 +1,11 @@
"""Tests for certbot_dns_cloudxns.dns_cloudxns.""" """Tests for certbot_dns_cloudxns.dns_cloudxns."""
import os
import unittest import unittest
import mock import mock
from requests.exceptions import HTTPError, RequestException 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
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]

View File

@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.31.0', '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 'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,12 +1,12 @@
"""Tests for certbot_dns_digitalocean.dns_digitalocean.""" """Tests for certbot_dns_digitalocean.dns_digitalocean."""
import os
import unittest import unittest
import digitalocean import digitalocean
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.21.1 acme[dev]==0.29.0
certbot[dev]==0.21.1 -e .[dev]

View File

@@ -7,8 +7,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum # Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.21.1', 'acme>=0.29.0',
'certbot>=0.21.1', 'certbot>=0.34.0.dev0',
'mock', 'mock',
'python-digitalocean>=1.11', 'python-digitalocean>=1.11',
'setuptools', 'setuptools',

View File

@@ -1,11 +1,11 @@
"""Tests for certbot_dns_dnsimple.dns_dnsimple.""" """Tests for certbot_dns_dnsimple.dns_dnsimple."""
import os
import unittest import unittest
import mock import mock
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]

View File

@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.31.0', '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 'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,11 +1,11 @@
"""Tests for certbot_dns_dnsmadeeasy.dns_dnsmadeeasy.""" """Tests for certbot_dns_dnsmadeeasy.dns_dnsmadeeasy."""
import os
import unittest import unittest
import mock import mock
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]

View File

@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.31.0', '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 'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,11 +1,11 @@
"""Tests for certbot_dns_gehirn.dns_gehirn.""" """Tests for certbot_dns_gehirn.dns_gehirn."""
import os
import unittest import unittest
import mock import mock
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]

View File

@@ -7,7 +7,7 @@ version = '0.34.0.dev0'
# Please update tox.ini when modifying dependency version requirements # Please update tox.ini when modifying dependency version requirements
install_requires = [ install_requires = [
'acme>=0.31.0', 'acme>=0.31.0',
'certbot>=0.31.0', 'certbot>=0.34.0.dev0',
'dns-lexicon>=2.1.22', 'dns-lexicon>=2.1.22',
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,6 +1,5 @@
"""Tests for certbot_dns_google.dns_google.""" """Tests for certbot_dns_google.dns_google."""
import os
import unittest import unittest
import mock import mock
@@ -10,6 +9,7 @@ from googleapiclient.http import HttpMock
from httplib2 import ServerNotFoundError from httplib2 import ServerNotFoundError
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.errors import PluginError from certbot.errors import PluginError
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.21.1 acme[dev]==0.29.0
certbot[dev]==0.21.1 -e .[dev]

View File

@@ -7,8 +7,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum # Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.21.1', 'acme>=0.29.0',
'certbot>=0.21.1', 'certbot>=0.34.0.dev0',
# 1.5 is the first version that supports oauth2client>=2.0 # 1.5 is the first version that supports oauth2client>=2.0
'google-api-python-client>=1.5', 'google-api-python-client>=1.5',
'mock', 'mock',

View File

@@ -1,10 +1,10 @@
"""Tests for certbot_dns_linode.dns_linode.""" """Tests for certbot_dns_linode.dns_linode."""
import os
import unittest import unittest
import mock import mock
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]

View File

@@ -6,7 +6,7 @@ version = '0.34.0.dev0'
# Please update tox.ini when modifying dependency version requirements # Please update tox.ini when modifying dependency version requirements
install_requires = [ install_requires = [
'acme>=0.31.0', 'acme>=0.31.0',
'certbot>=0.31.0', 'certbot>=0.34.0.dev0',
'dns-lexicon>=2.2.1', 'dns-lexicon>=2.2.1',
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,11 +1,11 @@
"""Tests for certbot_dns_luadns.dns_luadns.""" """Tests for certbot_dns_luadns.dns_luadns."""
import os
import unittest import unittest
import mock import mock
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]

View File

@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.31.0', '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 'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,11 +1,11 @@
"""Tests for certbot_dns_nsone.dns_nsone.""" """Tests for certbot_dns_nsone.dns_nsone."""
import os
import unittest import unittest
import mock import mock
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]

View File

@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.31.0', '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 'dns-lexicon>=2.2.1', # Support for >1 TXT record per name
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,11 +1,11 @@
"""Tests for certbot_dns_ovh.dns_ovh.""" """Tests for certbot_dns_ovh.dns_ovh."""
import os
import unittest import unittest
import mock import mock
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,4 +1,4 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]
dns-lexicon==2.7.14 dns-lexicon==2.7.14

View File

@@ -8,7 +8,7 @@ version = '0.34.0.dev0'
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.31.0', 'acme>=0.31.0',
'certbot>=0.31.0', 'certbot>=0.34.0.dev0',
'dns-lexicon>=2.7.14', # Correct proxy use on OVH provider 'dns-lexicon>=2.7.14', # Correct proxy use on OVH provider
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,6 +1,5 @@
"""Tests for certbot_dns_rfc2136.dns_rfc2136.""" """Tests for certbot_dns_rfc2136.dns_rfc2136."""
import os
import unittest import unittest
import dns.flags import dns.flags
@@ -9,6 +8,7 @@ import dns.tsig
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.21.1 acme[dev]==0.29.0
certbot[dev]==0.21.1 -e .[dev]

View File

@@ -7,8 +7,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum # Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.21.1', 'acme>=0.29.0',
'certbot>=0.21.1', 'certbot>=0.34.0.dev0',
'dnspython', 'dnspython',
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,12 +1,12 @@
"""Tests for certbot_dns_route53.dns_route53.Authenticator""" """Tests for certbot_dns_route53.dns_route53.Authenticator"""
import os
import unittest import unittest
import mock import mock
from botocore.exceptions import NoCredentialsError, ClientError from botocore.exceptions import NoCredentialsError, ClientError
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.25.0 acme[dev]==0.29.0
certbot[dev]==0.21.1 -e .[dev]

View File

@@ -6,8 +6,8 @@ version = '0.34.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum # Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.25.0', 'acme>=0.29.0',
'certbot>=0.21.1', 'certbot>=0.34.0.dev0',
'boto3', 'boto3',
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,11 +1,11 @@
"""Tests for certbot_dns_sakuracloud.dns_sakuracloud.""" """Tests for certbot_dns_sakuracloud.dns_sakuracloud."""
import os
import unittest import unittest
import mock import mock
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN from certbot.plugins.dns_test_common import DOMAIN

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.31.0 acme[dev]==0.31.0
certbot[dev]==0.31.0 -e .[dev]

View File

@@ -7,7 +7,7 @@ version = '0.34.0.dev0'
# Please update tox.ini when modifying dependency version requirements # Please update tox.ini when modifying dependency version requirements
install_requires = [ install_requires = [
'acme>=0.31.0', 'acme>=0.31.0',
'certbot>=0.31.0', 'certbot>=0.34.0.dev0',
'dns-lexicon>=2.1.23', 'dns-lexicon>=2.1.23',
'mock', 'mock',
'setuptools', 'setuptools',

View File

@@ -1,6 +1,5 @@
"""Nginx Configuration""" """Nginx Configuration"""
import logging import logging
import os
import re import re
import socket import socket
import subprocess import subprocess
@@ -20,6 +19,7 @@ from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
from certbot.plugins import common from certbot.plugins import common
from certbot_nginx import constants from certbot_nginx import constants

View File

@@ -1,12 +1,12 @@
"""A class that performs HTTP-01 challenges for Nginx""" """A class that performs HTTP-01 challenges for Nginx"""
import logging import logging
import os
from acme import challenges from acme import challenges
from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.plugins import common from certbot.plugins import common
from certbot_nginx import obj from certbot_nginx import obj

View File

@@ -3,13 +3,13 @@ import copy
import functools import functools
import glob import glob
import logging import logging
import os
import re import re
import pyparsing import pyparsing
import six import six
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot_nginx import obj from certbot_nginx import obj
from certbot_nginx import nginxparser from certbot_nginx import nginxparser

View File

@@ -1,17 +1,16 @@
# pylint: disable=too-many-public-methods # pylint: disable=too-many-public-methods
"""Test for certbot_nginx.configurator.""" """Test for certbot_nginx.configurator."""
import os
import unittest import unittest
import mock
import OpenSSL import OpenSSL
import mock
from acme import challenges from acme import challenges
from acme import messages from acme import messages
from certbot import achallenges from certbot import achallenges
from certbot import crypto_util from certbot import crypto_util
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.tests import util as certbot_test_util from certbot.tests import util as certbot_test_util
from certbot_nginx import constants from certbot_nginx import constants

View File

@@ -1,17 +1,18 @@
"""Tests for certbot_nginx.parser.""" """Tests for certbot_nginx.parser."""
import glob import glob
import os
import re import re
import shutil import shutil
import unittest import unittest
from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot_nginx import nginxparser from certbot_nginx import nginxparser
from certbot_nginx import obj from certbot_nginx import obj
from certbot_nginx import parser from certbot_nginx import parser
from certbot_nginx.tests import util 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 class NginxParserTest(util.NginxTest): #pylint: disable=too-many-public-methods

View File

@@ -1,6 +1,5 @@
"""Common utilities for certbot_nginx.""" """Common utilities for certbot_nginx."""
import copy import copy
import os
import shutil import shutil
import tempfile import tempfile
import unittest import unittest
@@ -12,6 +11,7 @@ import pkg_resources
import zope.component import zope.component
from certbot import configuration from certbot import configuration
from certbot.compat import os
from certbot.plugins import common from certbot.plugins import common
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -13,7 +13,7 @@
# serve to show the default. # serve to show the default.
import sys import sys
import os from certbot.compat import os
import shlex import shlex

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.29.0 acme[dev]==0.29.0
certbot[dev]==0.33.0 -e .[dev]

View File

@@ -10,7 +10,7 @@ version = '0.34.0.dev0'
# acme/certbot version. # acme/certbot version.
install_requires = [ install_requires = [
'acme>=0.29.0', 'acme>=0.29.0',
'certbot>=0.33.0', 'certbot>=0.34.0.dev0',
'mock', 'mock',
'PyOpenSSL', 'PyOpenSSL',
'pyparsing>=1.5.5', # Python3 support; perhaps unnecessary? 'pyparsing>=1.5.5', # Python3 support; perhaps unnecessary?

View File

@@ -1,24 +1,24 @@
"""certbot installer plugin for postfix.""" """certbot installer plugin for postfix."""
import logging import logging
import os
import zope.interface
import zope.component
import six 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 errors
from certbot import interfaces from certbot import interfaces
from certbot import util as certbot_util from certbot import util as certbot_util
from certbot.compat import os
from certbot.plugins import common as plugins_common from certbot.plugins import common as plugins_common
from certbot_postfix import constants from certbot_postfix import constants
from certbot_postfix import postconf from certbot_postfix import postconf
from certbot_postfix import util 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__) logger = logging.getLogger(__name__)
@zope.interface.implementer(interfaces.IInstaller) @zope.interface.implementer(interfaces.IInstaller)

View File

@@ -1,16 +1,16 @@
"""Tests for certbot_postfix.installer.""" """Tests for certbot_postfix.installer."""
import copy import copy
import functools import functools
import os
import unittest import unittest
from contextlib import contextmanager from contextlib import contextmanager
import mock import mock
import pkg_resources import pkg_resources
import six 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 import errors
from certbot.compat import os
from certbot.tests import util as certbot_test_util from certbot.tests import util as certbot_test_util

View File

@@ -12,7 +12,7 @@
# add these directories to sys.path here. If the directory is relative to the # 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. # documentation root, use os.path.abspath to make it absolute, like shown here.
# #
import os from certbot.compat import os
# import sys # import sys
# sys.path.insert(0, os.path.abspath('.')) # sys.path.insert(0, os.path.abspath('.'))

View File

@@ -1,3 +1,3 @@
# Remember to update setup.py to match the package versions below. # Remember to update setup.py to match the package versions below.
acme[dev]==0.25.0 acme[dev]==0.29.0
certbot[dev]==0.23.0 -e .[dev]

View File

@@ -5,8 +5,8 @@ from setuptools import find_packages
version = '0.26.0.dev0' version = '0.26.0.dev0'
install_requires = [ install_requires = [
'acme>=0.25.0', 'acme>=0.29.0',
'certbot>=0.23.0', 'certbot>=0.34.0.dev0',
'setuptools', 'setuptools',
'six', 'six',
'zope.component', 'zope.component',

View File

@@ -3,7 +3,6 @@ import datetime
import functools import functools
import hashlib import hashlib
import logging import logging
import os
import shutil import shutil
import socket import socket
@@ -22,6 +21,7 @@ from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,7 +1,6 @@
"""Tools for managing certificates.""" """Tools for managing certificates."""
import datetime import datetime
import logging import logging
import os
import re import re
import traceback import traceback
@@ -17,6 +16,7 @@ from certbot import ocsp
from certbot import storage from certbot import storage
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
from certbot.display import util as display_util from certbot.display import util as display_util
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,19 +1,17 @@
"""Certbot command line argument & config processing.""" """Certbot command line argument & config processing."""
# pylint: disable=too-many-lines # pylint: disable=too-many-lines
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import copy import copy
import glob import glob
import logging
import logging.handlers import logging.handlers
import os
import sys import sys
import configargparse import configargparse
import six import six
import zope.component import zope.component
import zope.interface import zope.interface
from zope.interface import interfaces as zope_interfaces from zope.interface import interfaces as zope_interfaces
from acme import challenges from acme import challenges
@@ -22,18 +20,17 @@ from acme.magic_typing import Any, Dict, Optional
# pylint: enable=unused-import, no-name-in-module # pylint: enable=unused-import, no-name-in-module
import certbot import certbot
import certbot.plugins.enhancements as enhancements
import certbot.plugins.selection as plugin_selection
from certbot import constants from certbot import constants
from certbot import crypto_util from certbot import crypto_util
from certbot import errors from certbot import errors
from certbot import hooks from certbot import hooks
from certbot import interfaces from certbot import interfaces
from certbot import util from certbot import util
from certbot.compat import os
from certbot.display import util as display_util from certbot.display import util as display_util
from certbot.plugins import disco as plugins_disco 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__) logger = logging.getLogger(__name__)

View File

@@ -1,7 +1,6 @@
"""Certbot client API.""" """Certbot client API."""
import datetime import datetime
import logging import logging
import os
import platform import platform
import OpenSSL import OpenSSL
@@ -32,6 +31,7 @@ from certbot import reverter
from certbot import storage from certbot import storage
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
from certbot.display import enhancements from certbot.display import enhancements
from certbot.display import ops as display_ops from certbot.display import ops as display_ops
from certbot.plugins import selection as plugin_selection from certbot.plugins import selection as plugin_selection

View File

@@ -2,14 +2,14 @@
This compat module handles various platform specific calls that do not fall into one This compat module handles various platform specific calls that do not fall into one
particular category. particular category.
""" """
import os
import select
import sys
import errno
import ctypes import ctypes
import errno
import select
import stat import stat
import sys
from certbot import errors from certbot import errors
from certbot.compat import os
UNPRIVILEGED_SUBCOMMANDS_ALLOWED = [ UNPRIVILEGED_SUBCOMMANDS_ALLOWED = [
'certificates', 'enhance', 'revoke', 'delete', 'certificates', 'enhance', 'revoke', 'delete',

31
certbot/compat/os.py Normal file
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

View File

@@ -1,6 +1,5 @@
"""Certbot user-supplied configuration.""" """Certbot user-supplied configuration."""
import copy import copy
import os
import zope.interface import zope.interface
from six.moves.urllib import parse # pylint: disable=relative-import 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 interfaces
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
@zope.interface.implementer(interfaces.IConfig) @zope.interface.implementer(interfaces.IConfig)

View File

@@ -1,12 +1,12 @@
"""Certbot constants.""" """Certbot constants."""
import logging import logging
import os
import pkg_resources import pkg_resources
from acme import challenges from acme import challenges
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
SETUPTOOLS_PLUGINS_ENTRY_POINT = "certbot.plugins" SETUPTOOLS_PLUGINS_ENTRY_POINT = "certbot.plugins"
"""Setuptools entry point group name for plugins.""" """Setuptools entry point group name for plugins."""

View File

@@ -6,7 +6,6 @@
""" """
import hashlib import hashlib
import logging import logging
import os
import warnings import warnings
import pyrfc3339 import pyrfc3339
@@ -30,6 +29,7 @@ from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,6 +1,5 @@
"""Contains UI methods for LE user operations.""" """Contains UI methods for LE user operations."""
import logging import logging
import os
import zope.component import zope.component
@@ -8,6 +7,7 @@ from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
from certbot.display import util as display_util from certbot.display import util as display_util
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,6 +1,5 @@
"""Certbot display.""" """Certbot display."""
import logging import logging
import os
import sys import sys
import textwrap import textwrap
@@ -10,6 +9,7 @@ from certbot import constants
from certbot import errors from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
from certbot.display import completer from certbot.display import completer
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,7 +1,6 @@
"""Registers functions to be called if an exception or signal occurs.""" """Registers functions to be called if an exception or signal occurs."""
import functools import functools
import logging import logging
import os
import signal import signal
import traceback import traceback
@@ -10,6 +9,7 @@ from acme.magic_typing import Any, Callable, Dict, List, Union
# pylint: enable=unused-import, no-name-in-module # pylint: enable=unused-import, no-name-in-module
from certbot import errors from certbot import errors
from certbot.compat import os
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -2,14 +2,13 @@
from __future__ import print_function from __future__ import print_function
import logging import logging
import os
from subprocess import Popen, PIPE 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 errors
from certbot import util from certbot import util
from certbot.compat import os
from certbot.plugins import util as plug_util from certbot.plugins import util as plug_util
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,7 +1,6 @@
"""Implements file locks compatible with Linux and Windows for locking files and directories.""" """Implements file locks compatible with Linux and Windows for locking files and directories."""
import errno import errno
import logging import logging
import os
try: try:
import fcntl # pylint: disable=import-error import fcntl # pylint: disable=import-error
except ImportError: except ImportError:
@@ -10,8 +9,10 @@ except ImportError:
else: else:
POSIX_MODE = True POSIX_MODE = True
from acme.magic_typing import Optional # pylint: disable=unused-import, no-name-in-module
from certbot import errors 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__) logger = logging.getLogger(__name__)

View File

@@ -17,7 +17,6 @@ from __future__ import print_function
import functools import functools
import logging import logging
import logging.handlers import logging.handlers
import os
import sys import sys
import tempfile import tempfile
import traceback import traceback
@@ -28,6 +27,7 @@ from certbot import constants
from certbot import errors from certbot import errors
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
# Logging format # Logging format
CLI_FMT = "%(message)s" CLI_FMT = "%(message)s"

View File

@@ -4,7 +4,6 @@ from __future__ import print_function
import functools import functools
import logging.handlers import logging.handlers
import os
import sys import sys
import configobj import configobj
@@ -33,6 +32,7 @@ from certbot import storage
from certbot import updater from certbot import updater
from certbot import util from certbot import util
from certbot.compat import misc from certbot.compat import misc
from certbot.compat import os
from certbot.display import util as display_util, ops as display_ops from certbot.display import util as display_util, ops as display_ops
from certbot.plugins import disco as plugins_disco from certbot.plugins import disco as plugins_disco
from certbot.plugins import enhancements from certbot.plugins import enhancements

View File

@@ -1,6 +1,5 @@
"""Plugin common functions.""" """Plugin common functions."""
import logging import logging
import os
import re import re
import shutil import shutil
import tempfile import tempfile
@@ -12,6 +11,7 @@ import zope.interface
from josepy import util as jose_util from josepy import util as jose_util
from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module 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 achallenges # pylint: disable=unused-import
from certbot import constants from certbot import constants
from certbot import crypto_util from certbot import crypto_util
@@ -19,7 +19,7 @@ from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot import reverter from certbot import reverter
from certbot import util from certbot import util
from certbot.compat import os
from certbot.plugins.storage import PluginStorage from certbot.plugins.storage import PluginStorage
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -1,20 +1,19 @@
"""Tests for certbot.plugins.common.""" """Tests for certbot.plugins.common."""
import functools import functools
import os
import shutil import shutil
import tempfile import tempfile
import unittest import unittest
import OpenSSL
import josepy as jose import josepy as jose
import mock import mock
import OpenSSL
from acme import challenges from acme import challenges
from certbot import achallenges from certbot import achallenges
from certbot import crypto_util from certbot import crypto_util
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.tests import acme_util from certbot.tests import acme_util
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -2,16 +2,17 @@
import abc import abc
import logging import logging
import os
import stat import stat
from time import sleep from time import sleep
import configobj import configobj
import zope.interface import zope.interface
from acme import challenges from acme import challenges
from certbot import errors from certbot import errors
from certbot import interfaces from certbot import interfaces
from certbot.compat import os
from certbot.display import ops from certbot.display import ops
from certbot.display import util as display_util from certbot.display import util as display_util
from certbot.plugins import common from certbot.plugins import common

View File

@@ -2,12 +2,12 @@
import collections import collections
import logging import logging
import os
import unittest import unittest
import mock import mock
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.display import util as display_util from certbot.display import util as display_util
from certbot.plugins import dns_common from certbot.plugins import dns_common
from certbot.plugins import dns_test_common from certbot.plugins import dns_test_common

View File

@@ -1,14 +1,14 @@
"""Base test class for DNS authenticators.""" """Base test class for DNS authenticators."""
import os
import configobj import configobj
import josepy as jose import josepy as jose
import mock import mock
import six import six
from acme import challenges from acme import challenges
from certbot import achallenges from certbot import achallenges
from certbot.compat import os
from certbot.tests import acme_util from certbot.tests import acme_util
from certbot.tests import util as test_util from certbot.tests import util as test_util

View File

@@ -1,6 +1,4 @@
"""Manual authenticator plugin""" """Manual authenticator plugin"""
import os
import zope.component import zope.component
import zope.interface 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 acme.magic_typing import Dict # pylint: disable=unused-import, no-name-in-module
from certbot import achallenges # pylint: disable=unused-import from certbot import achallenges # pylint: disable=unused-import
from certbot import interfaces
from certbot import errors from certbot import errors
from certbot import hooks from certbot import hooks
from certbot import interfaces
from certbot import reverter from certbot import reverter
from certbot.compat import os
from certbot.plugins import common from certbot.plugins import common

View File

@@ -1,15 +1,14 @@
"""Tests for certbot.plugins.manual""" """Tests for certbot.plugins.manual"""
import os
import unittest import unittest
import sys import sys
import six
import mock import mock
import six
from acme import challenges from acme import challenges
from certbot import errors from certbot import errors
from certbot.compat import os
from certbot.tests import acme_util from certbot.tests import acme_util
from certbot.tests import util as test_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_public_ip_logging_ok = True
self.config.manual_auth_hook = ( self.config.manual_auth_hook = (
'{0} -c "from __future__ import print_function;' '{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_TOKEN\', \'notoken\'));'
'print(os.environ.get(\'CERTBOT_VALIDATION\', \'novalidation\'));"' 'print(os.environ.get(\'CERTBOT_VALIDATION\', \'novalidation\'));"'
.format(sys.executable)) .format(sys.executable))

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