repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
certbot | certbot-dns-sakuracloud/src/certbot_dns_sakuracloud/_internal/tests/dns_sakuracloud_test.py | .py | """Tests for certbot_dns_sakuracloud._internal.dns_sakuracloud."""
import sys
from unittest import mock
import pytest
from requests import Response
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
fr... | 44 | 1,529 |
certbot | certbot-dns-cloudflare/setup.py | .py | import os
from setuptools import setup
version = '5.8.0.dev0'
install_requires = [
'cloudflare>=4.0',
]
if os.environ.get('SNAP_BUILD'):
install_requires.append('packaging')
else:
install_requires.extend([
# We specify the minimum acme and certbot version as the current plugin
# version ... | 27 | 549 |
certbot | certbot-dns-cloudflare/src/certbot_dns_cloudflare/__init__.py | .py | """
The `~certbot_dns_cloudflare.dns_cloudflare` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the Cloudflare API.
.. note::
The plugin is not installed by default. It can be installed by heading to
`certbot.... | 125 | 5,295 |
certbot | certbot-dns-cloudflare/src/certbot_dns_cloudflare/_internal/dns_cloudflare.py | .py | """DNS Authenticator for Cloudflare."""
import logging
import warnings
from typing import Any
from typing import Callable
from typing import Literal
from typing import Optional
from typing import TypedDict
# cloudflare 4.x includes a pydantic v1 compatibility shim that emits a
# UserWarning on Python 3.14+. Suppress ... | 334 | 16,257 |
certbot | certbot-dns-cloudflare/src/certbot_dns_cloudflare/_internal/tests/dns_cloudflare_test.py | .py | """Tests for certbot_dns_cloudflare._internal.dns_cloudflare."""
import sys
import unittest
from typing import Any
from unittest import mock
import cloudflare
import pytest
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import... | 327 | 14,517 |
certbot | tools/release_message.py | .py | #!/usr/bin/env python
"""
Script to generate a message notifying the person doing the release
of the result of the workflow run.
Run:
python tools/release_message.py GITHUB_AUTHOR_NAME SUCCESS
where SUCCESS is True or False
"""
import os
import random
import sys
server_url = os.environ['GITHUB_SERVER_URL']
repo_nam... | 67 | 2,053 |
certbot | tools/extract_changelog.py | .py | #!/usr/bin/env python
from __future__ import print_function
import os
import re
import sys
CERTBOT_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
NEW_SECTION_PATTERN = re.compile(r'^##\s*[\d.]+\s*-\s*[\d-]+$')
def main():
version = sys.argv[1]
if version.endswith('.dev0'):
vers... | 42 | 990 |
certbot | tools/venv.py | .py | #!/usr/bin/env python3
# Developer virtualenv setup for Certbot client
"""Aids in creating a developer virtual environment for Certbot.
When this module is run as a script, it takes the arguments that should
be passed to pip to install the Certbot packages as command line
arguments. If no arguments are provided, all C... | 243 | 8,488 |
certbot | tools/finish_release.py | .py | #!/usr/bin/env python
"""
Post-release script to publish artifacts created from GitHub Actions, synchronize the repo
on Github, and print a formatted changelog for the latest release.
This currently includes:
* Moving snaps from the beta channel to the stable channel
* Pushing the candidate branch to GitHub
* Creat... | 371 | 15,340 |
certbot | tools/pip_install.py | .py | #!/usr/bin/env python
# pip installs packages using pinned package versions. If CERTBOT_OLDEST is set
# to 1, tools/oldest_constraints.txt is used, otherwise, tools/requirements.txt
# is used. Before installing the requested packages, core Python packaging
# tools like pip, setuptools, and wheel are updated to pinned v... | 75 | 2,488 |
certbot | tools/pipstrap.py | .py | #!/usr/bin/env python
"""Uses pip to upgrade Python packaging tools to pinned versions."""
import pip_install
def main():
pip_install.pipstrap()
if __name__ == '__main__':
main()
| 12 | 191 |
certbot | tools/snap/build_remote_single.py | .py | #!/usr/bin/env python3
import argparse
import functools
import glob
import os
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import realpath
import random
import re
import string
import subprocess
import sys
import tempfile
from typing import List
from typing import Tuple... | 225 | 8,779 |
certbot | letstest/setup.py | .py | from setuptools import setup
version = '5.8.0.dev0'
setup(
version=version,
)
| 8 | 84 |
certbot | letstest/letstest/multitester.py | .py | """
Certbot Integration Test Tool
- Launches EC2 instances with a given list of AMIs for different distros
- Copies certbot repo and puts it on the instances
- Runs certbot tests (bash scripts) on all of these
- Logs execution and success/fail for debugging
Notes:
- Some AWS images, e.g. official CentOS and FreeBSD... | 521 | 21,510 |
certbot | letstest/scripts/version.py | .py | #!/usr/bin/env python
"""Get the current Certbot version number.
Provides a simple utility for determining the Certbot version number
"""
from __future__ import print_function
from os.path import abspath
from os.path import dirname
from os.path import join
import re
def certbot_version(letstest_scripts_dir):
"... | 33 | 930 |
certbot | certbot-dns-route53/setup.py | .py | import os
from setuptools import setup
version = '5.8.0.dev0'
install_requires = [
'boto3>=1.20.34',
]
if os.environ.get('SNAP_BUILD'):
install_requires.append('packaging')
else:
install_requires.extend([
# We specify the minimum acme and certbot version as the current plugin
# version f... | 26 | 547 |
certbot | certbot-dns-route53/src/certbot_dns_route53/__init__.py | .py | """
The `~certbot_dns_route53.dns_route53` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the Amazon Web Services Route 53 API.
.. note::
The plugin is not installed by default. It can be installed by heading to
... | 106 | 3,690 |
certbot | certbot-dns-route53/src/certbot_dns_route53/_internal/dns_route53.py | .py | """Certbot Route53 authenticator plugin."""
import collections
import logging
import time
from typing import Any
from typing import Callable
from typing import Iterable
from typing import cast
import boto3
from botocore.exceptions import ClientError
from botocore.exceptions import NoCredentialsError
from acme import ... | 188 | 7,509 |
certbot | certbot-dns-route53/src/certbot_dns_route53/_internal/tests/dns_route53_test.py | .py | """Tests for certbot_dns_route53._internal.dns_route53.Authenticator"""
import sys
import unittest
from unittest import mock
from botocore.exceptions import ClientError
from botocore.exceptions import NoCredentialsError
import josepy as jose
import pytest
from acme import challenges, messages
from certbot import ach... | 275 | 10,187 |
certbot | certbot-dns-route53/src/certbot_dns_route53/_internal/tests/conftest.py | .py | from unittest import mock
import pytest
@pytest.fixture(autouse=True)
def mock_sleep():
with mock.patch("time.sleep") as mocked:
yield mocked
| 9 | 156 |
certbot | certbot-apache/setup.py | .py | from setuptools import setup
version = '5.8.0.dev0'
install_requires = [
# We specify the minimum certbot version as the current plugin
# version for simplicity. See
# https://github.com/certbot/certbot/issues/8761 for more info.
f'certbot[apache]>={version}',
]
setup(
version=version,
instal... | 16 | 351 |
certbot | certbot-apache/src/certbot_apache/_internal/entrypoint.py | .py | """ Entry point for Apache Plugin """
import certbot.plugins.apache
ENTRYPOINT = certbot.plugins.apache.ENTRYPOINT
| 7 | 118 |
certbot | tests/modification-check.py | .py | #!/usr/bin/env python
"""Ensures there have been no changes to important certbot-auto files."""
import hashlib
import os
# Relative to the root of the Certbot repo, these files are expected to exist
# and have the SHA-256 hashes contained in this dictionary. These hashes were
# taken from our v1.14.0 tag which was th... | 46 | 1,638 |
certbot | acme/examples/http01_example.py | .py | """Example ACME-V2 API for HTTP-01 challenge.
Brief:
This a complete usage example of the python-acme API.
Limitations of this example:
- Works for only one Domain name
- Performs only HTTP-01 challenge
- Uses ACME-v2
Workflow:
(Account creation)
- Create account key
- Register account and a... | 238 | 7,118 |
certbot | acme/src/acme/errors.py | .py | """ACME errors."""
import datetime
import typing
from typing import Any
from typing import Mapping
from josepy import errors as jose_errors
import requests
# We import acme.messages only during type check to avoid circular dependencies. Type references
# to acme.message.* must be quoted to be lazily initialized and a... | 158 | 5,020 |
certbot | acme/src/acme/fields.py | .py | """ACME JSON fields."""
import datetime
import logging
from typing import Any
import josepy as jose
import pyrfc3339
logger = logging.getLogger(__name__)
class Fixed(jose.Field):
"""Fixed field."""
def __init__(self, json_name: str, value: Any) -> None:
self.value = value
super().__init__(
... | 61 | 1,665 |
certbot | acme/src/acme/challenges.py | .py | """ACME Identifier Validation Challenges."""
import abc
import functools
import hashlib
import ipaddress
import logging
from typing import Any
from typing import cast
from typing import Mapping
from typing import Optional
from typing import TypeVar
from typing import Union
from cryptography.hazmat.primitives import ha... | 479 | 16,102 |
certbot | acme/src/acme/crypto_util.py | .py | """Crypto utilities."""
import enum
from datetime import datetime, timedelta, timezone
import ipaddress
import logging
from types import ModuleType
import typing
from typing import Any
from typing import Optional
from typing import Union
import warnings
import sys
from cryptography import x509
from cryptography.hazmat... | 332 | 12,143 |
certbot | acme/src/acme/util.py | .py | """ACME utilities."""
from typing import Any
from typing import Callable
from typing import Mapping
def map_keys(dikt: Mapping[Any, Any], func: Callable[[Any], Any]) -> dict[Any, Any]:
"""Map dictionary keys."""
return {func(key): value for key, value in dikt.items()}
| 10 | 279 |
certbot | acme/src/acme/__init__.py | .py | """ACME protocol implementation.
This module is an implementation of the `ACME protocol`_.
.. _`ACME protocol`: https://datatracker.ietf.org/doc/html/rfc8555
"""
import sys
# This code exists to keep backwards compatibility with people using acme.jose
# before it became the standalone josepy package.
#
# It is base... | 22 | 749 |
certbot | acme/src/acme/standalone.py | .py | """Support for standalone client challenge solvers. """
from __future__ import annotations
import collections
import functools
import http.client as http_client
import http.server as BaseHTTPServer
import logging
import socket
import socketserver
import threading
from typing import Any
from typing import Optional
fro... | 231 | 9,215 |
certbot | acme/src/acme/jws.py | .py | """ACME-specific JWS.
The JWS implementation in josepy only implements the base JOSE standard. In
order to support the new header fields defined in ACME, this module defines some
ACME-specific classes that layer on top of josepy.
"""
from typing import Optional
import josepy as jose
class Header(jose.Header):
"... | 60 | 2,564 |
certbot | acme/src/acme/messages.py | .py | """ACME protocol messages."""
from collections.abc import Hashable
import datetime
import json
from typing import Any
from typing import Iterator
from typing import Mapping
from typing import MutableMapping
from typing import Optional
from typing import TypeVar
from cryptography import x509
import josepy as jose
fro... | 710 | 27,520 |
certbot | acme/src/acme/client.py | .py | """ACME client API."""
import base64
import datetime
from email.utils import parsedate_tz
import http.client as http_client
import logging
import math
import random
import time
from typing import Any
from typing import cast
from typing import Mapping
from typing import Optional
from typing import Union
from cryptograp... | 849 | 36,103 |
certbot | acme/src/acme/_internal/tests/standalone_test.py | .py | """Tests for acme.standalone."""
import http.client as http_client
import socket
import socketserver
import sys
import threading
import unittest
from unittest import mock
import josepy as jose
import pytest
import requests
from acme import challenges
from acme._internal.tests import test_util
class HTTP01ServerTest... | 200 | 7,049 |
certbot | acme/src/acme/_internal/tests/errors_test.py | .py | """Tests for acme.errors."""
import sys
import unittest
from unittest import mock
import pytest
class BadNonceTest(unittest.TestCase):
"""Tests for acme.errors.BadNonce."""
def setUp(self):
from acme.errors import BadNonce
self.error = BadNonce(nonce="xxx", error="error")
def test_str(s... | 87 | 2,722 |
certbot | acme/src/acme/_internal/tests/util_test.py | .py | """Tests for acme.util."""
import sys
import pytest
def test_it():
from acme.util import map_keys
assert {'a': 'b', 'c': 'd'} == \
map_keys({'a': 'b', 'c': 'd'}, lambda key: key)
assert {2: 2, 4: 4} == map_keys({1: 2, 3: 4}, lambda x: x + 1)
if __name__ == '__main__':
sys.exit(... | 16 | 380 |
certbot | acme/src/acme/_internal/tests/messages_test.py | .py | """Tests for acme.messages."""
import sys
import json
import unittest
from unittest import mock
import josepy as jose
import pytest
from acme import challenges
from acme._internal.tests import test_util
CERT = test_util.load_cert('cert.der')
CSR = test_util.load_csr('csr.der')
KEY = test_util.load_rsa_private_key('r... | 598 | 21,468 |
certbot | acme/src/acme/_internal/tests/fields_test.py | .py | """Tests for acme.fields."""
import datetime
import sys
import unittest
import josepy as jose
import pytest
class FixedTest(unittest.TestCase):
"""Tests for acme.fields.Fixed."""
def setUp(self):
from acme.fields import fixed
self.field = fixed('name', 'x')
def test_decode(self):
... | 59 | 1,704 |
certbot | acme/src/acme/_internal/tests/test_util.py | .py | """Test utilities.
.. warning:: This module is not part of the public API.
"""
import importlib.resources
import os
from typing import Callable
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
import josepy as jose
from jo... | 62 | 2,044 |
certbot | acme/src/acme/_internal/tests/crypto_util_test.py | .py | """Tests for acme.crypto_util."""
import ipaddress
import itertools
import sys
import unittest
from unittest import mock
import warnings
import pytest
from cryptography import x509
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa, x25519
from acme._int... | 278 | 9,862 |
certbot | acme/src/acme/_internal/tests/client_test.py | .py | """Tests for acme.client."""
# pylint: disable=too-many-lines
import copy
import datetime
import http.client as http_client
import json
import sys
import unittest
from unittest import mock
from cryptography import x509
import josepy as jose
import pytest
import requests
from acme import challenges
from acme import e... | 1,068 | 47,205 |
certbot | acme/src/acme/_internal/tests/jose_test.py | .py | """Tests for acme.jose shim."""
import importlib
import sys
import pytest
def _test_it(submodule, attribute):
if submodule:
acme_jose_path = 'acme.jose.' + submodule
josepy_path = 'josepy.' + submodule
else:
acme_jose_path = 'acme.jose'
josepy_path = 'josepy'
acme_jose_mod... | 54 | 1,849 |
certbot | acme/src/acme/_internal/tests/jws_test.py | .py | """Tests for acme.jws."""
import sys
import unittest
import josepy as jose
import pytest
from acme._internal.tests import test_util
KEY = jose.JWKRSA.load(test_util.load_vector('rsa512_key.pem'))
class HeaderTest(unittest.TestCase):
"""Tests for acme.jws.Header."""
good_nonce = jose.encode_b64jose(b'foo')... | 69 | 2,128 |
certbot | acme/src/acme/_internal/tests/challenges_test.py | .py | """Tests for acme.challenges."""
import sys
from typing import TYPE_CHECKING
import unittest
from unittest import mock
import urllib.parse as urllib_parse
import josepy as jose
from josepy.jwk import JWKEC
import pytest
import requests
from acme._internal.tests import test_util
CERT = test_util.load_cert('cert.pem')... | 400 | 14,643 |
certbot | acme/src/acme/_internal/tests/conftest.py | .py | from unittest import mock
import pytest
# This avoids a bug on mac where getfqdn errors after a long timeout.
# See https://bugs.python.org/issue35164
# and discussion at https://github.com/certbot/certbot/pull/10408
@pytest.fixture(autouse=True)
def mock_getfqdn():
with mock.patch("socket.getfqdn", return_value=... | 17 | 482 |
certbot | certbot-ci/src/certbot_integration_tests/conftest.py | .py | # type: ignore
"""
General conftest for pytest execution of all integration tests lying
in the certbot_integration tests package.
As stated by pytest documentation, conftest module is used to set on
for a directory a specific configuration using built-in pytest hooks.
See https://docs.pytest.org/en/latest/reference.ht... | 104 | 3,950 |
certbot | certbot-ci/src/certbot_integration_tests/rfc2136_tests/context.py | .py | """Module to handle the context of RFC2136 integration tests."""
from contextlib import contextmanager
import importlib.resources
import tempfile
from typing import Generator
from typing import Iterable
import pytest
from certbot_integration_tests.certbot_tests import context as certbot_context
from certbot_integrati... | 65 | 2,751 |
certbot | certbot-ci/src/certbot_integration_tests/rfc2136_tests/test_main.py | .py | """Module executing integration tests against Certbot with the RFC2136 DNS authenticator."""
from typing import Generator
import pytest
from certbot_integration_tests.rfc2136_tests.context import IntegrationTestsContext
@pytest.fixture(name="context")
def test_context(request: pytest.FixtureRequest) -> Generator[In... | 29 | 1,067 |
certbot | certbot-ci/src/certbot_integration_tests/utils/pebble_artifacts.py | .py | # pylint: disable=missing-module-docstring
import atexit
import importlib.resources
import io
import json
import os
import platform
import stat
import zipfile
from contextlib import ExitStack
from typing import Optional
import requests
from certbot_integration_tests.utils.constants import DEFAULT_HTTP_01_PORT
from ce... | 93 | 3,524 |
certbot | certbot-ci/src/certbot_integration_tests/utils/acme_server.py | .py | #!/usr/bin/env python
"""Module to setup an ACME CA server environment able to run multiple tests in parallel"""
import argparse
import errno
import json
import os
import shutil
import subprocess
import sys
import tempfile
import time
from types import TracebackType
from typing import Any
from typing import cast
from ... | 230 | 10,226 |
certbot | certbot-ci/src/certbot_integration_tests/utils/misc.py | .py | """
Misc module contains stateless functions that could be used during pytest execution,
or outside during setup/teardown of the integration tests environment.
"""
import atexit
import contextlib
import errno
import functools
import http.server as SimpleHTTPServer
import importlib.resources
import json
import os
import... | 338 | 13,349 |
certbot | certbot-ci/src/certbot_integration_tests/utils/dns_server.py | .py | #!/usr/bin/env python
"""Module to setup an RFC2136-capable DNS server"""
import importlib.resources
import os
import os.path
import shutil
import socket
import subprocess
import sys
import tempfile
import time
from types import TracebackType
from typing import Any
from typing import Optional
from certbot_integration_... | 162 | 5,902 |
certbot | certbot-ci/src/certbot_integration_tests/utils/constants.py | .py | """Some useful constants to use throughout certbot-ci integration tests"""
DEFAULT_HTTP_01_PORT = 5002
HTTPS_PORT = 5001
CHALLTESTSRV_PORT = 8055
PEBBLE_DIRECTORY_URL = 'https://localhost:14000/dir'
PEBBLE_MANAGEMENT_URL = 'https://localhost:15000'
PEBBLE_CHALLTESTSRV_URL = f'http://localhost:{CHALLTESTSRV_PORT}'
MOCK_... | 11 | 397 |
certbot | certbot-ci/src/certbot_integration_tests/utils/pebble_ocsp_server.py | .py | #!/usr/bin/env python
"""
This runnable module interfaces itself with the Pebble management interface in order
to serve a mock OCSP responder during integration tests against Pebble.
"""
import datetime
import http.server as BaseHTTPServer
import re
from typing import cast
from typing import Union
from cryptography im... | 89 | 3,745 |
certbot | certbot-ci/src/certbot_integration_tests/utils/proxy.py | .py | #!/usr/bin/env python
# pylint: disable=missing-module-docstring
#
# Note: If you're having trouble with this module, there was some discussion
# about how it could be ripped out entirely at
# https://github.com/certbot/certbot/pull/10495#discussion_r2699618989 that you
# may want to read.
import http.server as BaseHT... | 55 | 2,025 |
certbot | certbot-ci/src/certbot_integration_tests/utils/certbot_call.py | .py | #!/usr/bin/env python
"""Module to call certbot in test mode"""
import configparser
import os
import subprocess
import sys
from typing import Optional
import certbot_integration_tests
from certbot_integration_tests.utils.constants import DEFAULT_HTTP_01_PORT
from certbot_integration_tests.utils.constants import HTTPS... | 179 | 8,179 |
certbot | certbot-ci/src/certbot_integration_tests/certbot_tests/context.py | .py | """Module to handle the context of integration tests."""
import os
import shutil
import sys
import tempfile
from typing import Iterable
import pytest
from certbot_integration_tests.utils import certbot_call
class IntegrationTestsContext:
"""General fixture describing a certbot integration tests context"""
d... | 96 | 4,438 |
certbot | certbot-ci/src/certbot_integration_tests/certbot_tests/test_main.py | .py | """Module executing integration tests against certbot core."""
import json
import os
from os.path import exists
from os.path import join
import re
import shutil
import subprocess
import sys
from typing import Generator
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
from cryptography.hazmat.prim... | 1,146 | 49,893 |
certbot | certbot-ci/src/certbot_integration_tests/certbot_tests/assertions.py | .py | """This module contains advanced assertions for the certbot integration tests."""
import os
from typing import Optional
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurveP... | 206 | 7,960 |
certbot | certbot-ci/src/certbot_integration_tests/nginx_tests/nginx_config.py | .py | # -*- coding: utf-8 -*-
"""General purpose nginx test configuration generator."""
import atexit
import importlib.resources
from contextlib import ExitStack
from typing import Optional
def construct_nginx_config(nginx_root: str, nginx_webroot: str, http_port: int, https_port: int,
other_port... | 141 | 4,707 |
certbot | certbot-ci/src/certbot_integration_tests/nginx_tests/context.py | .py | """Module to handle the context of nginx integration tests."""
import os
import subprocess
from typing import Iterable
import pytest
from certbot_integration_tests.certbot_tests import context as certbot_context
from certbot_integration_tests.nginx_tests import nginx_config as config
from certbot_integration_tests.ut... | 69 | 2,810 |
certbot | certbot-ci/src/certbot_integration_tests/nginx_tests/test_main.py | .py | """Module executing integration tests against certbot with nginx plugin."""
import os
import ssl
from typing import Generator
import pytest
from certbot_integration_tests.nginx_tests.context import IntegrationTestsContext
@pytest.fixture(name='context')
def test_context(request: pytest.FixtureRequest) -> Generator[... | 60 | 2,389 |
certbot | certbot-ci/src/certbot_integration_tests/assets/hook.py | .py | #!/usr/bin/env python
"""A Certbot hook for probing."""
import os
import sys
hook_script_type = os.path.basename(os.path.dirname(sys.argv[1]))
if hook_script_type == 'deploy' and ('RENEWED_DOMAINS' not in os.environ
or 'RENEWED_LINEAGE' not in os.environ):
sys.stderr.write('Env... | 13 | 402 |
certbot | certbot-ci/src/snap_integration_tests/conftest.py | .py | # type: ignore
"""
General conftest for pytest execution of all integration tests lying
in the snap_installer_integration tests package.
As stated by pytest documentation, conftest module is used to set on
for a directory a specific configuration using built-in pytest hooks.
See https://docs.pytest.org/en/latest/refer... | 49 | 2,032 |
certbot | certbot-ci/src/snap_integration_tests/dns_tests/test_main.py | .py | #!/usr/bin/env python3
"""Module executing integration tests against certbot snap."""
import glob
import os
import re
import subprocess
from typing import Generator
import pytest
@pytest.fixture(autouse=True, scope="module")
def install_certbot_snap(request: pytest.FixtureRequest) -> Generator[None, None, None]:
... | 52 | 2,177 |
certbot | certbot-dns-linode/src/certbot_dns_linode/__init__.py | .py | """
The `~certbot_dns_linode.dns_linode` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the Linode API.
.. note::
The plugin is not installed by default. It can be installed by heading to
`certbot.eff.org <htt... | 98 | 4,029 |
certbot | certbot-dns-linode/src/certbot_dns_linode/_internal/dns_linode.py | .py | """DNS Authenticator for Linode."""
import logging
from typing import Any
from typing import Callable
from typing import Optional
from certbot import errors
from certbot.plugins import dns_common_lexicon
logger = logging.getLogger(__name__)
API_KEY_URL_V4 = 'https://cloud.linode.com/profile/tokens'
class Authentic... | 59 | 2,178 |
certbot | certbot-dns-linode/src/certbot_dns_linode/_internal/tests/dns_linode_test.py | .py | """Tests for certbot_dns_linode._internal.dns_linode."""
import sys
from unittest import mock
import pytest
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
from certbot_dns_linode._internal.dns_l... | 48 | 1,533 |
certbot | certbot-dns-rfc2136/setup.py | .py | import os
from setuptools import setup
version = '5.8.0.dev0'
install_requires = [
# This version was chosen because it is the version packaged in RHEL 9 and Debian unstable. It
# is possible this requirement could be relaxed to allow for an even older version of dnspython
# if necessary.
'dnspython>... | 30 | 769 |
certbot | certbot-dns-rfc2136/src/certbot_dns_rfc2136/__init__.py | .py | """
The `~certbot_dns_rfc2136.dns_rfc2136` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using RFC 2136 Dynamic Updates.
.. note::
The plugin is not installed by default. It can be installed by heading to
`certbot.... | 231 | 8,350 |
certbot | certbot-dns-rfc2136/src/certbot_dns_rfc2136/_internal/dns_rfc2136.py | .py | """DNS Authenticator using RFC 2136 Dynamic Updates."""
import logging
from typing import Any
from typing import Callable
from typing import cast
from typing import Optional
import dns.flags
import dns.message
import dns.name
import dns.query
import dns.rdataclass
import dns.rdatatype
import dns.tsig
import dns.tsigke... | 250 | 10,039 |
certbot | certbot-dns-rfc2136/src/certbot_dns_rfc2136/_internal/tests/dns_rfc2136_test.py | .py | """Tests for certbot_dns_rfc2136._internal.dns_rfc2136."""
import sys
import unittest
from unittest import mock
import dns.flags
import dns.rcode
import dns.tsig
import pytest
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common imp... | 273 | 11,410 |
certbot | certbot-dns-google/setup.py | .py | import os
from setuptools import setup
version = '5.8.0.dev0'
install_requires = [
'google-api-python-client>=1.6.5',
'google-auth>=2.16.0',
]
if os.environ.get('SNAP_BUILD'):
install_requires.append('packaging')
else:
install_requires.extend([
# We specify the minimum acme and certbot versi... | 27 | 591 |
certbot | certbot-dns-google/src/certbot_dns_google/__init__.py | .py | """
The `~certbot_dns_google.dns_google` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the Google Cloud DNS API.
.. note::
The plugin is not installed by default. It can be installed by heading to
`certbot.ef... | 225 | 10,225 |
certbot | certbot-dns-google/src/certbot_dns_google/_internal/dns_google.py | .py | """DNS Authenticator for Google Cloud DNS."""
import logging
from typing import Any
from typing import Callable
from typing import Optional
from typing import cast
import google.auth
from google.auth import exceptions as googleauth_exceptions
from googleapiclient import discovery
from googleapiclient import errors as... | 315 | 13,606 |
certbot | certbot-dns-google/src/certbot_dns_google/_internal/tests/dns_google_test.py | .py | """Tests for certbot_dns_google._internal.dns_google."""
from __future__ import annotations
import sys
from typing import Optional
import unittest
from unittest import mock
from google.auth import exceptions as googleauth_exceptions
from googleapiclient import discovery
from googleapiclient.errors import Error
from go... | 500 | 25,411 |
certbot | certbot-dns-digitalocean/setup.py | .py | import os
from setuptools import setup
version = '5.8.0.dev0'
install_requires = [
'python-digitalocean>=1.15.0', # 1.15.0 or newer is recommended for TTL support
]
if os.environ.get('SNAP_BUILD'):
install_requires.append('packaging')
else:
install_requires.extend([
# We specify the minimum acme... | 26 | 609 |
certbot | certbot-dns-digitalocean/src/certbot_dns_digitalocean/__init__.py | .py | """
The `~certbot_dns_digitalocean.dns_digitalocean` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the DigitalOcean API.
.. note::
The plugin is not installed by default. It can be installed by heading to
`ce... | 100 | 3,892 |
certbot | certbot-dns-digitalocean/src/certbot_dns_digitalocean/_internal/dns_digitalocean.py | .py | """DNS Authenticator for DigitalOcean."""
import logging
from typing import Any
from typing import Callable
from typing import cast
from typing import Optional
import digitalocean
from certbot import errors
from certbot.plugins import dns_common
from certbot.plugins.dns_common import CredentialsConfiguration
logger ... | 183 | 7,646 |
certbot | certbot-dns-digitalocean/src/certbot_dns_digitalocean/_internal/tests/dns_digitalocean_test.py | .py | """Tests for certbot_dns_digitalocean._internal.dns_digitalocean."""
import sys
import unittest
from unittest import mock
import digitalocean
import pytest
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 cert... | 178 | 6,856 |
certbot | certbot-compatibility-test/nginx/roundtrip.py | .py | #!/usr/bin/env python
import os
import sys
from certbot._internal.plugins.nginx import nginxparser
def roundtrip(stuff):
success = True
for t in stuff:
print(t)
if not os.path.isfile(t):
continue
with open(t, "r") as f:
config = f.read()
try:
... | 36 | 967 |
certbot | certbot-compatibility-test/src/certbot_compatibility_test/test_driver.py | .py | """Tests Certbot plugins against different server configurations."""
import argparse
import contextlib
import filecmp
import logging
import os
import shutil
import socket
import sys
import tempfile
import time
from typing import Any
from typing import Generator
from typing import Iterable
from typing import Optional
f... | 402 | 14,313 |
certbot | certbot-compatibility-test/src/certbot_compatibility_test/errors.py | .py | """Certbot compatibility test errors"""
class Error(Exception):
"""Generic Certbot compatibility test error"""
| 6 | 117 |
certbot | certbot-compatibility-test/src/certbot_compatibility_test/util.py | .py | """Utility functions for Certbot plugin tests."""
import argparse
import copy
from datetime import datetime, timedelta, timezone
import os
import re
import shutil
import tarfile
from cryptography import x509
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import types
i... | 103 | 3,550 |
certbot | certbot-compatibility-test/src/certbot_compatibility_test/validator.py | .py | """Validators to determine the current webserver configuration"""
import contextlib
import logging
import socket
from typing import cast
from typing import Mapping
from typing import Optional
from typing import Union
from cryptography import x509
from OpenSSL import SSL
import requests
from acme import errors as acme... | 176 | 6,537 |
certbot | certbot-compatibility-test/src/certbot_compatibility_test/interfaces.py | .py | """Certbot compatibility test interfaces"""
from abc import ABCMeta
from abc import abstractmethod
import argparse
from typing import cast
from certbot import interfaces
from certbot.configuration import NamespaceConfig
class PluginProxy(interfaces.Plugin, metaclass=ABCMeta):
"""Wraps a Certbot plugin"""
ht... | 65 | 1,991 |
certbot | certbot-compatibility-test/src/certbot_compatibility_test/configurators/common.py | .py | """Provides a common base for configurator proxies"""
from abc import abstractmethod
import argparse
import logging
import os
import shutil
import tempfile
from typing import Iterable
from typing import Optional
from typing import overload
from typing import Union
from acme import challenges
from acme.challenges impor... | 157 | 5,957 |
certbot | certbot-compatibility-test/src/certbot_compatibility_test/configurators/nginx/common.py | .py | """Provides a common base for Nginx proxies"""
import os
import shutil
import subprocess
from certbot import configuration
from certbot._internal.plugins.nginx import configurator
from certbot._internal.plugins.nginx import constants
from certbot_compatibility_test import errors
from certbot_compatibility_test import ... | 88 | 3,195 |
certbot | certbot-compatibility-test/src/certbot_compatibility_test/configurators/apache/common.py | .py | """Provides a common base for Apache proxies"""
import argparse
import os
import shutil
import subprocess
from unittest import mock
from certbot import configuration
from certbot import errors as le_errors
from certbot import util as certbot_util
from certbot_apache._internal import entrypoint
from certbot_compatibili... | 107 | 3,945 |
certbot | certbot-dns-gehirn/src/certbot_dns_gehirn/__init__.py | .py | """
The `~certbot_dns_gehirn.dns_gehirn` plugin automates the process of completing
a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and subsequently
removing, TXT records using the Gehirn Infrastructure Service DNS API.
.. note::
The plugin is not installed by default. It can be installed by heading ... | 93 | 3,626 |
certbot | certbot-dns-gehirn/src/certbot_dns_gehirn/_internal/dns_gehirn.py | .py | """DNS Authenticator for Gehirn Infrastructure Service DNS."""
import logging
from typing import Any
from typing import Callable
from typing import Optional
from requests import HTTPError
from certbot import errors
from certbot.plugins import dns_common_lexicon
logger = logging.getLogger(__name__)
DASHBOARD_URL = "... | 56 | 2,235 |
certbot | certbot-dns-gehirn/src/certbot_dns_gehirn/_internal/tests/dns_gehirn_test.py | .py | """Tests for certbot_dns_gehirn._internal.dns_gehirn."""
import sys
from unittest import mock
import pytest
from requests import Response
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 certbo... | 45 | 1,485 |
certbot | certbot-dns-dnsmadeeasy/src/certbot_dns_dnsmadeeasy/__init__.py | .py | """
The `~certbot_dns_dnsmadeeasy.dns_dnsmadeeasy` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the DNS Made Easy API.
.. note::
The plugin is not installed by default. It can be installed by heading to
`cer... | 91 | 3,576 |
certbot | certbot-dns-dnsmadeeasy/src/certbot_dns_dnsmadeeasy/_internal/dns_dnsmadeeasy.py | .py | """DNS Authenticator for DNS Made Easy DNS."""
import logging
from typing import Any
from typing import Callable
from typing import Optional
from requests import HTTPError
from certbot import errors
from certbot.plugins import dns_common_lexicon
logger = logging.getLogger(__name__)
ACCOUNT_URL = 'https://cp.dnsmade... | 62 | 2,317 |
certbot | certbot-dns-dnsmadeeasy/src/certbot_dns_dnsmadeeasy/_internal/tests/dns_dnsmadeeasy_test.py | .py | """Tests for certbot_dns_dnsmadeeasy._internal.dns_dnsmadeeasy."""
import sys
from unittest import mock
import pytest
from requests import Response
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
f... | 44 | 1,478 |
certbot | certbot/setup.py | .py | import codecs
import os
import re
from setuptools import setup
def read_file(filename, encoding='utf8'):
"""Read unicode from given file."""
with codecs.open(filename, encoding=encoding) as fd:
return fd.read()
here = os.path.abspath(os.path.dirname(__file__))
# read version number (and other meta... | 106 | 3,196 |
certbot | certbot/examples/plugins/setup.py | .py | from setuptools import setup
setup(
name='certbot-example-plugins',
package='certbot_example_plugins.py',
install_requires=[
'certbot',
],
entry_points={
'certbot.plugins': [
'example_authenticator = certbot_example_plugins:Authenticator',
'example_installer ... | 16 | 378 |
certbot | certbot/examples/plugins/certbot_example_plugins.py | .py | """Example Certbot plugins.
For full examples, see `certbot.plugins`.
"""
from certbot import interfaces
from certbot.plugins import common
class Authenticator(common.Plugin, interfaces.Authenticator):
"""Example Authenticator."""
description = "Example Authenticator plugin"
# Implement all methods fr... | 26 | 674 |
certbot | certbot/src/certbot/configuration.py | .py | """Certbot user-supplied configuration."""
import argparse
import copy
import enum
import logging
from typing import Any
from typing import Optional
from urllib import parse
from certbot import errors
from certbot._internal import constants
from certbot.compat import misc
from certbot.compat import os
logger = loggi... | 502 | 19,278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.