Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-certbot for openSUSE:Factory checked in at 2026-11-19 16:57:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-certbot (Old) and /work/SRC/openSUSE:Factory/.python-certbot.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-certbot" Thu Nov 19 16:57:56 2026 rev:70 rq:1398694 version:5.10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-certbot/python-certbot.changes 2026-09-08 17:07:59.275746814 +0200 +++ /work/SRC/openSUSE:Factory/.python-certbot.new.1251/python-certbot.changes 2026-11-19 16:59:12.000172246 +0100 @@ -1,0 +2,10 @@ +Thu Nov 19 12:16:56 UTC 2026 - Markéta Machová <[email protected]> + +- update to 5.10.0 + * Fixes a bug where certbot would sometimes incorrectly pass + failed SANs as successfully renewed SANs to renewal hooks. + * The account to deactivate is selected before Certbot asks for + irreversible deactivation confirmation. + * Fixes a race condition in the webroot plugin. + +------------------------------------------------------------------- Old: ---- certbot-5.8.0.tar.gz New: ---- certbot-5.10.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-certbot.spec ++++++ --- /var/tmp/diff_new_pack.fSeVzg/_old 2026-11-19 16:59:13.001214678 +0100 +++ /var/tmp/diff_new_pack.fSeVzg/_new 2026-11-19 16:59:13.004214805 +0100 @@ -23,7 +23,7 @@ %endif %{?sle15_python_module_pythons} Name: python-certbot -Version: 5.8.0 +Version: 5.10.0 Release: 0 Summary: ACME client License: Apache-2.0 ++++++ certbot-5.8.0.tar.gz -> certbot-5.10.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/CHANGELOG.md new/certbot-5.10.0/CHANGELOG.md --- old/certbot-5.8.0/CHANGELOG.md 2026-09-01 19:52:19.534951000 +0200 +++ new/certbot-5.10.0/CHANGELOG.md 2026-11-10 23:28:27.854777600 +0100 @@ -4,6 +4,26 @@ <!-- towncrier release notes start --> +## 5.10.0 - 2026-11-10 + +### Fixed + +- Fixes a race condition in the webroot plugin where, if the webroot could be modified by a less privileged user while Certbot ran, the ownership and mode of an unintended file could be changed instead of those of the challenge directory Certbot had just created. +- Rejects invalid ARI suggested renewal windows whose end time is not after their start time. + + +## 5.9.0 - 2026-10-28 + +### Added + +- Added an OCI image source label to Docker images, allowing third-party tools such as Renovate to discover the source repository. ([#10808](https://github.com/certbot/certbot/issues/10808)) + +### Fixed + +- Fixes a bug where certbot would sometimes incorrectly pass failed SANs as successfully renewed SANs to renewal hooks. ([#10780](https://github.com/certbot/certbot/issues/10780)) +- The account to deactivate is selected before Certbot asks for irreversible deactivation confirmation. + + ## 5.8.0 - 2026-09-01 ### Changed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/PKG-INFO new/certbot-5.10.0/PKG-INFO --- old/certbot-5.8.0/PKG-INFO 2026-09-01 19:52:20.645508000 +0200 +++ new/certbot-5.10.0/PKG-INFO 2026-11-10 23:28:28.966780400 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: certbot -Version: 5.8.0 +Version: 5.10.0 Summary: ACME client Author: Certbot Project License-Expression: Apache-2.0 @@ -25,7 +25,7 @@ Requires-Python: >=3.10 Description-Content-Type: text/x-rst License-File: LICENSE.txt -Requires-Dist: acme>=5.8.0 +Requires-Dist: acme>=5.10.0 Requires-Dist: ConfigArgParse>=1.5.3 Requires-Dist: configobj>=5.0.6 Requires-Dist: cryptography>=47.0.0 @@ -65,10 +65,10 @@ Requires-Dist: uv; extra == "test" Requires-Dist: wheel; extra == "test" Provides-Extra: apache -Requires-Dist: certbot-apache>=5.8.0; extra == "apache" +Requires-Dist: certbot-apache>=5.10.0; extra == "apache" Requires-Dist: python-augeas; extra == "apache" Provides-Extra: nginx -Requires-Dist: certbot-nginx>=5.8.0; extra == "nginx" +Requires-Dist: certbot-nginx>=5.10.0; extra == "nginx" Requires-Dist: PyOpenSSL>=25.0.0; extra == "nginx" Requires-Dist: pyparsing>=3.0.0; extra == "nginx" Provides-Extra: all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/docs/cli-help.txt new/certbot-5.10.0/docs/cli-help.txt --- old/certbot-5.8.0/docs/cli-help.txt 2026-09-01 19:52:18.828124500 +0200 +++ new/certbot-5.10.0/docs/cli-help.txt 2026-11-10 23:28:27.560776700 +0100 @@ -147,7 +147,7 @@ case, and to know when to deprecate support for past Python versions and flags. If you wish to hide this information from the Let's Encrypt server, set this to - "". (default: CertbotACMEClient/5.7.0 (certbot; + "". (default: CertbotACMEClient/5.9.0 (certbot; OS_NAME OS_VERSION) Authenticator/XXX Installer/YYY (SUBCOMMAND; flags: FLAGS) Py/major.minor.patchlevel). The flags encoded in the user agent are: --duplicate, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/docs/using.rst new/certbot-5.10.0/docs/using.rst --- old/certbot-5.8.0/docs/using.rst 2026-09-01 19:52:18.829250600 +0200 +++ new/certbot-5.10.0/docs/using.rst 2026-11-10 23:28:27.561776900 +0100 @@ -338,6 +338,8 @@ dns-eurodns_ Y N DNS Authentication for EuroDNS dns-dnscale_ Y N DNS Authenticator for DNScale dns-feno_ Y N DNS Authentication using the FENO (feno.no) API for .no domains +dns-enum_ Y N DNS Authentication using enum DNS +dns-hosttech_ Y N DNS Authentication using the Hosttech DNS API ======================= ==== ==== ================================================================= .. _haproxy: https://github.com/greenhost/certbot-haproxy @@ -377,6 +379,8 @@ .. _dns-eurodns: https://pypi.org/project/certbot-dns-eurodns/ .. _dns-dnscale: https://github.com/dnscaleou/certbot-dns-dnscale .. _dns-feno: https://github.com/mrerikcodes/certbot-dns-feno +.. _dns-enum: https://github.com/enumco/certbot-dns-enum +.. _dns-hosttech: https://github.com/bunkerity/certbot-dns-hosttech If you're interested, you can also :ref:`write your own plugin <dev-plugin>`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/__init__.py new/certbot-5.10.0/src/certbot/__init__.py --- old/certbot-5.8.0/src/certbot/__init__.py 2026-09-01 19:52:19.798805700 +0200 +++ new/certbot-5.10.0/src/certbot/__init__.py 2026-11-10 23:28:28.088778000 +0100 @@ -1,4 +1,13 @@ """Certbot client.""" +import sys +import warnings # version number like 1.2.3a0, must have at least 2 parts, like 1.2 -__version__ = '5.8.0' +__version__ = '5.10.0' + +if sys.version_info[:2] == (3, 10): + warnings.warn( + "Python 3.10 support will be dropped in the next release " + "of Certbot. Please upgrade your Python version.", + DeprecationWarning + ) # pragma: no cover diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/auth_handler.py new/certbot-5.10.0/src/certbot/_internal/auth_handler.py --- old/certbot-5.8.0/src/certbot/_internal/auth_handler.py 2026-09-01 19:52:18.830665300 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/auth_handler.py 2026-11-10 23:28:27.562776800 +0100 @@ -41,8 +41,8 @@ type strings with the most preferred challenge listed first """ - def __init__(self, auth: interfaces.Authenticator, acme_client: Optional[client.ClientV2], - account: Optional[Account], pref_challs: list[str]) -> None: + def __init__(self, auth: interfaces.Authenticator, acme_client: client.ClientV2, + account: Account, pref_challs: list[str]) -> None: self.auth = auth self.acme = acme_client @@ -69,8 +69,6 @@ authzrs = orderr.authorizations[:] if not authzrs: raise errors.AuthorizationError('No authorization to handle.') - if not self.acme: - raise errors.Error("No ACME client defined, authorizations cannot be handled.") # Retrieve challenges that need to be performed to validate authorizations. achalls = self._choose_challenges(authzrs) @@ -122,9 +120,6 @@ list of unsuccessfully deactivated authorizations. :rtype: tuple """ - if not self.acme: - raise errors.Error("No ACME client defined, cannot deactivate valid authorizations.") - to_deactivate = [authzr for authzr in orderr.authorizations if authzr.body.status == messages.STATUS_VALID] deactivated = [] @@ -147,9 +142,6 @@ all verified. The poll may occur several times, until all authorizations are checked (valid or invalid), or a maximum of retries, or the polling deadline is reached. """ - if not self.acme: - raise errors.Error("No ACME client defined, cannot poll authorizations.") - authzrs_to_check: dict[int, tuple[messages.AuthorizationResource, Optional[Response]]] = {index: (authzr, None) for index, authzr in enumerate(authzrs)} @@ -218,9 +210,6 @@ NB: Necessary and already validated challenges are not retrieved, as they can be reused for a certificate issuance. """ - if not self.acme: - raise errors.Error("No ACME client defined, cannot choose the challenges.") - pending_authzrs = [authzr for authzr in authzrs if authzr.body.status != messages.STATUS_VALID] achalls: list[achallenges.AnnotatedChallenge] = [] @@ -288,8 +277,6 @@ :raises .errors.Error: if challenge type is not recognized """ - if not self.account: - raise errors.Error("Account is not set.") achalls = [] for index in path: @@ -300,8 +287,6 @@ def _report_failed_authzrs(self, failed_authzrs: list[messages.AuthorizationResource]) -> None: """Notifies the user about failed authorizations.""" - if not self.account: - raise errors.Error("Account is not set.") problems: dict[str, list[achallenges.AnnotatedChallenge]] = {} failed_achalls = [challb_to_achall(challb, self.account.key, authzr.body.identifier) for authzr in failed_authzrs for challb in authzr.body.challenges diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/client.py new/certbot-5.10.0/src/certbot/_internal/client.py --- old/certbot-5.8.0/src/certbot/_internal/client.py 2026-09-01 19:52:18.831697700 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/client.py 2026-11-10 23:28:27.563776700 +0100 @@ -299,6 +299,8 @@ self.auth_handler: Optional[auth_handler.AuthHandler] if auth is not None: + if self.acme is None or self.account is None: + raise ValueError("Cannot create AuthHandler without ACME client and account") self.auth_handler = auth_handler.AuthHandler( auth, self.acme, self.account, self.config.pref_challs) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/hooks.py new/certbot-5.10.0/src/certbot/_internal/hooks.py --- old/certbot-5.8.0/src/certbot/_internal/hooks.py 2026-09-01 19:52:18.832408400 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/hooks.py 2026-11-10 23:28:27.564777000 +0100 @@ -163,20 +163,30 @@ post_hooks.append(command) +def _build_sans_env_var(sans: list[san.SAN], char_limit: int, var_name: str) -> str: + truncated_sans: list[str] = [] + env_var_len = 0 + for s in sans: + san_str = str(s) + env_var_len += len(san_str) + # add 1 for whitespace delimiter + if len(truncated_sans) > 0: + env_var_len += 1 + if env_var_len > char_limit: + logger.warning("Limiting %s environment variable to %s characters", + var_name, char_limit) + break + truncated_sans.append(san_str) + return ' '.join(truncated_sans) + + def run_saved_post_hooks(renewed_sans: list[san.SAN], failed_sans: list[san.SAN]) -> None: """Run any post hooks that were saved up in the course of the 'renew' verb""" - renewed_sans_str = ' '.join(map(str, renewed_sans)) - failed_sans_str = ' '.join(map(str, failed_sans)) - # 32k combined is reasonable on Windows and likely quite conservative on other platforms - if len(renewed_sans_str) > 16_000: - logger.warning("Limiting RENEWED_DOMAINS environment variable to 16k characters") - renewed_sans_str = renewed_sans_str[:16_000] - - if len(failed_sans_str) > 16_000: - logger.warning("Limiting FAILED_DOMAINS environment variable to 16k characters") - renewed_sans_str = failed_sans_str[:16_000] + char_limit = 16_000 + renewed_sans_str = _build_sans_env_var(renewed_sans, char_limit, 'RENEWED_DOMAINS') + failed_sans_str = _build_sans_env_var(failed_sans, char_limit, 'RENEWED_DOMAINS') for cmd in post_hooks: _run_hook( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/main.py new/certbot-5.10.0/src/certbot/_internal/main.py --- old/certbot-5.8.0/src/certbot/_internal/main.py 2026-09-01 19:52:18.833178800 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/main.py 2026-11-10 23:28:27.564777000 +0100 @@ -872,6 +872,9 @@ if not accounts: return f"Could not find existing account for server {config.server}." + + acc, acme = _determine_account(config) + prompt = ("Are you sure you would like to irrevocably deactivate " "your account?") wants_deactivate = display_util.yesno(prompt, yes_label='Deactivate', no_label='Abort', @@ -880,7 +883,6 @@ if not wants_deactivate: return "Deactivation aborted." - acc, acme = _determine_account(config) cb_client = client.Client(config, acc, None, None, acme=acme) if not cb_client.acme: @@ -1883,6 +1885,12 @@ if config.func != plugins_cmd: # pylint: disable=comparison-with-callable raise + if sys.version_info[:2] == (3, 10): + logger.warning( + "Python 3.10 support will be dropped in the next release " + "of Certbot. Please upgrade your Python version.", + ) # pragma: no cover + with make_displayer(config) as displayer: display_obj.set_display(displayer) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/plugins/webroot.py new/certbot-5.10.0/src/certbot/_internal/plugins/webroot.py --- old/certbot-5.8.0/src/certbot/_internal/plugins/webroot.py 2026-09-01 19:52:18.851044000 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/plugins/webroot.py 2026-11-10 23:28:27.569776800 +0100 @@ -210,12 +210,18 @@ # For Linux, this is coupled with the "umask" call above because # os.mkdir's "mode" parameter may not always work: # https://docs.python.org/3/library/os.html#os.mkdir - filesystem.mkdir(prefix, 0o755) - self._created_dirs.append(prefix) + # + # Creating the directory and copying the ownership are done in one + # step that is not vulnerable to the directory being swapped for a + # symlink in between, as the webroot may be writable by a less + # privileged user than the one running Certbot. try: - filesystem.copy_ownership_and_apply_mode( - path, prefix, 0o755, copy_user=True, copy_group=True) - except (OSError, AttributeError) as exception: + filesystem.mkdir_copy_ownership_and_apply_mode( + prefix, path, 0o755, copy_user=True, copy_group=True) + self._created_dirs.append(prefix) + except filesystem.OwnershipError as exception: + # The directory exists, so it still needs to be cleaned up. + self._created_dirs.append(prefix) logger.warning("Unable to change owner and uid of webroot directory") logger.debug("Error was: %s", exception) except OSError as exception: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/tests/auth_handler_test.py new/certbot-5.10.0/src/certbot/_internal/tests/auth_handler_test.py --- old/certbot-5.8.0/src/certbot/_internal/tests/auth_handler_test.py 2026-09-01 19:52:18.853261200 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/tests/auth_handler_test.py 2026-11-10 23:28:27.570776700 +0100 @@ -27,7 +27,7 @@ from certbot._internal.auth_handler import AuthHandler # Account is mocked... - self.handler = AuthHandler(None, None, mock.Mock(key="mock_key"), []) + self.handler = AuthHandler(mock.MagicMock(), mock.MagicMock(), mock.Mock(key="mock_key"), []) self.authzr = acme_util.gen_authzr( messages.STATUS_PENDING, "test", acme_util.CHALLENGES, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/tests/compat/filesystem_test.py new/certbot-5.10.0/src/certbot/_internal/tests/compat/filesystem_test.py --- old/certbot-5.8.0/src/certbot/_internal/tests/compat/filesystem_test.py 2026-09-01 19:52:18.853776700 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/tests/compat/filesystem_test.py 2026-11-10 23:28:27.571776900 +0100 @@ -445,6 +445,110 @@ assert filesystem.check_mode(dst, 0o700) is True +class MkdirCopyOwnershipAndApplyModeTest(test_util.TempDirTestCase): + """Tests about mkdir_copy_ownership_and_apply_mode""" + def setUp(self): + super().setUp() + self.parent = os.path.join(self.tempdir, 'parent') + filesystem.mkdir(self.parent) + self.dst = os.path.join(self.parent, 'new') + # A file that must never be touched, as the swapped in symlinks point to it. + self.victim = os.path.join(self.tempdir, 'victim') + util.safe_open(self.victim, 'w', chmod=0o600).close() + # Captured before any test patches it. + self.real_mkdir = filesystem.os.mkdir + + def _call(self): + filesystem.mkdir_copy_ownership_and_apply_mode( + self.dst, self.parent, 0o755, copy_user=True, copy_group=True) + + def test_creates_directory(self): + filesystem.mkdir_copy_ownership_and_apply_mode( + self.dst, self.parent, 0o750, copy_user=True, copy_group=True) + + assert os.path.isdir(self.dst) + assert not os.path.islink(self.dst) + assert filesystem.check_mode(self.dst, 0o750) + assert filesystem.has_same_ownership(self.dst, self.parent) + + @unittest.skipUnless(POSIX_MODE, reason='Test specific to Linux security') + def test_copies_given_ownership(self): + with mock.patch('os.fchown') as mock_fchown: + with mock.patch('os.stat') as mock_stat: + mock_stat.return_value.st_uid = 50 + mock_stat.return_value.st_gid = 51 + filesystem.mkdir_copy_ownership_and_apply_mode( + self.dst, self.victim, 0o755, copy_user=True, copy_group=False) + filesystem.mkdir_copy_ownership_and_apply_mode( + self.dst + '2', self.victim, 0o755, copy_user=False, copy_group=True) + + assert mock_fchown.call_args_list[0][0][1:] == (50, -1) + assert mock_fchown.call_args_list[1][0][1:] == (-1, 51) + + def test_existing_directory(self): + filesystem.mkdir(self.dst) + with pytest.raises(FileExistsError): + self._call() + + @unittest.skipUnless(POSIX_MODE, reason='Test specific to Linux security') + def test_missing_parent(self): + self.dst = os.path.join(self.tempdir, 'missing', 'new') + with pytest.raises(FileNotFoundError): + self._call() + + @unittest.skipUnless(POSIX_MODE, reason='Test specific to Linux security') + def test_ownership_failure(self): + with mock.patch('os.fchown', side_effect=PermissionError(errno.EPERM, 'msg')): + with pytest.raises(filesystem.OwnershipError): + self._call() + # Directory creation succeeded and callers rely on that to clean it up. + assert os.path.isdir(self.dst) + + @unittest.skipIf(POSIX_MODE, reason='Test specific to Windows security') + def test_ownership_failure_windows(self): + with mock.patch('certbot.compat.filesystem.copy_ownership_and_apply_mode', + side_effect=OSError(errno.EACCES, 'msg')): + with pytest.raises(filesystem.OwnershipError): + self._call() + # Directory creation succeeded and callers rely on that to clean it up. + assert os.path.isdir(self.dst) + + @unittest.skipUnless(POSIX_MODE, reason='Test specific to Linux security') + def test_new_directory_replaced_by_symlink(self): + def mkdir_then_swap(name, mode, dir_fd=None): + self.real_mkdir(name, mode, dir_fd=dir_fd) + os.rmdir(name, dir_fd=dir_fd) + os.symlink(self.victim, name, dir_fd=dir_fd) + + with mock.patch('os.mkdir', side_effect=mkdir_then_swap): + with pytest.raises(filesystem.OwnershipError): + self._call() + + # The symlink must not have been followed. + assert filesystem.check_mode(self.victim, 0o600) + + @unittest.skipUnless(POSIX_MODE, reason='Test specific to Linux security') + def test_parent_replaced_by_symlink(self): + other = os.path.join(self.tempdir, 'other') + filesystem.mkdir(other) + # An existing file with the same name as the new directory. + decoy = os.path.join(other, 'new') + util.safe_open(decoy, 'w', chmod=0o600).close() + moved = os.path.join(self.tempdir, 'moved') + + def mkdir_then_swap_parent(name, mode, dir_fd=None): + self.real_mkdir(name, mode, dir_fd=dir_fd) + filesystem.replace(self.parent, moved) + os.symlink(other, self.parent) + + with mock.patch('os.mkdir', side_effect=mkdir_then_swap_parent): + self._call() + + # Only the directory that was created got its mode and ownership set. + assert filesystem.check_mode(decoy, 0o600) + assert filesystem.check_mode(os.path.join(moved, 'new'), 0o755) + + class CheckPermissionsTest(test_util.TempDirTestCase): """Tests relative to functions that check modes.""" def setUp(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/tests/hook_test.py new/certbot-5.10.0/src/certbot/_internal/tests/hook_test.py --- old/certbot-5.8.0/src/certbot/_internal/tests/hook_test.py 2026-09-01 19:52:18.855523300 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/tests/hook_test.py 2026-11-10 23:28:27.571776900 +0100 @@ -313,6 +313,37 @@ assert mock_execute.call_args.kwargs['env']["RENEWED_DOMAINS"] == "success.org" assert mock_execute.call_args.kwargs['env']["FAILED_DOMAINS"] == "failed.org" + def test_env_overflow(self): + self.eventually = ["foo"] + # build two lists of domains that, when joined into an env var, are just under the 16,000 + # character count + success = ['a.io'] * 3200 + assert len(' '.join(success)) == 15_999 + failed = ['b.io'] * 3200 + assert len(' '.join(failed)) == 15_999 + + mock_execute = self._call_with_mock_execute_and_eventually(success, failed) + assert mock_execute.call_args.kwargs['env']["RENEWED_DOMAINS"] == ' '.join(success) + assert mock_execute.call_args.kwargs['env']["FAILED_DOMAINS"] == ' '.join(failed) + + # change them to be exactly equal to the character limit + success[-1] = 'a' + success[-1] + assert len(' '.join(success)) == 16_000 + failed[-1] = 'b' + failed[-1] + assert len(' '.join(failed)) == 16_000 + mock_execute = self._call_with_mock_execute_and_eventually(success, failed) + assert mock_execute.call_args.kwargs['env']["RENEWED_DOMAINS"] == ' '.join(success) + assert mock_execute.call_args.kwargs['env']["FAILED_DOMAINS"] == ' '.join(failed) + + # put them over the character limit + success[-1] = 'a' + success[-1] + assert len(' '.join(success)) == 16_001 + failed[-1] = 'b' + failed[-1] + assert len(' '.join(failed)) == 16_001 + mock_execute = self._call_with_mock_execute_and_eventually(success, failed) + assert mock_execute.call_args.kwargs['env']["RENEWED_DOMAINS"] == ' '.join(success[:-1]) + assert mock_execute.call_args.kwargs['env']["FAILED_DOMAINS"] == ' '.join(failed[:-1]) + class RenewalHookTest(HookTest): """Common base class for testing deploy/renew hooks.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/tests/main_test.py new/certbot-5.10.0/src/certbot/_internal/tests/main_test.py --- old/certbot-5.8.0/src/certbot/_internal/tests/main_test.py 2026-09-01 19:52:18.856622200 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/tests/main_test.py 2026-11-10 23:28:27.572776800 +0100 @@ -1892,7 +1892,10 @@ patch.stop() def test_abort_unregister(self): - self.mocks['account'].AccountFileStorage.return_value = mock.Mock() + mocked_storage = mock.MagicMock() + mocked_storage.find_all.return_value = [mock.MagicMock()] + self.mocks['account'].AccountFileStorage.return_value = mocked_storage + self.mocks['_determine_account'].return_value = (mock.MagicMock(), None) util_mock = self.mocks['get_utility']() util_mock.yesno.return_value = False @@ -1902,6 +1905,8 @@ res = main.unregister(config, unused_plugins) assert res == "Deactivation aborted." + self.mocks['_determine_account'].assert_called_once_with(config) + self.mocks['client'].Client.assert_not_called() @mock.patch("certbot._internal.main.display_util.notify") def test_unregister(self, mock_notify): @@ -1909,7 +1914,9 @@ mocked_storage.find_all.return_value = ["an account"] self.mocks['account'].AccountFileStorage.return_value = mocked_storage - self.mocks['_determine_account'].return_value = (mock.MagicMock(), "foo") + acc = mock.MagicMock() + acme = mock.MagicMock() + self.mocks['_determine_account'].return_value = (acc, acme) cb_client = mock.MagicMock() self.mocks['client'].Client.return_value = cb_client @@ -1920,12 +1927,33 @@ res = main.unregister(config, unused_plugins) assert res is None + self.mocks['_determine_account'].assert_called_once_with(config) + self.mocks['client'].Client.assert_called_once_with( + config, acc, None, None, acme=acme) + cb_client.acme.deactivate_registration.assert_called_once_with(acc.regr) mock_notify.assert_called_once_with("Account deactivated.") + def test_unregister_selection_error(self): + mocked_storage = mock.MagicMock() + mocked_storage.find_all.return_value = ["account 1", "account 2"] + self.mocks['account'].AccountFileStorage.return_value = mocked_storage + self.mocks['_determine_account'].side_effect = ValueError + + util_mock = self.mocks['get_utility']() + config = mock.MagicMock() + + with self.assertRaises(ValueError): + main.unregister(config, mock.Mock()) + + self.mocks['_determine_account'].assert_called_once_with(config) + util_mock.yesno.assert_not_called() + self.mocks['client'].Client.assert_not_called() + def test_unregister_no_account(self): mocked_storage = mock.MagicMock() mocked_storage.find_all.return_value = [] self.mocks['account'].AccountFileStorage.return_value = mocked_storage + util_mock = self.mocks['get_utility']() cb_client = mock.MagicMock() self.mocks['client'].Client.return_value = cb_client @@ -1937,6 +1965,9 @@ res = main.unregister(config, unused_plugins) m = "Could not find existing account for server https://acme.example.com/directory." assert res == m + self.mocks['_determine_account'].assert_not_called() + util_mock.yesno.assert_not_called() + self.mocks['client'].Client.assert_not_called() assert cb_client.acme.deactivate_registration.called is False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/_internal/tests/plugins/webroot_test.py new/certbot-5.10.0/src/certbot/_internal/tests/plugins/webroot_test.py --- old/certbot-5.8.0/src/certbot/_internal/tests/plugins/webroot_test.py 2026-09-01 19:52:18.873306500 +0200 +++ new/certbot-5.10.0/src/certbot/_internal/tests/plugins/webroot_test.py 2026-11-10 23:28:27.581776900 +0100 @@ -200,8 +200,19 @@ self.auth.perform([]) filesystem.chmod(self.path, 0o700) + @unittest.skipIf(not filesystem.POSIX_MODE, reason='Test specific to Linux') + @mock.patch("os.fchown") + def test_failed_chown(self, mock_fchown): + mock_fchown.side_effect = OSError(errno.EACCES, "msg") + self.auth.perform([self.achall]) # exception caught and logged + # The directories were still created, and are cleaned up afterwards. + assert os.path.isdir(self.root_challenge_path) + self.auth.cleanup([self.achall]) + assert not os.path.exists(self.partial_root_challenge_path) + + @unittest.skipIf(filesystem.POSIX_MODE, reason='Test specific to Windows') @mock.patch("certbot._internal.plugins.webroot.filesystem.copy_ownership_and_apply_mode") - def test_failed_chown(self, mock_ownership): + def test_failed_chown_windows(self, mock_ownership): mock_ownership.side_effect = OSError(errno.EACCES, "msg") self.auth.perform([self.achall]) # exception caught and logged diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot/compat/filesystem.py new/certbot-5.10.0/src/certbot/compat/filesystem.py --- old/certbot-5.8.0/src/certbot/compat/filesystem.py 2026-09-01 19:52:18.874079500 +0200 +++ new/certbot-5.10.0/src/certbot/compat/filesystem.py 2026-11-10 23:28:27.582776800 +0100 @@ -129,6 +129,72 @@ chmod(dst, mode) +class OwnershipError(OSError): + """ + Raised by :func:`mkdir_copy_ownership_and_apply_mode` when the directory was created + but its ownership or mode could not be set. + """ + + +def mkdir_copy_ownership_and_apply_mode(dst: str, src: str, mode: int, + copy_user: bool, copy_group: bool) -> None: + """ + Create the directory ``dst``, copy ownership (user and optionally group on Linux) from + ``src`` to it, then apply the given mode, in a way that is safe to use when ``dst`` lives + in a directory that other, less privileged, users can write to. + + Calling :func:`mkdir` followed by :func:`copy_ownership_and_apply_mode` is not safe in + that situation on Linux: both act on a path, so in between the two calls an unprivileged + user can replace the new directory, or one of its parents, with a symlink and make the + process (which may be running as root) change the owner and mode of an arbitrary file. + On Linux the parent directory is therefore opened once and the new directory is created, + opened (without following symlinks) and modified relative to that descriptor, so the + ownership and mode changes can only ever apply to the directory that was just created. + + :param str dst: Path of the directory to create (its parent must already exist) + :param str src: Path of the file or directory to copy the ownership from + :param int mode: Permission mode to apply on the new directory + :param bool copy_user: Copy user if `True` + :param bool copy_group: Copy group if `True` on Linux (has no effect on Windows) + + :raises OSError: if the directory could not be created + :raises OwnershipError: if the directory was created but its ownership or mode + could not be set (it still exists) + """ + if not POSIX_MODE: + # Windows has no symlink-following chown and uses a DACL, see the notes above + # copy_ownership_and_apply_mode. + mkdir(dst, mode) + try: + copy_ownership_and_apply_mode(src, dst, mode, copy_user, copy_group) + except (OSError, AttributeError) as err: + raise OwnershipError(str(err)) from err + return + + parent, name = os.path.split(dst) + # O_PATH (Linux) is enough to use the descriptor as a base for mkdir/open and, unlike + # O_RDONLY, does not require read permission on the parent directory. + parent_flags = os.O_DIRECTORY | getattr(os, "O_PATH", os.O_RDONLY) + parent_fd = os.open(parent or os.curdir, parent_flags) + try: + os.mkdir(name, mode, dir_fd=parent_fd) + try: + child_fd = os.open(name, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, + dir_fd=parent_fd) + try: + stats = os.stat(src) + os.fchown(child_fd, + stats.st_uid if copy_user else -1, + stats.st_gid if copy_group else -1) + os.fchmod(child_fd, mode) + finally: + os.close(child_fd) + except OSError as err: + raise OwnershipError(f"Unable to set ownership or mode of {dst}: {err}") from err + finally: + os.close(parent_fd) + + # Quite similar to copy_ownership_and_apply_mode, but this time the DACL is copied from # the source file on Windows. The DACL stays consistent with the dynamic rights of the # equivalent POSIX mode, because ownership and mode are copied altogether on the destination diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot.egg-info/PKG-INFO new/certbot-5.10.0/src/certbot.egg-info/PKG-INFO --- old/certbot-5.8.0/src/certbot.egg-info/PKG-INFO 2026-09-01 19:52:20.556334500 +0200 +++ new/certbot-5.10.0/src/certbot.egg-info/PKG-INFO 2026-11-10 23:28:28.868780100 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: certbot -Version: 5.8.0 +Version: 5.10.0 Summary: ACME client Author: Certbot Project License-Expression: Apache-2.0 @@ -25,7 +25,7 @@ Requires-Python: >=3.10 Description-Content-Type: text/x-rst License-File: LICENSE.txt -Requires-Dist: acme>=5.8.0 +Requires-Dist: acme>=5.10.0 Requires-Dist: ConfigArgParse>=1.5.3 Requires-Dist: configobj>=5.0.6 Requires-Dist: cryptography>=47.0.0 @@ -65,10 +65,10 @@ Requires-Dist: uv; extra == "test" Requires-Dist: wheel; extra == "test" Provides-Extra: apache -Requires-Dist: certbot-apache>=5.8.0; extra == "apache" +Requires-Dist: certbot-apache>=5.10.0; extra == "apache" Requires-Dist: python-augeas; extra == "apache" Provides-Extra: nginx -Requires-Dist: certbot-nginx>=5.8.0; extra == "nginx" +Requires-Dist: certbot-nginx>=5.10.0; extra == "nginx" Requires-Dist: PyOpenSSL>=25.0.0; extra == "nginx" Requires-Dist: pyparsing>=3.0.0; extra == "nginx" Provides-Extra: all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/certbot-5.8.0/src/certbot.egg-info/requires.txt new/certbot-5.10.0/src/certbot.egg-info/requires.txt --- old/certbot-5.8.0/src/certbot.egg-info/requires.txt 2026-09-01 19:52:20.557262000 +0200 +++ new/certbot-5.10.0/src/certbot.egg-info/requires.txt 2026-11-10 23:28:28.870780200 +0100 @@ -1,4 +1,4 @@ -acme>=5.8.0 +acme>=5.10.0 ConfigArgParse>=1.5.3 configobj>=5.0.6 cryptography>=47.0.0 @@ -17,7 +17,7 @@ certbot[apache,dev,docs,nginx,test] [apache] -certbot-apache>=5.8.0 +certbot-apache>=5.10.0 python-augeas [dev] @@ -34,7 +34,7 @@ sphinx_rtd_theme [nginx] -certbot-nginx>=5.8.0 +certbot-nginx>=5.10.0 PyOpenSSL>=25.0.0 pyparsing>=3.0.0
