Compare commits

...

1195 Commits

Author SHA1 Message Date
Erica Portnoy
d97f2aefc3 Release 5.1.0 2025-10-07 09:42:28 -07:00
Erica Portnoy
1d32888ac4 Update changelog for 5.1.0 release 2025-10-07 09:42:00 -07:00
Brad Warren
33890ab7f3 deprecate make_self_signed_cert (#10466)
with https://github.com/certbot/certbot/pull/10465,
make_self_signed_cert is no longer used outside of our tests so let's
move it there and remove it from our public API
2025-09-30 07:16:03 -07:00
Brad Warren
513190afe0 don't use snakeoil certs in nginx (#10465)
this PR finally removes all uses of self-signed certificates from
certbot-nginx

i plan to create one last PR related to this deprecating
`acme.crypto_util.make_self_signed_cert` and moving the function to
certbot-compatibility-test which is the only place it's currently used

i think we could also do additional refactoring in certbot-nginx by
moving the _make_server_ssl call out of choose_or_make_vhost and make
deploy_cert responsible for calling it if the returned vhosts aren't
ssl. in this case, we could then skip updating cert and key directives a
second time as this is duplicate work if we just made the server ssl

i considered doing this, but it's a bigger refactor, breaks more tests,
and i'm not sure it really buys us much so i skipped it. i could take
this on or create an issue for it if you think it's important for us to
do for some reason tho ohemorange
2025-09-25 12:41:47 -07:00
Brad Warren
57d2429e4f remove create_if_no_match (#10464)
this is another tiny piece of my nginx refactoring. with
https://github.com/certbot/certbot/pull/10455, this function is now
never called outside of tests with `create_if_no_match=False` so this PR
removes the unnecessary parameter

luckily, tests still Just Work™ with this change
2025-09-25 08:43:23 -07:00
ohemorange
dc2f3b9eb0 Show --deploy-hook help info in certonly and run info, and add note that it will be run again later. (#10463)
Fixes https://github.com/certbot/certbot/issues/6180.

New output:

```
  --deploy-hook DEPLOY_HOOK
                        Command to be run in a shell once for each successfully issued certificate, including on subsequent renewals. Unless --disable-hook-validation is
                        used, the command’s first word must be the absolute pathname of an executable or one found via the PATH environment variable. For this command, the
                        shell variable $RENEWED_LINEAGE will point to the config live subdirectory (for example, "/etc/letsencrypt/live/example.com") containing the new
                        certificates and keys; the shell variable $RENEWED_DOMAINS will contain a space-delimited list of renewed certificate domains (for example,
                        "example.com www.example.com") (default: None)
```

Pre and post hooks are still only shown in `renew` and `reconfigure`
help, though perhaps there is less confusion over those so it's not
necessary.
2025-09-23 12:23:11 -07:00
ohemorange
f8838fc949 Remove unnecessary time.sleep from certbot-ci (#10461)
Fixes https://github.com/certbot/certbot/issues/10450

Discussion when originally added is
[here](https://github.com/certbot/certbot/pull/6989/files#r283050165).
Further notes are "The problem is transient, only observed on Travis so
far, not locally. I not know how to recreate a reliable pattern and find
precisely what needs to be done." So it's possible we weren't even
hitting this anymore anyway. Regardless, I ran the test a few times in
CI just to make sure it's not breaking.

Runs:

https://dev.azure.com/certbot/certbot/_build/results?buildId=9686&view=results
(pass)

https://dev.azure.com/certbot/certbot/_build/results?buildId=9688&view=results
(pass)

https://dev.azure.com/certbot/certbot/_build/results?buildId=9689&view=results
(pass)

https://dev.azure.com/certbot/certbot/_build/results?buildId=9690&view=results
(pass)

https://dev.azure.com/certbot/certbot/_build/results?buildId=9691&view=results
(pass)
2025-09-18 12:40:53 -07:00
Alexis
90905de18f [DOCS] Update documentation: Remove decommissioned server (#10460)
Deleted decommissioned server language

Fixes: #10459

Signed-off-by: zoracon <zoracon@pm.me>
2025-09-18 08:04:24 -07:00
Brad Warren
deb3d035e3 require ssl vhosts for HSTS and OCSP stapling (#10455)
this is the first part of the nginx refactoring work i wanted to do.
ohemorange, if this conflicts with your work on updating our nginx ssl
config, please feel free to either ignore this for now or point me to
your branch after merging this and i can fix up any merge conflicts
myself like i previously offered

the main thing this PR does is create a new choose_or_make_vhosts
function with the current choose_vhosts behavior and makes choose_vhosts
only return existing ssl vhosts which i think is the behavior we want
when setting up HSTS or OCSP stapling. [this is what we do in
apache](867b499f9b/certbot-apache/src/certbot_apache/_internal/configurator.py (L1795-L1829)),
enabling HSTS or OCSP stapling on an HTTP vhost seems wrong/dangerous,
and since we don't have cert and key information in these [enhance
calls](867b499f9b/certbot/src/certbot/interfaces.py (L255)),
any SSL vhost we create will be left with snakeoil certs which also
seems very wrong

of course, this simple change to certbot-nginx's prod code required many
changes to its tests. the config file for headers.com was introduced
[here](https://github.com/certbot/certbot/pull/6068) specifically for
testing HSTS so i added the SSL configuration it needs to make work with
the choose_vhost changes. that then broke the IP tests for headers.com
that were added in https://github.com/certbot/certbot/pull/10145/ so i
created a new no-listens.com vhost for testing that

if this is merged, my plan in the next PR or two is to:

1. since choose_or_make_vhosts is now always called with
create_if_no_match=True in prod code, i plan to remove that variable,
make that the default behavior of the function, and fix up tests
2. then, since choose_or_make_vhosts is only called in deploy_cert, i
plan to pass the cert and key to it so it can be used in
_make_server_ssl instead of the dummy certs currently being used there

i could do more of this in this PR if you want ohemorange, but i figured
it rarely hurts to break things up especially when the code is kind of
tricky like it is (to me) here
2025-09-17 14:23:32 -07:00
ohemorange
867b499f9b Merge pull request #10451 from certbot/candidate-5.0.0
release 5.0.0
2025-09-02 12:09:12 -07:00
Brad Warren
8ecd7fc23d Bump version to 5.1.0 2025-09-02 08:47:05 -07:00
Brad Warren
95e65ac3a5 Remove built packages from git 2025-09-02 08:47:05 -07:00
Brad Warren
c307f62114 Release 5.0.0 2025-09-02 08:47:04 -07:00
Brad Warren
6f8a357147 Update changelog for 5.0.0 release 2025-09-02 08:46:14 -07:00
ldlb
8556a9c427 fix: Remove pyOpenSSL dependency with custom certificate text formatting (#10439)
fixed: #10434

---------

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2025-08-29 14:39:48 -07:00
ohemorange
1c67e990f7 Merge pull request #10448 from certbot/no-openssl-ocsp
remove openssl-based ocsp checking
2025-08-28 10:22:17 -07:00
Brad Warren
9c1685638b fixup pytest.ini, out var, and add changelog 2025-08-28 09:33:37 -07:00
Brad Warren
a06fa7643d Merge branch 'main' into no-openssl-ocsp 2025-08-28 09:27:06 -07:00
ohemorange
5c30a180a2 Apache config update (#10443)
Part of https://github.com/certbot/certbot/issues/10183

There are two changes made here:

1. Add `DHE-RSA-CHACHA20-POLY1305` to `SSLCipherSuite` list. Nice to
have for compliance reasons. See
https://github.com/mozilla/server-side-tls/issues/285 DHE ciphers in
general are the topic of
[some](https://github.com/mozilla/server-side-tls/issues/268)
[debate](https://github.com/mozilla/server-side-tls/issues/299) over on
the generator repo; my opinion is that certbot should match whatever
they currently recommend, and if they do decide to change it, we can
also update to match them again later.
2. Configure curves with `SSLOpenSSLConfCmd`. Needed for OpenSSL 3.0
support, so FFDH won't be used. This option requires apache `>=2.4.8`
but we already require `>=2.4.11` to use this conf file in the first
place, so that's fine. When the file in their repo was converted from
`.hbs` to `.js` the version requirement was changed to `>=2.4.11` but I
suspect that's a bug, and either way it's still fine. See
https://github.com/mozilla/ssl-config-generator/issues/270 and
https://github.com/mozilla/ssl-config-generator/pull/297

You can see a generated Apache config file here:
https://ssl-config.mozilla.org/#server=apache&version=2.4.60&config=intermediate&openssl=3.4.0&guideline=5.7

Originally, I had planned to switch `SSLProtocol` list to allowlist
format. It's a little nicer, though it did the same thing, technically,
and would let us match mozilla, who does this because it makes their
code cleaner. See
https://github.com/mozilla/ssl-config-generator/pull/286/. But TLSv1.3
is only
[supported](https://github.com/mozilla/ssl-config-generator/blob/master/src/js/configs.js#L12C5-L12C21)
in `apache >= 2.4.36`, so we on the other hand would have to include it
conditionally. Whereas despite `SSLv2` [not being
available](https://github.com/mozilla/ssl-config-generator/pull/286/files#diff-3d067ee1b10453909ca9c86397a6b235fcb961ed3ca1cfbdda4daa2cb4b30b97L41)
in `apache >= 2.3.16`, it still recognizes it just fine in a config.
We're always `>= 2.3.16` now so we could remove it proactively, I
suppose, in case apache stops recognizing it. I left it as-is here but
could change it.
2025-08-27 16:38:08 -07:00
Brad Warren
4c5e575531 use a static string when creating self-signed certs (#10447)
this is the quickest somewhat sane fix for the current CI problem that i
could think of

the domain being used in the self-signed cert really seems irrelevant.
on my main test VPS, socket.gethostname returns "brad-certbot-dev". on
my laptop, it's "MacBookPro". i manually tested this branch a bit on my
VPS and nginx seems content

using a simple static string like this seems unlikely to break anything
to me and i think helps clearly identify where the self-signed cert is
coming from if ever causes a problem for anyone in the future
2025-08-26 17:04:08 -07:00
Brad Warren
aabc5a0dd6 update centos ami (#10445)
it looks like the one previously being used was deleted so i grabbed a
new one from https://centos.org/download/aws-images/

you can see this passing at
https://dev.azure.com/certbot/certbot/_build/results?buildId=9627&view=results
after also reconfiguring CI to only run test farm tests
2025-08-25 10:21:33 -07:00
Brad Warren
444e3251bf make apache tls warning conditional (#10444)
this is in response to the thread at
https://opensource.eff.org/eff-open-source/pl/49gnrcner7gptrnsi339bqu1yo
2025-08-25 10:19:18 -07:00
Brad Warren
e9dd4eb03b stop running setup.py and switch to python -m build (#10442)
fixes #10404

unfortunately, exactly what `python setup.py clean` did doesn't seem
well documented so i dug into the code with a debugger. executing the
`clean` subcommand is done by [this
code](9cc2f5c05c/setuptools/_distutils/command/clean.py (L54-L77))
where the relevant build variables are set by the `build` subcommand
[here](9cc2f5c05c/setuptools/_distutils/command/build.py (L52))
and
[here](9cc2f5c05c/setuptools/_distutils/command/build.py (L112)).
it turns out us running `python setup.py clean` was already redundant
with `rm -rf build` on the next line

i built two releases, one on the latest commit in this PR and another on
44f1dd677b
before the switch to `python -m build`. a simple diff of the resulting
tarballs and wheels fails, presumably because of metadata differences,
but after untaring or unzipping the files, the contents are identical
for all of our built packages
2025-08-22 11:03:00 -07:00
ohemorange
d75cb60eeb Clean up warning catching in pytest.ini (#10438)
Several of these have been fixed, so let's update the requirement if
necessary and remove the warning catching.

`python-dateutil 2.9.0` was released Feb 29, 2024, so it's not widely
packaged in non-EOL major distros yet.
`pytest-cov 4.1.0` was released May 24, 2023.
Our pinned versions were already higher than these requirements.

Alternatively, we could just remove the warnings and not update the
minimum requirement, but I think it's nicer to note it in requirements
for anyone running our tests, like packagers.

We already require `poetry-plugin-export>=1.9.0`. `1.7.0` updated its
`requests-toolbelt` requirement to `>=1.0.0`, which is greater than the
minimum version needed to remove the warning.
2025-08-21 11:33:57 -07:00
ohemorange
4f12c29ef3 Remove unused code for renaming certificates (#10437)
Fixes https://github.com/certbot/certbot/issues/10397

This code was not being called, so let's remove it.
2025-08-19 09:29:33 -07:00
ohemorange
3c1bd657b5 Add instructions for renaming certificate to docs (#10436)
Fixes https://github.com/certbot/certbot/issues/10431
2025-08-19 09:27:41 -07:00
ohemorange
00a51ab22b Drop in uv for pip (#10428)
It's a [drop-in
replacement](https://docs.astral.sh/uv/pip/compatibility/) that speeds
things up. I don't see any reason why not.

`--use-pep517` is [set by default](
https://docs.astral.sh/uv/pip/compatibility/#pep-517-build-isolation),
so we don't need it.

`--disable-pip-version-check` also does nothing on uv.

`uv` [uses
separate](https://docs.astral.sh/uv/pip/compatibility/#build-constraints)
`UV_BUILD_CONSTRAINT` and `UV_CONSTRAINT`. I just added it to both to do
the simplest thing here. We could split them.

We probably don't actually need to pipstrap pip anymore, I could take
that out.

What's happening with `parsedatetime` and `python-digitalocean` is that
they were always secretly wrong. Since `pip` compiles bytecode by
default, it was suppressing the errors. If you add the
`--compile-bytecode` flag to `uv`, it passes, but I don't think we
should do that. You can see the failure happen on main by passing
`--no-compile` to the pip args and running `certbot -r -e oldest`.

Now what I don't understand is that some places seem to say the `'\/'`
error from `parsedatetime` only started in python 3.12, whereas others
see it on earlier python. Perhaps pytest is vendorizing python or
something. Not too worried about that, needed to get updated anyway, and
it's an accurate oldest version based on our oldest OSes.
`python-digitalocean` is techincally newer than debian 11, but we've
made that decision before so it seems fine to me.
2025-08-18 13:17:02 -07:00
Brad Warren
cad2c61db1 add changelog for #10377 (#10429)
it feels changelog entry worthy to me
2025-08-18 11:14:46 -07:00
Jacob Hoffman-Andrews
a58d9e96d7 ari: store Retry-After in lineage config (#10377)
This uses the new `storage.atomic_rewrite` function to write only the
ARI-related value to the config file, leaving other values the same.

Updates `storage.atomic_rewrite` to handle the case where the
`"renewalparams"` section might be empty (which occurs in the new
unittests), and adds some comments.

Note: `atomic_rewrite` is mocked out as a no-op in
`test_resilient_ari_directory_fetches` and `test_renew_before_expiry`
because those tests have a simplistic config object on their
mock_renewable_cert that doesn't include a filename. If we try to write
the config in those tests we'd get an error (trying to write to `None`).
Since those tests aren't intended to test the "store and obey
Retry-After" behavior, I figured it's reasonable to skip it in the name
of testing; but of course, open to idea about the best way to navigate
this.

Part of #10355
2025-08-18 11:05:29 -07:00
ohemorange
56da12207b Mock time.sleep for more modules to speed up tests (#10427)
The extra 8 seconds isn't really relevant in the test farm, but is nice
to have for local runs. This is based on what was done in
https://github.com/certbot/certbot/pull/10419/.
2025-08-18 09:59:55 -07:00
ohemorange
1816e56557 Set up unreleased packages minus dns plugins to use pyproject.toml (#10424)
Part of https://github.com/certbot/certbot/issues/10403

We were never actually updating the versions in certbot-ci and letstest.
Not that it really matters, but let's do that there as well.
2025-08-18 09:57:14 -07:00
ohemorange
407dc158f6 Set up dns plugins to use pyproject.toml (#10425)
Final part of https://github.com/certbot/certbot/issues/10403

I tested running `tools/snap/generate_dnsplugins_snapcraft.sh
certbot-dns-dnsimple` and it put the correct description in to the
`snapcraft.yaml` file.
2025-08-15 09:17:15 -07:00
ohemorange
d5dd8e47e1 Set up released packages minus dns plugins to use pyproject.toml (#10417)
Part of https://github.com/certbot/certbot/issues/10403.

As far as I can tell, "stick it in setup.py" is the official way of
handling complex dependencies. But since the version is static, we have
a little more choice here than we had with `certbot/pyproject.toml`.

We could put the version in the respective `pyproject.toml`s and read it
directly from the toml file with something like
[this](https://stackoverflow.com/a/78082561). Or otherwise load and
parse that file. The benefit of doing it that way is that all
non-certbot versions would be canonically in the `pyproject.toml`, and
also if we wanted we could use that same toml parsing to change the
version at release time instead of `sed`. I actually suspect `acme`,
`certbot-ci`, and `certbot-compatibility-test` will be the only ones
where we can completely delete `setup.py`, as the others all have
lockstep dependencies. (side note - we just never update `certbot-ci`
version. it's still set at `0.32.0.dev0`. there's no way this matters
but just noting.) I chose to do it this way instead because it seems
cleaner since we have to keep `setup.py` around anyway, but I don't have
a strong preference.

Based on what I've read, there's not actually a clean way to grab and
insert the version number within the toml file. This is due to [design
decisions](https://github.com/toml-lang/toml/issues/77) by the toml
authors. The clean `all` extras specification that we used in
`certbot/pyproject.toml` [seems to be an
outlier](https://github.com/pypa/setuptools/discussions/3627#discussioncomment-6476654)
because it's pip handling the self-reference, not toml.
2025-08-15 08:33:16 -07:00
ohemorange
80fa8ad738 Remove unnecessary code from release script (#10426)
This code [never did
anything](https://github.com/certbot/certbot/pull/10417#issuecomment-3190266418),
and it is not now. Let's remove it so we don't have to keep taking it
into account. I did a test release and it removed the `dev0`s just fine.
2025-08-15 02:01:34 +00:00
ohemorange
454048f2f6 Fix memory leak in apache unit tests (#10421)
This was causing oldest tests to fail on my mac, which has an open file
limit of 256. Locks were being released at exit, but there were more
than 256 tests being run at once. Holding onto the file descriptor for
temporary files was making us keep the files open.

I also removed unnecessary setUps and tearDowns in subclasses so that
this could be fixed in only one spot.

If you wanted to do any testing locally, I was throwing this in places:
```
import errno, os, resource
open_file_handles = []
for fd in range(resource.getrlimit(resource.RLIMIT_NOFILE)[0]):
    try: os.fstat(fd)
    except OSError as e:
        if e.errno == errno.EBADF: continue
    open_file_handles.append(fd)
print(f'location description: {len(open_file_handles)}')
```
2025-08-14 17:13:33 -07:00
ohemorange
49900b27d3 Update pinned oldest dependencies (#10420)
This is not necessarily the absolute minimum versions/pins we could use,
but it does get tests working. Fixes
https://github.com/certbot/certbot/issues/10418.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-08-14 16:37:10 -07:00
ohemorange
7201159d32 Have oldest tests inherit environment from python tests (#10422) 2025-08-14 16:36:34 -07:00
ohemorange
801894c7da Speed up mac tests using various strategies (#10419)
Alternative to https://github.com/certbot/certbot/pull/10408/ and
https://github.com/certbot/certbot/pull/10415/ that fixes production
code for account meta and puts autouse fixtures in certbot and acme
tests. Overrides all `time.sleep` calls while we're at it.

Fixes the production code where it's simple/clean, and fixes the tests
for HTTPServer-based code because we just don't have that many mac users
using standalone.
2025-08-14 09:58:06 -07:00
Jacob Hoffman-Andrews
bd796deaa3 storage: factor out atomic update operation (#10409)
The responsibility for atomic updates to a config file was previously
spread across different functions. This moves the atomic update to the
lowest level of the call graph.

Also, factor out the code that creates a ConfigObj based on various
inputs (archive dir, cert locations, and renewal params). This allows
cleanly reusing it across the "update" and "create new" paths.

Now the "create new config" code path doesn't have to do any renaming,
and the "update config" code path can assume the input file exists (and
error if it doesn't).

This will make it easier and cleaner to reuse the config-writing code in
#10377.

Part of #10355
2025-08-13 18:53:37 +00:00
Brad Warren
34a128ae88 update pinned dependencies (#10416)
this fixes the alert those with access can see at
https://github.com/certbot/certbot/security/dependabot
2025-08-13 17:59:55 +00:00
Brad Warren
d5a2e9227c use pep585 types everywhere and add a test (#10414)
this is the final part of
https://github.com/certbot/certbot/issues/10195. this fixes
https://github.com/certbot/certbot/issues/10195

the changes in the first commit were done automatically with the
command:
```
ruff check --fix --extend-select UP006 --unsafe-fixes
```
the second commit configures ruff to check for this to avoid regressions

thanks for bearing with me thru these somewhat large automatically
generated PRs ohemorange 🙏
2025-08-12 16:56:45 -07:00
Brad Warren
27b344c8d8 use pep585 types in certbot-apache (#10413)
this is another part of https://github.com/certbot/certbot/issues/10195

these changes were done automatically with the command:

```
ruff check --fix --extend-select UP006 --unsafe-fixes certbot-apache
```
2025-08-12 15:36:02 -07:00
ohemorange
92c8aa9b6c Add note and warning about old nginx ssl options not receiving updates (#10410)
This PR is modeled on https://github.com/certbot/certbot/pull/10373/,
and is part of https://github.com/certbot/certbot/issues/10183.

relevant requirements:
use_tls13 >= 1.13.0
session_tix_off implemented: nginx >= 1.5.9 and openssl_version >=
1.0.2l
session tix off by default: >= 1.23.2

oldest non-deprecated major distros nginx versions:
debian 11 1.18.0
epel 8 1.23.1
ubuntu 22.04 1.18.0

Therefore, we can stop testing for use tls 13 and session tix off
allowed, with the same caveat as [in this
comment](https://github.com/certbot/certbot/pull/10373#issuecomment-3134101604).
While we could add a new split for configs that don't require session
tickets off to be set explicitly since it's the default, I don't think
it's worth doing now. I added a note in the comments about this.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-08-12 17:54:46 +00:00
ohemorange
5d05984dd9 remove python 3.9 support (#10406)
Fixes https://github.com/certbot/certbot/issues/10389. you can compare
this to the PR that did this for python 3.8 at
https://github.com/certbot/certbot/pull/10077

additional changes:
- linux-py310 test is removed from extended tests, since it's now run in
standard tests. additionally, openssl will never be < 1.1.1 now, due to
https://peps.python.org/pep-0644/.
- `letstest/scripts/test_openssl_version.py` was testing functionality
that was removed in https://github.com/certbot/certbot/pull/10373 so it
was deleted

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-08-12 17:49:02 +00:00
Brad Warren
c519307569 use pep585 types in private certbot files (#10412)
this is another part of https://github.com/certbot/certbot/issues/10195

the first commit was done automatically with the command:

```
ruff check --fix --extend-select UP006 --unsafe-fixes certbot/src/certbot/_internal
```

this was unfortunately insufficient as it left a line in webroot.py with
over 100 characters. i fixed this manually in my second commit
2025-08-11 23:51:23 +00:00
Brad Warren
1943889119 use pep585 types in public certbot files (#10411)
this is another part of https://github.com/certbot/certbot/issues/10195

these changes were done automatically with the commands:

```
ruff check --fix --extend-select UP006 --unsafe-fixes certbot
git checkout certbot/src/certbot/_internal
```

fixing up the files under certbot/src/certbot/_internal will be done in
another PR
2025-08-11 23:45:25 +00:00
Brad Warren
dd99dc30f2 use pep585 annotations in acme (#10407)
this is part of https://github.com/certbot/certbot/issues/10195 where i
posted [my general
plan](https://github.com/certbot/certbot/issues/10195#issuecomment-3176661347)
here

these changes were done automatically with the command:
```
ruff check --fix --extend-select UP006 --unsafe-fixes acme
```
2025-08-11 13:19:39 -07:00
Brad Warren
14a7a97f5b remove curses environment marker (#10405)
i noticed this when reviewing
https://github.com/certbot/certbot/pull/10402

we stopped using curses ages ago and should probably remove this. see
https://github.com/certbot/certbot/pull/3665
2025-08-11 18:09:52 +00:00
ohemorange
9b3db6d52c Add pyproject.toml for certbot (#10402)
This sets up a `pyproject.toml` file for certbot, initially generated
[using](https://hatch.pypa.io/latest/intro/#existing-project) `hatch new
--init` and modifying from there. Since we dynamically require acme of a
matching version, I kept that around in `setup.py` to do the simplest
thing in this PR.

Other possible (future) implementations:
- setuptools has a beta implementation to read from a
`requirements.txt`. we could generate one of those.
- we could just hardcode it and update at release time. I like not
having to keep the version up to date in various places but maybe it's
actually fine
- something something integration with poetry pinning?

I think the syntax for setting version dynamically in `pyproject.toml`
is much nicer than what we do in `setup.py`. It's a little silly to do
it there after we've bothered to calculate it, but I put it there in the
hopes of being able to remove it from `setup.py` someday/somehow.

It would be nice to access the version dynamically set in
`pyproject.toml` in `setup.py`, but I do not think it is likely to be
possible.

Here are some useful links regarding this migrations:
- [How to modernize a `setup.py` based
project?](https://packaging.python.org/en/latest/guides/modernize-setup-py-project/)
- [Writing your
`pyproject.toml`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/)
- [Configuring setuptools using `pyproject.toml` files](
https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html)
- [`pyproject.toml`
specification](https://packaging.python.org/en/latest/specifications/pyproject-toml/)
- [Platform compatibility
tags](https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/)
2025-08-11 10:50:41 -07:00
Brad Warren
f0f036a34c fixup pinning (#10400)
this is in response to
https://github.com/certbot/certbot/pull/10399#issuecomment-3166305086

this PR does two things:

1. it clarifies what is meant by "build dependencies" in DESIGN.md
2. fixes our workaround for
https://github.com/python-poetry/poetry/issues/4103 which broke when we
moved most of our code under `src` directories. i kept the previous `rm
-rf ${REPO_ROOT}/*/*.egg-info` line around for `letstest` and to
hopefully add some robustness for us if we ever move our code around
again
2025-08-08 10:08:44 -07:00
ohemorange
dea3e5f1c4 Set up ruff so that test files have at least some linting (#10399)
Alternative implementation for #7908.

In this PR:
- set up ruff in CI (add to `tox.ini`, mark dep in `certbot/setup.py`)
- add a `ruff.toml` that ignores particularly annoying errors. I think
line length isn't actually necessary to set with this workflow since
we're not checking it but putting it there for future usage.
- either fix or ignore the rest of the errors that come with the default
linting configuration. fixed errors are mostly unused variables. ignored
are usually where we're doing weird import things for a specific reason.
2025-08-08 08:48:43 -07:00
ohemorange
5859e50e44 Run ruff to fix test errors (#10398)
This is mostly removing unused imports, plus one unused `import as`. Had
to put back imports being used with `eval` -- see the second commit.
2025-08-07 22:10:02 +00:00
Jacob Hoffman-Andrews
13954a783a renewal: factor out AriClientPool (#10393)
Part of #10355.

This allows combining the NamespaceConfig object with a cache of ACME
clients, so we don't have to make the whole large NamespaceConfig object
available all the way down the renewal call stack.

The new AriClientPool is responsible for instantiating ACME clients for
the purpose of ARI fetching. It provides only a simple user agent,
listing the Certbot version. The only CLI flag it observes is
--no-verify-ssl.
2025-08-07 13:19:05 -07:00
ohemorange
f39a584db4 Remove SSLSocket and probe_sni (#10395)
Fixes https://github.com/certbot/certbot/issues/10381.

Also cleans out lingering unused OpenSSL references that I happened to
notice. I can move these to a different PR if requested.

Fixes https://github.com/certbot/certbot/issues/10079 as well.
```
$ git grep PKey
$ git grep "crypto.x509"
$ 
```

towncrier draft:
```
## 99.99.0 - 2025-08-05

### Changed

- Removed final instances of pyopenssl x509 and PKey objects
  * Removed `acme.crypto_util.SSLSocket`
  * Removed `acme.crypto_util.probe_sni`

  ([#10079](https://github.com/certbot/certbot/issues/10079),
  [#10381](https://github.com/certbot/certbot/issues/10381))
- Removed a number of deprecated classes/interfaces
  * Removed `acme.challenges.TLSALPN01Response`
  * Removed `acme.challenges.TLSALPN01`
  * Removed `acme.standalone.TLSServer`
  * Removed `acme.standalone.TLSALPN01Server`

  ([#10274](https://github.com/certbot/certbot/issues/10274))
```
2025-08-05 16:39:13 -07:00
Will Greenberg
15a145ac3f acme: remove deprecated TLS-ALPN challenge functionality (#10378)
Fixes #10274

---------

Co-authored-by: ohemorange <erica@eff.org>
Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
Co-authored-by: Brad Warren <bmw@eff.org>
2025-08-05 21:19:51 +00:00
Brad Warren
f55ea6e70f Release 4.2.0 (#10394) 2025-08-05 12:32:36 -07:00
Erica Portnoy
ffb2196e21 Bump version to 5.0.0 2025-08-05 08:58:17 -07:00
Erica Portnoy
ba9a10b866 Remove built packages from git 2025-08-05 08:58:17 -07:00
Erica Portnoy
832d11a63f Release 4.2.0 2025-08-05 08:58:16 -07:00
Erica Portnoy
1b209c9bd3 Update changelog for 4.2.0 release 2025-08-05 08:57:49 -07:00
Jacob Hoffman-Andrews
e9cf7e8a9b renewal: use early return for empty lineage server (#10392)
This allows outdenting most of the logic for _ari_renewal_time.

Split from #10377.
2025-08-05 08:16:54 -07:00
Brad Warren
3d8be0c3b2 deprecate python 3.9 (#10390)
i based this PR on https://github.com/certbot/certbot/pull/10034/

this is maybe a little early since [python 3.9's EOL is in
october](https://devguide.python.org/versions/#supported-versions), but
i thought this would be good to do now to ensure we didn't forget, help
keep us on schedule when we're not releasing every month, allow us to
fix the security alert those with access can see at
https://github.com/certbot/certbot/security/dependabot which is caused
by [us (transitively) needing an old version of urllib3 with python
3.9](d80b1d395a/tools/requirements.txt (L195)),
and simplify development ever so slightly as discussed at
https://github.com/certbot/certbot/pull/10179

i created https://github.com/certbot/certbot/issues/10389 to track
dropping support entirely
2025-08-04 14:14:09 -07:00
Brad Warren
581977c92d try and improve should_autorenew comments (#10391)
i wrote this in response to erica's thread at
https://opensource.eff.org/eff-open-source/pl/xtuemgdti78xfx1hn9jwbrfrjy

this hopefully helps some, but i think our logic here is unfortunately
fairly complicated which is reflected in the code comments. feel free to
suggest alternate wording or even just close this if you think our
comments currently in main are good enough
2025-08-04 13:48:12 -07:00
ohemorange
d80b1d395a Deprecate acme.crypto_util.probe_sni() (#10387)
Fixes #10386.

- Creates an internal version of `probe_sni` for
`certbot-compatibility-test` use
- Deprecates `acme.crypto_util.probe_sni()`
2025-08-04 08:08:45 -07:00
Brad Warren
106d21d21d modify pyvenv.cfg instead of PYTHONPATH (#10384)
this fixes https://github.com/certbot/certbot/issues/10176 and fixes
https://github.com/certbot/certbot/issues/10257. it is based on
https://github.com/certbot/certbot/pull/10017 and ohemorange said it's
fine for me to cherry-pick their commit here

this change accomplishes a few things:

* because PYTHONPATH is no longer set to
`"$SNAP/lib/python3.12/site-packages:${PYTHONPATH}"` which evaluates to
`"$SNAP/lib/python3.12/site-packages:"` if PYTHONPATH wasn't previously
set, Certbot no longer searches for Python modules in the current
working directory which was causing #10176. i was able to reproduce this
problem with our currently released snap and verify that this change
fixes that problem
* since we no longer set PYTHONPATH at all, it won't be set in user
hooks which was causing https://github.com/certbot/certbot/issues/10257
* as an added bonus, scripts that start with `#!/usr/bin/env
/snap/certbot/current/bin/python3` as suggested
[here](https://github.com/certbot/certbot/issues/10257#issuecomment-2809421320)
are still able to find and import certbot and its dependencies so those
scripts should continue to work. i verified this is the case with manual
testing

finally, i created two news fragments here based on the text at
https://towncrier.readthedocs.io/en/stable/tutorial.html#creating-news-fragments
which says

> You can associate multiple issue numbers with a news fragment by
giving them the same contents.

when run on this PR `towncrier --draft` outputs:
```
Loading template...
Finding news fragments...
Rendering news fragments...
Draft only -- nothing has been written.
What is seen below is what would be written.

## 4.2.0.dev0 - 2025-07-31

### Changed

- Catches and ignores errors during the directory fetch for ARI checking so
  that these errors do not hinder the actual certificate issuance.
  ([#10342](https://github.com/certbot/certbot/issues/10342))
- Removed the dependency on `pytz`.
  ([#10350](https://github.com/certbot/certbot/issues/10350))

### Fixed

- The Certbot snap no longer sets the environment variable PYTHONPATH stopping
  it from picking up Python files in the current directory and polluting the
  environment for Certbot hooks written in Python.
  ([#10176](https://github.com/certbot/certbot/issues/10176),
  [#10257](https://github.com/certbot/certbot/issues/10257))
- Previously, we claimed to set FAILED_DOMAINS and RENEWED_DOMAINS env
  variables for use by post-hooks when certificate renewals fail, but we were
  not actually setting them. Now, we are.
  ([#10259](https://github.com/certbot/certbot/issues/10259))
- Added `--eab-hmac-alg` parameter to support custom HMAC algorithm for
  External Account Binding.
  ([#10281](https://github.com/certbot/certbot/issues/10281))
- Certbot now always uses the server value from the renewal configuration file
  for ARI checks instead of the server value from the current invocation of
  Certbot. This helps prevent ARI requests from going to the wrong server if
  the user changes CAs.
  ([#10339](https://github.com/certbot/certbot/issues/10339))



```

---------

Co-authored-by: Erica Portnoy <erica@eff.org>
2025-08-01 11:55:38 -07:00
ohemorange
b782c52ede Remove _snap_log_name and put back comments from #9956 (#10385)
https://github.com/certbot/certbot/pull/9956/ was accidentally merged,
so we rolled the thousand commits back, and put them back in
https://github.com/certbot/certbot/pull/9983/

In the process, commits
7d3ceb27b6
and
f62eab640e
were lost. The comment in `snapcraft.yaml` is superseded by
https://github.com/certbot/certbot/pull/10384, so let's just reapply the
remaining changes to `build_remote.py` and `snapcraft.yaml`.
2025-07-31 14:20:29 -07:00
Brad Warren
2b868708d5 move --eab-hmac-alg from fixed to added (#10383)
as i went to merge https://github.com/certbot/certbot/pull/10379, i
noticed that it moved the changelog entry from
https://github.com/certbot/certbot/pull/10319 from added to fixed which
i had missed in my prior reviews. i think added is more appropriate so
this moves it back

i personally don't think this PR requires two reviews
2025-07-31 11:38:17 -07:00
Will Greenberg
2ac7baa651 Add towncrier for automatic changelog generation (#10379)
blast from the past! resurrects
https://github.com/certbot/certbot/pull/9803 with all of @bmw's changes.
i figured instead of force-pushing a basically brand new branch and
obliterating the old review, i'd just start from a clean slate

fixes #8272

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
Co-authored-by: Brad Warren <bmw@eff.org>
2025-07-31 07:12:56 -07:00
Brad Warren
1f128b0e0a improve ARI error handling and logging (#10374)
fixes https://github.com/certbot/certbot/issues/10336 and fixes
https://github.com/certbot/certbot/issues/10357 using the plan at
https://github.com/certbot/certbot/issues/10336#issuecomment-3109192677

while this PR makes the renewal_time function slightly less nice, i
think us catching and handling the exceptions in certbot makes the most
sense so we can do exactly what we want around terminal and file logging

with this change, a output from a failed `sudo certbot renew` run looks
like
```
$ sudo certbot renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Processing /etc/letsencrypt/renewal/example.org.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
An error occurred requesting ACME Renewal Information (ARI). If this problem persists and you think it's a bug in Certbot, please open an issue at https://github.com/certbot/certbot/issues/new/choose.
Certificate not yet due for renewal

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
The following certificates are not due for renewal yet:
  /etc/letsencrypt/live/example.org/fullchain.pem expires on 2025-10-23 (skipped)
No renewals were attempted.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
```
`sudo certbot renew -q` produces no output and the relevant messages in
the log file look like:
```
2025-07-30 19:51:13,267:WARNING:certbot._internal.renewal:An error occurred requesting ACME Renewal Information (ARI). If this problem persists and you think it's a bug in Certbot, please open an issue at https://github.com/certbot/certbot/issues/new/choose.
2025-07-30 19:51:13,267:DEBUG:certbot._internal.renewal:Error while requesting ARI was:
Traceback (most recent call last):
  File "/home/brad/certbot/acme/src/acme/client.py", line 366, in renewal_time
    raise ValueError('im some error')
ValueError: im some error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/brad/certbot/certbot/src/certbot/_internal/renewal.py", line 351, in _ari_renewal_time
    return acme.renewal_time(cert_pem)[0]
  File "/home/brad/certbot/acme/src/acme/client.py", line 370, in renewal_time
    raise errors.ARIError(error_msg, now + default_retry_after) from e
acme.errors.ARIError: ('failed to fetch renewal_info URL https://acme-staging-v02.api.letsencrypt.org/acme/renewal-info/oXQaBm1Qt4YtSizBfrSNiElszRY.LMjTHFS4HPbSRMOzLrA9OZId', datetime.datetime(2025, 7, 31, 1, 51, 13, 267088))

```
2025-07-30 16:31:59 -07:00
Brad Warren
ae2a00bbad prep for 4.2.0 and fix changelog (#10375)
something weird happened to the changelog in
https://github.com/certbot/certbot/pull/10319. a 4.2.0 entry was added
below the entry for `5.0.0 - main` despite 4.2.0 not having been
released. since it's sounding like we're expecting our next release to
be 4.2.0 and not 5.0, i merged these two changelog entries into one for
4.2.0

i also modified our setup.py files to use 4.2.0.dev0 instead of
5.0.0.dev0 altho this isn't strictly necessary because our release
script will automatically set all version numbers to whatever version we
give it on the command line before building the release
2025-07-29 14:44:39 -07:00
SATOH Fumiyasu
6ba8abe8d5 Remove the dependency on pytz (#10350)
The `pytz` is obsoleted by Python 3.9.
2025-07-28 08:00:16 -07:00
ohemorange
d8acf7cea0 Add note and warning about old-options-ssl-apache.conf not receiving updates (#10373)
Part of #10183

> Option 4. Stop updating old files with security improvements. If
people want to be on old software they can but then they're not getting
the nice new things. We can either warn or not warn if we see people
using them, either on certbot install (what, who's installing new
certbot on these machines), new cert, cert renewal, or certbot update.
The second two would require code changes, I'm pretty sure. I don't
think we should warn too often because that's how we get people to
silence all output. This is a little weird because we don't usually keep
around deprecated things. We could also warn loudly and see if people
complain. Or do some sort of brownout.

This PR warns every time certbot is run. We could make it run less often
(only when a new config file is installed, probably), but that's a more
extensive code change, and honestly I think it's probably fine? But I
can change it.
2025-07-25 12:05:58 -07:00
Nicholas Ciechanowski
33d3162c24 add 3rd party certbot-dns-synergy-wholesale to the docs (#10364) 2025-07-21 08:06:55 -07:00
Brad Warren
d2e1567d26 warn about missing server during ARI checks (#10369)
this is part of https://github.com/certbot/certbot/issues/10336

on my test server, the output of `certbot renew` after deleting the
server field looks like:
<img width="1815" height="398" alt="Screenshot 2025-07-17 at 12 06
07 PM"
src="https://github.com/user-attachments/assets/537bcc39-eb59-43b4-912f-d30ac22baae8"
/>
2025-07-17 13:17:50 -07:00
ohemorange
a020de1e50 Make ACME directory fetches for ARI checks resilient (#10358)
Fixes https://github.com/certbot/certbot/issues/10342

When doing ARI checks in acme.renewal_time, we catch RequestException
and return a default value. That's so an unavailable ARI server doesn't
cause issues.

Before we get to acme.renewal_time, we have to create an ACME client,
and in the process fetch a directory. We should make the directory fetch
similarly resilient.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-07-17 12:18:25 -07:00
Brad Warren
57cb40ee9a simplify request exception handling (#10363)
my desire to do this came from the discussion at
https://github.com/certbot/certbot/pull/10358#discussion_r2198273164

the code i'm deleting here came from
https://github.com/certbot/certbot/pull/4733

i think doing string parsing on the exception like this is convoluted
and overkill. i also agree with erica from the linked thread above that
we shouldn't be raising a ValueError here, especially when the docstring
for this function says `:raises requests.exceptions.RequestException: in
case of any problems` and doesn't mention ValueError

i prefer we do the simple thing and just delete the code. in the my
opinion unlikely event we decide polishing this important, i think we
can reconsider more complex approaches here
2025-07-17 12:07:00 -07:00
Brad Warren
eb563ccc1d update dependencies (#10368)
this fixes the security alerts those with access can see at
https://github.com/certbot/certbot/security/dependabot

setting `PIP_USE_PEP517: "true"` is needed with modern versions of
setuptools as described in the issue linked in the code comment. we're
already setting the equivalent flag in builds outside of snaps. see
https://github.com/certbot/certbot/pull/10249
2025-07-17 11:56:03 -07:00
ldlb
295d8c3c49 Add --eab-hmac-alg parameter to support custom HMAC algorithm for EAB (#10319)
fixed: #10281
2025-06-27 14:16:38 -07:00
Will Greenberg
372813175d Fix #10339 (#10353)
When making an ARI request, use the server listed in the cert's renewal
conf rather than the one passed in certbot's config.

Fixes #10339

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-06-27 10:51:55 -07:00
ohemorange
b70a9f0987 Restore le-auto, which should not be modified (#10351)
https://github.com/certbot/certbot/pull/10297 modified
`letsencrypt-auto-source/letsencrypt-auto`. It should never be modified
except during a release, and we have a test to make sure of it. Old
scripts pull directly from that file on github, so let's put that back
asap.
2025-06-24 21:07:55 +00:00
Yaroslav Halchenko
86f76cd3df Add codespell support (CI to check, not to fix) and make it fix a few typos (#10297)
Another token of gratitude for a super useful tool and service.

More about codespell: https://github.com/codespell-project/codespell .

I personally introduced it to dozens if not hundreds of projects already
and so far only positive feedback.

CI workflow has 'permissions' set only to 'read' so also should be safe.

---------

Signed-off-by: Yaroslav O. Halchenko <debian@onerussian.com>
2025-06-24 13:14:31 +09:00
ohemorange
6ee19bac55 Allow notification of two reviewers being assigned to a PR and two issue assignees (#10345)
Fixes https://github.com/certbot/certbot/issues/10344

You can see this working in the mattermost "Test" channel, where I ran
this code from my test repo.

The documentation for the PR reviewer syntax is here:
https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=review_requested#pull_request

We now no longer notify on PR assignees. But I think that is the correct
behavior.

This PR also fixes a bug in the issue assigned notification code, and
now lets you see when two different people were assigned. That
documentation is here:
https://docs.github.com/en/webhooks/webhook-events-and-payloads#

After this is in, I'll make the same changes to the josepy repo.

You can see the `if` syntax here:
https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows

```
on:
  pull_request:
    types: [review_requested]
jobs:
  specific_review_requested:
    runs-on: ubuntu-latest
    if: ${{ github.event.requested_team.name == 'octo-team'}}
    steps:
      - run: echo 'A review from octo-team was requested'
```

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-06-23 17:08:21 +00:00
ohemorange
bc0b54950a Run changelog generation stage on ubuntu-latest, nightly (#10349)
Fixes https://github.com/certbot/certbot/issues/10328

This PR:
1) Moves changelog generation to ubuntu-latest instead of deprecated
windows, and
2) Sets it to run nightly so we catch breakages before release day
3) Modifies `update_changelog.py` to also allow `.dev0` version numbers
and headings with `main` instead of the date in them, for testing.

I could have been more specific about only matching `main` or a date,
but that seemed honestly unnecessary.

Here is a manually triggered nightly test; the test branch just
[removes](https://github.com/certbot/certbot/compare/changelog-gen...nightly-changelog-gen?expand=1)
all the other tests for speed:
https://dev.azure.com/certbot/certbot/_build/results?buildId=9250&view=results

You can download the created changelog artifact here:
https://dev.azure.com/certbot/certbot/_build/results?buildId=9250&view=artifacts&pathAsName=false&type=publishedArtifacts
2025-06-20 09:38:34 -07:00
ohemorange
035a6dcc39 Actually set FAILED_DOMAINS and RENEWED_DOMAINS variables when renewals fail (#10347)
Fixes https://github.com/certbot/certbot/issues/10259

This PR moves post-hook execution from `main.renew` to
`renewal.handle_renewal_request` so that failed and renewed domains
actually get passed into post-hook execution as promised, even when
failures happened.

I suspect the original PR was being overly cautious by putting the whole
thing into a try/finally so that post-hooks definitely happen, but
`handle_renewal_request` is already full of exception catching. I
understand the worry about executing a pre-hook and then failing to
execute its matching post-hook, but the code really is already
structured to make sure that that won't happen. And then when we added
`FAILED_DOMAINS` and `RENEWED_DOMAINS`, we both kept that
overly-cautious hooks execution location, but also kept the error so we
have a summary at the end...which meant that if failures happened, the
env vars were never set.

If we really want to keep the `hooks.run_saved_post_hooks` call on the
outside of everything in main, we can, but then we will have to do one
of the following:
- pass in the output lists to be filled out during execution. not my
favorite pattern
- throw the output lists in the error object or make a wrapper error,
not sure, haven't looked at `errors.py` too closely
- stop raising that final error where we report failures at the very
bottom. it's a little outdated maybe but I do like it and I think people
are used to it
- raise that error in main, returning the number of parse and renewal
failures. this is my favorite of the options, but I still like it less
than what I've implemented here.

Here's the integration/regression test failing on main:

https://dev.azure.com/certbot/certbot/_build/results?buildId=9237&view=logs&j=fca58cec-e7ce-563a-f36f-5c233894d750
You can see here that that branch just has the integration test without
the fix (and removing other tests for efficiency):
https://github.com/certbot/certbot/compare/main...test-fail-env-on-main

It's the default, but just to be clear, this should definitely have two
reviewers.
2025-06-20 07:42:20 -07:00
Brad Warren
a7e4ffb13b update acmev1 url comment (#10343)
this was the wrong/misleading comment i remember erica mentioning in our
discussions yesterday. the problem here is modern versions of certbot
also always save the server url. see
31599bad83/certbot/src/certbot/_internal/storage.py (L288-L291)

i personally don't think this requires two reviews and if whoever gets
to this first agrees, i think you should feel free to merge this
2025-06-13 10:31:49 -07:00
ohemorange
779ebe9085 Merge pull request #10341 from certbot/candidate-4.1.1
update files from 4.1.1 release
2025-06-12 13:40:50 -07:00
Brad Warren
f24cacf496 fixup changelog 2025-06-12 13:21:39 -07:00
ohemorange
b531a302ee Remove manual mattermost notification on azure failure code (#10330)
I added the exact same service hook we use for nightly failures for
release failures.
<img width="1347" alt="Screenshot 2025-06-11 at 10 32 18 AM"
src="https://github.com/user-attachments/assets/b4728d0b-212b-4ecb-84c6-0ed62715f0ff"
/>
Service hooks can be viewed here:
https://dev.azure.com/certbot/certbot/_settings/serviceHooks

Now there's no reason to keep around the manual notification stage, it
wasn't working in either case anyway. Since it's literally the same as
the nightly hook, I don't personally feel the need to test the release
branch but I can if the reviewer would like.
2025-06-12 12:40:07 -07:00
Brad Warren
4aaf9ccf59 Bump version to 5.0.0 2025-06-12 11:09:58 -07:00
Brad Warren
679f831cdd Add contents to certbot/CHANGELOG.md for next version 2025-06-12 11:09:58 -07:00
Brad Warren
2929d8072a Remove built packages from git 2025-06-12 11:09:58 -07:00
Brad Warren
c93a261aad Release 4.1.1 2025-06-12 11:09:57 -07:00
Brad Warren
9afb6415b8 fix up acme & certbot standalone code (#10293)
certbot's standalone code contains confusing references to things like
`SSLSocket` which we were hoping to deprecate in
https://github.com/certbot/certbot/issues/10284. are they relevant?
they're sure not!

certbot's standalone plugin only supports HTTP-01 so comments about
things like `ACMETLSServer` and the completely unused `certs` variable
can be deleted

furthermore, the type of the different variables named things like
`http_01_resources` were wrong in multiple places. as can be seen in
certbot's standalone code, the type is
`Set[acme_standalone.HTTP01RequestHandler.HTTP01Resource]`. this is also
[the type used in acme.standalone's
tests](723fe64d4d/acme/src/acme/_internal/tests/standalone_test.py (L78-L81))
despite the file's type annotations saying it takes a different type. i
think the incorrect type annotations were never caught because mypy
can't fully make sense of our overly complex server classes here

finally, `from __future__ import annotations` was added to make [forward
references in type
annotations](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#forward-references)
easier
2025-06-12 11:09:12 -07:00
Brad Warren
ee2bdafc56 Update changelog for 4.1.1 release 2025-06-12 11:08:34 -07:00
ohemorange
680d998597 Pass in dict of acme clients instead of acme so we can wait to initialize in some cases (#10337)
Regression test fails on main with commit "add regression test"
cherry-picked onto it

```
$ pytest   certbot/src/certbot/_internal/tests/renewal_test.py 
======================================================================= test session starts =======================================================================
platform darwin -- Python 3.12.8, pytest-8.3.5, pluggy-1.5.0
rootdir: /Users/erica/certbot
configfile: pytest.ini
plugins: anyio-4.9.0, cov-6.1.1, xdist-3.6.1
collected 27 items                                                                                                                                                

certbot/src/certbot/_internal/tests/renewal_test.py .....F.....................                                                                             [100%]

============================================================================ FAILURES =============================================================================
___________________________________________________________ RenewalTest.test_no_network_if_no_autorenew ___________________________________________________________

self = <certbot._internal.tests.renewal_test.RenewalTest testMethod=test_no_network_if_no_autorenew>
mock_autorenewal_enabled = <MagicMock name='autorenewal_is_enabled' id='4378096224'>, mock_client_network_get = <MagicMock name='get' id='4378087008'>
unused_mock_display = <certbot.tests.util.FreezableMock object at 0x104eb4f50>

>   ???
E   AssertionError: assert 1 == 0
E    +  where 1 = <MagicMock name='get' id='4378087008'>.call_count

certbot/src/certbot/_internal/tests/renewal_test.py:260: AssertionError
===================================================================== short test summary info =====================================================================
FAILED certbot/src/certbot/_internal/tests/renewal_test.py::RenewalTest::test_no_network_if_no_autorenew - AssertionError: assert 1 == 0
================================================================== 1 failed, 26 passed in 0.30s ===================================================================

```
2025-06-12 11:02:22 -07:00
ohemorange
31599bad83 Reduce logging level of ARI failure to info (#10335)
This is a feature people didn't have before and won't miss if it fails.
We can always raise it later, but let's reduce it for now to stop people
worrying about the big red warning.
2025-06-12 16:16:57 +00:00
ohemorange
b682687449 Avoid ari mismatch problem during dry-run (#10332)
This is one solution to https://github.com/certbot/certbot/issues/10327.
It won't test an ARI check during a dry run, since it will just avoid
the mismatch problem by checking for dry run first and returning before
checking ARI. This PR will make the big error (actually a warning, but
red and scary) go away though.
2025-06-12 08:05:57 -07:00
ohemorange
2e827c5da6 Improve changelog entry (#10331)
I thought https://github.com/certbot/certbot/pull/9804/ was abandoned
but the author just missed my comment. I would like to accept that PR to
get it in, but in the process of updating the PR I wrote a nicer
changelog entry, so I would like to add that.
2025-06-11 16:37:43 -07:00
✨ Q (it/its) ✨
8e9d867447 Print error details when an IssuanceError is thrown (#9804)
When a CA fails to issue a certificate after finalisation Certbot
currently prints the following unhelpful message:

```
An unexpected error occurred:
acme.errors.IssuanceError
```

This PR makes Certbot print the ACME error object from the order, as
such

```
An unexpected error occurred:
CAA error :: Invalid CAA: CAA prohibits issuance
```

## Pull Request Checklist

- [ ] The Certbot team has recently expressed interest in reviewing a PR
for this. If not, this PR may be closed due our limited resources and
need to prioritize how we spend them.
- [x] If the change being made is to a [distributed
component](https://certbot.eff.org/docs/contributing.html#code-components-and-layout),
edit the `master` section of `certbot/CHANGELOG.md` to include a
description of the change being made.
- [x] Add or update any documentation as needed to support the changes
in this PR.
- [x] Include your name in `AUTHORS.md` if you like.
2025-06-11 15:15:45 -07:00
Brad Warren
1e8c09c05f Release 4.1.0 (#10326) 2025-06-11 07:32:03 -07:00
Erica Portnoy
4a1a136fcb Bump version to 5.0.0 2025-06-10 14:43:36 -07:00
Erica Portnoy
42789114b3 Add contents to certbot/CHANGELOG.md for next version 2025-06-10 14:43:36 -07:00
Erica Portnoy
9a08102f43 Remove built packages from git 2025-06-10 14:43:36 -07:00
Erica Portnoy
6a72811a39 Release 4.1.0 2025-06-10 14:43:35 -07:00
Erica Portnoy
f417f24998 Update changelog for 4.1.0 release 2025-06-10 14:43:05 -07:00
ohemorange
10b019b3b8 moving to src layout means we need to cd into src as well to grab version number for changelog (#10325) 2025-06-10 21:40:53 +00:00
ohemorange
47b44a6751 Add a changelog entry describing the impacts of ARI on short renew_before_expiry (#10323)
Fixes #10312. This is perhaps overly detailed, but I was hoping that by
giving a viable path forward it would forestall requests to change it
back, add a flag to ignore ari, or otherwise change the behavior. Very
open to suggestions on wording/content/length/etc.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-06-09 20:11:19 +00:00
ohemorange
4c5492fbec Use ubuntu-latest for mattermost-notify on azure (#10324)
There's no reason to be using a specific vmImage here; set it to
`ubuntu-latest` so we don't have to regularly update this. Fixes
https://github.com/certbot/certbot/issues/10322.
2025-06-09 12:45:53 -07:00
Jacob Hoffman-Andrews
1d9fc8dccf renewal: use lineage-specific server for ARI (#10307)
Previously, we were constructing an ACME client for ARI checking that
used the global value for `server`, not the one recorded in a lineage's
renewal file.

This resulted in errors in the logs and failure to observe ARI for
lineages that used a non-default `--server` (e.g. staging or non-Let's
Encrypt CAs).

---------

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2025-06-09 11:44:04 -07:00
Jacob Hoffman-Andrews
a75057042f integration: add test for early renewal from ARI (#10311)
This depends on a pending Pebble pull request and so will fail
integration tests until/unless that lands:
https://github.com/letsencrypt/pebble/pull/501

However, I'd appreciate some eyes on this PR in this regard: is the
interface we're using in Pebble useful and appropriate? If not, we can
adjust the Pebble PR.

Inspired based on conversation on
https://github.com/certbot/certbot/pull/10307, but note that this just
tests the general case; it does not test the "default server differs
from lineage server" case yet; when I try adding that I get some bugs
that may reflect a problem in #10307 I need to fix (or may reflect that
I need to inhibit the `--server` flag rather than trying to override it
late in the command line).
2025-06-06 14:39:10 -07:00
Brad Warren
95a70e98c2 don't check ARI for expired certs (#10317)
fixes https://github.com/certbot/certbot/issues/10308

my thinking here was if the spec forbids checking ARI for expired certs,
this check should happen directly in the renewal_time function. if we do
that, what's its most useful response? error? return None? return a
datetime in the past?

i feel the latter is most helpful. tell the caller to renew now rather
than erroring out or giving it no suggestion about when it should renew

it probably doesn't matter much, but i think this would be nice to have
for 4.1.0 as it fixes a (minor) spec compliance issue in our ARI
implementation that is being released
2025-06-06 10:52:54 -07:00
ohemorange
48f34938c6 Change acme.renewal_time to only check ARI, and not also a default time. Separate out default check and use that in should_autorenew instead. (#10309)
Fixes https://github.com/certbot/certbot/issues/10298. Replacement for
#10301.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-06-04 14:48:44 -07:00
ohemorange
3cbe1288c9 Clean up renew_before_expiry default behavior (#10306)
[Recent changes](https://github.com/certbot/certbot/pull/10272/) to
`renewal.should_autorenew` assumed that if
`RenewableCert.configuration.renew_before_expiry` was set, that means
the user set it. That's wasn't true; we were throwing in a default value
if the user didn't set it. But there's no reason for that, especially
since we now set the default renewal time dynamically. Also, we were
writing out a commented `# renew_before_expiry = 30 days` without any
further documentation, in a file that we tell users they [shouldn't
really be
editing](https://eff-certbot.readthedocs.io/en/latest/using.html#modifying-the-renewal-configuration-file).
We now do neither of those things.
2025-06-02 14:19:31 -07:00
Brad Warren
e873874752 update developer OS dependency list (#10304)
this is a follow up from https://github.com/certbot/certbot/pull/10286
and related to https://github.com/certbot/certbot/issues/10302

sorry i initially missed this! in #10286 our tests were just yelling at
me about the different augeas package needed, but python headers and a
compiler are also needed for things to work with an updated version of
python-augeas

i don't believe we need this change in our macOS instructions because:

1. homebrew doesn't split up python packages the way many linux distros
do. there is no equivalent python-dev package
2. if you're using homebrew, you already have a compiler because
[homebrew requires command line tools for
xcode](https://docs.brew.sh/Installation#macos-requirements)
3. "it works on my machine"
2025-06-02 12:54:33 -07:00
Jacob Hoffman-Andrews
dbd0c6fce8 Deprecate parameter enforce_openssl_binary_usage (#10300)
Part of https://github.com/certbot/certbot/issues/10291
2025-05-29 13:28:48 -07:00
ohemorange
7a27a67cdb Respect Retry-After header when polling for order finalization (#10288)
Fixes #10273.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-05-15 16:24:52 +00:00
Brad Warren
5d03191493 deprecate SSLSocket and TLSServer (#10294)
fixes https://github.com/certbot/certbot/issues/10284
2025-05-15 09:06:18 -07:00
Jacob Hoffman-Andrews
723fe64d4d Add ARI support to acme module and to Certbot (#10272)
Follow-up to #10241. The acme module code is mostly the same, except the
switch to return a tuple containing Retry-After.

This includes the CLI-side work to call out to the new `renewal_time`
method when checking for renewal.

I moved `should_autorenew` from `storage.py` into `renewal.py`, where it
fits better (and also this solves an import cycle problem). To make the
edits more visible I split this into one commit for the move and [one
commit for the subsequent
edits](4e137d9b00 (diff-fad906e31304c767d620bfd243f4c7adf1e63a3420fd634ee57a0f6651c182cf)).

This does not yet attempt to store the Retry-After info, or failure
retries, in renewal configs. I figured since that's a pretty big chunk
of work and design on its own, I wanted to get interim feedback as is. I
think this PR would be okay to land with the current default crons /
systemd timers that run twice a day. I think we should implement storage
of retry information before increasing the frequency of runs. And if the
team would like to hold off on landing any ARI until that storage is
done, I'm good with that too. 👍🏻
2025-05-13 10:34:19 -07:00
Jacob Hoffman-Andrews
3a1f6782b6 Remove openssl-based OCSP checking
Use exclusively the `cryptography` package for OCSP checking.
2025-05-13 10:26:44 -07:00
Brad Warren
c5686e6653 fix mac dev augeas setup (#10287)
it appears these changes are also needed to work with python-augeas
1.2.0. i didn't catch this in
https://github.com/certbot/certbot/pull/10286 because the problem only
affects ARM macs and it appears [our CI only offers intel
macs](https://learn.microsoft.com/en-us/azure/devops/release-notes/roadmap/macos-agents-apple-silicon)

the issue here is described in homebrew issues like
https://github.com/Homebrew/brew/issues/13481 and
https://github.com/orgs/Homebrew/discussions/868. essentially, homebrew
on intel macs puts files in /usr/local which is then found by other
software by default while on arm macs it uses /opt/homebrew meaning we
have to set additional flags for things like C compilers to find headers
and libraries installed through homebrew. there was a little discussion
in https://github.com/Homebrew/brew/issues/13481 of having homebrew
fixup environment variables like `CFLAGS` by default on ARM systems, but
the issue was closed ☹️

in the meantime, this PR should fix things for certbot devs and removes
the need for the ~/lib symlinks with both new and old versions of
python-augeas
2025-05-12 11:26:40 -07:00
Brad Warren
fde359f4da fixup http01_example.py (#10285)
it looks like https://github.com/certbot/certbot/pull/10098 introduced a
couple bugs into this file:

1.
[RSAPrivateKeys](https://cryptography.io/en/latest/hazmat/primitives/asymmetric/rsa/#cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey)
don't have a `public_bytes` method
2. `cryptography.x509` wasn't imported and
[load_pem_x509_certificate](https://cryptography.io/en/latest/x509/reference/#cryptography.x509.load_pem_x509_certificate)
takes bytes, not a string

i think avoiding this is unfortunately difficult as this file has no
tests, but it was useful for me just now when testing
https://github.com/certbot/certbot/pull/10283 so i wanted to fix it up

i also changed the script to initially create the account without an
email address as the fake@example.com email causes registration with
LE's staging server to fail early in execution

with the changes in this PR changes, if you:

1. change the value of
[DOMAIN](0075104805/acme/examples/http01_example.py (L57))
to a domain pointing at your machine
2. as root, activate your certbot dev environment, and run `python
acme/examples/http01_example.py `

it will fail late in the script with:
```
Traceback (most recent call last):
  File "/home/brad/certbot/acme/examples/http01_example.py", line 237, in <module>
    example_http()
    ~~~~~~~~~~~~^^
  File "/home/brad/certbot/acme/examples/http01_example.py", line 223, in example_http
    regr = client_acme.update_registration(
        regr.update(
    ...<3 lines>...
        )
    )
  File "/home/brad/certbot/acme/src/acme/client.py", line 101, in update_registration
    updated_regr = self._send_recv_regr(regr, body=body)
  File "/home/brad/certbot/acme/src/acme/client.py", line 373, in _send_recv_regr
    response = self._post(regr.uri, body)
  File "/home/brad/certbot/acme/src/acme/client.py", line 392, in _post
    return self.net.post(*args, **kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/brad/certbot/acme/src/acme/client.py", line 766, in post
    return self._post_once(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/brad/certbot/acme/src/acme/client.py", line 781, in _post_once
    response = self._check_response(response, content_type=content_type)
  File "/home/brad/certbot/acme/src/acme/client.py", line 630, in _check_response
    raise messages.Error.from_json(jobj)
acme.messages.Error: urn:ietf:params:acme:error:invalidContact :: The provided contact URI was invalid :: Unable to update account :: invalid contact: contact email has forbidden domain "example.org"
```
if you also change [this email
variable](0075104805/acme/examples/http01_example.py (L223))
to a valid email address, the script will run successfully
2025-05-08 15:43:37 -07:00
Brad Warren
10747555ae upgrade python-augeas (#10286)
a couple weeks ago, [python-augeas
1.2.0](https://pypi.org/project/python-augeas/#history) was uploaded to
pypi. unfortunately, this broke things for us

the first major change was from
https://github.com/hercules-team/python-augeas/pull/49 where
python-augeas now needs the new OS packages described in the initial
comment there

the second change was from
https://github.com/hercules-team/python-augeas/pull/51 which added a
python interface to augeas functions that weren't introduced until
[augeas
1.13.0](af2aa88ab3/NEWS (L65-L66)).
this isn't ideal, but i don't think it's a big deal for us. augeas
1.13.0 is over three years old and [ubuntu
20.04](https://ubuntu.com/blog/ubuntu-20-04-eol-for-devicesional) and
[debian bullseye](https://www.debian.org/releases/) which have older
versions than that are technically EOL'd

regardless of how we feel about these changes, our tests don't currently
work with an updated version of python-augeas and this PR fixes it. i'm
also tracking https://github.com/certbot/certbot/issues/10282 to update
certbot.eff.org to list the newly required OS packages
2025-05-08 13:03:31 -07:00
Will Greenberg
0fc755fe08 Fix 10260 (#10283)
Builds off of https://github.com/certbot/certbot/pull/7066 to stringify
these validation errors

Fixes #10260

---------

Co-authored-by: George Daramouskas <gdaramouskas@therp.nl>
Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-05-08 09:13:04 -07:00
Jacob Hoffman-Andrews
dcdfdacf75 store preferred/required_profile in renewal config (#10280)
This ensures that renewals of certificates will use the same profile
settings.

Fixes #10271
2025-05-07 16:32:48 -07:00
Jacob Hoffman-Andrews
0075104805 acme.ClientNetwork: JWK becomes optional (#10275)
This results in a ClientNetwork that can .get() but not .post(). Useful
for fetching ARI, which does not require authentication.
2025-05-06 12:34:50 -07:00
Alexis
2cf6cda1fa [REPO] Update SECURITY.md (#10253)
Add supported versions

---------

Signed-off-by: zoracon <zoracon@pm.me>
2025-05-06 10:57:50 -07:00
Brad Warren
6418ee32e5 upgrade certbot compatibility test images (#10277)
i need this for some other upgrades i'm working on. using these debian
buster images which were [EOL'd ages
ago](https://www.debian.org/releases/) is giving me problems

while i was at it, i fixed up up the following warnings docker was
printing at me:

*
https://docs.docker.com/reference/build-checks/legacy-key-value-format/
* https://docs.docker.com/reference/build-checks/maintainer-deprecated/
2025-05-06 10:57:10 -07:00
Brad Warren
cc08242abc update pinned dependencies (#10278)
this fixes the security alerts those with access can see at
https://github.com/certbot/certbot/security/dependabot

i based what needed to be done to drop python < 3.9.2 support on
https://github.com/certbot/certbot/pull/10077 and concluded we only
really needed to update `python_requires`. we could do a deprecation
period for this, but i think it's not necessary. cryptography didn't
(it's not even in mentioned in [their
changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst))
and none of the major LTS distros use python 3.9.0 or 3.9.1
2025-05-06 10:56:19 -07:00
ohemorange
62361dac44 Catch and ignore orderNotReady response when posting a request to begin finalization and poll until ready (#10239)
Fixes #9766.
2025-05-02 12:08:46 -07:00
Brad Warren
5dcfd32a11 remove unneeded cryptography req (#10276)
since https://github.com/certbot/certbot/pull/10130, we depend on much
newer versions of cryptography so this restraint is no longer needed
2025-04-30 11:47:35 -07:00
ohemorange
6ac951e146 Deprecate TLS-ALPN support in ACME (#10268)
Fixes #10266.

See example deprecation in
https://github.com/certbot/josepy/pull/207/files

I can add stacklevel=2, though I find that usually I just look at the
whole stack anyway when debugging, myself, so it doesn't really matter.
2025-04-28 15:09:15 -07:00
ohemorange
508fba1da6 Why do we have this? It means warnings aren't filtered in acme tests (#10267)
This was added in https://github.com/certbot/certbot/pull/6091 to make
tests pass in EPEL and older ubuntus, 7 years ago. It is probably no
longer needed.

| pytest version | min. Python version |
|---------------|---------------------|
|8.0+ | 3.8+|
| 7.1+ | 3.7+ |
| 6.2 - 7.0 | 3.6+ |
| 5.0 - 6.1 | 3.5+ |
| 3.3 - 4.6 | 2.7, 3.4+ |

That version is [no longer
supported](https://docs.pytest.org/en/stable/backwards-compatibility.html).

Probably therefore we can just get rid of this.
2025-04-25 20:53:31 +00:00
ohemorange
2da39317b2 Replace pyparsing error that usually misdirects people with a more helpful message (#10265)
Addresses #10264, though I could not actually find a way to fix that
particular issue. So, fixes #10264 is not actually accurate, but I would
like github to link them.
2025-04-25 13:11:28 -07:00
ohemorange
16f858547f Add --use-pep517 flag to pip to silence warning in tools/venv.py, and switch codebase to src-layout (#10249)
Fixes #10252.

See further discussion here: https://github.com/pypa/pip/issues/11457

We are doing option:

> Alternatively, enable the --use-pep517 pip option, possibly with
--no-build-isolation. The --use-pip517 flag will force pip to use the
modern mechanism for editable installs. --no-build-isolation may be
needed if your project has build-time requirements beyond setuptools and
wheel. By passing this flag, you are responsible for making sure your
environment already has the required dependencies to build your package.
Once the legacy mechanism is removed, --use-pep517 will have no effect
and will essentially be enabled by default in this context.

Major changes made here include:
- Add `--use-pep517` to use the modern mechanism, which will be the only
mechanism in future pip releases
- Change to `/src` layout to appease mypy, and because for editable
installs that really is the normal way these days.
  - `cd acme && mkdir src && mv acme src/` etc.
- add `where='src'` argument to `find_packages` and add
`package_dir={'': 'src'},` in `setup.py`s
  - update `MANIFEST.in` files with new path locations 
- Update our many hardcoded filepaths
- Update `importlib-metadata` requirement to fix
double-plugin-entry-point problem in oldest tests
2025-04-11 19:30:33 +00:00
mirchicap
6de7570af0 Add certbot-dns-cdmon to third-party plugins list (#10258)
This PR adds `certbot-dns-cdmon` to the list of third-party plugins in
the documentation.

`certbot-dns-cdmon` enables DNS-01 challenge automation for domains
managed with cdmon's DNS.

PyPI: https://pypi.org/project/certbot-dns-cdmon/
2025-04-10 14:38:02 -07:00
Brad Warren
9bc9e3412e Merge pull request #10261 from certbot/candidate-4.0.0 2025-04-08 10:25:34 -07:00
Will Greenberg
f822602fff Bump version to 4.1.0 2025-04-07 15:04:01 -07:00
Will Greenberg
52ad3e80bd Add contents to certbot/CHANGELOG.md for next version 2025-04-07 15:04:01 -07:00
Will Greenberg
d9e3d7b2d2 Remove built packages from git 2025-04-07 15:04:01 -07:00
Will Greenberg
d95a389c3f Release 4.0.0 2025-04-07 15:04:00 -07:00
Will Greenberg
f7a0df3461 Update changelog for 4.0.0 release 2025-04-07 15:03:33 -07:00
Jonathan Vanasco
cb5d579a84 cloudtest some warnings (#10255) 2025-04-03 14:38:54 -07:00
Jacob Hoffman-Andrews
45626e88e2 Add --preferred-profile and --required-profile (#10230)
Fixes #10194
2025-04-03 06:48:52 +09:00
Will Greenberg
15024aabd3 Repin dependencies for josepy 2.0 (#10254) 2025-04-02 18:17:44 +00:00
Jonathan Vanasco
dd876a40ed Feature acme cryptography 2 (#10245)
redoing https://github.com/certbot/certbot/pull/10174 but lots of
mergecommits and ff wanted; so test in a clean environment
2025-04-02 10:53:47 -07:00
ohemorange
7a90cdd231 Remove custom version of CertificateIssuerPrivateKeyTypes now that cryptography version is minimum 43 (#10236)
Fixes https://github.com/certbot/certbot/issues/10233

This was a stand-in for
`cryptography.hazmat.primitives.asymmetric.types.CertificateIssuerPrivateKeyTypes`,
which we can now use directly.
2025-03-28 11:56:02 -07:00
ohemorange
7d461a8dfc Add template for code maintenance task (#10251)
We need this to create issues to track work like "update venv.py to
address upcoming pip build system deprecation" since we no longer have a
blank issue template.
2025-03-28 16:41:50 +00:00
Brad Warren
83510c1da5 use type feature instead of label (#10247)
not doing this breaks our triage link which currently looks for
unlabeled issues
2025-03-27 21:36:16 +00:00
Alexis
0b51653def [REPO] Add New Feature Template (#10238)
Adding for cases when it's not a bug, but a feature request. Helping
those and us frame the initial request better.
2025-03-17 18:07:32 -07:00
ohemorange
aa005f20fe Add RewriteEngine on directive also in post (#10232)
Fixes
https://github.com/certbot/certbot/issues/9835#issuecomment-2717096178,
where our `RewriteEngine on` directive inserted at the beginning of a
virtualhost was overridden a `RewriteEngine Off` directive later. This
PR does the easy thing of placing `RewriteEngine on` in our
post-insert.
2025-03-17 20:02:10 +00:00
ohemorange
8a6138856f Escape <TAG> in docker readme file (#10235)
Fixes https://github.com/certbot/certbot/issues/10229
2025-03-17 08:48:25 -07:00
ohemorange
7322e56cc7 Use updated name TLS_METHOD instead of SSLv23_METHOD (#10237)
Fixes #10231
2025-03-14 10:38:02 -07:00
Artur Corrêa Souza
df9075e023 fix(route53): explanation on credentials file (#9907)
The credentials configuration file is at ~/.aws/credentials.

Also, when running on root it uses the root home (so /root/.aws). This
was from my test at an ubuntu server.

## Pull Request Checklist

- [ ] The Certbot team has recently expressed interest in reviewing a PR
for this. If not, this PR may be closed due our limited resources and
need to prioritize how we spend them.
- [ ] If the change being made is to a [distributed
component](https://certbot.eff.org/docs/contributing.html#code-components-and-layout),
edit the `master` section of `certbot/CHANGELOG.md` to include a
description of the change being made.
- [ ] Add or update any documentation as needed to support the changes
in this PR.
- [ ] Include your name in `AUTHORS.md` if you like.
2025-03-13 13:23:57 -07:00
Jacob Hoffman-Andrews
d91e552491 renewal: by default, use a fraction of lifetime (#10207)
Previously we defaulted to renewing at 30 days before expiry, and
allowed users to customize the config file to set a different value.

Instead, we should renew when 1/3 of the lifetime is left, or for
shorter certificates (<10 days), when 1/2 of the lifetime is left.

This still allows explicitly configured values to take precedence.

---------

Co-authored-by: Will Greenberg <ifnspifn@gmail.com>
2025-03-12 10:35:59 -07:00
Will Greenberg
b3bd4304f4 Merge pull request #10228 from certbot/candidate-3.3.0
Candidate 3.3.0
2025-03-11 09:54:07 -07:00
Brad Warren
37f6f8a12c Bump version to 4.0.0 2025-03-11 08:04:08 -07:00
Brad Warren
be60ad5131 Add contents to certbot/CHANGELOG.md for next version 2025-03-11 08:04:08 -07:00
Brad Warren
16cbd6c00a Remove built packages from git 2025-03-11 08:04:08 -07:00
Brad Warren
3b19e18641 Release 3.3.0 2025-03-11 08:04:07 -07:00
Brad Warren
259afd7458 Update changelog for 3.3.0 release 2025-03-11 08:03:28 -07:00
Brad Warren
b7e09dd652 change changelog to 3.3.0 (#10226)
i tested it and the version numbers in setup.py files will be changed
automatically by the release script
2025-03-10 12:08:29 -07:00
Jacob Hoffman-Andrews
8487bfeaa5 Update contributing.rst (#10203)
Give better instructions on running all unittests, and on running
specific test cases.

Replace `python` with `python3` in venv setup invocations because some
systems don't have a plain `python` command.

---------

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2025-03-08 00:21:44 +00:00
Jacob Hoffman-Andrews
c323af7be9 Remove warnings about empty email. (#10214)
We strongly encouraged providing an email address because we wanted
people to get expiration notices to ensure that even if their Certbot
install broke, they could fix it before their site goes down.

Now that Let's Encrypt is getting rid of expiration notices
(https://letsencrypt.org/2025/01/22/ending-expiration-emails/), we can
remove some of the encouragement, providing a smoother user experience.
2025-03-06 14:38:52 -08:00
Brad Warren
2a92e22332 make integration tests crossplatform (#10217)
i wanted this for testing
https://github.com/certbot/certbot/issues/10190

alex started working on this in
https://github.com/certbot/certbot/pull/9207 years ago, but pebble
didn't end up doing a release containing his work while he was still
regularly contributing to certbot. this has now changed though

before this PR, our integration tests only worked on amd64 linux
systems. with this PR, i've successfully run our integration tests on
all combinations of the architectures amd64 and arm64 and the OSes linux
and macos

---------

Co-authored-by: ohemorange <erica@eff.org>
2025-03-06 14:13:26 -08:00
Brad Warren
48ffe02ce3 fix openssl env vars (#10223)
this should fix https://github.com/certbot/certbot/issues/10190

i unfortunately wasn't able to reproduce the nginx problem, but i did
audit all subprocess calls in certbot and all of its plugins and
confirmed that they use this `env_no_snap_for_external_calls` function.
with `OPENSSL_MODULES` no longer pointing inside the snap, this problem
should go away

i also cleared `OPENSSL_FORCE_FIPS_MODE` because of the report
[here](https://community.letsencrypt.org/t/certbot-snap-error-while-renewing-openssl-init-ssl/232145/16)
2025-03-06 13:21:33 -08:00
Will Greenberg
a43fdedd12 Merge pull request #10224 from certbot/bmw-patch-1
use pull_request_target
2025-03-05 11:13:47 -08:00
Brad Warren
4cffcbffaa use-pr-target 2025-03-05 08:19:10 -08:00
Alexis
65c33488dd [DOCS] Update CONTRIBUTING.md (#10220)
Just adding consistent language for the contributing guide.
2025-03-04 19:01:39 -08:00
Jacob Hoffman-Andrews
487dd53103 tests: remove RSA-256 key. (#10208)
This is ludicrously short and was only used by some key-mismatch tests.
We have plenty of other mismatched keys.
2025-02-25 18:03:16 -08:00
Brad Warren
d3d0b76f9f update centos9 ami (#10210)
tests on this passed at
https://dev.azure.com/certbot/certbot/_build/results?buildId=8790&view=results
2025-02-25 15:46:28 -08:00
ohemorange
52ee2a5e8b Improve instructions for updating github releases token (#10201)
The token is now owned by the team account and can simply be
regenerated, so we don't need the info about perhaps doing that. Plus,
there are now more clear instructions on the wiki. And the date was
updated.
2025-02-25 14:27:40 -08:00
ohemorange
a6bed18f0b Use ubuntu 24 to build docker (#10202)
Maybe addresses https://github.com/certbot/certbot/issues/10020

#10020 claims that without the verbose settings, build fail almost every
time. In my one (1) test removing verbosity, it passed, so idk. BUT! It
took [56
minutes](https://dev.azure.com/certbot/certbot/_build/results?buildId=8766&view=logs&j=fdd3565a-f3c6-5154-eca9-9ae03666f7bd&t=5dbd9851-46a4-524f-73a8-4028241afcde)
instead of [37 on ubuntu
24](https://dev.azure.com/certbot/certbot/_build/results?buildId=8768&view=logs&j=fdd3565a-f3c6-5154-eca9-9ae03666f7bd&t=5dbd9851-46a4-524f-73a8-4028241afcde).
Whether or not this actually fixes the underlying problem (still looking
into that), that seems worthwhile to speed up.
2025-02-24 19:22:07 -08:00
Jacob Hoffman-Andrews
792a76569d acme: add support for profiles (#10196)
Recognizes the profiles map in the "meta" section of directory.

Allows sending a "profile" field in order objects.

Adds an optional "profile" parameter to new_order in client.py.

Related to #10194.
2025-02-24 19:18:51 -08:00
ohemorange
9105cd21ba Update url for moved image to fix readthedocs build (#10200)
https://readthedocs.org/projects/eff-certbot/builds/27298576/ was
failing with `WARNING: Could not fetch remote image:
https://raw.githubusercontent.com/EFForg/design/master/logos/eff-certbot-lockup.png
[404]`

This is because the file was moved to
https://raw.githubusercontent.com/EFForg/design/master/logos/certbot/eff-certbot-lockup.png
as you can see here:
https://github.com/EFForg/design/tree/master/logos/certbot
2025-02-24 11:17:03 -08:00
ohemorange
6fd6a541d4 Remove internal comments from server_names directive (#10147)
Fixes https://github.com/certbot/certbot/issues/7090
2025-02-24 10:54:58 -08:00
Jonathan Vanasco
cda56361ad Fix deprecate pyopenssl (#10186)
Uploading for tests;

These deprecations are a precursor to #10174 

In addition to the previously discussed `acme` functions, the `certbot`
functions were deprecated as they are primarily used for testing and
support. Marking them deprecated now will allow them to be removed in
the next major release, as they will no-longer be used.
2025-02-24 10:54:17 -08:00
Alexis
d3aceba188 [TOOLING] Add Automation for When a PR or Issue is Assigned (#10191)
Adding automation for team triage meetings for when PRs or Issues are
assigned. You can see an example in the "Test" channel.

---------

Co-authored-by: ohemorange <erica@eff.org>
2025-02-14 14:58:00 -08:00
Alexis
8524255a2e [REPO] Create New Issue Template with Updated Strcuture (#10172)
Playing around with the new [issue template
structure](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms).

If you'd like to test it out:
https://github.com/zoracon/zoracon/issues/new?template=bug.yml

---------

Co-authored-by: ohemorange <ebportnoy@gmail.com>
Co-authored-by: ohemorange <erica@eff.org>
2025-02-14 14:50:20 -08:00
Osiris Inferi
a32fc2d6f0 Example explanation for standalone authenticator in cli.ini mentions incorrect port (#9951)
The standalone authenticator doesn't use port 443, so the comment in the
`cli.ini` example also shouldn't say so.
2025-02-13 14:26:06 -08:00
ohemorange
a24f14d48f Be consistent with checking capitalization in rfc2136 plugin (#10188)
Fixes https://github.com/certbot/certbot/issues/10177.

We were using `.upper()` when validating the config but not when
actually creating the object. Now we call it in both places. I updated a
test to work as a regression test here.
2025-02-12 21:42:00 -08:00
ohemorange
3ab9bf9f39 Release 3.2.0 (#10187)
This should be merged, not squashed!
2025-02-11 15:32:51 -08:00
Will Greenberg
4708012b2d bump changelog to 4.0.0 2025-02-11 15:18:54 -08:00
Will Greenberg
8a2ded2d0e psych, actually bump version to 4.0.0 2025-02-11 15:17:56 -08:00
Will Greenberg
77594d7300 Bump version to 3.3.0 2025-02-11 11:58:46 -08:00
Will Greenberg
fa9cd61066 Add contents to certbot/CHANGELOG.md for next version 2025-02-11 11:58:46 -08:00
Will Greenberg
a6d8c467f0 Remove built packages from git 2025-02-11 11:58:45 -08:00
Will Greenberg
a0e8b49057 Release 3.2.0 2025-02-11 11:58:44 -08:00
Will Greenberg
3272dcbebd Update changelog for 3.2.0 release 2025-02-11 11:57:39 -08:00
Ted Strzalkowski
3395dce319 Add ClouDNS to documentation (#9879)
There is a ClouDNS plugin actively maintained that should be included in
the documentation for discoverability by users.
2025-02-11 10:56:58 -08:00
Trinopoty Biswas
ad29d5fbcf Remove support for Linode API v3 (#10062)
The v3 api was sunset at the end of July 2023. This PR cleans up code
related to api v3.

## Pull Request Checklist

- [ ] The Certbot team has recently expressed interest in reviewing a PR
for this. If not, this PR may be closed due our limited resources and
need to prioritize how we spend them.
- [ ] If the change being made is to a [distributed
component](https://certbot.eff.org/docs/contributing.html#code-components-and-layout),
edit the `main` section of `certbot/CHANGELOG.md` to include a
description of the change being made.
- [ ] Add or update any documentation as needed to support the changes
in this PR.
- [ ] Include your name in `AUTHORS.md` if you like.
2025-02-11 10:25:28 -08:00
Will Greenberg
de48847af4 Require v2.19 of cloudflare's python library (#10182)
This is a stopgap measure until we upgrade to the newer (but
backwards-incompatible) versions of cloudflare's python library (see
#9938)

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-02-06 19:29:07 +00:00
ohemorange
a57b29a276 [apache] Add type hints to apache configurator for mypy --strict (#10155)
I don't love the `Any` in that `Callable`, but I can't find a way to fix
it. In practice, it's either going to be `str` or `None`, but we pass an
`options` that's typed as `List[str] | str | None`, and one of the
functions has a header with a strict `str`. I tried various unions of
things and it wasn't working and I decided it's not worth it.

```
$ mypy --strict certbot-apache/certbot_apache/_internal/configurator.py 
Success: no issues found in 1 source file
```
2025-02-06 10:54:10 -08:00
ohemorange
9989e7b82f Remove unneeded casts now that Addr.fromstring can't be None (#10167)
Now that https://github.com/certbot/certbot/pull/10162 is in
2025-02-06 10:53:22 -08:00
ohemorange
aafe7ba2f9 Update to latest poetry-plugin-export to fix urllib3 multiple versions issue and unpin urllib3 (#10169)
We can use modern urllib3 now! They
[fixed](https://github.com/python-poetry/poetry-plugin-export/pull/286)
the poetry
[issue](https://github.com/python-poetry/poetry-plugin-export/issues/183)
and shipped it!

Since this PR updates the requirements file, it pulls in the new
`josepy` release, so I've silenced those warnings here. If I should do
that in a separate PR lmk.
2025-02-05 17:14:25 -08:00
Brad Warren
87e5dcbc83 update ocsp api (#10181)
this does the simple and more urgent fix described in
https://github.com/certbot/certbot/issues/10053. i created
https://github.com/certbot/certbot/issues/10180 to track fixing up our
tests to generally help prevent this kind of problem in the future
2025-02-05 14:08:14 -08:00
Brad Warren
2535a7bb29 fix mypy on 3.9 (#10179)
in
https://github.com/certbot/certbot/pull/10160/files#diff-f14c5058a01d9c9f8e0215ae6378c1d99fcfe2dd71d5cea207a7d610b31c149bR123
we used the nice & clean `|` syntax for unions but this caused tests to
fail for me locally where i was using python 3.9. this fixes that using
the same approach as was used in
https://github.com/certbot/certbot/pull/10178

i think we want this regardless, but by the same logic as
a00e343459,
i think we could consider deprecating & dropping python 3.9 support
early
2025-02-05 12:15:27 -08:00
ohemorange
e32f4fc5fb Allow http block inclusion at top-level nginx.conf (#10178)
Fixes #9928.

Thanks to @vanviethieuanh for tracking down the source of the issue!
2025-02-04 11:15:17 -08:00
ohemorange
b5f7fe179e Avoid trailing dot on link problem (#10173)
Fixes https://github.com/certbot/certbot/issues/9964.

Decided not to be fancy and just throw a newline in there.

```
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at:
https://letsencrypt.org/documents/LE-SA-v1.4-April-3-2024.pdf
You must agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: 
```
2025-02-03 08:50:18 -08:00
Alexis
2ae7f83e2a [REPO] Modify Stalebot Labels for Better Filters (#10171)
- Better labels upon an issue going stale will help triage better. There
other PRs with "needs update" that are manually put and therefore we
can't explicitly filter for stalebot.
- For management purposes, being able to view how many issues are
auto-closed helps as well.
2025-01-31 15:23:10 -08:00
ohemorange
935855b751 Enable strict mypy for certbot-ci/certbot_integration_tests (#10168)
Co-authored-by: Brad Warren <bmw@eff.org>
2025-01-31 02:32:27 +00:00
ohemorange
0dedef801a Run mypy with --strict on modules that are ready for it (#10166) 2025-01-30 23:11:31 +00:00
ohemorange
d5cb89ba13 [apache] Add type hints to apache test utils (to enable mypy --strict) (#10151)
We could also leave the `jose.JWKRSA` call as-is and add
`--implicit-reexport`, or explicitly export `JWKRSA` in `josepy`, but I
think just cleaning the calls up is nice.

```
$ mypy --strict certbot-apache/certbot_apache/_internal/tests/util.py
Success: no issues found in 1 source file
```
2025-01-29 15:10:31 -08:00
ohemorange
04f3072399 Ignore sublime project files (#10165) 2025-01-29 13:26:44 -08:00
Brad Warren
392467609f add python 3.13 support (#10164)
fixes https://github.com/certbot/certbot/issues/10045. this is based on
the PR that did this for 3.12 at
https://github.com/certbot/certbot/pull/9852

this PR also removes python 3.8 from our tox config which should have
been done as part of https://github.com/certbot/certbot/pull/10077
2025-01-29 12:53:56 -08:00
ohemorange
7661dbaf82 Enable strict typing in certbot-dns-google (#10160)
```
$ mypy --strict certbot-dns-google/certbot_dns_google
Success: no issues found in 5 source files
```


I can change the `setattr`s to `# type: ignore [method-assign,
unused-ignore]` if that's preferred.
2025-01-28 16:53:38 -08:00
ohemorange
014e554f70 Enable strict typing in certbot-dns-cloudflare (#10157)
```
$ mypy --strict certbot-dns-cloudflare/certbot_dns_cloudflare
Success: no issues found in 5 source files
```

If we do `type: ignore` but don't set `--strict`, mypy gets mad. Flake8
doesn't like this but luckily we don't use that here (yet?). The other
option is to add `# type: ignore [method-assign, unused-ignore]`; I can
change it to that if that's preferred.
2025-01-28 16:46:18 -08:00
ohemorange
f5bfe543ff Enable strict typing in certbot-dns-rfc2136 (#10159)
```
$ mypy --strict certbot-dns-rfc2136/certbot_dns_rfc2136
Success: no issues found in 5 source files
```

`dnspython` would be perfectly happy to accept a string once the
algorithm is passed through, but our `_RFC2136Client` object will only
accept `dns.name.Name` objects, so let's make it happy.
2025-01-28 16:43:28 -08:00
ohemorange
e8cc2df316 [nginx] Add type hints to nginx configurator for mypy --strict (#10156)
Decided that imports should be in ascii, not caseless, order. If we've
done otherwise elsewhere I'll change it.

The cast isn't the best but that's what we get for using a dict holding
various objects -- the thing marked by `vhost` is going to be a
virtualhost so 🤷

`re.findall` can
[return](https://docs.python.org/3/library/re.html#re.findall) either a
list of strings or a list of tuples of strings, depending what you
specify in the regex. In our case it's going to be a list of strings.
2025-01-28 16:42:08 -08:00
ohemorange
f94c981dfd [apache] Add type hints to apache obj and http_01 for mypy --strict (#10154)
```
$ mypy --strict certbot-apache/certbot_apache/_internal/http_01.py 
Success: no issues found in 1 source file
$ mypy --strict certbot-apache/certbot_apache/_internal/obj.py 
Success: no issues found in 1 source file
```

PEP 526 says to declare types of unpacked tuples beforehand:
https://peps.python.org/pep-0526/#global-and-local-variable-annotations.
Could have just declared it in apache, but improved the acme return type
while I was at it.

Once again, `typing.Pattern` is deprecated in favor of `re.Pattern` so
changing that while parametrizing the type
2025-01-28 16:33:12 -08:00
Brad Warren
f0f3cdad9c fixup fromstring return types (#10162)
in https://github.com/certbot/certbot/pull/9124 we had the problem of
certbot-nginx's `Addr.fromstring` method possibly returning None which
is not possible in the `Addr` method in the certbot base class or in
certbot-apache. we fixed this by telling mypy the common
`Addr.fromstring` method returns an `Optional[Addr]` (despite it
actually always returning an `Addr`) and then unnecessarily complicating
certbot-apache's code a bit. the need for extra complexity with this
approach is going even further in
https://github.com/certbot/certbot/pull/10151 where we have to use
`cast` to assure mypy that the type isn't actually `Optional`. i
personally don't like all this
2025-01-28 16:29:52 -08:00
ohemorange
6f46e1be15 Improve help output for default-None constants (#10149)
Fixes #10000.

To create this PR, I looked through `constants.py` for defaults set to
`None`. If the action for the cli flag was `store_true` and there wasn't
other custom manual default specification, I changed it to report
`False`, and added a comment in `constants.py`. Adding `(default:` in
the help text suppresses listing of the actual default (done by
`cli_utils.py:CustomHelpFormatter`). Also added a comment for `redirect`
which is described manually since I noticed it while I was going
through.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-01-28 23:41:02 +00:00
ohemorange
ec3330ee0c Enable strict typing in certbot-dns-digitalocean (#10158)
If we do `type: ignore` but don't set `--strict`, mypy gets mad. Flake8
doesn't like this but luckily we don't use that here (yet?). The other
option is to add `# type: ignore [method-assign, unused-ignore]`; I can
change it to that if that's preferred.

```
$ mypy --strict certbot-dns-digitalocean/certbot_dns_digitalocean
Success: no issues found in 5 source files
```
2025-01-28 11:04:08 -08:00
ohemorange
e657cc3a8d [apache] Add type hints to apache parser.py (to enable mypy --strict) (#10152)
```
$ mypy --strict certbot-apache/certbot_apache/_internal/parser.py 
Success: no issues found in 1 source file
```

`typing.Pattern` is deprecated in python 3.9 in favor of using
`re.Pattern` directly, and also wants to be subscripted with its type.

`python-augeas` types can be found in
a1e84a7e58/augeas/__init__.py
2025-01-28 10:54:11 -08:00
ohemorange
a46db66371 Enable strict typing in certbot-dns-route53 (#10161)
Using the `ignore` syntax this time!

```
$ mypy --strict certbot-dns-route53/certbot_dns_route53
Success: no issues found in 5 source files
```
2025-01-28 10:53:27 -08:00
ohemorange
d98edd97ad Preserve IP addresses when adding ssl listen directives in nginx server blocks (#10145)
Fixes #10011

When we take a server block with no ssl addresses in and and enable ssl,
if it has any listens on the http port, use those host addresses when
creating a directive to listen on ssl. Addresses with no port and on
other ports will be ignored.

---------

Co-authored-by: Will Greenberg <willg@eff.org>
2025-01-28 10:52:06 -08:00
ohemorange
70ba4f2438 Run directory hooks during commands other than renew (#10146)
Partially fixes #9869. Fixes #9978.
2025-01-28 10:20:17 -08:00
ohemorange
9d049723c2 Enable mypy strict equality checking (#10150)
Fixes one impossible check, but that's it! Closes
https://github.com/certbot/certbot/issues/5649.
2025-01-27 14:55:57 -08:00
ohemorange
60b88a3b83 [apache] Add type hints to apache dualparser.py (to enable mypy --strict) (#10153)
`typing.Type` is deprecated in favor of built-in `type`. In strict
mode,`find_ancestors` needs to be more specific about what it actually
returns, due to covariance and generics and such.

```
$ mypy --strict certbot-apache/certbot_apache/_internal/dualparser.py 
Success: no issues found in 1 source file
```
2025-01-27 14:54:40 -08:00
ohemorange
e0e81a97f2 Add new style of issue template (#10143)
Pasted from the old one. Maybe we can just rename it but this is what
github's web interface led me to create.

I want to make sure that they at least create the template so that they
read it. If they then choose to ignore it that's fine, but it should
always pop up. Basically I want to keep the old behavior. Open to
alternatives.

We could also play around with the new issue forms:
https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms

Or label this one the "bug" template, and create a second one that is
blank but has the header text paragraph. I haven't seen a way to make
something appear in all templates, including the "blank" one, other than
just turning off blank templates.
2025-01-22 16:27:03 -08:00
Alex Gaynor
e050fe91a3 Allow using cryptography certs and keys in the standalone plugin (#10133)
Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-01-16 22:16:45 +00:00
Will Greenberg
ed972a130f Add gen_ss_cert deprecation to changelog (#10142)
Forgot a changelog note for this
2025-01-16 19:23:41 +00:00
Brad Warren
b411cddc8a fix private key format (#10134)
fixes https://github.com/certbot/certbot/issues/10131

this seems simple enough, but i also requested alex's review as a quick
sanity check if he doesn't mind providing one

i've verified this fixes the problem and that PKCS#8 was used in certbot
3.0.1
2025-01-16 11:04:55 -08:00
Brad Warren
40f0b91512 Fix readlink on windows (#10140)
fixes https://github.com/certbot/certbot/issues/10135

i did this by first reverting the bad changes from
https://github.com/certbot/certbot/pull/10077 and then fixing up
comments/documentation

it seems that the code comments
[here](https://github.com/certbot/certbot/blob/v3.0.1/certbot/certbot/compat/filesystem.py#L410-L411)
and in the unit tests that os.readlink always returns the extended form
in python 3.8+ was incorrect

significant credit for this work goes to
https://github.com/certbot/certbot/pull/10136 and
https://github.com/mbs-c for identifying the problem in the code here
2025-01-16 10:09:44 -08:00
Will Greenberg
7e87acee3c acme: deprecate gen_ss_cert in favor of make_self_signed_cert (#10097)
gen_ss_cert()'s signature contains deprecated pyOpenSSL API, so here we
deprecate it in favor of a new function that does the same thing, except
with only cryptography types: make_self_signed_cert
2025-01-16 11:38:10 +09:00
ohemorange
680729655e Honor --reuse-key when --allow-subset-of-names is set (#10138)
Fixes #10109. We were not previously doing so, and that was an
oversight. Adds regression tests in unit tests and integration tests.

Integration regression test failing without the fix is here:
https://dev.azure.com/certbot/certbot/_build/results?buildId=8463&view=logs&j=fca58cec-e7ce-563a-f36f-5c233894d750&t=8c19ffdb-5db1-573e-d81e-907ba1b3cfee
2025-01-16 01:41:57 +00:00
Brad Warren
94dcf25f6e notify about PRs from forks (#10101) 2025-01-15 17:19:25 -08:00
Brad Warren
96c4bcd9a8 double failing timeout (#10141)
our macOS tests recently started failing (more?) often hitting the
timeout modified in this PR. an example of this can be seen at
https://dev.azure.com/certbot/certbot/_build/results?buildId=8459&view=logs&j=1ae398a1-7dc9-5ade-0f59-912b32975b53&t=0ec28dfb-4593-5e04-05b6-bb502ec0a017&s=96ac2280-8cb4-5df5-99de-dd2da759617d.
this has affected at least
https://github.com/certbot/certbot/pull/10138,
https://github.com/certbot/certbot/pull/10130, and
https://github.com/certbot/certbot/pull/10136

i'm not sure whether the failing tests are actually getting stuck or
just hitting the timeout i bumped here, but i suspect it may be the
latter. our tests on macOS in CI are unreasonably slow for some reason.
i do not have this problem on my macbook locally

this PR does the simple/lazy thing of bumping the timeout which may help
avoid the now regularly occuring problem and/or help us get more
certainty whether the tests are actually getting stuck or not
2025-01-15 13:51:02 -08:00
Brad Warren
a00e343459 update policy on minimum dependency versions (#10130)
fixes #10105

this PR updates our minimally required cryptography and pyopenssl
versions as well as updating our policy for choosing minimum dependency
versions generally

before this PR, we were trying to keep compatibility with packages
available in EPEL 9 using the python 3 version available in RHEL 9.
after the discussion in #10105 we decided not to do this anymore
because:

* EPEL 9 may not want to update to certbot 3.0+ anyway because of our
backwards incompatible changes from certbot 2.x
* RHEL 9 appstream repos now contain newer versions of many of our
dependencies for newer versions of python
* alternate installation methods for RHEL 9 based users including our
snaps and pip are available

on a call we then discussed what distro repositories we should track
instead of EPEL 9. our docs previously said Debian sid/unstable, but we
felt this as unnecessary because Debian sid can and does change very
quickly. if we wanted a new dependency there, Debian could probably
accommodate it

we also considered RHEL 10 + EPEL 10, however, these repos are not even
stable yet and certbot and many of its dependencies are not yet packaged
there at all

for these reasons, plus many of the reasons we decided to upgrade past
EPEL 9 with the default python 3 version there, we decided that at least
for now, we will remove any linux distro considerations when choosing
minimal dependency versions of certbot

as i wrote in the contributing docs, we may choose to reconsider this
plan if there are requests for us to do so, but based on the information
above, we are not sure this will ever even happen and removing this
constraint significantly simplifies development of certbot
2025-01-15 09:47:40 -08:00
Alexis
86694397a6 Update notify_weekly.yaml (#10118)
Making the weekly message a little more useful.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2025-01-13 07:46:12 -08:00
ohemorange
b18c074088 Allow non-breaking spaces in nginx config files (#10126)
Fixes @josevavia's issue in #9942.
2025-01-10 15:25:05 -08:00
Brad Warren
f59a639ec4 improve repin experience on macOS (#10128)
this hopefully at least helps the problem hit at
https://github.com/certbot/certbot/pull/10126#discussion_r1909714276

i took this approach because in my experience, linux specific shell
commands have crept into our scripts repeatedly over the years so i
think just having macOS devs use the linux versions is much more
reliable. it's what i've personally been doing for years now
2025-01-10 12:54:54 -08:00
Brad Warren
5411e4c86a silence poetry warning (#10127)
when reviewing https://github.com/certbot/certbot/pull/10126 and running
`tools/pinning/oldest/repin.sh` using a freshly created dev environment,
i was repeatedly given the message

> The "poetry.dev-dependencies" section is deprecated and will be
removed in a future version. Use "poetry.group.dev.dependencies"
instead.

i believe this section was generated automatically by poetry's tooling
when it created the initial boilerplate file for us, but we don't use
it, so i just deleted the section which makes the warnings disappear
2025-01-10 12:52:24 -08:00
Brad Warren
0425b87b78 Merge pull request #10123 from certbot/candidate-3.1.0
Release Certbot 3.1.0
2025-01-07 15:53:09 -08:00
Erica Portnoy
1de966d637 Bump version to 3.2.0 2025-01-07 12:54:01 -08:00
Erica Portnoy
ba2e4aecb7 Add contents to certbot/CHANGELOG.md for next version 2025-01-07 12:54:01 -08:00
Erica Portnoy
7d2b1996d9 Remove built packages from git 2025-01-07 12:54:01 -08:00
Erica Portnoy
dcd52b0711 Release 3.1.0 2025-01-07 12:54:00 -08:00
Erica Portnoy
8074858620 Update changelog for 3.1.0 release 2025-01-07 12:53:36 -08:00
Brad Warren
d3d293299a minor acme doc & comment fixes (#10122)
this fixes two tiny things i noticed when reviewing
https://github.com/certbot/certbot/pull/10120

1. not all of our `acme` modules were generating API documentation
2. the deleted commend about a "type ignore" should have been deleted in
https://github.com/certbot/certbot/pull/9197 but will and i missed it
2025-01-07 18:17:00 +00:00
Alex Gaynor
9148acd332 Migrate verify_cert to take cryptography certificates (#10120) 2025-01-07 17:46:31 +00:00
Brad Warren
9f9a1df85e upgrade pylint (#10121)
we need this for https://github.com/certbot/certbot/issues/10045
2025-01-07 09:43:14 -08:00
ohemorange
985457e57b Add docstring for acme.crypto_util.get_names_from_subject_and_extensions (#10115)
It was my oversight to not request this when this function was made
public in https://github.com/certbot/certbot/pull/10111.
2025-01-06 14:37:29 -08:00
Alex Gaynor
4004589cbf Migrate certbot-compatibility-test to cryptography (as much as possible (#10117)
Also fixed a typing error.
2025-01-06 13:39:16 -08:00
Alex Gaynor
8f7c3756b3 Migrate get_serial_from_cert and valid_privkey to cryptography (#10116) 2025-01-06 13:34:57 -08:00
Alex Gaynor
6ea5da51e0 Simplify typing for a local variable (#10113)
`_DefaultCertSelection` _is_ a `Callable` of the appropriate signature.

Also fixed a mypy error I see locally, `TOKEN_SIZE` should be an
integer.
2025-01-06 13:18:28 -08:00
Alex Gaynor
1ac05ae891 Remove _pyopenssl_cert_or_req_san_ip which is unused, and migrate _pyopenssl_cert_or_req_all_names to cryptography (#10112)
Unfortunately the other helpers from this family are directly called by
(historic) versions of certbot, and so cannot be easily removed.
2025-01-06 12:46:23 -08:00
Manuel Baldassarri
a441debdaa Add Nginx Unit plugin to documentation (#10110)
## Pull Request Checklist

- [ ] The Certbot team has recently expressed interest in reviewing a PR
for this. If not, this PR may be closed due our limited resources and
need to prioritize how we spend them.
- [ ] If the change being made is to a [distributed
component](https://certbot.eff.org/docs/contributing.html#code-components-and-layout),
edit the `main` section of `certbot/CHANGELOG.md` to include a
description of the change being made.
- [x] Add or update any documentation as needed to support the changes
in this PR.
- [ ] Include your name in `AUTHORS.md` if you like.
2025-01-06 12:37:31 -08:00
Alex Gaynor
5dd898f56b Move _get_names_from_subject_and_extensions to acme's crypto_utils (#10111)
Make use of it in more places
2025-01-03 16:21:31 -08:00
Alex Gaynor
a1fce6b398 Convert notBefore and notAfter to use cryptography's APIs (#10103) 2025-01-03 13:50:33 -08:00
Will Greenberg
635d9c3ec3 Merge pull request #10090 from alex/san-cryptography
Convert several SAN handling functions to use cryptography's APIs
2025-01-02 11:42:49 -08:00
Alex Gaynor
0f36d0c1ba Convert several SAN handling functions to use cryptography's APIs 2025-01-02 14:25:17 -05:00
Alex Gaynor
619da0432a Introduce a Format enum to help us migrate away from pyOpenSSL's constants
Begin using it in `dump_pyopenssl_chain`
2024-12-21 11:06:43 -05:00
Alex Gaynor
314838eb81 Convert some certbot-ci utilities to use cryptography's APIs (#10102) 2024-12-19 19:37:09 +00:00
Will Greenberg
25a1933e01 snap: disable FIPS detection (#10067)
This is needed because the Python + OpenSSL bundled in core24 don't
include an OpenSSL FIPS provider, which causes crashes on host systems
with OpenSSL 1.1.1f (e.g. Ubuntu Pro 20.04). For some reason, core24's
OpenSSL also looks in a non-standard location for the provider, which
also causes crashes on systems with OpenSSL 3.x (e.g. RHEL 9). If you
need FIPS functionality in certbot, install via pip.
2024-12-19 10:55:53 -08:00
Alex Gaynor
0f500e8010 Convert crypto_util_test.py to use cryptography's APIs (#10100) 2024-12-19 10:24:16 -08:00
Alex Gaynor
1afae838bb Convert validate_key_csr to use cryptography's APIs (#10099) 2024-12-19 07:11:47 -08:00
Alex Gaynor
724be8848a Convert http01_example.py to use cryptography's APIs (#10098)
Co-authored-by: ohemorange <ebportnoy@gmail.com>
2024-12-18 23:54:44 +00:00
Alex Gaynor
06ea141ca9 Convert make_key to use cryptography's APIs (#10091) 2024-12-18 15:10:20 -08:00
Mads Jensen
23245c07b2 Replace assert False with pytest.fail (#10094)
This seems to be better style. The assert False statements are
automatically removed by Python when running in the optimized mode,
which could hide test failures.

## Pull Request Checklist

- [ ] The Certbot team has recently expressed interest in reviewing a PR
for this. If not, this PR may be closed due our limited resources and
need to prioritize how we spend them.
- [ ] If the change being made is to a [distributed
component](https://certbot.eff.org/docs/contributing.html#code-components-and-layout),
edit the `main` section of `certbot/CHANGELOG.md` to include a
description of the change being made.
- [ ] Add or update any documentation as needed to support the changes
in this PR.
- [ ] Include your name in `AUTHORS.md` if you like.

Co-authored-by: Mads Jensen <atombrella@users.noreply.github.com>
2024-12-18 14:44:05 -08:00
Will Greenberg
2d1d1cd534 Merge pull request #10089 from jvanasco/fix-migrate_to_cryptography
switch `cert_and_chain_from_fullchain` to cryptography APIs
2024-12-17 14:37:02 -08:00
Will Greenberg
5240e3cbf2 Merge pull request #10085 from atombrella/pyupgrade/up020_open_alias
Replace io.open with the built-in.
2024-12-17 14:35:08 -08:00
Will Greenberg
5fca4a14ab Merge pull request #10084 from atombrella/pyupgrade/up024_oserror
Replace aliased OSError.
2024-12-17 14:34:10 -08:00
Alex Gaynor
9be070414f Convert valid_csr and csr_matches_pubkey to use cryptography's APIs (#10088) 2024-12-17 09:22:22 -08:00
jonathan vanasco
761c268934 missed import level in port 2024-12-16 15:42:33 -05:00
jonathan vanasco
1fa110c9d7 added to authors 2024-12-16 15:30:42 -05:00
jonathan vanasco
9d1fccf53a switch cert_and_chain_from_fullchain to cryptography 2024-12-16 15:24:38 -05:00
Alex Gaynor
b16c64a05b Convert make_csr to use cryptography instead of pyOpenSSL (#10086)
These pyOpenSSL APIs are deprecated and we'd like to remove them.
2024-12-16 11:00:52 -08:00
Mads Jensen
88932da859 lint 2024-12-14 11:33:59 +01:00
Mads Jensen
8a69b2f1d9 Replace io.open with the built-in.
As of Python 3, io.open is an alias for the built-in open function.
2024-12-14 11:29:40 +01:00
Mads Jensen
57b5942fc3 Replace aliased OSError.
As of Python 3.3, various errors were merged into OSError.
https://docs.python.org/3/library/exceptions.html#OSError
2024-12-14 11:15:26 +01:00
Brad Warren
0f0000298b improve repinning (#10082)
this PR hopefully improves two things that i hit while working on #10035

1) i found that repinning our dependencies took ~6 minutes!

digging into it a bit, the biggest culprit i found was the inclusion of
`--no-cache-dir` here which seemed to cause poetry to redownload the
same packages over and over in a single run. this comes from
https://github.com/certbot/certbot/pull/9453 which fixed a problem i
(but not alex) was having with a major performance penalty. i removed
the flag here and instead included instructions on clearing poetry's
caches in case anyone ever hits this in the future. with this change,
the script now takes about 40 seconds on my laptop

2) every run of this script ended with the output:

    ```
Warning: poetry-plugin-export will not be installed by default in a
future version of Poetry.
In order to avoid a breaking change and make your automation
forward-compatible, please install poetry-plugin-export.
explicitly. See https://python-poetry.org/docs/plugins/#using-plugins
for details on how to install a plugin.
To disable this warning run 'poetry config warnings.export false'.
    ```

setting `POETRY_WARNINGS_EXPORT=false` fixes this which i believe is
safe to do because of
2c8609464c/certbot/setup.py (L53-L56)
2024-12-12 12:00:11 -08:00
Will Greenberg
c39fbe388c Merge pull request #10081 from certbot/no-windows-installer
remove the windows installer
2024-12-12 10:40:44 -08:00
Brad Warren
fc07f5f935 update pinnings 2024-12-12 08:57:10 -08:00
Brad Warren
9c8cdd05da remove the windows installer 2024-12-12 08:57:10 -08:00
Brad Warren
2c8609464c fix upgrading pyopenssl (#10080)
i hit this when working on https://github.com/certbot/certbot/pull/10076
where i found that updating all our dependencies no longer worked
because of new deprecations in pyopenssl. this pr fixes that
2024-12-11 15:15:55 -08:00
Brad Warren
7a48c235a9 remove importlib_resources (#10076)
this is part of my work on
https://github.com/certbot/certbot/issues/10035 based on erica's comment
at
https://github.com/certbot/certbot/issues/10035#issuecomment-2452212686
2024-12-06 12:37:17 -08:00
Mads Jensen
3f9387bd15 Fix F541 and E711 (#10071)
There are a quite a lot of imports that are unused.

F541 is Unnecessary f-interpolation without placeholders
E711 is incorrect use of == for boolean and None comparisons

## Pull Request Checklist

- [x] The Certbot team has recently expressed interest in reviewing a PR
for this. If not, this PR may be closed due our limited resources and
need to prioritize how we spend them.
- [ ] If the change being made is to a [distributed
component](https://certbot.eff.org/docs/contributing.html#code-components-and-layout),
edit the `main` section of `certbot/CHANGELOG.md` to include a
description of the change being made.
- [ ] Add or update any documentation as needed to support the changes
in this PR.
- [x] Include your name in `AUTHORS.md` if you like.

---------

Co-authored-by: Mads Jensen <atombrella@users.noreply.github.com>
2024-12-05 11:33:09 -08:00
Brad Warren
087cb4d1f4 remove python 3.8 support (#10077)
fixes https://github.com/certbot/certbot/issues/10035. you can compare
this to the PR that did this for python 3.7 at
https://github.com/certbot/certbot/pull/9792

i agree with erica's comment at
https://github.com/certbot/certbot/issues/10035#issuecomment-2452212686,
but felt this PR was already getting pretty large so i did that in a
second PR at https://github.com/certbot/certbot/pull/10076
2024-12-04 14:55:20 -08:00
Brad Warren
bcbc3dd484 Merge pull request #10075 from certbot/test-no-setuptools
remove setuptools dependency
2024-12-03 13:58:03 -08:00
Brad Warren
89737718c1 update documentation and pinnings 2024-12-03 11:25:02 -08:00
Harlan Lieberman-Berg
b0e389aad7 Drop setuptools as a runtime dependency
Because of the change from using setuptools.pkg_resources to using
importlib, we no longer need a runtime dependency on setuptools. It is
still required, however, for running setup.py.
2024-12-03 11:17:27 -08:00
Brad Warren
9f5451d16b update intersphinx mapping (#10074)
this hopefully fixes our nightly failures

readthedocs seems to redirect users to its .io site so
https://acme-python.readthedocs.org/en/latest/objects.inv is supposed to
redirect people to
https://acme-python.readthedocs.io/en/latest/objects.inv, but that
doesn't always seem to work and instead [sometimes serves a
403](https://dev.azure.com/certbot/certbot/_build/results?buildId=8237&view=logs&j=d74e04fe-9740-597d-e9fa-1d0400037dfd&t=dde413a4-f24c-59a0-9684-e33d79f9aa02&l=800)

removing the need for this redirect seems to fix things based on some
quick testing and certainly shouldn't hurt
2024-12-03 11:16:13 -08:00
Will Greenberg
5ada20cb74 Merge pull request #10068 from certbot/test-include-ssl-provider
stage SSL lib and set OPENSSL_MODULES
2024-11-22 13:22:09 -08:00
Brad Warren
ba256adcdb add changelog entry 2024-11-22 11:23:00 -08:00
Brad Warren
94adff7247 stage ssl lib and set OPENSSL_MODULES 2024-11-22 11:00:56 -08:00
Will Greenberg
06d6231d6d Merge pull request #10060 from certbot/candidate-3.0.1
update main from 3.0.1 release
2024-11-18 13:38:23 -08:00
Brad Warren
61da18cc47 Merge branch 'main' into candidate-3.0.1 2024-11-18 13:25:09 -08:00
Brad Warren
7ab421233e remove old python macos cover tests (#10063)
Co-authored-by: Will Greenberg <willg@eff.org>
2024-11-18 19:18:46 +00:00
Brad Warren
59f32c9d11 update docker image (#10057) 2024-11-14 13:37:08 -08:00
Brad Warren
2b57c5f03c Bump version to 3.1.0 2024-11-14 09:22:05 -08:00
Brad Warren
8f75af1e84 Add contents to certbot/CHANGELOG.md for next version 2024-11-14 09:22:05 -08:00
Brad Warren
3c9b936168 Remove built packages from git 2024-11-14 09:22:04 -08:00
Brad Warren
93294fc989 Release 3.0.1 2024-11-14 09:22:03 -08:00
Brad Warren
58a07ddd79 Update changelog for 3.0.1 release 2024-11-14 09:21:24 -08:00
Will Greenberg
933c1703b6 Remove built packages from git
(cherry picked from commit 990352e371)
2024-11-14 09:21:04 -08:00
Brad Warren
a44d739dd7 silence warning and add test (#10054) (#10058)
fixes https://github.com/certbot/certbot/issues/9967

actually fixing the underlying issue is being tracked by https://github.com/certbot/certbot/issues/10053

in addition to the unit test, i tested this manually. if you obtain any cert and run `certbot renew` in an up-to-date dev environment, there's 3 warnings when on `main` and none on this branch

(cherry picked from commit aa6ea3b513)
2024-11-14 09:07:06 -08:00
Brad Warren
58374867c8 Merge pull request #10056 from certbot/prep-for-3.0.1
prep for 3.0.1
2024-11-13 20:40:33 -08:00
Brad Warren
aa6ea3b513 silence warning and add test (#10054)
fixes https://github.com/certbot/certbot/issues/9967

actually fixing the underlying issue is being tracked by https://github.com/certbot/certbot/issues/10053

in addition to the unit test, i tested this manually. if you obtain any cert and run `certbot renew` in an up-to-date dev environment, there's 3 warnings when on `main` and none on this branch
2024-11-13 20:39:50 -08:00
ohemorange
a25ef72c4f escape backslashes in format string in finish_release.py (#10043)
(cherry picked from commit 38fc7fcc48)
2024-11-13 10:34:32 -08:00
ohemorange
396b6cce02 Fix release script main replacement (#10042)
* restore incorrect regex changes to CHANGELOG.md

* Update _release.sh regex to switch only first instance of main in changelog

(cherry picked from commit 0e225dcba2)
2024-11-13 10:34:26 -08:00
ohemorange
38fc7fcc48 escape backslashes in format string in finish_release.py (#10043) 2024-11-05 23:42:59 +00:00
ohemorange
0e225dcba2 Fix release script main replacement (#10042)
* restore incorrect regex changes to CHANGELOG.md

* Update _release.sh regex to switch only first instance of main in changelog
2024-11-05 14:55:23 -08:00
Brad Warren
4ff5719a65 Merge pull request #10039 from certbot/candidate-3.0.0
Candidate 3.0.0
2024-11-05 12:52:47 -08:00
Will Greenberg
798a61622c Bump version to 3.1.0 2024-11-05 10:55:20 -08:00
Will Greenberg
b20d01e032 Add contents to certbot/CHANGELOG.md for next version 2024-11-05 10:55:20 -08:00
Will Greenberg
990352e371 Remove built packages from git 2024-11-05 10:55:20 -08:00
Will Greenberg
c5a5d6f9a1 Release 3.0.0 2024-11-05 10:55:19 -08:00
Will Greenberg
d4850399c5 Update changelog for 3.0.0 release 2024-11-05 10:54:15 -08:00
Brad Warren
c4be440853 update dependencies (#10036)
this fixes the current [dependabot alert](https://github.com/certbot/certbot/security/dependabot)
2024-11-01 10:04:10 -07:00
Will Greenberg
165c3e32b0 snap: fix generated postrefreshhook script (#9994)
Fixes #9990

If the python oneliner to check certbot's version succeeded, exit_code
would never be set, which would cause our exit_code check to fail. Use
a check that handles unset exit_code
2024-11-01 08:03:57 -07:00
Will Greenberg
2660a2017b Certbot 3.0 outdated plugin warning (#10031)
* Print an error if outdated snap plugins detected

With Certbot 3.0 comes a bump to Python 3.12, so if any snap plugins
are still located in a python3.8 directory, print an error informing
the user.

* tox nitpicks

* personal nitpick

* review fixups

* Update certbot/certbot/_internal/snap_config.py

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* Use LOGGER.warn instead of error

* warn-->warning

* warn-->warning

---------

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2024-11-01 07:52:48 -07:00
ohemorange
6a6544fd90 Update azure standard tests to use macOS-15 and python3.12 (#10032)
macOS-12 is [being deprecated](https://github.com/actions/runner-images/issues/10721) on Azure, so update to the latest available version.

* Upgrade macOS azure tests to use macOS-15

* switch standard azure tests to using python 3.12

* restore mac and linux cover tests to oldest and newest version style, and add explanation that that's what we're doing.
2024-11-01 07:34:16 -07:00
Brad Warren
320cf92944 depecate py38 support (#10034) 2024-10-31 15:48:57 -07:00
Brad Warren
3078c2f3db remove reference to "good first issue" label (#10018) 2024-10-25 11:43:44 -07:00
Brad Warren
c54f99e35b mattermost/action-mattermost-notify still uses master (#10021) 2024-10-04 14:08:25 -07:00
Brad Warren
c81dbb2582 Make Docker builds more verbose (#10022)
* use consistent casing to fix warnings

* don't truncate docker build logs

* make docker build output verbose
2024-10-04 13:54:56 -07:00
Will Greenberg
742f97e11a docs: fix logo url (#10019) 2024-09-26 15:10:06 -07:00
Will Greenberg
84c8dbc52a Migrate master branch to main
We're a few years behind the curve on this one, but using "master" as a
programming term is a callous practice that explicitly uses the
historical institution of slavery as a cheap, racist metaphor. Switch to
using "main", as it's the new default in git and GitHub.
2024-09-26 14:48:10 -07:00
Brad Warren
4b51e3004c remove certbot_dns_route53.authenticator (#10014)
This is another and very minor piece of https://github.com/certbot/certbot/issues/9988.

We've done nothing to warn/migrate installations using the old `certbot-route53:auth` plugin name and installations like that still exist according to https://gist.github.com/bmw/aceb69020dceee50ba827ec17b22e08a. We could try to warn/migrate these users for a future release or decide it's niche enough that we'll just let it break, but I think it's easy enough to keep the simple shim around.

This PR just moves the code raising a deprecation warning into `_internal` as part of cleaning up all deprecation warnings I found in https://github.com/certbot/certbot/issues/9988. I manually tested this with a Certbot config using the `certbot-route53:auth` plugin name and renewal worked just fine.
2024-09-18 14:07:35 -07:00
ohemorange
018800c5cc specify channel in weekly mm message (#10013) 2024-09-16 12:31:52 -07:00
Brad Warren
2eb4154169 allow manually triggering GH actions (#10015) 2024-09-16 12:16:51 -07:00
Brad Warren
becc2c3fee Remove deprecated --dns-route53-propagation-seconds (#10010)
* remove dns-route53-prop-secs

* document design difference
2024-09-13 12:14:49 -07:00
ldlb
cb5382d4d5 Remove deprecated features:--manual-public-ip-logging-ok (#9991)
* Remove parameter '--manual-public-ip-logging-ok'

* Update changelog with removal of '--manual-public-ip-logging-ok' flag
2024-09-12 07:21:55 -07:00
ohemorange
6975e32998 Fix weekly mattermost notifier (#10009) 2024-09-11 11:11:47 -07:00
Brad Warren
62962357c5 add parenthesis (#10008) 2024-09-10 13:06:48 -07:00
ohemorange
343b540970 Use new mattermost action workflow (#10007) 2024-09-10 12:53:21 -07:00
ohemorange
089b7efacd Update syntax for mattermost webhooks (#10006) 2024-09-10 12:16:53 -07:00
Brad Warren
1584b0b58c add macos qol suggestions (#9995) 2024-09-09 12:34:00 -07:00
Brad Warren
141b15077c Update changelog for 3.0 and remove update_symlinks and {csr,key}_dir (#10004)
* update changelog to 3.0

we did a similar thing in https://github.com/certbot/certbot/pull/9461

* remove update_symlinks

* remove {csr,key}_dir
2024-09-09 12:31:25 -07:00
Brad Warren
ee2c4844b9 fix centos9 test (#9999) 2024-09-05 16:14:10 -07:00
Shubham Sharma
181813b9b2 add mijn.host (#10002) 2024-09-05 08:56:03 -07:00
Alexandre Detiste
43d0652b0d remove six leftovers (#9996) 2024-08-30 11:38:44 -07:00
Adrien Ferrand
80e68bec26 Update dependencies (27-08-2024) (#9993)
Update dependencies & proactively defends against major bump to Josepy 2+

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2024-08-28 07:22:22 -07:00
Brad Warren
7b2b2b1685 switch from gpg2 to gpg (#9985)
The `gnupg` package from Homebrew only installs a `gpg` binary, not a `gpg2` binary. I had previously worked around this by manually creating an alias, but I think we can do better.

GPG version 1 is ancient and [hasn't seen a release since 2006](https://gnupg.org/download/release_notes.html). Additionally, `gpg` has referred to GPG 2 in Ubuntu since at least 20.04 which is the oldest non-EOL'd version as of writing this so I think this change is safe to make.
2024-08-19 15:24:39 -07:00
Will Greenberg
c3c587001f Update python version to 3.12 and base to core24 in snaps (#9983)
Fixes #9872, originally merged in #9956.

To upgrade to python3.12 as 3.8 is reaching EOL, we need to upgrade the core snap that certbot is based on. The latest version is core24, so we're going with that for longevity. We will want to notify third party snaps to make changes as well. They can release their snaps to a version higher than certbot's, and their users will not be upgraded until the matching (or greater) version of certbot is released. They should do this as otherwise including these changes will break their plugins.

Key documents for this migration are https://snapcraft.io/docs/migrate-core22 and https://snapcraft.io/docs/migrate-core24. The discussion at https://forum.snapcraft.io/t/upgrading-classic-snap-to-core24-using-snapcraft-8-3-causes-python-3-12-errors-at-runtime/ is also relevant to understanding some changes, which may become unnecessary in future versions of snapcraft.


* Migrate primary certbot snap to core24 and python 3.12

* Migrate plugin snaps to core24 and python 3.12

* Migrate to core24 in build_remote

* Run snap tests using python 3.12

* Unstage pyvenv.cfg and set PYTHONPATH

---------

Co-authored-by: Erica Portnoy <ebportnoy@gmail.com>
Co-authored-by: Erica Portnoy <erica@eff.org>
2024-08-08 16:24:11 -07:00
Will Greenberg
281b724996 clarify docs (#9984)
Authored-by: Brad Warren <bmw@eff.org>
2024-08-08 16:16:28 -07:00
Will Greenberg
3d5714f499 dns_server: update BIND9 docker image (#9973)
The 9.16 image isn't published anymore
2024-07-30 22:13:48 +00:00
Will Greenberg
ba9f1939ab Merge pull request #9963 from certbot/test-no-centos7
remove centos7 test
2024-07-03 11:14:07 -07:00
Brad Warren
481c8c0600 remove centos7 test 2024-07-03 09:48:55 -07:00
OmniTroid
35b177a1a0 seperate->separate (#9954) 2024-06-21 06:35:42 -07:00
Will Greenberg
95976762ac certbot-compatibility-test: fix breaking tests (#9955)
Recently our test environments were upgraded to use Docker 26, which
enabled ipv6 loopback by default in containers. This caused tests to
start failing due to an nginx test config which was the sole listener
for ipv6.

This simply removes that ipv6 listen directive in the config, and the
archived version we use for testing.
2024-06-20 11:37:28 -07:00
Will Greenberg
bf64e7f4e4 Merge pull request #9953 from certbot/candidate-2.11.0
Candidate 2.11.0
2024-06-05 20:13:22 -07:00
Will Greenberg
9213154e44 Bump version to 2.12.0 2024-06-05 14:34:41 -07:00
Will Greenberg
810d50eb3d Add contents to certbot/CHANGELOG.md for next version 2024-06-05 14:34:41 -07:00
Will Greenberg
99a4129cd4 Remove built packages from git 2024-06-05 14:34:41 -07:00
Will Greenberg
8db8fcf26c Release 2.11.0 2024-06-05 14:34:40 -07:00
Will Greenberg
6d8fec7760 Update changelog for 2.11.0 release 2024-06-05 14:34:02 -07:00
Will Greenberg
4f3af45f5c Merge pull request #9952 from certbot/test-snap-config-nits
suggest snap_config nits
2024-06-05 10:33:26 -07:00
Brad Warren
8ebd8ea9fb suggest snap_config nits 2024-06-04 14:32:34 -07:00
Brad Warren
83d8fbbd75 Merge pull request #9950 from certbot/test-update-deps
update dependencies
2024-06-04 12:58:38 -07:00
Will Greenberg
0c49ab462f snap_config: oops kwargs are important i guess 2024-06-04 10:37:28 -07:00
Will Greenberg
35091d878f snap_config: switch to newer HttpAdapter interface 2024-06-03 18:13:31 -07:00
Brad Warren
c31f53a225 run tools/pinning/current/repin.sh 2024-05-31 10:10:46 -07:00
Brad Warren
d2a13c55f2 pin back mypy (#9939)
while working on https://github.com/certbot/certbot/issues/9938, i updated our dependencies which updated mypy introducing new errors that mypy wanted me to fix. i think this makes the regularly necessary process of updating our dependencies too tedious and we should instead pin our linters that do this to a specific version and update them manually as desired. we already do this with pylint in the lines above my changes in this PR for the same reason
2024-05-30 11:21:32 -07:00
Will Greenberg
de1ce7340f Merge pull request #9937 from ionos-cloud/docs_add_ionos_certbot_plugin
add IONOS Cloud DNS plugin to the documentation
2024-05-23 10:37:17 -07:00
Will Greenberg
929f9e944f Merge pull request #9944 from lukhnos/maintain-checklist-order
Ensure _scrub_checklist_input honors indices order (#9943)
2024-05-22 14:55:40 -07:00
Lukhnos Liu
6c422774d5 Ensure _scrub_checklist_input honors indices order (#9943)
This fixes a bug where, when a user requests a cert interactively, the
CSR's SANs are not listed in the order that the user has in mind. This
is because, during the input validation, the _scrub_checklist_input
method does not produce a list of tags (which represents the domain
names the user has requested a cert for) in the order of in the given
indices. As a result, the CN of the resulting cert, as well as the
directory name used to store the certs, may not always be what the user
has expected, which should be the first item chosen from the interactive
prompt.
2024-05-22 15:50:02 -04:00
Brad Warren
443ec2200f pin back cloudflare (#9940)
* pin back cloudflare

* update readme
2024-05-16 09:18:21 -07:00
zak905
38cbeb560c add IONOS Cloud DNS plugin to the documentation 2024-05-07 12:08:39 +02:00
Will Greenberg
873f979a25 Replace boulder tests with pebble (#9918)
Pebble 2.5.1 supports OCSP stapling, so we can finally replace all boulder tests/harnesses with the much simpler pebble setup.

Closes #9898

* Remove unused `--acme-server` argument

Since this argument is never set and always defaults to 'pebble', just
remove it to simplify assumptions about which test server's being used.

* Remove boulder option from integration tests

Now that pebble supports all of our test cases, we can move off of
the much more complicated boulder test harness.

* pebble_artifacts: bump to latest pebble release

* pebble_artifacts: fix download path

* certbot-ci: unzip pebble assets

* CI: rip out windows tests/jobs

* tox.ini: rm outdated Windows comment

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* ci: rm redundant integration test

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* acme_server: raise error if proxy and http-01 port are both set

* acme_server: rm vestigial preterimate commands stuff

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2024-05-02 12:24:00 -07:00
Will Greenberg
2a41402f2a Merge pull request #9919 from certbot/unpin-poetry-tox
Unpin poetry and use tox >= v4
2024-04-10 11:54:31 -07:00
Brad Warren
6ecf3782ac document the github-releases credential (#9925) 2024-04-04 07:36:44 -07:00
Brad Warren
d1347fce9a Merge pull request #9927 from certbot/candidate-2.10.0
Candidate 2.10.0
2024-04-03 16:43:00 -07:00
Will Greenberg
9412ce9f05 Bump version to 2.11.0 2024-04-02 14:20:25 -07:00
Will Greenberg
fabe7bbc78 Add contents to certbot/CHANGELOG.md for next version 2024-04-02 14:20:25 -07:00
Will Greenberg
1e34fb8b51 Remove built packages from git 2024-04-02 14:20:25 -07:00
Will Greenberg
4d7d0d6d04 Release 2.10.0 2024-04-02 14:20:24 -07:00
Will Greenberg
cf77b3c3fa Update changelog for 2.10.0 release 2024-04-02 14:20:00 -07:00
Will Greenberg
a7674bd45a Merge pull request #9926 from certbot/docker-compose-v2
Switch to using docker compose v2
2024-04-02 14:16:45 -07:00
Will Greenberg
cdeac7a745 Remove CHANGELOG entry, update contributing docs 2024-04-02 13:47:56 -07:00
Will Greenberg
50b2097d38 conftest: use docker compose ls to test 2024-04-02 13:46:38 -07:00
Will Greenberg
30e7f23360 Switch to using docker compose v2
Azure recently dropped the `docker-compose` standalone executable (aka
docker-compose v1), and since it's not receiving updates anymore, let's
get with the times and update to v2 as well.
2024-04-02 12:36:29 -07:00
Brad Warren
248455a92b add back package signing (#9913)
* add packages to git commit

* rename deploy stage

* rename deploy jobs

* set up github releases

* remove v

* tweak release script

* remove publishing windows installer

* update changelog
2024-04-01 10:59:55 -07:00
Erica Portnoy
cca30ace31 actually completely unpin poetry 2024-03-29 12:03:04 -07:00
Erica Portnoy
90348bde4e allowlist the apache conf test farm test 2024-03-29 11:24:51 -07:00
Erica Portnoy
54dd12cd57 update azure environment passing to new required but undocumented format 2024-03-28 18:05:47 -07:00
Erica Portnoy
4e6934a4b6 new tox requires local scripts to be explicitly allowlisted 2024-03-28 17:36:02 -07:00
Erica Portnoy
57bb4e40b7 remove accidentally checked in file 2024-03-28 15:52:11 -07:00
Erica Portnoy
7f885292f9 why does this fix it????? 2024-03-28 15:49:20 -07:00
Erica Portnoy
8978e4dbff remove useless editable-legacy flag 2024-03-28 15:42:41 -07:00
Erica Portnoy
920b717c45 update poetry version using urllib3 workaround 2024-03-28 15:34:24 -07:00
Erica Portnoy
54b7b1883e use legacy editable mode for oldest tests 2024-03-27 16:27:42 -07:00
Erica Portnoy
87ab76fc7d allowlist apache conf test external 2024-03-27 15:44:28 -07:00
Erica Portnoy
4925f71933 work around undocumented lack of ability to reference multi-named envs 2024-03-27 15:11:21 -07:00
Erica Portnoy
39fda1d44d make minor changes to support tox v4 based on https://tox.wiki/en/latest/upgrading.html 2024-03-27 14:16:40 -07:00
Erica Portnoy
c8a1e30981 change tox pin to >= 4 and rerun pinning script 2024-03-27 14:05:59 -07:00
Brad Warren
7abf143394 update centos9stream ami (#9914) 2024-03-20 13:18:36 -07:00
ohemorange
f4e031f505 Add troubleshooting instructions to the finish_release script for snapcraft credential expiry. (#9896) 2024-02-08 21:31:36 +00:00
Brad Warren
2844fdd74a Merge pull request #9895 from certbot/candidate-2.9.0
Candidate 2.9.0
2024-02-08 13:05:29 -08:00
Erica Portnoy
3b183961a9 Bump version to 2.10.0 2024-02-08 11:46:08 -08:00
Erica Portnoy
76411ecca7 Add contents to certbot/CHANGELOG.md for next version 2024-02-08 11:46:08 -08:00
Erica Portnoy
725c64d581 Release 2.9.0 2024-02-08 11:46:07 -08:00
Erica Portnoy
99ae4ac5ef Update changelog for 2.9.0 release 2024-02-08 11:45:17 -08:00
Brad Warren
b8b759f1d2 update dependencies (#9893)
Fixes https://github.com/certbot/certbot/issues/9892 and https://github.com/certbot/certbot/security/dependabot

Upgrading the base docker image has been done in previous PRs like https://github.com/certbot/certbot/pull/9415. Doing this was needed because the [newer versions of `cryptography` need a newer version of rust](https://dev.azure.com/certbot/certbot/_build/results?buildId=7451&view=logs&j=fdd3565a-f3c6-5154-eca9-9ae03666f7bd&t=5dbd9851-46a4-524f-73a8-4028241afcde&l=475).

I ran the full test suite on this branch which you can see in the GitHub status checks below. The boulder tests should fail as they're to be fixed by https://github.com/certbot/certbot/pull/9889 but everything else should pass.
2024-02-07 17:55:30 -08:00
Brad Warren
8b5a017b05 use our own boulder rate limit file (#9889)
* use our own rate limit file

* clarify path
2024-02-07 17:33:07 -08:00
ohemorange
b7ef536ec3 Use the legacy snapcraft build until #9890 is fixed (#9891) 2024-02-07 16:29:08 -08:00
Simon Stier
282df74ee9 add 3rd party certbot-dns-stackit to the docs (#9885) 2024-02-02 08:38:55 -08:00
Alexis
0a565815f9 Docs: Reset requirements.txt path (#9877)
* Reset requirements.txt path

* Add requirements.txt path

* Test config path

* Change docs path

* Amend paths for successful builds

* Place copyright for epub

- Will amend copyright parameter at a later date
2024-02-01 08:27:45 -08:00
ohemorange
d33bbf35c2 Make reconfigure use staging server (#9870)
* Make reconfigure use staging server

* lint and imports

* Unset the account if it's been set in preparation for a dry run

* Add unit tests for checking we switch to staging and don't accidentally modify anything else

* add docstring

* Add test to make sure a requested new account id is saved

* update changelog

* set noninteractive mode for dry run

* error when account or server is set by the user

* switch to checking for changed values in account and server

* recommend using renew instead of certonly for forbidden fields

* change link to renew-reconfiguration
2024-01-26 12:09:20 -08:00
Brad Warren
714a0b348d offer poetry verbosity (#9881) 2024-01-24 16:15:26 -08:00
Alexis
7ca1b8f286 Merge pull request #9876 from certbot/zoraconpatch-yaml-error
Fix YAML Errors in "Formats" section
2024-01-18 10:45:09 -08:00
zoracon
be40e377d9 Move YAML file back and amend paths 2024-01-17 14:51:37 -08:00
zoracon
01cf4bae75 Amend YAML error on reeadthedocs yaml files 2024-01-17 14:46:12 -08:00
Will Greenberg
ef949f9149 Merge pull request #9858 from certbot/zoracon-patch-readthedocs-test
Move .readthedocs.yaml
2024-01-16 14:03:25 -08:00
ohemorange
926d0c7e0f Fix mypy joinpath errors (#9871)
* Fix mypy joinpath errors

* update changelog
2024-01-05 16:35:37 -08:00
Brad Warren
9d8eb6ccfd Add Python 3.12 support (#9852)
* add py312 support

* sed -i "s/\( *'Pro.*3\.1\)1\(',\)/\11\2\n\12\2/" */setup.py

* update pytest.ini comment

* upgrade macos version

* fixup changelog
2023-12-13 10:02:38 -08:00
Alexis
585f70e700 Create .readthedocs.yaml
Test moving config file in attempt to solve build errors
2023-12-07 18:52:05 -08:00
Alexis
21e24264f4 Bump Hardcoded RSA Default in API (#9855)
Rectifies: https://github.com/certbot/certbot/security/advisories/GHSA-pcq2-mjvr-m4jj
2023-12-06 13:00:55 -08:00
Brad Warren
cf78ad3a3d Merge pull request #9853 from certbot/candidate-2.8.0
Candidate 2.8.0
2023-12-05 16:48:55 -08:00
Will Greenberg
dccb92d57f Bump version to 2.9.0 2023-12-05 11:14:39 -08:00
Will Greenberg
f9d31faadc Add contents to certbot/CHANGELOG.md for next version 2023-12-05 11:14:39 -08:00
Will Greenberg
e9225d1cc2 Release 2.8.0 2023-12-05 11:14:38 -08:00
Will Greenberg
3dd1f0eea9 Update changelog for 2.8.0 release 2023-12-05 11:13:52 -08:00
Brad Warren
917e3aba6b add pkg_resources changelog (#9851) 2023-12-05 10:33:49 -08:00
Brad Warren
3833255980 update dependencies (#9848) 2023-12-05 10:33:31 -08:00
Francesco Colista
619654f317 Add support for Alpine Linux (#9834)
Signed-off-by: Francesco Colista <fcolista@alpinelinux.org>
2023-11-22 13:53:31 +01:00
Brad Warren
76f9a33e45 Upgrade the pinned version of pylint (#9839)
* upgrade pylint

* fix upgraded pylint

* downgrade pyopenssl

* remove unneeded ignores

* stop using text

* update sphinx-rtd-theme
2023-11-15 09:52:37 +01:00
Adrien Ferrand
5f67bb99a8 Full cleanup of pkg_resources (#9797)
Fixes #9606

This PRs removes some elements that were related to pkg_resources dependency and its deprecation.
2023-11-13 15:50:32 -08:00
Will Greenberg
d8392bf394 Merge pull request #9832 from certbot/candidate-2.7.4
Update master from 2.7.4 release
2023-11-01 11:36:29 -07:00
Brad Warren
6a89fcbc56 Merge branch 'master' into candidate-2.7.4 2023-11-01 07:50:54 -07:00
Brad Warren
2adaacab82 Bump version to 2.8.0 2023-11-01 06:24:20 -07:00
Brad Warren
2ae810c45a Add contents to certbot/CHANGELOG.md for next version 2023-11-01 06:24:19 -07:00
Brad Warren
b62133e3e1 Release 2.7.4 2023-11-01 06:24:18 -07:00
Brad Warren
a92bb44ff9 Update changelog for 2.7.4 release 2023-11-01 06:23:12 -07:00
Brad Warren
9650c25968 Fix change detection on mutable values (#9829) (#9830)
* handle mutable values

* add unit test

* add changelog entry

* fix typo

(cherry picked from commit c3c29afdca)
2023-11-01 00:10:11 +00:00
Brad Warren
c3c29afdca Fix change detection on mutable values (#9829)
* handle mutable values

* add unit test

* add changelog entry

* fix typo
2023-10-31 16:28:16 -07:00
Brad Warren
dca4ddd3d8 Prep for 2.7.4 (#9823)
* Set the delegated field in Lexicon config to bypass subdomain resolution (#9821)

The Lexicon-based DNS plugins use a mechanism to determine which actual segment of the input domain is actually the DNS zone in which the DNS-01 challenge has to be initiated (eg. `subdomain.domain.com` or `domain.com` for input `subdomain.domain.com`): they tries recursively to configure Lexicon and initiate authentication from the most specific to most generic domain segment, and select the first segment where Lexicon stop erroring out.

This mechanism broke with #9746 because now the plugins call Lexicon client instead of the underlying providers, and the client makes guess on the actual domain requested. Typically for `subdomain.domain.com` it will actually try to authenticate against `domain.com`, and so the mechanism above does not work anymore.

This PR fixes the issue by using the `delegated` field in Lexicon config each time the plugin needs it. This field is designed for this kind of purpose: it will instruct Lexicon what is the actual DNS zone domain instead of guessing it.

I tested the change with one of my OVH account. The expected behavior is re-established and the plugin is able to test `subdomain.domain.com` then `domain.com` as before.

Fixes #9791
Fixes #9818

(cherry picked from commit cf4f07d17e)

* add changelog entry for 9821 (#9822)

(cherry picked from commit 7bb85f8440)

---------

Co-authored-by: Adrien Ferrand <adferrand@users.noreply.github.com>
2023-10-30 10:34:30 -07:00
Brad Warren
7bb85f8440 add changelog entry for 9821 (#9822) 2023-10-28 00:04:11 +02:00
Adrien Ferrand
cf4f07d17e Set the delegated field in Lexicon config to bypass subdomain resolution (#9821)
The Lexicon-based DNS plugins use a mechanism to determine which actual segment of the input domain is actually the DNS zone in which the DNS-01 challenge has to be initiated (eg. `subdomain.domain.com` or `domain.com` for input `subdomain.domain.com`): they tries recursively to configure Lexicon and initiate authentication from the most specific to most generic domain segment, and select the first segment where Lexicon stop erroring out.

This mechanism broke with #9746 because now the plugins call Lexicon client instead of the underlying providers, and the client makes guess on the actual domain requested. Typically for `subdomain.domain.com` it will actually try to authenticate against `domain.com`, and so the mechanism above does not work anymore.

This PR fixes the issue by using the `delegated` field in Lexicon config each time the plugin needs it. This field is designed for this kind of purpose: it will instruct Lexicon what is the actual DNS zone domain instead of guessing it.

I tested the change with one of my OVH account. The expected behavior is re-established and the plugin is able to test `subdomain.domain.com` then `domain.com` as before.

Fixes #9791
Fixes #9818
2023-10-27 10:04:40 -07:00
Will Greenberg
36c78b3717 Merge pull request #9819 from certbot/candidate-2.7.3
Update master from 2.7.3 release
2023-10-26 14:01:31 -07:00
Will Greenberg
bf5475fa74 Merge pull request #9820 from certbot/2.7.3-update
Update 2.7.x from 2.7.3 release
2023-10-26 14:00:37 -07:00
Brad Warren
9bfc9dda5c Merge branch 'master' into candidate-2.7.3 2023-10-25 08:27:20 -07:00
Brad Warren
e904bd4e29 Bump version to 2.8.0 2023-10-24 13:43:22 -07:00
Brad Warren
d140a7df52 Add contents to certbot/CHANGELOG.md for next version 2023-10-24 13:43:22 -07:00
Brad Warren
bd550c09c2 Release 2.7.3 2023-10-24 13:43:20 -07:00
Brad Warren
01405a8fa6 Update changelog for 2.7.3 release 2023-10-24 13:42:05 -07:00
Brad Warren
5bf833fe28 2.7.3 prep (#9817)
* Update changelog for 2.7.2 release

* Release 2.7.2

* helpful: Add an edge case for arguments w/ contained spaces (#9813)

Fixes #9811

(cherry picked from commit 3ae9d7e03a)

* fixes #9805 (#9816)

(cherry picked from commit d1577280ad)

---------

Co-authored-by: Will Greenberg <willg@eff.org>
2023-10-24 12:49:04 -07:00
Brad Warren
d1577280ad fixes #9805 (#9816) 2023-10-24 12:27:19 -07:00
Will Greenberg
3ae9d7e03a helpful: Add an edge case for arguments w/ contained spaces (#9813)
Fixes #9811
2023-10-24 08:26:00 -07:00
Will Greenberg
5594ac20e0 Merge pull request #9809 from certbot/candidate-2.7.2
Candidate 2.7.2
2023-10-19 17:49:02 -07:00
Brad Warren
7f6000f1d4 Merge branch 'master' into candidate-2.7.2 2023-10-19 17:35:05 -07:00
Will Greenberg
1863c66179 Bump version to 2.8.0 2023-10-19 15:34:19 -07:00
Will Greenberg
185c20c71b Add contents to certbot/CHANGELOG.md for next version 2023-10-19 15:34:19 -07:00
Will Greenberg
a1b773cbdc Release 2.7.2 2023-10-19 15:34:18 -07:00
Will Greenberg
937eaef621 Update changelog for 2.7.2 release 2023-10-19 15:33:34 -07:00
Brad Warren
e40741955f Prep for 2.7.2 (#9808)
* helpful: fix handling of abbreviated ConfigArgparse arguments (#9796)

* helpful: fix handling of abbreviated ConfigArgparse arguments

ConfigArgparse allows for "abbreviated" arguments, i.e. just the prefix
of an argument, but it doesn't set the argument sources in these cases.
This commit checks for those cases and sets the sources appropriately.

* failing to find an action raises an error instead of logging

* Update changelog

* Add handling for short arguments, fix equals sign handling

These were silently being dropped before, possibly leading to instances
of `NamespaceConfig.set_by_user()` returning false negatives.

(cherry picked from commit 11e17ef77b)

* Fix finish_release.py (#9800)

* response is value

* rename vars

(cherry picked from commit a96fb4b6ce)

* Merge pull request #9762 from certbot/docs/yaml-config

Add YAML files for Readthedocs requirements

(cherry picked from commit 44046c70c3)

* Update Lexicon requirements to stabilize certbot-dns-ovh behavior (#9802)

* Update minimum Lexicon version required for certbot-dns-ovh

* Add types

* FIx mypy

* Fix lint

* Fix BOTH lint and mypy

(cherry picked from commit 5cf5f36f19)

* simplify code (#9807)

(cherry picked from commit 6f7b5ab1cd)

* Include linting fixes from 8a95c03

---------

Co-authored-by: Will Greenberg <willg@eff.org>
Co-authored-by: Alexis <alexis@eff.org>
Co-authored-by: Adrien Ferrand <adferrand@users.noreply.github.com>
2023-10-19 11:27:21 -07:00
Brad Warren
6f7b5ab1cd simplify code (#9807) 2023-10-18 14:32:07 -07:00
Adrien Ferrand
5cf5f36f19 Update Lexicon requirements to stabilize certbot-dns-ovh behavior (#9802)
* Update minimum Lexicon version required for certbot-dns-ovh

* Add types

* FIx mypy

* Fix lint

* Fix BOTH lint and mypy
2023-10-18 13:19:26 -07:00
Brad Warren
a96fb4b6ce Fix finish_release.py (#9800)
* response is value

* rename vars
2023-10-16 17:54:24 -07:00
Will Greenberg
11e17ef77b helpful: fix handling of abbreviated ConfigArgparse arguments (#9796)
* helpful: fix handling of abbreviated ConfigArgparse arguments

ConfigArgparse allows for "abbreviated" arguments, i.e. just the prefix
of an argument, but it doesn't set the argument sources in these cases.
This commit checks for those cases and sets the sources appropriately.

* failing to find an action raises an error instead of logging

* Update changelog

* Add handling for short arguments, fix equals sign handling

These were silently being dropped before, possibly leading to instances
of `NamespaceConfig.set_by_user()` returning false negatives.
2023-10-13 12:02:01 -07:00
Adrien Ferrand
8a95c030e6 Drop Python 3.7 support (#9792)
* Drop Python 3.7 support

* Fix lint and test

* Check for venv generation

* Update requirements

* Update oldest constaints and compatibility tests runtime
2023-10-13 06:57:42 -07:00
Brad Warren
d9d825ac50 Merge pull request #9794 from certbot/candidate-2.7.1
Update master from 2.7.1 release
2023-10-11 16:37:57 -07:00
Brad Warren
07b1b0d8b2 Merge pull request #9795 from certbot/candidate-2.7.1-2.7.x
Update 2.7.x from 2.7.1 release
2023-10-11 16:37:48 -07:00
Brad Warren
beec975379 Merge branch 'master' into candidate-2.7.1 2023-10-10 08:50:31 -07:00
Mattias Ellert
01d129dfca Adapt to Python 3.12.0rc2 (#9764)
The warning message changed from "datetime.utcfromtimestamp() is deprecated"
to "datetime.datetime.utcfromtimestamp() is deprecated"
2023-10-10 16:02:24 +02:00
Brad Warren
8bf21cad25 Bump version to 2.8.0 2023-10-10 06:40:53 -07:00
Brad Warren
dcac5ed8f0 Add contents to certbot/CHANGELOG.md for next version 2023-10-10 06:40:53 -07:00
Brad Warren
228e3f2a8d Release 2.7.1 2023-10-10 06:40:52 -07:00
Brad Warren
6624e0b65c Update changelog for 2.7.1 release 2023-10-10 06:39:19 -07:00
Brad Warren
21113d17c7 Prep for 2.7.1 (#9790)
* Bump setup.py's ConfigArgParse version (#9784)

I neglected to do this during #9678, so looks like some pip installs
are failing to get the minimum required version.

(cherry picked from commit 02efc8c5ca)

* Fix dnsimple typo (#9787)

Fixes https://github.com/certbot/certbot/issues/9786.

(cherry picked from commit 4e60a0d03a)

* update pinned dependencies (#9788)

This fixes the security alerts those with access can see at https://github.com/certbot/certbot/security/dependabot.

(cherry picked from commit 5849ff73fb)

* update changelog for configargparse (#9789)

I'd like to do a bug fix release for https://github.com/certbot/certbot/issues/9786. If we're doing one, I figure we may as well flag this change from https://github.com/certbot/certbot/pull/9784 too.

(cherry picked from commit 61773be971)

---------

Co-authored-by: Will Greenberg <willg@eff.org>
2023-10-06 18:59:26 +00:00
Brad Warren
61773be971 update changelog for configargparse (#9789)
I'd like to do a bug fix release for https://github.com/certbot/certbot/issues/9786. If we're doing one, I figure we may as well flag this change from https://github.com/certbot/certbot/pull/9784 too.
2023-10-06 11:39:19 -07:00
Brad Warren
5849ff73fb update pinned dependencies (#9788)
This fixes the security alerts those with access can see at https://github.com/certbot/certbot/security/dependabot.
2023-10-06 11:39:08 -07:00
Brad Warren
4e60a0d03a Fix dnsimple typo (#9787)
Fixes https://github.com/certbot/certbot/issues/9786.
2023-10-05 13:15:30 -07:00
Alexis
44046c70c3 Merge pull request #9762 from certbot/docs/yaml-config
Add YAML files for Readthedocs requirements
2023-10-05 09:24:02 -07:00
Will Greenberg
02efc8c5ca Bump setup.py's ConfigArgParse version (#9784)
I neglected to do this during #9678, so looks like some pip installs
are failing to get the minimum required version.
2023-10-04 16:22:13 -07:00
Brad Warren
0862e05754 Merge pull request #9780 from certbot/candidate-2.7.0
Candidate 2.7.0
2023-10-03 12:46:06 -07:00
Will Greenberg
08d1979bcb Bump version to 2.8.0 2023-10-03 11:22:04 -07:00
Will Greenberg
6c66764f25 Add contents to certbot/CHANGELOG.md for next version 2023-10-03 11:22:04 -07:00
Will Greenberg
c4642c2dfe Release 2.7.0 2023-10-03 11:22:02 -07:00
Will Greenberg
bcb7f371e3 Update changelog for 2.7.0 release 2023-10-03 11:21:15 -07:00
Adrien Ferrand
732a3ac962 Refactor Lexicon-based DNS plugins (#9746)
* Refactor Lexicon-based DNS plugins and upgrade minimal version of Lexicon

* Relax filterwarning to comply with envs where boto3 is not installed

* Update pinned dependencies

* Use our previous method to deprecate part of modules

* Safe import internally

* Add changelog

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2023-09-25 15:15:04 -07:00
Alexis
694c758db7 Swap out with updated AMI image IDs (#9770)
- Add comments for other OS
2023-09-20 13:03:53 -07:00
zoracon
f5cb0a156b Remove duplicate file
- was in the incorrect directory
2023-09-20 12:58:36 -07:00
zoracon
4178e8ffc4 Merge branch 'master' of https://github.com/certbot/certbot into docs/yaml-config 2023-09-20 12:55:59 -07:00
zoracon
a3353b5c42 Revert "Swap out with updated AMI image IDs"
This reverts commit 24c8825d22.
2023-09-20 12:55:48 -07:00
zoracon
24c8825d22 Swap out with updated AMI image IDs
- Add comments for other OS
2023-09-20 12:46:33 -07:00
Adrien Ferrand
23f9dfc655 Migrate pkg_resources usages to importlib.metadata (#9749)
* Migrate entrypoint logic from pkg_resources to importlib.metadata

* Usage of importlib_metadata up to Python 3.9 to align API behavior to Python 3.10

---------

Co-authored-by: Adrien Ferrand <adrien.ferrand@amadeus.com>
Co-authored-by: Adrien Ferrand <adrien.ferrand@arteris.com>
2023-09-12 08:18:57 -07:00
Adrien Ferrand
cc359dab46 Migrate pkg_resources usages to importlib.resources (#9748)
* Migrate pkg_resources API related to resources to importlib_resources

* Fix lint and mypy + pin lexicon

* Update filterwarnings

* Update oldest tests requirements

* Update pinned dependencies

* Fix for modern versions of python

* Fix assets load in nginx integration tests

* Fix a warning

* Isolate static generation from importlib.resource into a private function

---------

Co-authored-by: Adrien Ferrand <adrien.ferrand@amadeus.com>
2023-09-07 11:38:44 -07:00
zoracon
89902e26bf Add YAML files for Readthedocs requirements 2023-08-31 16:06:47 -07:00
Paulo Dias
b1978ff188 dns-google: fix condition to don't use private dns zones (#9744)
* dns-google: fix condition to don't use private dns zones

* update MD

* Fix condition

* fix condition

* update testdata

* fix identation

* update tests

* update changelog

* Update dns_google.py

* add test for split horizon dns google

* add dnsName to managed zones
2023-08-27 01:19:38 +02:00
Brad Warren
579b39dce1 Fix docs (#9755)
* update quickstart and remove os import

* simplify theme use

* list sphinx_rtd_theme as extension

Our docs builds failed last night, presumably because #9754 updated `sphinx_rtd_theme` which changed some unknown thing.

Looking into it, our usage of this project was very unconventional. Following the code comment I deleted in this PR to https://docs.readthedocs.io/en/stable/faq.html#i-want-to-use-the-read-the-docs-theme-locally, simple instructions are given to put the following in your `conf.py` file:
```
extensions = [
    ...
    'sphinx_rtd_theme',
]

html_theme = "sphinx_rtd_theme"
```
I did this instead of the more complicated logic we were using and all builds passed locally. I also triggered a build on readthedocs with these changes which also passed.
2023-08-25 12:22:14 -07:00
Brad Warren
9b4b99f3e8 Update dependencies (#9754)
This takes care of the dependabot alerts those with access can see at https://github.com/certbot/certbot/security/dependabot.

Pinning back `cython` is needed because without it, our full test suite will fail when trying to build `pyyaml` on ARM systems.
2023-08-24 17:05:54 -07:00
Alexis
3e84b94308 Merge pull request #9739 from certbot/CI/workflow-patch-forks
Skip Mattermost Job for Forked Repos
2023-07-24 13:12:28 -07:00
Alexis
2cb2cb0575 Update merged.yaml 2023-07-24 12:11:40 -07:00
Mattias Ellert
ddd4b31b1c Mock in Python 3.12 finds more errors in mock syntax. (#9734) 2023-07-21 16:44:48 -07:00
Will Greenberg
68d812e6dd Add pytz as a dependency for integration tests (#9737) 2023-07-19 13:10:35 -07:00
Mattias Ellert
6effedc2f4 Do not call deprecated datetime.utcnow() and datetime.utcfromtimestamp() (#9735)
* Do not call deprecated datetime.utcnow() and datetime.utcfromtimestamp()

* Ignore DeprecationWarnings from importing dependencies

$ python3 -Wdefault
Python 3.12.0b4 (main, Jul 12 2023, 00:00:00) [GCC 13.1.1 20230614 (Red Hat 13.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
/usr/lib/python3.12/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
  warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
>>> import pytz
/usr/lib/python3.12/site-packages/pytz/tzinfo.py:27: DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC).
  _epoch = datetime.utcfromtimestamp(0)

* Used pytz.UTC consistently for clarity
2023-07-18 15:44:25 -07:00
Zachary Ware
c31d3a2cfd Update PyPI links (#9733)
Switch from the legacy pypi.python.org/pypi/ to the canonical pypi.org/project/
2023-07-15 15:58:00 -07:00
Brad Warren
e6572e695b deprecate python 3.7 support (#9730) 2023-07-10 08:06:04 +10:00
Brad Warren
a7674548ab Fix snap builds (#9729)
* release script change

* fix setup.py

* match setup.py logic
2023-07-07 13:14:05 +10:00
Michael Cassaniti
436b7fbe28 post renewal hook: Add RENEWED_DOMAINS and FAILED_DOMAINS as environment variables (#9724)
* renewal hook: Add RENEWED_DOMAINS and FAILED_DOMAINS as environment variables

* renewal hook: Updated documentation

* renewal hook: Updated CHANGELOG

* renew post hook: Add limit on variable sizes
2023-07-06 06:56:31 -07:00
alexzorin
d0e11c81b1 Repin dependencies to fix security alerts (#9717)
* repin current

* repin oldest

* csr must have version set to zero

* only set PIP_USE_PEP517 for macOS

* experiment with brew update git failure workaround
2023-07-05 06:40:02 -07:00
Leon G
4fc4d536c1 Add LooseVersion class with risky comparison, deprecate parse_loose_version (#9646)
* Replace parse_loose_version with LooseVersion

* Fix LooseVersion docstring

* Strengthen LooseVersion comparison

* Update changelog
2023-06-21 07:57:50 -07:00
alexzorin
b1e5efac3c disco: print the name of the plugin if it fails to load (#9719) 2023-06-16 08:26:15 -07:00
alexzorin
539d48d438 letstest: replace buster with bullseye (#9718) 2023-06-12 06:56:53 -07:00
Alex Gaynor
ae6268ea3c Remove workaround that's not relevant since py2 isn't supported (#9716) 2023-06-11 06:44:58 +10:00
Charles Hong
2d8a274eb5 Update using.rst (#9714)
Add a link to the third-party DNS authentication plugin using SOLIDserver
2023-06-08 18:40:58 +10:00
Remi Rampin
ff8afe827b Update GitHub repo location letsencrypt -> certbot (#9713)
* Update GitHub repo location letsencrypt -> certbot

* Revert changes to CHANGELOG
2023-06-08 10:27:28 +10:00
Will Greenberg
468f4749b8 Revert change to NamespaceConfig's constructor (#9709)
* Revert change to NamespaceConfig's constructor

NamespaceConfig's argument sources dict is now set with a method,
and raises a runtime error if one isn't set when set_by_user() is
called.

* Actually update CHANGELOG to reflect the set_by_user changes

* linter appeasement

* configuration: update docs, add test

This test ensures that calling `set_by_user` without an initialized
sources dict raises a RuntimeError.
2023-06-07 15:16:14 -07:00
Will Greenberg
a5d223d1e5 Replace (most) global state in cli/__init__.py (#9678)
* Rewrite helpful_test to appease the linter

* Use public interface to access argparse sources dict

* HelpfulParser builds ArgumentSources dict, stores it in NamespaceConfig

After arguments/config files/user prompted input have been parsed, we
build a mapping of Namespace options to an ArgumentSource value. These
generally come from argparse's builtin "source_to_settings" dict, but
we also add a source value representing dynamic values set at runtime.

This dict is then passed to NamespaceConfig, which can then be queried
directly or via the "set_by_user" method, which replaces the global
"set_by_cli" and "option_was_set" functions.

* Use NamespaceConfig.set_by_user instead of set_by_cli/option_was_set

This involves passing the NamespaceConfig around to more functions
than before, removes the need for most of the global state shenanigans
needed by set_by_cli and friends.

* Set runtime config values on the NamespaceConfig object

This'll correctly mark them as being "runtime" values in the
ArgumentSources dict

* Bump oldest configargparse version

We need a version that has get_source_to_settings_dict()

* Add more cli unit tests, use ArgumentSource.DEFAULT by default

One of the tests revealed that ConfigArgParse's source dict excludes
arguments it considers unimportant/irrelevant. We now mark all arguments
as having a DEFAULT source by default, and update them otherwise.

* Mark more argument sources as RUNTIME

* Removes some redundant helpful_test.py, moves one to cli_test.py

We were already testing most of these cases in cli_test.py, only
with a more complete HelpfulArgumentParser setup. And since the hsts/no-hsts
test was manually performing the kind of argument adding that cli
already does out of the box, I figured the cli tests were a more natural
place for it.

* appease the linter

* Various fixups from review

* Add windows compatability fix

* Add test ensuring relevant_values behaves properly

* Build sources dict in a more predictable manner

The dict is now built in a defined order: first defaults, then config
files, then env vars, then command line args. This way we eliminate the
possibility of undefined behavior if configargparse puts an arg's entry
in multiple source dicts.

* remove superfluous update to sources dict

* remove duplicate constant defines, resolve circular import situation
2023-05-30 17:12:51 -07:00
Alexis
b5661e84e8 Update README.rst (#9693)
* Update README.rst

Updating with newer info about keys and server support and removing redundant wording

* Adjust from feedback
2023-05-23 10:58:40 +10:00
alexzorin
aa270b37a2 docs: add "Choosing dependency versions" to contributing.rst (#9681)
* docs: add "Choosing dependency versions" to contributing.rst

* change a word
2023-05-12 07:52:02 +10:00
Brad Warren
35209d921d bump stale limit (#9691) 2023-05-09 17:06:47 -07:00
Brad Warren
0ac8e10c85 Merge pull request #9692 from certbot/candidate-2.6.0
Release Certbot 2.6.0
2023-05-09 15:52:33 -07:00
Erica Portnoy
36bfddbf4e Bump version to 2.7.0 2023-05-09 12:45:29 -07:00
Erica Portnoy
721c4665e6 Add contents to certbot/CHANGELOG.md for next version 2023-05-09 12:45:29 -07:00
Erica Portnoy
013621d04e Release 2.6.0 2023-05-09 12:45:28 -07:00
Erica Portnoy
e0e2bfe13a Update changelog for 2.6.0 release 2023-05-09 12:44:36 -07:00
alexzorin
d2e2a92cdd update farm tests (#9687)
* letstest: -ubuntu18.04 +centos9stream +debian11

* letstest: username for centos 9 stream is ec2-user

This is mentioned on https://centos.org/download/aws-images/

* ensure mod_ssl is installed

in centos 9 stream, apache has to be restarted after mod_ssl is
installed, or the snakeoil certificates will not be present and
apache won't start.

this also removes nghttp2 being installed as the relevant bug
is long fixed.
2023-05-08 14:37:14 -07:00
alexzorin
6e52695faa dns-rfc2136: add test coverage for PR #9672 (#9684)
* dns-rfc2136: add test coverage for PR #9672

* fix compatibility with oldest dnspython

* rename test to be more descriptive

Co-authored-by: ohemorange <ebportnoy@gmail.com>

---------

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2023-05-08 14:34:40 -07:00
Brad Warren
5b5a2efdc9 squelch warnings (#9689) 2023-05-04 10:42:49 -07:00
✨ Q (it/its) ✨
8a0b0f63de Support unknown ACME challenge types (#9680)
This is, to my knowledge, an entirely inconsequential PR to add support for entirely novel challenge types.

Presently in the [`challb_to_achall` function](399b932a86/certbot/certbot/_internal/auth_handler.py (L367)) if the challenge type is not of a type known to certbot an error is thrown. This check is mostly pointless as an authenticator would not request a challenge unknown to it. This check does however forbid any plugins from supporting entirely novel challenges not of the key authorisation form.

* support unknown ACME challenge types

* add to changelog

* update tests

---------

Co-authored-by: Brad Warren <bmw@eff.org>
2023-04-26 08:23:11 -07:00
alexzorin
10fba2ee3f docs: clarify --dry-run documentation (#9683)
* remove pointless paragraph about --server and wildcards

* docs: update help text for --dry-run and --staging

* docs: update "Changing the ACME Server" for --dry-run

* add note about webserver reloads
2023-04-25 16:43:18 -07:00
alexzorin
67f14f177b ignore invalid plugin selection choices (#9665)
* plugins: ensure --installer/--authenticator is properly filtered

* fix windows failure in test
2023-04-25 11:27:32 +10:00
Phil Martin
f378ec4a0f Optionally sign initial SOA query (#9672)
* Optionally sign initial SOA query

Added configuration file option to enable signing of the initial SOA query when determining the authoritative nameserver for the zone. Default is disabled.

* Better handling of sign_query configuration and fix lint issues

* Update str casting to match 5503d12395

* Update certbot/CHANGELOG.md

Co-authored-by: alexzorin <alex@zorin.au>

* Update certbot/CHANGELOG.md

Co-authored-by: alexzorin <alex@zorin.au>

* Update dns_rfc2136.py

Updated with feedback from certbot/certbot#9672

---------

Co-authored-by: alexzorin <alex@zorin.au>
2023-04-25 11:25:57 +10:00
Jawshua
b0d0a83277 google: use Application Default Credentials where available (#9670)
* google: use Application Default Credentials where available

* Updated custom role documentation
2023-04-22 07:58:18 +10:00
Will Greenberg
399b932a86 Merge pull request #9673 from certbot/types-dns-common-get
types: CredentialsConfiguration.conf can return None
2023-04-17 17:45:00 -07:00
Alex Zorin
b9ec3155f7 amend rtype 2023-04-18 08:14:11 +10:00
Alex Zorin
ef5f4cae04 fix cast formatting 2023-04-18 08:13:28 +10:00
Brad Warren
31094bc547 rewrite coverage tests (#9669)
In addition to the speed improvements in CI, the speed improvements locally with both this https://github.com/certbot/certbot/pull/9666 which this builds on is even more significant. After it's been run once so it's had a chance to set up the different virtual environments, `tox` locally now takes 39 seconds on my laptop when it used to take 137 seconds.
2023-04-17 13:01:00 -07:00
Niek Peeters
f41673982d validate lineage name (#9644)
Fixes #6127.

* Added lineage name validity check

* Verify lineage name validity before obtaining certificate

* Added linage name limitation to cli help

* Update documentation on certificate name

* Added lineage name validation to changelog

* Use filepath seperators to determine lineagename validity

* Add unittest for private choose_lineagename method

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2023-04-17 12:55:20 -07:00
Brad Warren
996cc20cd7 remove unused envrc (#9677) 2023-04-17 02:17:55 +00:00
Brad Warren
20ccf8c9c9 remove development dockerfile (#9676) 2023-04-17 12:14:25 +10:00
Alex Zorin
5503d12395 types: CredentialsConfiguration.conf can return None 2023-04-16 10:43:00 +10:00
Brad Warren
4740e20725 Rewrite tox config (#9666)
* rewrite tox config

* fix apacheconftest-with-pebble deps

* more fixes

* more fixes

* move comment up

* fix mock location

* bump cffi

* update oldest constraints

* Revert "fix mock location"

This reverts commit 561037bfad.

* fix apache test

* fix server cleanup

* fix some leaky sockets

* stop leaking sockets

* change less

* Update tox.ini

Co-authored-by: alexzorin <alex@zorin.id.au>

* Update tox.ini

Co-authored-by: alexzorin <alex@zorin.id.au>

* tweak contributing doc

---------

Co-authored-by: alexzorin <alex@zorin.id.au>
2023-04-16 10:30:59 +10:00
Brad Warren
dc05b4da7a Increase stale operations per run (#9668)
* increase operations per run

* update comment
2023-04-13 09:18:24 +10:00
Brad Warren
5149dfd96e Add some missing type libraries for mypy (#9657)
* add some missing types

* install pkg-config

* install pkg-config for docker too

* add pkg-config to plugins

* pkg-config when cryptography may need to be built

* deps cleanup

* more comments

* more tweaks
2023-04-09 11:49:08 +10:00
humanoid2050
9ee1eee219 Build with buildkit (#9628)
* generate multiarch images for non-architecture tags

* Update documentation related to multiarch Docker

* Remove qemu and switch to build via buildkit

* Move to multistage Dockerfile

* refactor docker script arg parsing and fix merge bugs

* removed unnecessary testing script and fixed function name

* improved quoting in shell scripts

---------

Co-authored-by: humanoid2050 <humanoid2050@monolith>
Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
Co-authored-by: humanoid2050 <humanoid2050@katana>
Co-authored-by: Brad Warren <bmw@eff.org>
2023-04-08 12:22:16 -07:00
Brad Warren
7a68b29140 update min cryptography (#9663) 2023-04-07 10:28:17 +10:00
Brad Warren
a78073812c Always "pipstrap" when running pip_install.py (#9658)
Fixes https://github.com/certbot/certbot/issues/7921.

In all cases when we run `pip_install.py`, we first run `pipstrap.py`. This PR combines these two steps for convenience and to make always doing that less error prone. This will also help me with some of the `tox.ini` refactoring I'm planning to do.

I ran the full test suite on everything and tested the release script changes locally.

This change shouldn't have any effect on cryptography's setup because they install `certbot[test]` which depends on pip, setuptools, and wheel.

* always pipstrap

* use pip_install.py during releases
2023-04-05 16:43:26 -07:00
alexzorin
45327d00c4 Merge pull request #9624 from certbot/more-stale
Increase stale frequency
2023-04-06 09:24:25 +10:00
alexzorin
163bb9e945 Merge pull request #9656 from certbot/candidate-2.5.0
Update files from 2.5.0 release
2023-04-05 08:12:54 +10:00
Brad Warren
1fe201e320 Bump version to 2.6.0 2023-04-04 08:07:50 -07:00
Brad Warren
86c51acb91 Add contents to certbot/CHANGELOG.md for next version 2023-04-04 08:07:50 -07:00
Brad Warren
3c667e8fff Release 2.5.0 2023-04-04 08:07:49 -07:00
Brad Warren
10ba4ea349 Update changelog for 2.5.0 release 2023-04-04 08:06:41 -07:00
alexzorin
df85c25da8 add dns_route53_propagation_seconds to DEPRECATED_OPTIONS (#9652)
Fixes #9651.
2023-04-03 10:20:22 -07:00
Bishop Clark
1bd6bef42f Update __init__.py (#9653)
Removed two en_US meta-commas to cure the spliced sentences.
2023-04-02 11:15:08 +10:00
Brad Warren
097af18417 remove readlink (#9649) 2023-03-31 10:02:12 +11:00
Brad Warren
608d731e2b Make mypy pass on our tests (#9648)
* make mypy pass on our tests

* fix grammar
2023-03-31 09:20:44 +11:00
Brad Warren
63fb97d8de add changelog entry (#9641) 2023-03-28 22:29:08 +00:00
Brad Warren
c987c3f3aa remove boulder-integration.conf.sh (#9640) 2023-03-28 22:23:16 +00:00
Brad Warren
ba3dde9384 make dns tests internal (#9639) 2023-03-29 09:10:34 +11:00
Brad Warren
9e30e8afa9 make tests internal (#9638)
This is the certbot-nginx version of #9625.
2023-03-28 15:01:31 -07:00
Brad Warren
ed6bbde38f Make apache tests internal (#9637)
This is the certbot-apache version of #9625.
2023-03-28 14:55:44 -07:00
Brad Warren
16cc1a74be make certbot tests internal (#9627)
This is the Certbot version of https://github.com/certbot/certbot/pull/9625.
2023-03-28 14:44:55 -07:00
Brad Warren
6832521272 Make acme tests internal (#9625)
This is a first step towards implementing the plan I described at https://github.com/certbot/certbot/issues/7909#issuecomment-1448675456 which got a +1 from both Erica and Will. Similar changes for our other packages will be made in followup PRs to try and make this easier to review.

It may be helpful to look at https://github.com/certbot/certbot/pull/7600 when reviewing this PR where we did something similar in the past.

The value of `ignore-paths` in `.pylintrc` should work on Windows based on https://pylint.readthedocs.io/en/latest/user_guide/configuration/all-options.html#ignore-paths and the fact that on macOS/linux, changing path delimiters to `\` still causes these directories to be ignored.

I started testing this for mypy as well, but mypy doesn't current pass for us on Windows so I didn't bother and took this opportunity to remove it from the default environments in `tox.ini`. I'll update https://github.com/certbot/certbot/issues/7803 to mention that the value of `exclude` in `mypy.ini` may need to be tweaked if anyone works on that issue.

* make acme tests internal

* no mypy-win
2023-03-28 14:02:33 -07:00
alexzorin
e10e549a95 renewal: fix key_type not being preserved on <v1.25.0 renewal configs (#9636)
Fixes #9635.
2023-03-28 08:44:19 -07:00
Brad Warren
208ef4eb94 remove CERTBOT_NO_PIN (#9634)
Adrien and I added this is in https://github.com/certbot/certbot/pull/6590 in response to https://github.com/certbot/certbot/issues/6582 which I wrote. I now personally think these tests are way more trouble than they're worth.

In almost all cases, the versions pinned in `tools/requirements.txt` are used. The two exceptions to this that come to mind are users using OS packages and pip. In the former, the version of our dependencies is picked by the OS and do not change much on most systems. As for pip, [we only "support it on a best effort basis"](https://eff-certbot.readthedocs.io/en/stable/install.html#alternative-2-pip).

Even for pip users, I'm not convinced this buys us much other than frequent test failures. We have our tests configured to error on all Python warnings and [we regularly update `tools/requirements.txt`](https://github.com/certbot/certbot/commits/master/tools/requirements.txt). Due to that, assuming our dependencies follow normal conventions, we should have a chance to fix things in response to planned API changes long before they make their way to our users. I do not think it is necessary for our tests to break immediately after an API is deprecated.

I think almost all other failures due to these tests are caused by upstream bugs. In my experience, almost all of them will sort themselves out pretty quickly. I think that responding to those that are not or planned API changes we somehow missed can be addressed when `tools/requirements.txt` is updated or when someone opens an issue. I personally don't think blocking releases or causing our nightly tests to fail is at all worth it here. I think removing this frequent cause of test failures makes things just a little bit easier for Certbot devs without costing us much of anything.
2023-03-27 17:01:27 -07:00
alexzorin
f004383582 avoid pyOpenSSL 23.1.0 (#9631)
Our `NO_PIN` test [fails](https://dev.azure.com/certbot/certbot/_build/results?buildId=6542&view=logs&j=ce03f7c1-1e3f-5d55-28be-f084e7c62a50&t=597fea95-d44e-53a2-5b71-76ed20bd4dde) due to https://github.com/pyca/pyopenssl/issues/1199.

This PR might strictly not be necessary once a new release of `PyOpenSSL` is available? I suppose it depends whether they yank the release.
2023-03-27 11:27:48 -07:00
alexzorin
fbf7f1f4d1 logging: use logger.warning for DeprecatedArgumentAction (#9630) 2023-03-27 11:13:16 -07:00
alexzorin
a16f316b8f logging: increase pre-argparse logging level to WARNING (#9629) 2023-03-27 11:12:18 -07:00
alexzorin
8037321ad7 dns-route53: deprecate --dns-route53-propagation-seconds (#9619) 2023-03-24 07:28:13 +11:00
Brad Warren
6a666b0323 increase stale frequency 2023-03-23 10:11:20 -07:00
Christoph Anton Mitterer
7ce1f1789e improve documentation about shell commands in hooks (#9612)
Fixes #9611.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-03-23 07:28:26 -07:00
Anna Glasgall
8e28e36178 Add async interface for finalization to acme.client.ClientV2 (#9622)
* Add async interface for finalization to acme.client.ClientV2

Add `begin_order_finalization()`/`poll_finalization()` to
`acme.client.ClientV2`, which are directly analogous to
`answer_challenge()`/`poll_authorizations()`. This allows us to
finalize an order and then later poll for its completion as separate
steps.

* Address code review feedback

Rename `begin_order_finalization` -> `begin_finalization` and tweak
wording of changelog entry
2023-03-23 11:09:14 +11:00
Anna Glasgall
5d5dc429c4 acme.messages.OrderResource: Make roundtrippable through JSON (#9617)
Right now if you to_json() an `OrderResource` and later deserialize
it, the `AuthorizationResource` objects don't come back through the
round-trip (they just get de-jsonified as frozendicts and worse, they
can't even be passed to `AuthorizationResource.from_json` because
frozendicts aren't dicts). In addition, the `csr_pem` field gets
encoded as an array of integers, which definitely does not get
de-jsonified into what we want.

Fix these by adding an encoder to `authorizations` and encoder and
decoder to `csr_pem`.
2023-03-21 10:49:39 -07:00
Brad Warren
c07b5efb7f Rewrite lock_test.py (#9614)
`lock_test.py` is a weird, heavily customized, standalone testing relic that's giving me trouble because the name currently conflicts with `certbot/tests/lock_test.py`. Moving `certbot/tests` inside the Certbot package as discussed at https://github.com/certbot/certbot/issues/7909#issuecomment-1448675456 would avoid this, however, this is at least somewhat blocked on getting that test code passing lint and mypy checks again because we run those checks on the entirety of the Certbot package 🙃 Since `lock_test.py` could probably stand to be rewritten/refactored anyway, I took this approach.

What I did is I rewrote something largely equivalent to `lock_test.py` inside Certbot's unit tests. I chose not to do this in `certbot-ci` because its not necessary to have an ACME server available. We're no longer explicitly testing things with the nginx plugin here like we were in `lock_test.py`, however, we are checking that `prepare` is called on the plugin at the right time and I added comments about the importance of checking that we lock the directory during the call to `prepare` in the Apache and nginx test code.

As a bonus, this fixes https://github.com/certbot/certbot/issues/8121.
2023-03-15 12:54:20 -07:00
Will Greenberg
7a6752a68e Merge pull request #9601 from certbot/yaml/merge-notifications
Create Workflow for Merge Notifications
2023-03-08 14:07:53 -08:00
Alexis
40486f3ab4 Fix indentation error 2023-03-08 09:22:17 -08:00
Brad Warren
e3880b8912 Merge pull request #9608 from certbot/candidate-2.4.0
Candidate 2.4.0
2023-03-07 14:59:14 -08:00
Will Greenberg
242c96527b Bump version to 2.5.0 2023-03-07 13:18:07 -08:00
Will Greenberg
336ca91c26 Add contents to certbot/CHANGELOG.md for next version 2023-03-07 13:18:07 -08:00
Will Greenberg
eeb88c0855 Release 2.4.0 2023-03-07 13:18:06 -08:00
Will Greenberg
b586672f78 Update changelog for 2.4.0 release 2023-03-07 13:17:25 -08:00
Alexis
6c22e29875 Update to include sanitization for JSON file 2023-03-07 12:42:39 -08:00
alexzorin
397f6bc20a docs: link for certbot-standalone-nfq plugin (#9607) 2023-03-07 05:40:39 -08:00
Will Greenberg
48b499a38f Merge pull request #9600 from certbot/yaml/github-notify-weekly
Create Weekly Notification Message for Certbot Team
2023-03-06 12:18:15 -08:00
Alexis
9f5e666702 Add a space for link selection 2023-03-03 11:09:56 -08:00
Alexis
077cfb7861 Update .github/workflows/merged.yaml
Escape any double quotes in the Title that may come in
2023-03-03 11:06:27 -08:00
Brad Warren
da01846d34 Remove unnecessary unittest (#9596)
Now that we're using pytest more aggressively, I think we should start transitioning our tests to that style rather than continuing to use unittest. This PR removes some unnecessary uses of unittest I found.

I kept the test classes (while removing the inheritance from unittest.TestCase) where I felt like it added structure or logical grouping of tests.

I verified that pytest still finds all the tests in both this branch and master by running commands like:
```
pytest $(git diff --name-only master | grep -v windows_installer_integration_tests)
```
2023-03-02 06:48:40 -08:00
Brad Warren
cd467f2ce1 remove nose cruft (#9603) 2023-03-02 10:28:20 +11:00
alexzorin
bdd81a5961 google: ignore declare_namespace deprecation warnings (#9604)
Fixes the nopin build on master.

---------

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2023-03-01 22:41:00 +00:00
Alexis
87f8eca033 Update .github/workflows/notify_weekly.yaml
Remove trailing char
2023-02-28 17:39:17 -08:00
Alexis
10b0fb6da0 Update .github/workflows/notify_weekly.yaml 2023-02-28 17:38:43 -08:00
Alexis
44be66eed9 Update .github/workflows/notify_weekly.yaml 2023-02-28 17:38:23 -08:00
Alexis
bd3e3d1af1 Update .github/workflows/merged.yaml 2023-02-28 17:35:56 -08:00
Alexis
97dd95329d Update merged.yaml 2023-02-28 13:31:06 -08:00
Alexis
676863760a Create Workflow for Merge Notifications
Sent to Mattermost Channel for Certbot Team to check and be generally aware of more granular merge events.
2023-02-28 13:15:41 -08:00
Alexis
173b832a8f Create Weekly Notification Message for Certbot Team
Composes Mattermost message to team channel
2023-02-28 12:38:53 -08:00
Mads Jensen
34e6b1e74d Remove redundant OCSPTestOpenSSL.tearDown (#9599) 2023-02-27 15:45:19 -08:00
Will Greenberg
72be7999ed Merge pull request #9597 from certbot/revert-nginx-lua-detection
nginx: fix performance regression caused by #9475
2023-02-27 11:32:57 -08:00
Alex Zorin
1cb8c389b7 note the issue in the CHANGELOG 2023-02-25 09:32:38 +11:00
Alex Zorin
7c840a7dfd Revert "nginx: on encountering lua directives, produce a better warning (#9475)"
This reverts commit c178fa8c0b.
2023-02-25 08:45:19 +11:00
humanoid2050
a42cffc351 generate multiarch images for non-architecture tags (#9586)
* generate multiarch images for non-architecture tags

* lock docker build to legacy docker buider, and bugfix

* rename deploy.sh to deploy_by_arch.sh

* Update documentation related to multiarch Docker

* Consistent IFS value with respect to other scripts

Co-authored-by: humanoid2050 <humanoid2050@monolith>
Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2023-02-22 17:53:45 -08:00
ohemorange
1cb48eca58 Remove update symlinks (#9592)
* Add deprecation warning when update_symlinks is run

* Remove information about update_symlinks from help

* ignore our own warning and remove unused imports

* Update changelog
2023-02-22 12:16:28 -08:00
Brad Warren
2a7eeef176 Polish snap_build.py (#9584)
I wanted to try to make our tooling's messaging about it a little clearer.

While fixing my typo/bad English, we happened to hit a "Chroot problem" failure! See the logs for the CI first attempt at https://dev.azure.com/certbot/certbot/_build/results?buildId=6416&view=results.

Looking at these logs, I noticed three things:

1. This message I added is sometimes printed many times because we're still processing output from snapcraft. See https://dev.azure.com/certbot/certbot/_build/results?buildId=6416&view=logs&j=f44d40a4-7318-5ffe-762c-ae4557889284&s=1dfbc15b-7d0f-52a9-b1da-b17592bf94f8&t=07786725-57f8-5198-4d13-ea77f640bd5c&l=565.
2. snapcraft is complaining that we should be using --build-for now instead of --build-on. See https://dev.azure.com/certbot/certbot/_build/results?buildId=6416&view=logs&j=f44d40a4-7318-5ffe-762c-ae4557889284&s=1dfbc15b-7d0f-52a9-b1da-b17592bf94f8&t=07786725-57f8-5198-4d13-ea77f640bd5c&l=472.
3. Us canceling the Certbot build due to a "Chroot problem" happened 3 times in 3 seconds which seems very unlikely. See https://dev.azure.com/certbot/certbot/_build/results?buildId=6416&view=logs&j=f44d40a4-7318-5ffe-762c-ae4557889284&s=1dfbc15b-7d0f-52a9-b1da-b17592bf94f8&t=07786725-57f8-5198-4d13-ea77f640bd5c&l=587. I looked at the builds on launchpad and I only saw one Certbot build. I think what's happening is this code is causing the old build state to be reported so we error immediately.
I fixed all of these things in my follow up commits.

* polish chroot problem messaging

* only execute branch once
2023-02-16 11:17:47 -08:00
Brad Warren
a3c9371dc5 Use pytest assertions (#9585)
* run unittest2pytest

The command used here was `unittest2pytest -nw acme/tests certbot*/tests`.

* fix with pytest.raises

* add parens to fix refactoring

* <= not <
2023-02-16 16:02:02 +11:00
Brad Warren
fedb0b5f9d Merge pull request #9581 from certbot/candidate-2.3.0
Release candidate 2.3.0
2023-02-14 15:13:44 -08:00
Will Greenberg
1b904b62c9 Enable stale issue tracker (#9580) 2023-02-14 15:13:13 -08:00
Will Greenberg
941119f05b Bump version to 2.4.0 2023-02-14 12:44:32 -08:00
Will Greenberg
5d34a4d982 Add contents to certbot/CHANGELOG.md for next version 2023-02-14 12:44:32 -08:00
Will Greenberg
d4b2d3202b Release 2.3.0 2023-02-14 12:44:31 -08:00
Will Greenberg
1fe2d671cb Update changelog for 2.3.0 release 2023-02-14 12:42:21 -08:00
Will Greenberg
9960c1907b Merge pull request #9577 from certbot/update-stale
Disable stale for PRs
2023-02-14 12:28:09 -08:00
Brad Warren
1da113d7d6 tweak comment 2023-02-14 08:55:07 -08:00
Brad Warren
64800c2b1f disable stale for PRs 2023-02-14 08:51:17 -08:00
Brad Warren
dc07dfd07b Automatically run test files with pytest (#9576)
* Switch to pytest

git grep -l unittest.main | xargs sed -i 's/unittest.main()/sys.exit(pytest.main([__file__]))/g'
git ls-files -m | xargs -I {} sh -c "echo 'import sys\nimport pytest' >> '{}'"
isort --float-to-top .

* add pytest dep

* use sys.argv
2023-02-14 06:44:42 +11:00
alexzorin
057524aa52 certbot-ci: fix crash in and simplify manual_http_hooks (#9570)
There is a typo (`request` instead of `requests`) in the `auth.py` generated by this function:

d792d39813/certbot-ci/certbot_integration_tests/utils/misc.py (L184-L191)

that has [never ever succeeded](https://gist.github.com/alexzorin/ff2686b7123cea49f1e4107d1e7d95f5#file-master-log-L203-L208).

Moreover, this polling code is not necessary because `create_http_server` already polls until the HTTP server to come up, and the file we wrote to disk is guaranteed is immediately visible by the web server anyway.

* certbot-ci: fix crash in and simplify manual_http_hooks

* remove superfluous format argument

* remove unused argument
2023-02-10 11:15:42 -08:00
Brad Warren
1bb09da270 Update and run isort (#9573)
I want to use isort as part of https://github.com/certbot/certbot/issues/9572 because I want to do it programmatically, however, I felt like the config needed to be tweaked a bit due to it not understanding what is and is not our own code.

This PR updates the isort config so it recognizes our own modules and runs `isort .` from the root of the repo to update everything.

* update isort config

* run "isort ."
2023-02-10 10:51:20 -08:00
Will Greenberg
d8d177ce72 Merge pull request #9575 from certbot/no-more-1.x
Simplify release process and push everyone to 2.0
2023-02-10 10:10:13 -08:00
Brad Warren
7d4535a836 tweak cloudxns condition 2023-02-09 19:35:37 -08:00
Brad Warren
c32da71e8a fail faster if we try to use candidate 2023-02-09 18:56:43 -08:00
Brad Warren
ca5f13d0e3 update snapcraft credentials 2023-02-09 18:55:29 -08:00
Brad Warren
91005a0422 always push to beta 2023-02-09 18:45:06 -08:00
Brad Warren
f91d3ca828 remove 1.32.x deps 2023-02-09 18:42:41 -08:00
Brad Warren
3512d15dff Remove most progressive release tooling 2023-02-09 18:41:16 -08:00
Will Greenberg
caad4d93d0 Merge pull request #9574 from certbot/remove-test-test-code
Remove code testing testing code
2023-02-09 12:03:06 -08:00
Brad Warren
aac02bef35 Remove code testing testing code 2023-02-08 20:55:59 -08:00
alexzorin
cbb4c871c2 docs: document reconfigure verb (#9563)
* docs: document reconfigure verb

* expand on the flags relevant to reconfigure

* Update phrasing

Co-authored-by: ohemorange <ebportnoy@gmail.com>

---------

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2023-02-09 13:14:32 +11:00
ohemorange
99956ecab9 Fix typo direcory --> directory in --run-deploy-hooks help (#9568) 2023-02-08 16:16:28 -08:00
Brad Warren
d792d39813 reset set_by_cli between each test (#9567) 2023-02-09 09:24:07 +11:00
Brad Warren
f5ea5d453e fix requests-toolbelt warning (#9569) 2023-02-09 09:21:07 +11:00
Alexis
cd9ee996a8 Create SECURITY.md (#9566) 2023-02-09 07:12:15 +11:00
alexzorin
99184daff6 repin cryptography for openssl security update (#9565)
* repin cryptography for openssl security update

https://www.openssl.org/news/secadv/20230207.txt
https://cryptography.io/en/latest/changelog/#v39-0-1

* fix type hints

* remove outdated comments
2023-02-08 11:17:44 -08:00
ohemorange
23090198bf Configuration File Update w/o Certificate Issuance (#9355)
* Add command to update config files without issuing/renewing cert

* toss up a vague untested skeleton

* remove duplicated code

* set certname in config

* consistent name, no zope

* import copy

* reconsitute is in renewal

* import renewal

* import cli

* fix lint errors

* call choose_configurator_plugins for its side effect of writing to config

* Set certonly in choose config plugins as we do for renew

* rewrite by piggybacking on existing side effects of a dry run instead

* do not allow domains to be set while reconfiguring

* remove unused cert_manager.reconfigure

* remove unused imports

* Add comments and messages

* add cli information

* start adding tests

* remove test code

* get certname before setting up plugins

* get plugin from lineage if not set on cli

* import copy

* always reconstitute

* only load cert once

* add error message

* improve comment

* mock everything out for tests

* test functionality is working!

* add tests for adding and modifying hooks

* test that we don't modify the config if the dry run fails

* improve documentation

* add webroot to reconfigure common options

* lint and clean up intermediate artifacts

* mock validate_hooks for windows

* print success message with updated parameters

* Improve success message

* add message for no changes have been made

* improve changed message to show before as well

* syntax

* Add changes will apply at the next renewal message

* lint

* lint really likes dict.items() for some reason

* run the deploy hook

* turn off dry run to test deploy hook

* patch list_hooks call for tests

* factor out reporting results code

* Remove reporting of which values were changed

* add flag to run deploy hook despite doing a dry run, and recommend setting that to yes when running reconfigure and modifying the deploy hook

* missing () around multi-line string

* test if the two dicts are equal instead of finding the actual changes, thus avoiding having to deal with webroot_map being a list

* refer to --deploy-hook instead of deploy hook

* use renewal configuration instead of configuration information

* mention that the deploy hook will use the active cert not the test one

* disable lint and remove new from language asking about running a deploy hook

* pluralize run deploy hook(s)

* Add test for reporting results when there is a webroot map

* update changelog

* Update error message about modifying domains on the certificate

* update changelog

* Add basic integration tests

* Just set -a rather than redoing the whole testing infrastructure

* used webroot in integration test since it's already installed

* file contents are accessed twice now

---------

Co-authored-by: Alex Zorin <alex@zorin.au>
2023-02-04 08:46:08 +11:00
alexzorin
724635bbbd docs: generate a man page with a structure (#9561)
If you looked at [the Debian man page for Certbot](https://manpages.debian.org/bullseye/certbot/certbot.1.en.html) or [the FreeBSD one](https://man.freebsd.org/cgi/man.cgi?query=certbot&sektion=1&apropos=0&manpath=FreeBSD+13.1-RELEASE+and+Ports), you will notice that the entire document is in the "NAME" section. It looks weird in particular on the [FreeBSD man page listing](https://man.freebsd.org/cgi/man.cgi?query=certbot&apropos=1&sektion=0&manpath=FreeBSD+13.1-RELEASE+and+Ports&arch=default&format=html).

This PR adds some structure to the man page by adding a new "Synopsis" section (lifted from the Certbot snap's synopsis) and shoving the `certbot --help all` output into a new "Options" section. I think this should be sustainable for us, without having to worry about the man page in particular.

Fixes #9560.
2023-02-03 11:35:15 -08:00
Daniel McMahon
71a14f5193 Fix docs google permissions (#9556)
* include project level IAM requirements

* add name to authors.md

* Update certbot-dns-google/certbot_dns_google/__init__.py

Co-authored-by: alexzorin <alex@zorin.au>

* Update certbot-dns-google/certbot_dns_google/__init__.py

Co-authored-by: alexzorin <alex@zorin.au>

* Update certbot-dns-google/certbot_dns_google/__init__.py

Co-authored-by: alexzorin <alex@zorin.au>

---------

Co-authored-by: Daniel McMahon <daniel@igloocontrols.com>
Co-authored-by: alexzorin <alex@zorin.au>
2023-02-02 07:59:35 +11:00
alexzorin
cea717db3e docs: update -d flag copy to be CA-agnostic (#9542)
Some confusion ensued in [this community thread](https://community.letsencrypt.org/t/connection-between-ios-9-support-and-subject-common-name-or-x509v3-subject-alternative-name-critical/191619) about the Subject CN, which Certbot omits from the CSR, Let's Encrypt includes in the issued certificate, but some other CAs do not. 

It's probably for the best that we do not entomb Let's Encrypt's current issuance practices in Certbot's documentation.
2023-02-01 10:49:37 -08:00
alexzorin
e75dc1dfd0 show_account: display account thumbprint (#9540)
In #9127, where @osirisinferi added the `show_account` verb, I made a call not to include the thumbprint in the output of `certbot show_account`.

In hindsight, and after a community member asked for this feature, I think it's better to include it. 

It is useful on occasion and `show_account` is fairly specialized anyway. It's only really good for getting your account URL for rate limit increases, checking your contacts, and (now) and doing *magic* with the thumbprint for stateless/distributed HTTP-01 responders.

Without this feature, a clever user might figure out their thumbprint by doing a `certonly --manual --preferred-challenges http` request, but most users would probably be lost.

* show_account: display account thumbprint

* use local key for display
2023-02-01 10:48:13 -08:00
Brad Warren
1b1b27df28 Change coverage upload condition (#9552)
* change coverage upload condition

* fix typo

* set uploadCoverage

* add comment

* change coverage upload condition

* verbose version
2023-02-01 17:08:43 +11:00
Brad Warren
00f8d82808 double progressive percentage (#9557) 2023-02-01 07:05:01 +11:00
Will Greenberg
8226d30af0 Bump up the number of operations to 30 (#9554)
This is the default value, which is sensible since an "operation"
basically corresponds to a GH API call, and 1 won't really let us
do anything.
2023-01-28 08:16:15 +11:00
alexzorin
f0b6ba072f certbot-ci: boulder only supports port 80 for http-01 (#9548)
* certbot-ci: boulder will now only supports port 80 for http-01

* forgot to actually use the http_01_port argument

* print the port the proxy listens on

* try allow binding to privileged ports
2023-01-27 14:44:17 +11:00
Will Greenberg
99fea03c50 Merge pull request #9541 from certbot/remove-legacy-new-authz-support
account: stop storing legacy new_authzr_uri
2023-01-26 17:52:33 -08:00
Alex Zorin
08e008ac54 remove unused attributes from test 2023-01-27 10:41:45 +11:00
Alex Zorin
2e3cace739 remove docstring for removed argument 2023-01-27 10:38:00 +11:00
Alex Zorin
f3c6f7d46e Merge remote-tracking branch 'origin/master' into remove-legacy-new-authz-support 2023-01-27 09:04:16 +11:00
Will Greenberg
b0748b69e7 Replace probot/stale app with a Github Action (#9466)
* Replace probot/stale app with a Github Action

This creates a Github Actions workflow which seems to be the supported
way of automarking issues as stale. Adds a dry-run flag to test it out.

* small fixups

* cron typo

* disable unnecessary permissions

* use friendlier name
2023-01-25 15:59:22 -08:00
Brad Warren
c79a5d4407 Start sending coverage data to codecov (#9544)
* set up codecov

* export coverage data to xml
2023-01-26 08:15:51 +11:00
Brad Warren
4ad71ab5ae Fix tox environments (#9547)
* fix cover tox envs

* make test work on all Pythons

* Remove unused import

Co-authored-by: alexzorin <alex@zorin.id.au>

Co-authored-by: alexzorin <alex@zorin.id.au>
2023-01-25 12:00:06 +11:00
Will Greenberg
81ff6fcc0d acme.messages.Error: add mutability (#9546)
* acme.messages.Error: add mutability

As of Python 3.11, an exception caught within a `with` statement will
update the __traceback__ attribute. Because acme.messages.Error was
immutable, this was causing a knock-on exception, causing certbot to
exit abnormally. This commit hacks in mutability for acme.messages.Error

Fixes #9539

* Add CHANGELOG entry
2023-01-25 09:06:53 +11:00
Brad Warren
613e698199 disable random sleep in lock_test.py (#9545) 2023-01-25 08:05:01 +11:00
Alex Zorin
554143e187 fix lint 2023-01-23 19:43:34 +11:00
Alex Zorin
6505054f62 account: stop storing legacy new_authzr_uri 2023-01-23 18:41:25 +11:00
alexzorin
be3bf316c0 Deprecate {csr, keys} dirs & automatically truncate lineages (#9537)
Based on my design [here](https://docs.google.com/document/d/1jGh_bZPnrhi96KzuIcyCJfnudl4m3pRPGkiK4fTo8e4/edit?usp=sharing). 

Fixes https://github.com/certbot/certbot/issues/4634 and https://github.com/certbot/certbot/issues/4635.

- [x] Deprecate `NamespaceConfig.csr_dir`,`NamespaceConfig.key_dir`, ~~`constants.CSR_DIR` and `constants.KEY_DIR`~~. (`constants` is `_internal` so we can just delete it eventually).
- [x] Update `certbot.crypto_util.generate_csr` and `.generate_key` to make `csr_dir` and `key_dir` optional, respectively.
- [x] Change `certbot._internal.client.Client.obtain_certificate` to no longer include `csr_dir` and `key_dir` to the `.generate_csr` and `.generate_key` calls, respectively.
- Automatically delete unwanted lineage items:
  - [x] In `certbot._internal.storage.RenewableCert`, add a function to truncate the lineage history according to the criteria (keep the current and the 5 prior certificates). 
      - [x] Add a test suite for `truncate` 
  - [x] In `certbot._internal.renewal.renew_cert`, call the lineage truncation function after the symlinks have been updated for the renewal.


* Stop writing new files to /csr and /keys

* storage: add lineage truncation

* remove unused code

* deprecate keys_dir and csr_dir

* update CHANGELOG

* just keep 5 prior certificates, dont be clever with expiry

* docs: remove reference to /archive and /keys

* filter {csr,key}_dir deprecations directly in tests
2023-01-19 17:21:26 -08:00
alexzorin
e7fcd0e08d docs: give webroot and standalone better descriptions (#9536) 2023-01-12 08:03:51 -08:00
alexzorin
8149e255c8 Merge pull request #9534 from certbot/candidate-2.2.0
Update files from 2.2 release
2023-01-12 15:11:23 +11:00
Brad Warren
32a233d93b Bump version to 2.3.0 2023-01-11 13:21:23 -08:00
Brad Warren
a63bf5f88b Add contents to certbot/CHANGELOG.md for next version 2023-01-11 13:21:23 -08:00
Brad Warren
4ab4c9b65d Release 2.2.0 2023-01-11 13:21:22 -08:00
Brad Warren
b56df2fdd9 Update changelog for 2.2.0 release 2023-01-11 13:20:17 -08:00
Brad Warren
b1f22aa8a2 Add progressive release tooling (#9532)
This is based on what I wrote at https://opensource.eff.org/eff-open-source/pl/k1b4pcxnifyj9m7o4wdq7cka8h.
2023-01-11 12:27:38 -08:00
alexzorin
d641f062f2 limit challenge polling to 30 minutes (#9527)
* limit challenge polling to 30 minutes

* Fix docstring typo

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2023-01-06 09:24:58 +11:00
Brad Warren
666e12b25d upgrade shellingham (#9529) 2023-01-05 19:30:47 +11:00
Alex Bouma
b81ef33f33 Add link to dns-dnsmanager third party plugin (#9523) 2022-12-25 09:07:12 +11:00
Brad Warren
8155d60e9a remove setuptools pin (#9520) 2022-12-21 10:59:41 +11:00
Brad Warren
124e6d80c3 separate cover environment to workaround tox bug (#9519) 2022-12-19 13:38:04 -08:00
Brad Warren
ac75977156 update 1.32.x reqs (#9516) 2022-12-18 08:16:36 +11:00
alexzorin
63ff1f2a3a Merge pull request #9517 from certbot/candidate-1.32.2
Update master from 1.32.2 release
2022-12-18 08:13:52 +11:00
Brad Warren
74af586f4b Merge branch 'master' into candidate-1.32.2 2022-12-16 14:16:58 -08:00
Brad Warren
c3e1d7e560 Bump version to 2.2.0 2022-12-16 12:46:36 -08:00
Brad Warren
8e30f13e57 Add contents to certbot/CHANGELOG.md for next version 2022-12-16 12:46:36 -08:00
Brad Warren
06bba7167d Release 1.32.2 2022-12-16 12:46:34 -08:00
Brad Warren
118fce34d3 Update changelog for 1.32.2 release 2022-12-16 12:45:28 -08:00
Brad Warren
746631351f Prep for 1.32.2 (#9514)
* Update dependencies (#9505)

* upgrade dependencies

* forbid old setuptools

(cherry picked from commit 70a36fdf00)

* fix help output (#9509)

(cherry picked from commit 27af7b5d15)

* add reminder to repin.sh

* write changelog entry

* pin back mypy
2022-12-16 12:43:17 -08:00
alexzorin
3bc463a66f Merge pull request #9512 from certbot/candidate-2.1.1
Update master from 2.1.1 release
2022-12-17 07:36:22 +11:00
Brad Warren
ac0f4ba3ee Merge branch 'master' into candidate-2.1.1 2022-12-15 08:21:28 -08:00
Brad Warren
d47242296d Bump version to 2.2.0 2022-12-15 07:14:18 -08:00
Brad Warren
edfd84fab5 Add contents to certbot/CHANGELOG.md for next version 2022-12-15 07:14:18 -08:00
Brad Warren
af503ad836 Release 2.1.1 2022-12-15 07:14:17 -08:00
Brad Warren
06d40ec272 Update changelog for 2.1.1 release 2022-12-15 07:13:22 -08:00
Brad Warren
1615185a14 Prepare for 2.1.1 (#9508)
* Update dependencies (#9505)

* upgrade dependencies

* forbid old setuptools

(cherry picked from commit 70a36fdf00)

* prep changelog

* also mention windows
2022-12-15 11:31:56 +11:00
Brad Warren
27af7b5d15 fix help output (#9509) 2022-12-15 11:27:23 +11:00
Brad Warren
a807240db7 add 1.32.x/requirements.txt (#9506) 2022-12-13 11:00:30 +11:00
Brad Warren
70a36fdf00 Update dependencies (#9505)
* upgrade dependencies

* forbid old setuptools
2022-12-13 10:48:17 +11:00
Marcel Robitaille
6b7549bf3a Add filename to dns_common.py configuration errors (#9501)
Fixes #9500

Also print the path to the file with errors for the error "Error parsing credentials configuration" of `dns_common.py`. This makes debugging this error much easier.
2022-12-09 14:55:07 -08:00
alexzorin
4c04328e6d Merge pull request #9498 from certbot/candidate-2.1.0
Update files from 2.1.0 release
2022-12-08 06:37:34 +11:00
Brad Warren
7240e06613 Bump version to 2.2.0 2022-12-07 06:51:42 -08:00
Brad Warren
51bf92f353 Add contents to certbot/CHANGELOG.md for next version 2022-12-07 06:51:42 -08:00
Brad Warren
5e193eb12f Release 2.1.0 2022-12-07 06:51:41 -08:00
Brad Warren
63ea7d54e7 Update changelog for 2.1.0 release 2022-12-07 06:50:45 -08:00
alexzorin
26d3ab86b8 dns-linode: fix confusing credentials example (#9493) 2022-12-05 14:25:07 -08:00
ohemorange
b6695b7213 Merge pull request #9496 from certbot/1.32.x-candidate-1.32.1
Update 1.32.x from 1.32.1 release
2022-12-05 14:22:58 -08:00
ohemorange
1f262e677c Merge pull request #9494 from certbot/candidate-1.32.1
Update master changelog from 1.32.1 release
2022-12-05 14:22:53 -08:00
Brad Warren
023bb494b5 undo help text changes 2022-12-05 08:05:50 -08:00
Brad Warren
70d3fc5916 Merge branch 'master' into candidate-1.32.1 2022-12-05 08:00:21 -08:00
Brad Warren
e22d78b36c Bump version to 2.0.0 2022-12-05 07:04:31 -08:00
Brad Warren
17a7097011 Add contents to certbot/CHANGELOG.md for next version 2022-12-05 07:04:31 -08:00
Brad Warren
27809fbc59 Release 1.32.1 2022-12-05 07:04:30 -08:00
Brad Warren
a6ef3245ae Update changelog for 1.32.1 release 2022-12-05 07:03:16 -08:00
Brad Warren
1b5afb179f Prep for 1.32.1 (#9492)
I wanted to do this because we were notified that https://ubuntu.com/security/notices/USN-5638-3/ affects our snaps. This probably doesn't affect us, but rebuilding to be safe seems worth it to me personally.

I started to just trigger a new v1.32.0 release build, but I don't want to overwrite our 2.0 Docker images under the `latest` tag.

Changelog changes here are similar to what has been done for past point releases like https://github.com/certbot/certbot/pull/8501.

I also cherry picked #9474 to this branch to help the release process pass.

* add changelog

* Use a longer timeout for releases (#9474)

This is in response to the thread starting at https://github.com/certbot/certbot/pull/9330#issuecomment-1320416069.

In addition to this, I plan to add the following text to the step of the release instructions that tells you to wait until Azure Pipelines for the release has finished running:

> Some jobs such as building our snaps can take a long time to complete, however, if the process seems hung, you can cancel the build and then rerun the failed jobs. To do this, click on the build for the release in the link above, make sure you're logged into Azure Pipelines, and then use the cancel/rerun buttons in the top right of the web page.

(cherry picked from commit 30b4fd59a5)
2022-12-05 07:00:44 -08:00
Brad Warren
f0251a7959 fix apache unit tests (#9490)
Fixes https://github.com/certbot/certbot/issues/9481.

I poked around our other uses of this function and they seem OK to me for now, however, I opened https://github.com/certbot/certbot/issues/9489 to track the bigger refactor I think we should do here.
2022-12-01 12:27:24 -08:00
Brad Warren
8390c65a95 fix certbot plugins output (#9488) 2022-12-01 08:56:09 +11:00
alexzorin
fe5e56a52c certbot.interfaces: reintroduce empty zope interfaces (#9486)
* reintroduce certbot.interfaces.I* classes

* add wiki link
2022-12-01 08:42:54 +11:00
alexzorin
c178fa8c0b nginx: on encountering lua directives, produce a better warning (#9475)
* nginx: capitalise product names in warning message properly

* nginx: don't crash on encountering lua directives, warn instead

* add tests

* undo excess newline

* fix oldest tests: use old camelCase function name

* add missing newline in new testdata

* add tests for _by_lua, which should parse fine
2022-11-30 12:03:51 +11:00
Will Greenberg
c78503f21d Merge pull request #9477 from certbot/candidate-2.0.0
Release 2.0.0
2022-11-21 12:12:00 -08:00
Brad Warren
f171f0fcd9 remove botocore warning exceptions (#9476) 2022-11-22 06:42:00 +11:00
Will Greenberg
1e61513859 Bump version to 2.1.0 2022-11-21 09:59:06 -08:00
Will Greenberg
7b27d98370 Add contents to certbot/CHANGELOG.md for next version 2022-11-21 09:59:06 -08:00
Will Greenberg
3d0c2abd3b Release 2.0.0 2022-11-21 09:59:04 -08:00
Will Greenberg
f11dad9e04 Update changelog for 2.0.0 release 2022-11-21 09:58:20 -08:00
Brad Warren
30b4fd59a5 Use a longer timeout for releases (#9474)
This is in response to the thread starting at https://github.com/certbot/certbot/pull/9330#issuecomment-1320416069.

In addition to this, I plan to add the following text to the step of the release instructions that tells you to wait until Azure Pipelines for the release has finished running:

> Some jobs such as building our snaps can take a long time to complete, however, if the process seems hung, you can cancel the build and then rerun the failed jobs. To do this, click on the build for the release in the link above, make sure you're logged into Azure Pipelines, and then use the cancel/rerun buttons in the top right of the web page.
2022-11-21 08:18:06 -08:00
alexzorin
b2dc3e99d6 docs: remove section about dual RSA/ECDSA from User Guide (#9473)
As agreed here: https://github.com/certbot/certbot/pull/9465#discussion_r1025498427
2022-11-17 13:35:20 -08:00
Brad Warren
1c5e56d9c7 Claim Python 3.11 support and add tests (#9471)
* set up 3.11 tests

* fixup warnings

* sed -i "s/\( *'Pro.*3\.1\)0\(',\)/\10\2\n\11\2/" */setup.py

* update changelog
2022-11-18 07:55:27 +11:00
Brad Warren
ad708a0299 remove pylint pinning (#9472) 2022-11-18 07:36:50 +11:00
alexzorin
371cc6f9f1 docs: rewrite ecdsa section of user guide (#9465)
At the time this section was written, it was all about the introduction of support for ECDSA and how users can start taking advantage of that support.

Now that we use ECDSA by default, this piece of documentation probably should serve a new purpose. My idea here is to document the new behavior that we have in 2.0:  new key type on new certificates, old certificates will keep their existing key type.

Users may now be going in the reverse direction with their changes ("I got an ECDSA certificate but I need RSA because I have an old load balancer appliance!") so I have also updated some section titles to be less about ECDSA and more about Key Types in general.

Fixes #9442.
2022-11-17 09:41:34 -08:00
Brad Warren
d244013355 Upgrade pylint (#9470)
* upgrade pylint

* pylint --generate-rcfile > .pylintrc

* fixup pylintrc

* Remove unnecessary lambdas

* fix broad-except

* fix missing timeouts

* fix unit tests

* catch more generic exception
2022-11-17 18:21:14 +11:00
Brad Warren
652d5e96be Drop awscli dependency (#9459)
Fixes https://github.com/certbot/certbot/issues/9458.

* update readme

* drop awscli

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2022-11-16 17:10:18 -08:00
Brad Warren
455f9a0d6c Explain Certbot 2.0 snaps in changelog (#9469) 2022-11-17 11:40:17 +11:00
Brad Warren
9c003bc2d6 Add 2.0 release logic (#9467) (#9468)
This PR:

* Deletes the 2.0 pre-release pipeline
* Causes 1.x releases to be released to Docker Hub without updating the latest tag, PyPI, and the candidate and stable channels of the snap store
* Causes 2.x releases to be released to Docker Hub, PyPI, the beta channel of the snap store, and our Windows installer
We could potentially look into how to continue to do 1.x Windows installer releases through GitHub releases and tech ops tooling, but I personally don't think it's worth it right now.

This PR DOES NOT do anything about progressive snap releases. I think we can revisit this when/if we decide (how) to do them.

(cherry picked from commit 09af133af3)
2022-11-17 11:38:40 +11:00
Brad Warren
09af133af3 Add 2.0 release logic (#9467)
This PR:

* Deletes the 2.0 pre-release pipeline
* Causes 1.x releases to be released to Docker Hub without updating the latest tag, PyPI, and the candidate and stable channels of the snap store
* Causes 2.x releases to be released to Docker Hub, PyPI, the beta channel of the snap store, and our Windows installer
We could potentially look into how to continue to do 1.x Windows installer releases through GitHub releases and tech ops tooling, but I personally don't think it's worth it right now.

This PR DOES NOT do anything about progressive snap releases. I think we can revisit this when/if we decide (how) to do them.
2022-11-16 15:29:53 -08:00
Will Greenberg
21ef8e4332 main: set more permissive umask when creating work_dir (#9448)
* main: set more permissive umask when creating work_dir

This'll guarantee our working dir has the appropriate permissions,
even when a user has a strict umask

* update changelog

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2022-11-14 14:35:29 -08:00
Brad Warren
383a42851c Merge pull request #9461 from certbot/merge-2.0.x
Merge 2.0.x
2022-11-14 09:50:15 -08:00
Alex Zorin
f9962c3013 changelog: add 2.0 entries 2022-11-12 17:00:06 +11:00
Alex Zorin
a384886a15 changelog: update latest section to 2.0.0 2022-11-12 16:48:40 +11:00
Brad Warren
10f60bab0c Merge pull request #9460 from alexzorin/2.0.x
Merge `master` into `2.0.x`
2022-11-11 12:36:48 -08:00
Alex Zorin
202db15274 fix new mypy complaints 2022-11-11 18:03:57 +11:00
Alex Zorin
1773edcad0 Merge remote-tracking branch 'origin/master' into 2.0.x 2022-11-11 17:25:42 +11:00
Brad Warren
a8015fa102 Merge pull request #9457 from certbot/candidate-1.32.0
Release 1.32.0
2022-11-09 14:00:14 -08:00
Erica Portnoy
fd22bd0f66 Bump version to 1.33.0 2022-11-08 15:23:35 -08:00
Erica Portnoy
c087b6f6c9 Add contents to certbot/CHANGELOG.md for next version 2022-11-08 15:23:35 -08:00
Erica Portnoy
d88b9a5d11 Release 1.32.0 2022-11-08 15:23:34 -08:00
Erica Portnoy
dd2df86625 Update changelog for 1.32.0 release 2022-11-08 15:22:20 -08:00
alexzorin
7ab82b6f64 repin dependencies (#9454) 2022-11-02 12:32:00 -07:00
Brad Warren
9cf062d8d4 disable poetry's cache (#9453) 2022-11-02 10:23:57 -07:00
Kevin Jones
63de0ca9e6 Use https: protocol instead of deprecated git: protocol (#9452) 2022-10-31 14:17:50 -07:00
Will Greenberg
f73e062c7a Fix changelog entry (#9444)
* Fix changelog entry

* move to 1.32.0

Co-authored-by: Brad Warren <bmw@eff.org>
2022-11-01 07:22:07 +11:00
Will Greenberg
7865bbd39a Add comment explainig the load-bearing debug flags (#9443) 2022-10-27 14:47:29 +11:00
Will Greenberg
eed1afb808 certbot-apache: use httpd by default for CentOS/RHEL (#9402)
* certbot-apache: use httpd for newer RHEL derived distros

A change in RHEL 9 is causing apachectl to error out when used
with additional arguments, resulting in certbot errors. The CentOS
configurator now uses httpd instead for RHEL 9 (and later) derived
distros.

* Single CentOS class which uses the apache_bin option

* soothe mypy

* Always call super()._override_cmds()
2022-10-26 15:07:02 -07:00
Brad Warren
529942fe4b Unpin poetry (#9438)
* unpin poetry

* export constraints
2022-10-21 10:59:33 +02:00
Brad Warren
3a738cadc3 Remove docker-compose dependency (#9436)
This is progress towards https://github.com/certbot/certbot/issues/9370 as discussed at https://github.com/certbot/certbot/pull/9435.

I kept the command using `docker-compose` because `docker compose` doesn't seem that widely recognized yet and https://www.docker.com/blog/announcing-compose-v2-general-availability/ describes aliasing `docker-compose` to `docker compose` on newer systems by default.

* refactor boulder shutdown

* remove docker-compose dep

* Reorder shutdown process
2022-10-20 13:07:18 -07:00
alexzorin
5270c34dd7 docs: use modern tsig-keygen util in certbot-dns-rfc2136 (#9424)
Fixes #7206.

I think it's about time we did this:

- `dnssec-keygen` on new distros doesn't support the HMAC algorithms anymore, so our instructions don't work.
- The oldest distros we support are Debian Buster (`9.11.5.P4+dfsg-5.1+deb10u7`) and CentOS 7 (`9.11.4-26.P2.el7_9.9`), which ship `tsig-keygen` and support `HMAC-SHA512`.
2022-10-17 16:55:00 -07:00
alexzorin
314ded348e docs: add third-party dns-multi plugin (#9430) 2022-10-13 17:58:18 -07:00
Phil Martin
92aaa9703b TSIG SOA query fix (#9408)
* Use the TSIG keyring for the initial SOA request

Helps allow the use of keys in BIND ACLs to help certbot update the correct zone. Previously TSIG was only used for zone updates, rather than for both the authoritative SOA request and zone update.

* Update CHANGELOG.md

* Update AUTHORS.md

* Workaround for mypy failure due to dnspython stubs

As per https://github.com/certbot/certbot/pull/9408#issuecomment-1257868864

Co-authored-by: Alex Zorin <alex@zorin.id.au>
2022-10-14 08:52:08 +11:00
alexzorin
f5e7d16303 don't superfluously ask whether to renew, when changing key type (#9421)
* dont superfluously ask whether to renew, when changing key type

* reorder conditions

this prevents "Certificate not yet due for renewal" being printed

* and replace superfluous mock

* mock renewal.should_renew
2022-10-06 14:29:58 -07:00
Brad Warren
a0b8a2cc62 Merge pull request #9426 from certbot/2.0-merge-master
2.0.x: merge master and bump version to 2.0.0.dev0
2022-10-06 12:04:35 -07:00
Alex Zorin
d5d8739783 bump version to 2.0.0.dev0 2022-10-05 05:17:29 +11:00
Alex Zorin
4fcc0f7c2a Merge branch 'master' into 2.0-merge-master 2022-10-05 05:15:39 +11:00
alexzorin
e84271b36b Merge pull request #9425 from certbot/candidate-1.31.0
Release 1.31.0
2022-10-05 05:09:37 +11:00
Brad Warren
3eac48ba5a Bump version to 1.32.0 2022-10-04 07:41:45 -07:00
Brad Warren
9409c086d4 Add contents to certbot/CHANGELOG.md for next version 2022-10-04 07:41:45 -07:00
Brad Warren
d0fbde9126 Release 1.31.0 2022-10-04 07:41:44 -07:00
Brad Warren
049e29cc1c Update changelog for 1.31.0 release 2022-10-04 07:40:41 -07:00
osirisinferi
e3448fa0d5 Fix typo in install.rst (#9422) 2022-10-02 10:06:27 +11:00
Alexis
2460d9ad0c Docs: Rewrite Installation Instructions: User Guide (#9220)
* Rewrite Installation Instrcutions: User Guide

Simplifying Installation instructions in User Guide

- First step in simplifying docs for Certbot Users

* Amend Install Doc

- Address errors
- Clean up links

* Update certbot/docs/install.rst

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/docs/install.rst

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/docs/install.rst

Co-authored-by: alexzorin <alex@zor.io>

* Amend instructions
- clarify requirements
- update outdated advice
- remove direct link

* Remove unintentinally added files

Co-authored-by: alexzorin <alex@zor.io>
2022-10-01 09:13:30 +10:00
Charlie Britton
4ec115cca5 Add single domain option for OVH DNS creds (#9419) 2022-09-29 19:06:41 -07:00
alexzorin
fdd2a7e937 plugins: remove support for dist:plugin plugin names (#9359)
* plugins: remove support for dist:plugin plugin names

* address feedback
2022-09-30 07:09:03 +10:00
Will Greenberg
26d479d6e3 Remove external mock dependency (#9331)
* Remove external mock dependency

This also removes the "external-mock" test environment

* remove superfluous ignores

* remove mock warning ignore from pytest.ini

* drop deps on mock in oldest, drop dep on types-mock

Co-authored-by: Alex Zorin <alex@zorin.id.au>
2022-09-28 16:17:03 -07:00
Will Greenberg
c9eba6ccd3 Merge pull request #9353 from alexzorin/ecdsa-default-flag
change default key_type from rsa to ecdsa
2022-09-27 12:12:48 -07:00
Alex Zorin
5d6e067a74 fix tests broken by #9262 2022-09-27 13:51:35 +10:00
Alex Zorin
652c06a8ae fix typo in key conflict error message 2022-09-27 13:51:16 +10:00
Alex Zorin
f6d532a15b Merge remote-tracking branch 'origin/2.0.x' into ecdsa-default-flag 2022-09-27 12:38:20 +10:00
alexzorin
212c2ba990 error out when --reuse-key conflicts with other flags (#9262)
* error out when --reuse-key conflicts with other flags

* add unit test

* add integration tests

* lint
2022-09-27 12:37:24 +10:00
Brad Warren
c42dd567ca remove source_address arg (#9418) 2022-09-27 12:30:05 +10:00
osirisinferi
a845ab8446 Fix regression in Cloudflare library (#9417)
* Fix regression in CF library

* Add changelog entry

* Fix typo

Co-authored-by: alexzorin <alex@zor.io>

* Add note to docs

Co-authored-by: alexzorin <alex@zor.io>
2022-09-27 07:48:30 +10:00
Brad Warren
758cfb9f79 upgrade base docker image (#9415) 2022-09-26 20:36:08 +10:00
Will Greenberg
7c3b9043a1 Merge pull request #9414 from certbot/simplify-ci
Actually test everything in test- branches (besides deployment)
2022-09-22 14:09:20 -07:00
Brad Warren
e0b639397b actually test everything in test- branches 2022-09-22 07:07:43 -07:00
Brad Warren
db31a8c1f5 Upgrade dependency pinnings (#9412)
* upgrade dependencies

* remove unused ignore
2022-09-21 18:37:30 +10:00
osirisinferi
d214da191d Certbot-specific temp log dir prefix (#9406)
Fixes #9405.
2022-09-16 06:34:02 -07:00
Patrick Neumann
0326cbf95e Update generate_dnsplugins_snapcraft.sh (#9398)
There is no need for two interconneced (pipe) processes.
The regular expression in the grep part is not strict enough in some cases (presence of long_description.
sed does not seem to support perl regular expressions ("\s").
Some Python developers prefer single quotes to double qoutes. Some even go so far as to adapt generated templates (setup.py).
This update will (hopefully) fix this all.
This was tested on Ubuntu 20.04.5 LTS (Focal Fossa) and macOS 12.5.1 (Monterey).
2022-09-13 07:16:27 -07:00
ohemorange
314b2ef89b Merge pull request #9404 from certbot/master
Add 2.0 pre-release pipeline to 2.0.x branch
2022-09-12 15:56:54 -07:00
Brad Warren
39e8d14e1b Set up 2.0 pre-releases (#9400)
* update credential info

* update release tooling to use candidate channel

* split deploy jobs

* pass parameter through

* add 2.0 pipeline prerelease

* add comments

* quote file path
2022-09-09 14:23:39 -07:00
alexzorin
f4db687130 Merge pull request #9401 from alexzorin/update-2.0.x
Merge master into 2.0.x
2022-09-09 09:59:52 +10:00
Alex Zorin
63771b48bb Merge remote-tracking branch 'origin/master' into update-2.0.x 2022-09-09 08:37:56 +10:00
Brad Warren
80071c86f5 Merge pull request #9399 from certbot/candidate-1.30.0
Release 1.30.0
2022-09-08 10:28:45 -07:00
Will Greenberg
614eaf6898 Bump version to 1.31.0 2022-09-07 11:09:12 -07:00
Will Greenberg
0b284125d2 Add contents to certbot/CHANGELOG.md for next version 2022-09-07 11:09:12 -07:00
Will Greenberg
667b736879 Release 1.30.0 2022-09-07 11:09:11 -07:00
Will Greenberg
c68d4d6389 Update changelog for 1.30.0 release 2022-09-07 11:08:15 -07:00
Adrien Ferrand
9d736d5c9c Remove zope from Certbot (#9161)
* Remove zope and the internal reporter util.

* remove zope references from .pylintrc and pytest.ini

Co-authored-by: Alex Zorin <alex@zorin.id.au>
2022-09-07 15:09:32 +10:00
Will Greenberg
529a0e2272 Remove deprecated functions (#9315)
* Remove deprecated functions

* rm unused imports

* actually remove execute_command!

* revert changelog

Co-authored-by: Alex Zorin <alex@zorin.id.au>
2022-09-07 13:31:21 +10:00
Will Greenberg
a4a2315537 Removed deprecated functions (#9314)
* Removed deprecated functions

* rm import of distutils.version

* revert changelog

Co-authored-by: Alex Zorin <alex@zorin.id.au>
2022-09-07 13:20:56 +10:00
alexzorin
5e247d1683 unexport attributes in certbot.display.util (#9358) 2022-09-07 13:00:05 +10:00
Will Greenberg
20ca9288d5 Add UI text recommending multi-domain certs (#9393)
* Suggest multi-domain certs in domain selection menu

* Update changelog

* lint: fix long line

Co-authored-by: Alex Zorin <alex@zorin.id.au>
2022-09-07 12:55:58 +10:00
alexzorin
804ca32314 acme: remove Client and BackwardsCompatibleClientV2 (#9356)
* acme: remove Client and BackwardsCompatibleClientV2

* remove ClientTestBase and some unused variables

* add ClientV2.get_directory

* tweak ToS callback code

* acme: update example to use ClientV2.get_directory

* simplify ToS callback further into one step

* further removal of acmev1-related code

- remove acme.client.ClientBase
- remove acme.mixins.VersionedLEACMEMixin
- remove acme.client.DER_CONTENT_TYPE
- remove various ACMEv1 special cases
- remove acme.messages.ChallengeResources.combinations

* remove .mixins.ResourceMixin, fields.resource, fields.Resource
and resource field from various .message classes.

* simplify acme.messages.Directory:

- remove Directory.register
- remove HasResourceType and GenericHasResourceType
- remove ability to look up Directory resources by anything other
  than the exact field name in RFC8555 (section 9.7.5)

* remove acme.messages.OLD_ERROR_PREFIX and support the old prefix

* remove acme.mixins

* reorder imports

* add comment to Directory about resource lookups

* s/new-cert/newOrder/

* get rid of `resource` sillyness in tests

* remove acmev1 terms-of-service support from directory
2022-09-06 14:36:55 -07:00
alexzorin
c20d40ddba acme: further deprecations (#9395)
* acme: deprecate acme.fields.Resource and .resource

* acme: deprecate .messages.OLD_ERROR_PREFIX

* acme: deprecate .messages.Directory.register

* acme: clean up deprecations

* dont use unscoped filterwarnings

* change deprecation approach for acme.fields

* warn on non-string keys in acme.messages.Directory

* remove leaked filterwarnings in BackwardsCompatibleClientV2Test

* remove non-string lookups of acme.messages.Directory
2022-09-02 06:55:04 -07:00
alexzorin
f7e61edcb2 deprecate more attributes in acme (#9369)
* deprecate more attributes in acme

* Deprecate .Authorization.combinations by renaming the field and
  deprecating in getters/setters

* Silence deprecation warnings from our own imports of acme.mixins

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2022-08-30 14:41:53 -07:00
Brad Warren
f9d148be56 Upgrade CI OS (#9391)
* upgrade ubuntu

* upgrade macos

* use python3
2022-08-30 16:39:48 +10:00
Brad Warren
012314d946 Deprecate source address (#9389)
* deprecate source_address

* filter warnings

* fix route53 tests

* test warning

* update docstring
2022-08-30 10:28:47 +10:00
alexzorin
d8e45c286d apache: remove support for Apache 2.2 and CentOS 6 (#9354)
* apache: remove support for Apache 2.2 and CentOS 6

* delete more unused code

* remove unused attributes

* reorganize REWRITE_HTTPS_ARGS*
2022-08-29 10:05:48 -07:00
alexzorin
a81d58fa6e deprecate certbot-dns-cloudxns (#9367) 2022-08-27 07:25:37 +10:00
Brad Warren
cb632c376f encourage words before code (#9377) 2022-08-17 09:01:51 +10:00
Matthew W. Thomas
94bbb4c44c docs: add BunnyDNS to list of 3rd-party plugins (#9375)
* docs: add BunnyDNS to list of 3rd-party plugins

You can find the plugin here:
https://github.com/mwt/certbot-dns-bunny
It's for [BunnyDNS](https://bunny.net/dns/).

* Update AUTHORS.md
2022-08-12 14:03:08 -07:00
alexzorin
2574a8dfb5 remove all cloudxns-related code (#9361) 2022-08-10 11:01:11 -07:00
Gusmanov Timur
1b79c077a6 add dns-yandexcloud authentication plugin to third-party plugins (#9371) 2022-07-29 12:01:01 -07:00
Brad Warren
b73f3e2b16 pin back pylint (#9368) 2022-07-29 12:58:47 +10:00
alexzorin
42a4d30267 deps: remove pyjwt dependency (#9337)
* deps: remove pyjwt dependency

* pinning: strip extras from dependencies

`poetry export` outputs in requirements.txt format, which is now
apparently producing "dep[extra]==...". We are using this output
as the constraints file for pip and pip's new resolver does not
permit extras in the constraints file.

This change filters out the extras specifiers.

* repin current dependencies

* fix new pylint complaints

* silence lint about distutils.version

We have already deprecated the function and it'll be removed in
2.0.

* docs: set sphinx language to 'en'

this is emitting a warning and failing the build

* Revert "pinning: strip extras from dependencies"

This reverts commit 11268fd23160ac53fd8dad7a2ff15e453678e159.

* pin poetry back to avoid extras issue

* repin

* fix new mypy complaints in acme/
2022-07-28 17:26:12 -07:00
Brad Warren
e9e7a69c7b Update Azure Docker docs (#9363)
* describe docker access token

more

* Remove extra spaces

Co-authored-by: ohemorange <ebportnoy@gmail.com>

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2022-07-28 13:28:36 -07:00
Preston Locke
495b97aafe Clarify in docs that deletion does not revoke (#9348)
* Clarify in docs that deletion does not revoke

* Add myself to AUTHORS.md

* Move new paragraph below first note and change its wording
2022-07-26 16:03:53 -07:00
alexzorin
f82530d8c0 letstest: replace ubuntu 21.10 with 22.04 (#9364)
as ubuntu 21.10 is now EOL
2022-07-25 13:43:49 -07:00
alexzorin
ae7967c8ae docs: how to override the trusted CA certificates (#9357)
* docs: how to override the trusted CA certificates

* Update certbot/docs/using.rst

Co-authored-by: ohemorange <ebportnoy@gmail.com>

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2022-07-19 16:17:27 -07:00
Alex Zorin
82b6e15be7 change default key_type from rsa to ecdsa 2022-07-18 18:27:19 +10:00
Shahar Naveh
32608a142b DOC: Fix typo (#9346)
Co-authored-by: Shahar Naveh <>
2022-07-11 11:30:50 -07:00
Shahar Naveh
b9f6c3e5b6 DEP: Pin version of cryptography (#9339)
* DEP: Pin version of cryptography

* Added myself to authors:)

Co-authored-by: Shahar Naveh <>
2022-07-08 12:57:48 -07:00
ohemorange
184e087edf Prompt for username in finish_release.py (#9343)
The local machine's username may not be the same as the one on the CSS, so let's prompt for it instead.
2022-07-08 12:27:50 -07:00
Will Greenberg
1da36a9278 If a snap build times out, dump the logs (#9340) 2022-07-07 14:31:48 -07:00
Will Greenberg
2b1255cd6a finish_release.py: fix revision regex, add more logging (#9342) 2022-07-06 17:40:27 -07:00
ohemorange
c599aa08ad Merge pull request #9341 from certbot/candidate-1.29.0
Release 1.29.0
2022-07-06 13:18:26 -07:00
Will Greenberg
f1f526d63c Bump version to 1.30.0 2022-07-05 11:16:40 -07:00
Will Greenberg
ef0746eb1d Add contents to certbot/CHANGELOG.md for next version 2022-07-05 11:16:40 -07:00
Will Greenberg
befa4434ad Release 1.29.0 2022-07-05 11:16:39 -07:00
Will Greenberg
7e2105fca8 Update changelog for 1.29.0 release 2022-07-05 11:15:47 -07:00
Alexis
6e1696ba32 Add Signed Windows Installer Workflow (#9076)
* Add Code Signing action for Windows Installer

* Clean up variable names and input

* Amend and add to documentation per PR guidelines

* Update tools/finish_release.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update tools/finish_release.py

Amend typo

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Amend release script for better work flow

- SCP commands to upload and download unsigned & signed installers from CSS

* Collapse spaces

* Update tools/finish_release.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Create new windows signer function

* Update Windows Installer Script

- Update change log
- add new function for signing and document
- @TODO Streammline SSH session

* Remove Azure and Github release methods

- Methods moved to CSS
- Reduced to a ssh function that triggers the process on a CSS

* Amend Chnagelog and Remove Unneeded Deps

* Update tools/finish_release.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Add Verison Fetch Function

- For the purpose of snap releases
- Add back package to dev extras for function

* Chaneg path in ssh command

* Amend release script

* Amend the ssh command for CSS

* Update tools/finish_release.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update script with proper path and subprocess call

* Update ssh command

* Correct typo in path

* Fix typo in path

* Update certbot/CHANGELOG.md

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* Remove missed conflict text

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
Co-authored-by: ohemorange <ebportnoy@gmail.com>
2022-06-29 15:52:50 -07:00
Amir Omidi
dedbdea1d9 Update generated CSRs to create V1 CSRs (#9334)
* Update generated CSRs to create V1 CSRs

Per the RFC: https://datatracker.ietf.org/doc/html/rfc2986#section-4

Version 3 CSRs, as far as I can tell, are not a thing (yet).

Relevant code in Go, for example: https://cs.opensource.google/go/go/+/refs/tags/go1.18.3:src/crypto/x509/x509.go;l=1979

* Update AUTHORS.md

* Unit test for PR #9334

* Add a small comment explaining this line for future readers.

* Add info to changelog

Co-authored-by: Paul Buonopane <paul@namepros.com>
2022-06-29 14:24:24 +10:00
Alexis Kim
b9f9952660 removed certbot-auto references from docs (#9333) 2022-06-28 11:43:57 +10:00
ohemorange
1d2540629f Use a different timeout for nightly vs daytime (release and extended) builds (#9330) 2022-06-22 18:06:53 -07:00
alexzorin
49f21bcc9f deps: bump pyOpenSSL in oldest pinnings (#9329) 2022-06-22 16:38:32 -07:00
ohemorange
885ebf80e3 Change snapcraft authentication to use SNAPCRAFT_STORE_CREDENTIALS (#9326)
* try the easy thing of just doing what the error message says

* temporarily add deploy stage to extended tests to see if it uploads properly

* follow instructions on https://forum.snapcraft.io/t/snapcraft-authentication-options/30473

* just run the packaging jobs for speed

* fix formatting

* import changes from test- branch and revert temporary changes

* Update instructions in deploy-stage.yml
2022-06-20 06:37:40 +10:00
Will Greenberg
7505bb0c60 Drop the snap build tiemout to 90 minutes (#9320)
It was previously 5.5 hours, which was just to have an exception thrown
before Azure's 6 hour timeout. Generally we aren't seeing this step take
more than 45 minutes, so 90 minutes seems like more than enough.
2022-06-14 15:09:09 -07:00
Will Greenberg
99da999b2b Merge pull request #9318 from certbot/docs-clarify-plugin-contributions
docs: clarify that we're not merging any new plugins (not just DNS)
2022-06-13 11:37:52 -07:00
Alex Zorin
7197ae4b77 docs: clarify that we're not merging any new plugins (not just DNS) 2022-06-09 07:51:28 +10:00
osirisinferi
1a25c4052c Change query_registration() to use _get_v2_account() (#9307)
* Change `query_registration()` to use `_get_v2_account()`

* Improve `_get_v2_account()`

Required for proper working of `certbot.main.update_registration()`. This
function updates the `regr.body` locally instead of passing the fields
which need to be updated to `acme.client.update_registration()` as a
separate argument in the `update` parameter.

* Revert "Improve `_get_v2_account()`"

This reverts commit e88a23ad76b6dc092645a870b3b5f99bd4fbd095.

* Improve `_get_v2_account() (version 2)

Instead of e88a23a, this change should be more compatible with older
ACMEv1 accounts used through symlinking ACMEv2 account dirs to the
existing ACMEv1 account dirs.
It should also still be compatible with `certbot.main.update_registration`.

* Move and slightly update CHANGELOG entry
2022-06-09 07:49:40 +10:00
James Balazs
a73a86bbc0 Retry errors with subproblems in obtain_certificate with --allow-subset-of-names (#9251) (#9272)
* Handle CAA failure on finalize_order during renewal (#9251)

* Fix CAA error on renewal test

* Attempt to fix failing test in CI

* Retry errors with subproblems in obtain_certificate_from_csr with allow_subset_of_names

Only retry if not all domains succeeded

* Back out renewal changes

* Fix linting error line too long

* Update log message for more general case and only log on retry

* Changelog entry

* Add retry logic to order creation

* Changelog entry wording

* Fix acme error handling when no subproblems provided

* Fix test name

* Use summarize domain list to display list of failed domains

* Tidy up incorrect client tests

* Remove unused var and output all failed domains

* Add logging to failed authorization case

* use _retry_obtain_certificate for failed authorizations

* Fix typo failing in CI

* Retry logic comments

* Preserve original error

* Move changelog entry to latest version
2022-06-08 18:36:13 +10:00
alexzorin
3b211a6e1b Merge pull request #9317 from certbot/candidate-1.28.0
Candidate 1.28.0
2022-06-08 16:48:40 +10:00
Will Greenberg
4dd603f786 Bump version to 1.29.0 2022-06-07 12:43:12 -07:00
Will Greenberg
0dac0f173a Add contents to certbot/CHANGELOG.md for next version 2022-06-07 12:43:12 -07:00
Will Greenberg
b9f9ebc4fc Release 1.28.0 2022-06-07 12:43:11 -07:00
Will Greenberg
bcf1ce3f33 Update changelog for 1.28.0 release 2022-06-07 12:41:07 -07:00
alexzorin
295fc5e33a cli: fix help text for --no-autorenew (#9312) 2022-06-04 11:37:05 +10:00
Will Greenberg
d13131e303 Merge pull request #9309 from certbot/test-account-updates
certbot-ci: improve tests for update_account/show_account
2022-05-31 12:58:19 -07:00
Alex Zorin
7758a03b5b skip boulder for show_account assertions 2022-05-31 17:31:52 +10:00
Alex Zorin
cf63470db9 certbot-ci: improve tests for update_account/show_account 2022-05-31 17:02:43 +10:00
amplifi
5c111d0bd1 Cite Mozilla ssl-config in Apache/NGINX TLS configs (#8670) (#9295)
* Cite Mozilla ssl-config in Apache/nginx TLS configs (certbot#8670)

* Update CHANGELOG

* Add TLS config hashes to ALL_SSL_OPTIONS_HASHES

* Update wording in CHANGELOG
2022-05-13 10:59:49 -07:00
alexzorin
ec49b94acb acme: use order "status" to determine action during finalization (#9297)
Rather than deducing the status of an order by the "certificate"
and "error" fields, use the "status" field directly.
2022-05-13 09:51:11 -07:00
Brad Warren
7dd1e814fb Ignore parallel coverage files (#9293)
* ignore parallel coverage files

* Properly shutdown & close HTTP server
2022-05-07 13:31:59 +10:00
Brad Warren
2017669544 Merge pull request #9292 from certbot/candidate-1.27.0 2022-05-04 07:36:23 -07:00
Will Greenberg
8d7ced5e12 Bump version to 1.28.0 2022-05-03 11:35:09 -07:00
Will Greenberg
e593921560 Add contents to certbot/CHANGELOG.md for next version 2022-05-03 11:35:09 -07:00
Will Greenberg
373ff0e6e9 Release 1.27.0 2022-05-03 11:35:08 -07:00
Will Greenberg
103b8bc8f9 Update changelog for 1.27.0 release 2022-05-03 11:33:11 -07:00
Will Greenberg
828be0071e Add new signing key (#9288)
* Add new signing key

* Update certbot/CHANGELOG.md
2022-04-28 11:04:43 -07:00
Will Greenberg
71a3d8fffb Merge pull request #9289 from certbot/9184-fix-changelog
changelog: move entry for #9184
2022-04-27 12:19:53 -07:00
Alex Zorin
48155b1ec7 changelog: move entry for #9184 2022-04-27 13:19:42 +10:00
Will Greenberg
8066f230f5 If an installer is provided to certonly, restart after cert issuance (#9184)
* If an installer is provided to certonly, restart after cert issuance

* Add myself to AUTHORS.md

* Handle certonly's "installer" error case

* Handle interactive case, use lazy interpolation

* fix trailing whitespace

* fix whitespace in error message, re-raise exception

* Handle cases where user specified an authenticator but no installer

* make tox happy

* Clarify comment in selection.py

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* Add tests for the certonly installer changes

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2022-04-26 18:51:57 -07:00
Will Greenberg
3b6f3450c2 Add --debug to docker push (#9286)
This'll (hopefully) help us debug the connectivity issues during
the deploy CI
2022-04-22 08:07:59 -07:00
Richard "mtfnpy" Harman
20336266fd Add documentation on interactions between multiple views in BIND and the dns_rfc2136 plugin (#9284)
* Add documentation on interactions between multiple views in BIND and the dns_rfc2136 plugin

* Missing ; in example config

* Make lines shorter

* Missed one long line, and move Examples up in the documentation

* Apply suggestions from code review

Co-authored-by: alexzorin <alex@zor.io>

Co-authored-by: alexzorin <alex@zor.io>
2022-04-22 10:31:46 +10:00
Will Greenberg
549bc0a5fd Use win32 as platform in tox.ini (#9277)
This is used to match against sys.platform, which for windows is
win32 regardless of bitness
2022-04-19 07:40:46 +10:00
osirisinferi
0ca8ec6f7f Add missing closing parenthesis (#9279) 2022-04-13 11:47:19 +10:00
Brad Warren
df982b33b9 cleanup renewer defaults (#9274) 2022-04-09 19:20:03 +10:00
alexzorin
7a2c26fd22 docs: in contributing, ipdb→ipdb3 (#9271)
The binary is renamed in Python 3.
2022-04-07 23:27:16 +02:00
James Balazs
0fb5094250 Add subproblems to errors (#7046) (#9258)
* Add subproblems to errors (#7046)

* Fix can't assign attribute

* Tidy up string representations of errors and add decoders for subproblems / identifiers

* Add missing attributes to docstring

* Move change to 1.27.0 in changelog
2022-04-06 09:34:26 -07:00
Brad Warren
87216372dd Fix race condition and uncaught exception (#9264)
* Fix race condition and uncaught exception

* fix typo
2022-04-06 09:12:38 +10:00
alexzorin
b7df4416b5 Merge pull request #9267 from certbot/candidate-1.26.0
Update files from 1.26.0 release
2022-04-06 08:59:07 +10:00
Brad Warren
b9a7d771bc Bump version to 1.27.0 2022-04-05 10:43:01 -07:00
Brad Warren
3f8fde4270 Add contents to certbot/CHANGELOG.md for next version 2022-04-05 10:43:01 -07:00
Brad Warren
5b8cc18456 Release 1.26.0 2022-04-05 10:43:00 -07:00
Brad Warren
e8a1e6deb1 Update changelog for 1.26.0 release 2022-04-05 10:41:26 -07:00
alexzorin
b5a187841e certbot-ci: upgrade pebble to v2.3.1 (#9260) 2022-04-02 08:17:08 +11:00
alexzorin
d45a702649 changelog: clarify --new-key entry (#9259)
@osirisinferi pointed out [in chat](https://opensource.eff.org/eff-open-source/pl/y5whp5ny378wuedi8gd7995qbo) that the way this entry was written, suggested that `--new-key` might affect whether `--reuse-key` is set or not.

I think the second sentence was the main culprit, so I've nixed it and replaced it with a reminder about our other flags.

This maybe calls out more for a documentation section but let's fix this quickly before the release.
2022-04-01 13:27:11 -07:00
alexzorin
fe0b637e4d display acme.Errors less verbosely (#9255)
* display acme.Errors less verbosely

* remove superfluous import
2022-03-31 13:48:47 -07:00
alexzorin
284023a1b7 Add --new-key (#9252)
* add --new-key

* add tests
2022-03-31 11:40:21 -07:00
osirisinferi
4456a6ba0b Add error message to account registration error (#9233)
* Add  message to account reg. error

* Changelog

* Remove forced lowercase first char

* Catch errors raised by acme library

* Fix mypy and add some comments

* Add some tests

* Move changelog entry to current version

* Address comments

* Address additional comments

Put everything in this commit instead of using the "Commit suggestion"
feat on Github, which would resolve in 4 different tiny commits.
2022-03-31 07:36:15 +11:00
Mads Jensen
142fcad28b Update various references to draft RFC to published versions. (#9250) 2022-03-28 17:26:06 -07:00
osirisinferi
1d45939cab Skip ToS agreement question if ToS value is None (#9245)
* Skip ToS agreement question if ToS value is None

* Add changelog entry

* Typo in CHANGELOG

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* Typo in CHANGELOG

Co-authored-by: ohemorange <ebportnoy@gmail.com>

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2022-03-24 15:42:47 -07:00
Will Greenberg
9ef6110e36 Point pip to filesystem packages rather than local HTTP server (#9240) 2022-03-24 13:32:03 -07:00
alexzorin
05a9ded297 pinning: update awscli pin (#9242) 2022-03-23 15:13:05 -07:00
alexzorin
690f62bae2 dns-ovh: increase default propagation timeout to 120s (#9244) 2022-03-23 15:07:29 -07:00
alexzorin
5404701111 windows: upgrade Python to 3.9.11 (#9241) 2022-03-18 10:03:49 +11:00
alexzorin
5ef18d905a Merge pull request #9238 from certbot/candidate-1.25.0
Release 1.25.0
2022-03-17 08:55:14 +11:00
Erica Portnoy
429bc553a0 Bump version to 1.26.0 2022-03-16 11:17:55 -07:00
Erica Portnoy
690c35530f Add contents to certbot/CHANGELOG.md for next version 2022-03-16 11:17:55 -07:00
Erica Portnoy
44c097fc05 Release 1.25.0 2022-03-16 11:17:54 -07:00
Erica Portnoy
cf6c511e91 Update changelog for 1.25.0 release 2022-03-16 11:16:28 -07:00
ohemorange
f58e3c5e92 Run repin.sh to pull in new version of cryptography, using OpenSSL 1.1.1n (#9237) 2022-03-15 16:46:58 -07:00
alexzorin
f54d9a3257 certbot-ci: fix boulder-v2 failures related to unexported challtestsrv port (#9235)
* certbot-ci: fix challtestsrv address for boulder-v2

The port is no longer exposed on the Docker host.

* vary the challtestsrv URL by acme server

* fix mypy

* fix comment

Co-authored-by: ohemorange <ebportnoy@gmail.com>

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2022-03-16 08:50:26 +11:00
Mads Jensen
ae41832f7c Update ACME spec links to point to RFC 8555. (#9232) 2022-03-13 07:53:45 +11:00
Mads Jensen
2b51661430 Remove cast for jose.fields. (#9228)
* Remove cast for jose.fields.

https://github.com/certbot/certbot/pull/9073 references this.

* Some of them can't be removed, though.

* Fix josepy type hints of json

* Increase josepy pinning version.

Note that the repin scripts have not been used.

* Run repin scripts.

* Fix constraints
2022-03-12 20:31:54 +11:00
alexzorin
ee2f5f5a0a pinning: work around poetry crash caused by bad 3rd party constraint (#9229) 2022-03-12 09:04:09 +11:00
osirisinferi
a513b57e5e Must staple: check for OCSP support (#9226)
* Must staple: check for OCSP support

* Expand error message

* s/Must Staple/Must-Staple

* Broaden the term webserver

* Improve error message
2022-03-08 15:00:12 -08:00
Will Greenberg
f251a13f32 Remove Windows 2016 environment, generate 64 bit installer (#9202)
* Remove Windows 2016 environment, generate 64 bit installer

* Add note to changelog

* Use win_amd64 as installer suffix

* Bump PYTHON_BITNESS to 64

* Require 64 bit Windows for the installer_build job

* Update certbot install path

* update windows test name

* Base installer suffix on PYTHON_BITNESS again

* Update changelog to request users uninstall old version
2022-03-03 19:31:03 +01:00
Mads Jensen
92de543fe7 Use f-strings in many places in acme and certbot. (#9225) 2022-03-03 07:12:34 -08:00
alexzorin
5d493ca53c storage: always save key_type to renewal .conf (#9217)
* storage: always save key_type to renewal .conf

* fix typo in comment

Co-authored-by: DasSkelett <dasskelett@gmail.com>
2022-03-02 13:55:20 -08:00
Brad Warren
b95deaa7e4 Use the git CLI with cargo (#9223)
Hopefully this makes things more stable. This is based on Alex's suggestion [here](https://opensource.eff.org/eff-open-source/pl/ouf996zuxjnkdxwq81bihxak7e). 

* git cli in docker

* git cli in snap

* git cli in dns snaps

* use true strings
2022-03-02 12:10:01 -08:00
alexzorin
6e8f58e3f6 improve handling and ux of unexpected key type migration (#9200)
* improve handling and ux of unexpected key type migration

* update unit tests

* update integration tests

* if --cert-name and --key-type are set, dont prompt
2022-03-02 08:55:17 -08:00
Brad Warren
f734e7a81c Merge pull request #9224 from certbot/candidate-1.24.0
Release 1.24.0
2022-03-01 17:17:43 -08:00
Erica Portnoy
9d312af32a Bump version to 1.25.0 2022-03-01 12:34:54 -08:00
Erica Portnoy
430d383e47 Add contents to certbot/CHANGELOG.md for next version 2022-03-01 12:34:54 -08:00
Erica Portnoy
3d3077e1f1 Release 1.24.0 2022-03-01 12:34:21 -08:00
Erica Portnoy
88c0e4c6fa Update changelog for 1.24.0 release 2022-03-01 12:23:44 -08:00
Brad Warren
c1030c0d40 Drop Python 3.6 support (#9216)
* Remove deprecation warnings

* update ci

* update setup.py files

* update changelog

* update pinnings

* update requests and friends

* update setuptools pin

* update setuptools pin pt2

* update pytz

* upgrade pyparsing

* upgrade boto deps

* update deps and docs

* update pyproject.toml comment

* remove trailets pin

* remove explicit PYTHON_VERSION
2022-02-28 15:23:30 -08:00
alexzorin
3c9e690e19 snap_config: set a timeout when talking to snapd (#9218) 2022-02-28 11:16:58 -08:00
Brad Warren
37e4f5735a update changelog (#9219) 2022-02-28 09:51:44 -08:00
osirisinferi
96847ba779 Add extra challenge info to --debug-challenges (#9208)
* Add challenge info to `--debug-challenges`

* Expand/add tests

* Add changelog entry

* Make tests Python 3.6 and 3.7 compatible

* Don't use `config.namespace`

* And don't use `config.namespace` in tests too

* Expand tests to check for token/thumbprint

* Add test for the DNS-01 challenge

Changed the Apache authenticator to the manual authenticator. Doesn't
seem to make a difference to the tests, but makes more sense if the
DNS-01 challenge is being used.

* Reword changelog entry

* Mention feature in --help output

* Better variable assignment in test

Co-authored-by: alexzorin <alex@zor.io>

* Better variable assignment in test

Co-authored-by: alexzorin <alex@zor.io>

* Remove unnecessary `verbose_count` assignment

Co-authored-by: alexzorin <alex@zor.io>

* Use terminology from RFC 8555

* Compress the two new tests into one

* s/world wide web/internet

* Move new code into separate function

* Remove superfluous newline with mixed challs

Co-authored-by: alexzorin <alex@zor.io>
2022-02-28 07:25:49 +11:00
Brad Warren
d9dd3134f0 Cleanup scripts and switch to pyenv (#9214)
I think test_apache2.sh still has value as it allows us to test our Apache plugin with the Apache layouts found on different OSes. Unfortunately, many of the OSes we're currently testing against don't have Python 3.7+ packaged yet we still support these OSes through things like snap where we bundle our own version of Python.

To allow us to continue testing on these OSes, I switched to installing Python through pyenv. I also took the opportunity to clean up the scripts, removing a lot of code, failing more quickly, and simplifying failure logic in test_apache2.sh.
2022-02-24 12:06:23 -08:00
Brad Warren
e2b7b62b98 remove test_sdists.sh (#9213)
The reason I want to do this is many of the targets of `test_sdists.sh` use Python 3.6 which [has reached its EOL](https://www.python.org/dev/peps/pep-0494/#lifespan). We could instead just stop running the test on these systems or install a newer version of Python 3 outside of OS packaging, but instead I decided to look into why we have these tests to begin with.

I introduced these tests many years ago in https://github.com/certbot/certbot/pull/4089 as a fix for https://github.com/certbot/certbot/issues/4044. Essentially the problem was the way packagers ran tests and the way we ran tests were slightly different. This difference could cause test failures when distros tried to run tests on our packages.

Since I did this, [we've switched to telling packagers to run tests using `pytest` like we do](5e76669c50/certbot/docs/packaging.rst (notes-for-package-maintainers)) and we've greatly reduced our reliance on OS packaging through things like `snap`.

Because of this, I think we should stop running this test, reducing our reliance on the heavy "test farm tests", and simplifying our CI pipeline. I think future problems here is quite unlikely and even if we have them, it should only affect tests on our non-primary distribution mechanisms which I think is a very minor concern.

When reviewing this PR, it's probably worth noting that I just replaced `targets.yaml` with the contents of `apache2_targets.yaml` since the Apache 2 tests are the only runs we're running with this change.
2022-02-23 15:10:48 -08:00
Brad Warren
5e76669c50 add another DEBIAN_FRONTEND=noninteractive (#9212) 2022-02-23 09:22:10 +11:00
Brad Warren
c3cb01d24a Fixing hanging test farm tests (#9211)
[Our test farm tests started hanging last night](https://dev.azure.com/certbot/certbot/_build/results?buildId=5151&view=logs&j=23275d9a-33b0-57f8-5f28-197fe2e5b9cd&s=1dfbc15b-7d0f-52a9-b1da-b17592bf94f8). Running the tests locally, the cause was `apt-get install` raised an interactive prompt that wasn't handled well and caused the entire system to restart. Here's a [log of that](https://gist.github.com/fb80d0279306d08e4ffd744e559a3df2).

I fixed this by setting `DEBIAN_FRONTEND=noninteractive` as is commonly done in things like Dockerfiles to avoid this problem.
2022-02-22 13:19:48 -08:00
Brad Warren
c96420dbe0 remove outdated setup.cfg files (#9201) 2022-02-17 22:17:21 +11:00
Mads Jensen
6f85eb928c Use literals wherever possible. (#9194)
* Use literals wherever possible.

These were found with flake8-comprehensions.
2022-02-14 14:54:03 -08:00
ohemorange
a1b2e973c0 Search included files for nginx server_names_hash_bucket_size directive (#9198)
* Search all included files for bucket directive

* Add tests for mod_config

* Update changelog

* Move changelog entry to the new release's section

* Break immediately once we've found the `http` block

Co-authored-by: alexzorin <alex@zorin.id.au>

* Add parallel descriptive comment about updating bucket directive

Co-authored-by: alexzorin <alex@zorin.id.au>

* remove github-inserted trailing whitespace

Co-authored-by: alexzorin <alex@zorin.id.au>
2022-02-11 15:40:14 +11:00
Will Greenberg
f14cefff18 Test revert setuptools pin (#9197)
* Revert setuptools-rust pin

This was a temporary workaround to fix
https://github.com/certbot/certbot/issues/9111, but it looks like the
the issue resolved itself

* Make mypy happy

There was an unused ignore statement, and Validator.certificate was
unnecessarily casting strings as bytes for an X509 digest method.

* Pin setuptools-rust to prevent build-dep hiccups in the future
2022-02-10 14:10:14 -08:00
alexzorin
9524a9fc16 Merge pull request #9196 from certbot/candidate-1.23.0
Update files from 1.23.0 release
2022-02-10 15:50:16 +11:00
Brad Warren
d73c6f44c5 Bump version to 1.24.0 2022-02-08 07:50:45 -08:00
Brad Warren
d655ab6913 Add contents to certbot/CHANGELOG.md for next version 2022-02-08 07:50:45 -08:00
Brad Warren
719f3ac577 Release 1.23.0 2022-02-08 07:50:44 -08:00
Brad Warren
69461bc15a Update changelog for 1.23.0 release 2022-02-08 07:49:47 -08:00
Mads Jensen
6c278c3352 Inline dict creation in _assert_valid_call. (#9190)
PyCharm has this check, and it's the only one it could find. It'll cut off valuable nanoseconds off the test suite run 😄
2022-02-04 09:57:21 -08:00
Patrik Hagara
d1608f8f2d include py.typed marker files in distribution (#9187) 2022-02-04 18:29:26 +01:00
Mads Jensen
fe0c0dc3ae Add support for revoking ecdsa keys without --cert-name. (#8725)
* Add support for revoking ecdsa keys without --cert-name.

Co-Authored-By: commonism <commonism@users.noreply.github.com>

* Move alg to acme_client.ClientNetwork instantiating in acme_from_config_key

* Fix argument for RS256/ES256

* Support also ES384 and ES512 signing algorithms.
2022-02-03 17:34:04 -08:00
Brad Warren
5b17a18355 CentOS & RHEL test farm fixes (#9188)
* update rhel 7 ami

* update bootstrap script

* update centos 8 image

* update centos 7 images

* add target comments
2022-01-31 15:52:43 -08:00
Adrien Ferrand
0181a0b07f Fully type certbot apache (#9177)
* Work in progress

* Work in progress

* Work in progress

* Work in progress

* Fix issues around nullability of VirtualHost.path, may discuss that during review

* Work in progress

* Fix remaining types

* Various lint fixes

* Reconfigure tox and mypy to disallow untyped defs globally

* Cleanup compatibility tests

* Use cast for unused v2 logic

* Improve types

* Remove unused comment

* Fix coverage

* Better types

* Fix another type

* Update certbot-apache/certbot_apache/_internal/apacheparser.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot-apache/certbot_apache/_internal/assertions.py

Co-authored-by: alexzorin <alex@zor.io>

* Fix type

* Various fixes

* Refactor imports

* Keep naming convention consistent on TypeVars

* Improve types

* Improve types

* Remove remaining Sequence[str] in the project

Co-authored-by: alexzorin <alex@zor.io>
2022-01-31 19:17:40 +11:00
Rick
fb1b105ba2 dns-digitalocean: Ignore SOA TTL in favor of explicit TTL argument (#9149)
* Ignore SOA TTL in favor of explicit TTL argument

`domain.ttl` should be `None` so that the `self.ttl` argument in 
`add_txt_record()` is not ignored (`domain.ttl` takes precedence).

* Document mitigation for dns-digitalocean ignoring the 30 second TTL.
2022-01-25 21:34:38 +11:00
Adrien Ferrand
dac0b2c187 Typed jose fields (#9073)
* Add generic methods to save some casts, and fix lint

* Update current and oldest pinning

* Fix classes

* Remove some todos thanks to josepy 1.11.0

* Cleanup some useless pylint disable

* Finish complete typing

* Better TypeVar names

* Upgrade pinning and fix some typing errors

* Use protocol

* Fix types in apache

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2022-01-24 15:16:19 -08:00
alexzorin
7198f43008 apache: expose aug_save errors in the debug log (#9169)
Fixes #9168.

* apache: expose aug_save errors in the debug log

* logger arguments wrong way around

* log formatting

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2022-01-24 09:33:11 -08:00
tJouve
fb564cddd9 Dns-google: update permissions needed in documentation (#9094)
* dns-google : Update account permission needed

Add permission for transaction creation => dns.managedZones.get
Add permission for RR removal transaction => dns.changes.list

* Add fix GCP Permission Changelog

* Update CHANGELOG.md
2022-01-24 18:17:43 +11:00
Adrien Ferrand
3d5defe28a Deprecate Python 3.6 support (#9160)
Fixes https://github.com/certbot/certbot/issues/8983

Python 3.6 is now EOL: https://endoflife.date/python

This is normally a good time to create warnings about Python 3.6 deprecation the Certbot upcoming release 1.23.0 so that its support is removed in 1.24.0.

We have to say here that EPEL maintainers asked us to keep maintaining support of Python 3.6 because Python 3.7 will never be shipped to CentOS 7. This support would be needed in theory up to 2 more years, basically until CentOS 7 EOL in 2024-06-30. It has been said that we could support as a best effort until a reasonable need on Certbot side requires to drop Python 3.6. See https://github.com/certbot/certbot/issues/8983 for more information.

However some of us (including me) consider that there is already a reasonable need right now. Indeed, keeping the support on Python 3.6 while the Python community globally moves away from it will pin implicitly some Certbot dependencies to the last version of these dependencies supporting Python 3.6 as the upstream maintainers decide to make the move. At any point in a future time, one of these dependencies could require an urgent upgrade (typically a critical uncovered vulnerability): then we would require to drop Python 3.6 immediately without further notice instead of following an organized deprecation path.

This reason motivates to proactively deprecate then drop the Python versions once they are EOL. You can see the discussion in Mattermost starting from [this post](https://opensource.eff.org/eff-open-source/pl/ntzs9zy1fprjmkso3xrqspnoce) to get more elements about the reasoning.

* Deprecate Python 3.6 support.

* Ignore our own PendingDeprecationWarning
2022-01-21 12:42:05 -08:00
Mads Jensen
12442a2aca Test coverage dns ecdsa (#9174)
* Added test coverage for ES256 signing keys in DNS challenges.

* pass tests

* Feedback
2022-01-21 20:29:53 +11:00
Mads Jensen
7d9e9a4900 Add typing to certbot.apache (#9071)
* Add typing to certbot.apache

Co-authored-by: Adrien Ferrand <ferrand.ad@gmail.com>
2022-01-21 10:15:48 +01:00
kevgrig
afc5be5abe Add wildcard example (#9164)
* Add wildcard example

* Update wildcard example
2022-01-18 23:20:25 +01:00
Adrien Ferrand
16aad35d31 Fully type certbot-nginx module (#9124)
* Work in progress

* Fix type

* Work in progress

* Work in progress

* Work in progress

* Work in progress

* Work in progress

* Oups.

* Fix typing in UnspacedList

* Fix logic

* Finish typing

* List certbot-nginx as fully typed in tox

* Fix lint

* Fix checks

* Organize imports

* Fix typing for Python 3.6

* Fix checks

* Fix lint

* Update certbot-nginx/certbot_nginx/_internal/configurator.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot-nginx/certbot_nginx/_internal/configurator.py

Co-authored-by: alexzorin <alex@zor.io>

* Fix signature of deploy_cert regarding the installer interface

* Update certbot-nginx/certbot_nginx/_internal/obj.py

Co-authored-by: alexzorin <alex@zor.io>

* Fix types

* Update certbot-nginx/certbot_nginx/_internal/parser.py

Co-authored-by: alexzorin <alex@zor.io>

* Precise type

* Precise _coerce possible inputs/outputs

* Fix type

* Update certbot-nginx/certbot_nginx/_internal/http_01.py

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* Fix type

* Remove an undesirable implementation.

* Fix type

Co-authored-by: alexzorin <alex@zor.io>
Co-authored-by: ohemorange <ebportnoy@gmail.com>
2022-01-12 16:36:51 -08:00
Mads Jensen
30b066f082 Remove outdated pylint comments (#9167)
* Remove outdated pylint: disable=unused-import annotations.

* remove # pylint: disable=ungrouped-imports annotations.

* Remove single pylint: disable = unused-argument in DeleteIfAppropriateTest.test_opt_in_deletion.
2022-01-09 22:51:06 +01:00
Mads Jensen
7e5e51aeff Use super().__init__ instead of explicitly calling named super-class. (#9166)
* Use super().__init__ instead of explicitly calling named super-class.

* Fix unittest (typo fix).
2022-01-09 22:50:44 +01:00
Mads Jensen
ed7964b424 Improve assertions in nginx and DNS plugin tests. (#9157)
* Improve assertions in nginx and DNS plugin tests.

* Use assertIs for asserting is True/False.
2022-01-04 23:59:58 +01:00
Adrien Ferrand
97a09dee19 Revert "Remove win2016 from Azure devops pipelines. (#9145)" (#9158)
This reverts commit dc66c87928.
2022-01-04 20:24:24 +11:00
Mads Jensen
a0dbe1e850 Improve assertions in certbot-apache tests. (#9131)
* Improve assertions in certbot-apache tests.

Replacements inspired by flake8-assertive.

* Fix test failures

* assertEqual is not for None :D

* Pass all tests :)
2022-01-03 22:05:21 +01:00
Mads Jensen
eeca208c8f Various clean-ups in certbot-apache. Use f-strings. (#9132)
* Various clean-ups in certbot-apache. Use f-strings.

* Smaller tweaks
2022-01-02 00:27:47 +01:00
alexzorin
00f98fa911 letstest: bump ubuntu groovy to impish (#9155) 2022-01-02 00:23:24 +01:00
Mads Jensen
dc66c87928 Remove win2016 from Azure devops pipelines. (#9145)
From March 2022, support will be removed.
https://github.com/actions/virtual-environments/issues/4312
2022-01-02 00:22:52 +01:00
osirisinferi
93c2852fdb Add show_account subcommand to retrieve account info from ACME server (#9127)
* Fetch and print account contacts from ACME server

* Add tests

* Add changelog entryAdd changelog entry

* Add account URI and thumbprint output

Only show these items when verbosity > 0

* Add test case for account URI and thumbprint

* Move changelog entry to new placeholder

* Add test for `cb_client.acme` (coverage)

* Address comments

* Update changelog

* Few small word changes

* Add server to error messages

* Remove phone contact parts
2021-12-27 19:12:52 +11:00
osirisinferi
a391a34631 Add appending behaviour of max-log-backups = 0 (#9146) 2021-12-22 08:20:01 +11:00
Brad Warren
1577cd8663 write docs on how to test release script (#9142)
Alexis (rightfully) wasn't sure how to test this when working on https://github.com/certbot/certbot/pull/9076. This PR documents it in the script based on what I wrote at https://github.com/certbot/certbot/pull/8351#issue-715227127 which I reverified.
2021-12-21 09:28:31 -07:00
Adrien Ferrand
89ccbccff0 Fully type all DNS plugins (#9125)
* Add types in all DNS plugins

* Order imports

* Fix type

* Update certbot-dns-route53/certbot_dns_route53/_internal/dns_route53.py

Co-authored-by: alexzorin <alex@zor.io>

* Clean up imports

Co-authored-by: alexzorin <alex@zor.io>
2021-12-14 12:38:14 +11:00
Adrien Ferrand
cb3e1403cd Fully type certbot-compatibility-test (#9133)
* Finish typing the module

* Use cast

* Precise type
2021-12-14 12:14:11 +11:00
alexzorin
3353c0df43 tests: remove Boulder v1 endpoint from certbot-ci and azure (#9140) 2021-12-13 10:42:15 -08:00
Adrien Ferrand
97d9e2c97d Fully type lock_test.py (#9126)
* Type lock_test.py

* Reconfigure tox

* Fix imports
2021-12-13 14:01:31 +11:00
Adrien Ferrand
89cefc177a Fix --help output (#9130) 2021-12-11 12:58:33 +11:00
Brad Warren
8799b108c2 fix macos coverage (#9137) 2021-12-11 12:43:17 +11:00
Brad Warren
dab7864809 Add macOS instructions (#9136)
* add macOS instructions

* add integration test warning
2021-12-11 12:28:18 +11:00
Brad Warren
693c674a7e Merge pull request #9128 from certbot/candidate-1.22.0
Release 1.22.0
2021-12-08 09:42:08 -07:00
Erica Portnoy
c02ead0f11 Bump version to 1.23.0 2021-12-07 14:03:51 -08:00
Erica Portnoy
d5ea9072af Add contents to certbot/CHANGELOG.md for next version 2021-12-07 14:03:51 -08:00
Erica Portnoy
6463a2e22d Release 1.22.0 2021-12-07 14:03:50 -08:00
Erica Portnoy
d6adc4a2d0 Update changelog for 1.22.0 release 2021-12-07 14:02:45 -08:00
Mads Jensen
402f18e039 Apache augeas clean up (#9114)
The `# self.comment = comment` caught my eye while working on #9071 as well as the intermediate variables, which aren't really needed. As a result, I reformatted the code slightly in those places.

* Remove comment in AugeasCommentNode.__init__

* Replace some intermediate varibles with return-statements in apache augeas parser.

* more clean-up
2021-12-02 08:45:16 -07:00
Adrien Ferrand
aeb7beb1b1 Fully type certbot-ci module (#9120)
* Fully type certbot-ci module

* Fix lint, focus lint

* Add trailing comma

* Remove unused private function

* Type properly for future usages

* Update certbot-ci/certbot_integration_tests/utils/acme_server.py

Co-authored-by: alexzorin <alex@zor.io>

* Cleanup files

* Fix import

* Fix mypy and lint

Co-authored-by: alexzorin <alex@zor.io>
2021-11-30 08:24:39 +11:00
moratori
0d10a44f4b Added --issuance-timeout command line option (#9056)
* Added --issuance-timeout command line option

* clarification of command line option name,docstring and add tests

* fix test case for python36

* improved the command line options
2021-11-30 08:17:06 +11:00
Adrien Ferrand
86406ab63a Add type annotations to the certbot package (part 4) (#9087)
* Extract from #9084

* Cast/ignore types during the transition

* Remove useless casts and type ignore directives

* Fix lint

* Fix a cast

* Mandatory typing for certbot packages

* Update certbot/certbot/_internal/plugins/disco.py

Co-authored-by: alexzorin <alex@zor.io>

* Remove unused type import

* Fix iterator type

* Fix type

* Fix types in selection

Co-authored-by: alexzorin <alex@zor.io>
2021-11-26 09:00:03 +11:00
Aaron Gable
7d3a344d43 Update py cryptography to >=2.5.0 (#9110)
* Update py cryptography to >=2.5.0

* Review feedback
2021-11-24 14:46:11 -08:00
Adrien Ferrand
250d7b1542 Add type annotations to the certbot package (part 3) (#9086)
* Extract from #9084

* Cast/ignore types during the transition

* Fix after review

* Fix lint

* Update certbot/certbot/_internal/storage.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/certbot/_internal/storage.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/certbot/_internal/main.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/certbot/_internal/main.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/certbot/_internal/client.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/certbot/_internal/client.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/certbot/_internal/auth_handler.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/certbot/_internal/auth_handler.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/certbot/_internal/auth_handler.py

Co-authored-by: alexzorin <alex@zor.io>

* Remove a cast usage

* Fix import

* Remove now useless cast

* Update certbot/certbot/_internal/client.py

Co-authored-by: alexzorin <alex@zor.io>

Co-authored-by: alexzorin <alex@zor.io>
2021-11-25 07:47:36 +11:00
Adrien Ferrand
19147e1b8c Add type annotations to the certbot package (part 2) (#9085)
* Extract from #9084

* Cast/ignore types during the transition

* Clean up

* Fix assertion

* Update certbot/certbot/display/ops.py

Co-authored-by: alexzorin <alex@zor.io>

* Use sequence

* Improve documentation of "default" in display

* Fix contract

* Fix types

* Fix type

* Fix type

* Update certbot/certbot/display/ops.py

Co-authored-by: alexzorin <alex@zor.io>

Co-authored-by: alexzorin <alex@zor.io>
2021-11-24 18:33:09 +11:00
Brad Warren
d1821b3ad7 Pin back setuptools-rust (#9112)
* pin back setuptools-rust

* make pylint happy

This was taken from https://github.com/certbot/certbot/pull/9073.

* pin back josepy

* Apply lint's code style suggestions

* fix lint again

Co-authored-by: Erica Portnoy <ebportnoy@gmail.com>
2021-11-23 12:35:49 -08:00
Paul Kehrer
267fb94478 Remove use of deprecated verifier with cryptography (#9105)
This was deprecated in version 2.1 and cryptography will be
removing it soon. The replacement function is available in all
versions of cryptography that certbot supports (2.1+)
2021-11-23 10:18:22 -08:00
alexzorin
6766786049 Fix Windows webroot crash when multiple domains have the same webroot (#9108)
* Certificate issuing on Window while having web.confing and more then one domain in request

* add a test

* update changelog

Co-authored-by: Serghei Trufkin <Serghei.Trufkin@Technosoft.md>
2021-11-22 19:00:55 +01:00
alexzorin
d2578e05e7 docs: describe how to modify renewal config (#9014)
* docs: describe how to modify renewal config

* Apply suggestions from code review

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* reword warning about manual modifications

* explain the flags in the --force-renewal command

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2021-11-18 12:14:10 -08:00
alexzorin
2746fc572f webroot: unset existing mime type in web.config (#9092) 2021-11-15 14:35:18 +11:00
Adrien Ferrand
d20e42562c Add type annotations to the certbot package (part 1) (#9084)
* Extract from #9084

* Cast/ignore types during the transition

* Fix after review

* Fix lint
2021-11-12 14:27:46 +11:00
alexzorin
4756b66089 docs: update intersphinx url for certbot project (#9096) 2021-11-11 09:44:59 +01:00
Brad Warren
e8265dbf9c Add Python 3.10 support and tests (#9077)
Fixes https://github.com/certbot/certbot/issues/9058.

The changes to the CI config are equivalent to the ones made in https://github.com/certbot/certbot/pull/8460.

Other than ignoring some warnings raised by botocore, the main additional work that had to be done here was switching away from using `distutils.version.LooseVersion` since the entire `distutils` module was deprecated in Python 3.10. To do that, I took a few different approaches:

* If the version strings being parsed are from Python packages such as Certbot or setuptools, I switched to using [pkg_resources.parse_version](https://setuptools.pypa.io/en/latest/pkg_resources.html#parsing-utilities) from `setuptools`. This functionality has been available since [setuptools 8.0 from 2014](https://setuptools.pypa.io/en/latest/history.html#id865).
* If the version strings being parsed are not from Python packages, I added code equivalent to `distutils.version.LooseVersion` in `certbot.util.parse_loose_version`.
* The code for `CERTBOT_PIP_NO_BINARY` can be completely removed since that variable isn't used or referenced anywhere in this repo.

* add python 3.10 support

* make some version changes

* don't use looseversion in setup.py

* switch to pkg_resources

* deprecate get_strict_version

* fix route53 tests

* remove unused CERTBOT_PIP_NO_BINARY code

* stop using distutils in letstest

* add unit tests

* more changelog entries
2021-11-08 15:55:32 -08:00
orangepizza
b1edda8a65 fix a typo in gen_ss_cert type hint (#9089) 2021-11-07 14:18:15 +11:00
Brad Warren
81d5d2b421 Pin readthedocs deps (#9083)
* pin readthedocs deps

* fix reqs path
2021-11-04 20:35:44 +11:00
alexzorin
8f8dd2824e Merge pull request #9082 from certbot/candidate-1.21.0
Update files from 1.21.0 release
2021-11-04 12:41:05 +11:00
Brad Warren
9740f5428e Bump version to 1.22.0 2021-11-02 14:28:34 -07:00
Brad Warren
91c079ab41 Add contents to certbot/CHANGELOG.md for next version 2021-11-02 14:28:34 -07:00
Brad Warren
200e1f1709 Release 1.21.0 2021-11-02 14:28:33 -07:00
Brad Warren
e501e277b3 Update changelog for 1.21.0 release 2021-11-02 14:27:18 -07:00
Chris Swan
cdbc264bb6 Fix copyright date s/2015-2015/2015/ (#9070) 2021-10-25 12:20:57 -07:00
Adrien Ferrand
a0f22d21ce Add type annotations to the acme project (#9036)
* Start more types

* Second run

* Work in progress

* Types in all acme module

* Various fixes

* Various fixes

* Final fixes

* Disallow untyped defs for acme project

* Fix coverage

* Remote unecessary type ignore

* Use Mapping instead of Dict as input whenever it is possible

* Update acme/acme/client.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update acme/acme/client.py

Co-authored-by: alexzorin <alex@zor.io>

* Various fixes

* Fix code

* Fix code

* Update acme/acme/client.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update acme/acme/challenges.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update acme/acme/client.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Fix deactivate_registration and simplify signature of update_registration

* Do not leak personal data during account deactivation

* Clean more Dicts

* New fix to not leak contact field in the account deactivation payload.

* Add ignore for python 3.6 type check

* Revert "Add ignore for python 3.6 type check"

This reverts commit da7338137b798e3ace34de15ed12f76ec3cf3888.

* Let's find a smarter way than "type: ignore"

* Update certbot/certbot/_internal/account.py

Co-authored-by: alexzorin <alex@zor.io>

* Fix an annotation

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
Co-authored-by: alexzorin <alex@zor.io>
2021-10-25 09:43:21 +11:00
Adrien Ferrand
94af235713 Generate a web.config file for IIS to serve properly the challenge files in webroot plugin (#9054)
* Generate a web.config file to serve properly challenge files with IIS

* Fix cleanup, add test

* FIx lint

* Do not overwrite existing web.config. Delete only web.config when it has been created by Certbot and is unmodified.

* Fix lint

* Update certbot/certbot/_internal/plugins/webroot.py

Co-authored-by: alexzorin <alex@zor.io>

* Add log

* Check for POSIX_MODE before web.config deletion attempt.

* Add documentation

* Update certbot/CHANGELOG.md

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/docs/using.rst

Co-authored-by: alexzorin <alex@zor.io>
2021-10-24 08:37:40 +11:00
alexzorin
2375d87831 delete: add a warning about safe deletion (#8949) 2021-10-20 13:57:48 +11:00
Brad Warren
1a698fa235 update packaging docs to mention dl.eff.org (#9068) 2021-10-19 12:10:22 +11:00
Brad Warren
d250d34193 Change PGP keys (#9046)
* automate determining the key

* update packaging docs

* switch to new keys

* add changelog entry

* put keys in changelog
2021-10-14 14:27:15 -07:00
Piotr Kasprzyk
777935c8ed Remove trailing spaces from docs (#9064) 2021-10-12 22:56:24 +02:00
alexzorin
15c2792036 Merge pull request #9057 from certbot/candidate-1.20.0
Update files from 1.20.0 release
2021-10-06 18:54:52 +11:00
Brad Warren
46beb8af84 Bump version to 1.21.0 2021-10-05 06:53:59 -07:00
Brad Warren
aa63688450 Add contents to certbot/CHANGELOG.md for next version 2021-10-05 06:53:59 -07:00
Brad Warren
93f61887be Release 1.20.0 2021-10-05 06:53:57 -07:00
Brad Warren
54475964bd Update changelog for 1.20.0 release 2021-10-05 06:52:55 -07:00
Adrien Ferrand
065df4c9a7 Support Python 3.9 on Windows and package installer on it (#9053)
It seems that all required pre-compiled wheels to install Certbot on Python 3.9 on Windows are present.

This PR upgrades Windows tests on Python 3.9 and repackages the installer on this version of Python.
2021-10-04 14:20:49 -07:00
Brad Warren
cde3e1fa97 fix typo in error message (#9047) 2021-09-29 10:29:49 -07:00
alexzorin
bb2db252a7 stop using deprecated jose abstractclassmethod (#9045)
The josepy 1.10.0 release deprecated this decorator and [caused the nightly `nopin` test to break](https://dev.azure.com/certbot/certbot/_build/results?buildId=4548&view=logs&j=ce03f7c1-1e3f-5d55-28be-f084e7c62a50&t=597fea95-d44e-53a2-5b71-76ed20bd4dde).
2021-09-28 10:48:50 -07:00
alexzorin
abe23c0e60 missing trailing '?' in non-interactive checklist (#9043) 2021-09-22 11:07:30 -07:00
alexzorin
b0aa064640 dns-rfc2136: use certbot's own is_ipaddress func (#9035)
* dns-rfc2136: use certbot's own is_ipaddress func

* oldest: pin dnspython==1.15.0 (epel8 version)

* inhibit deprecationwarning for dnspython==1.15.0

* dns-rfc2136: declare minimum version of dnspython

* add changelog entry
2021-09-14 07:48:15 +10:00
Adrien Ferrand
bd5f4f2d8a Increase minimum of josepy version to use and update the oldest contraints. (#9032)
As a follow-up to #9027, this PR increases the minimum version of `josepy` to use and updates the oldest constraints accordingly.
2021-09-10 16:08:13 -07:00
alexzorin
aea3c7e363 add --no-reuse-key (#9029)
Fixes #9002.
2021-09-10 12:27:53 -07:00
Adrien Ferrand
fc02b10560 Upgrade pinned versions of certbot dependencies (josepy in particular) (#9027)
This PR upgrades the pinned version of the dependencies. Version `1.9.0` of josepy is used so errors related to JWK serialization with EC keys (see https://github.com/certbot/josepy/issues/109) are fixed for Certbot.
2021-09-10 12:26:07 -07:00
Brad Warren
ee190db235 Update oldest pyproject.toml comments (#8999)
* update oldest pyproject.toml comments

* Apply suggestions from code review

Co-authored-by: ohemorange <erica@eff.org>

* improve wording

Co-authored-by: ohemorange <erica@eff.org>
2021-09-09 14:57:55 -07:00
Brad Warren
077d28828a Add documentation about legacy cb-auto files (#9011)
* Add documentation about legacy cb-auto files

* Apply suggestions from code review

Co-authored-by: ohemorange <erica@eff.org>

Co-authored-by: ohemorange <erica@eff.org>
2021-09-09 13:21:47 -07:00
alexzorin
0b63d81f95 cli: minor copy changes to renew help text (#9025)
Fixes #9009.
2021-09-09 12:13:09 -07:00
alexzorin
d139e26a1c fix 'NEXT STEPS' being printed to stdout during -q (#9023)
@osirisinferi noticed [in chat](https://opensource.eff.org/eff-open-source/pl/sa85u4n71tywfpc15c1wu59wae) that "NEXT STEPS:" was ignoring `--quiet` and was being printed unconditionally.

I think it ended up being written this way in #8860 because I was trying not to avoid dumping ANSI escapes and newlines into the log file and confused myself in the process. 

This change makes things a bit more explicit in separating presentation/message.

* fix 'NEXT STEPS' being printed to stdout during -q

* fix tests
2021-09-09 12:10:27 -07:00
alexzorin
dedd0b84a8 Merge pull request #9024 from certbot/candidate-1.19.0
Update files from 1.19.0 release
2021-09-09 08:42:39 +10:00
Brad Warren
b9e4763de3 Bump version to 1.20.0 2021-09-07 10:15:07 -07:00
Brad Warren
8897a81f7d Add contents to certbot/CHANGELOG.md for next version 2021-09-07 10:15:07 -07:00
Brad Warren
5d6abc3234 Release 1.19.0 2021-09-07 10:15:05 -07:00
Brad Warren
dc7524d1d6 Update changelog for 1.19.0 release 2021-09-07 10:13:51 -07:00
alexzorin
70a18a9486 disable donation prompt during --quiet (#9022)
Issuing a certificate with --quiet was crashing during the donation
atexit call because it was trying to use the /dev/null fd after the
displayer context manager had already closed it.
2021-09-07 08:38:27 -07:00
alexzorin
b7bde05aee docs: redirect macOS users to different cron guide (#9013)
Due to macOS having some complications about Certbot from Homebrew being
in the PATH, the instructions we have in the Automated Renewal section
do not work for them. Instead, send those users to the instruction
generator.
2021-09-03 07:49:25 -07:00
alexzorin
8ff7153019 snap: revert to checking snapctl file existence (#9018)
While the previous approach of testing the functionality of snapctl
worked, the snapd developers told us they could not guarantee its
reliability.

---

As with #8955, I tested this on Debian 9, 10 and CentOS 7, 8, Stream.
2021-09-03 07:47:12 -07:00
Stefan Weil
0d4f92fa81 Fix some typos (found by codespell) (#9017)
* Fix some typos (found by codespell)

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* Remove typo fixes for some files which should not be modified

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-09-03 06:43:13 +10:00
Brad Warren
1a2d74decc Add comment about security alerts. (#9016) 2021-09-03 06:40:18 +10:00
Brad Warren
f6d5c8ffbe Make ACMEv1 deprecation warnings scarier (#9015)
Fixes https://github.com/certbot/certbot/issues/6844.

This PR does two things:

1. Changes ACMEv1 deprecation warnings from `PendingDeprecationWarning` to `DeprecationWarning`.
2. Changes the ACMEv1 deprecation warnings to be on references to the class themselves. This is the approach taken in https://github.com/certbot/certbot/pull/8989, the PRs linked there, and the `cryptography` code in the code comment. I think this approach warns in more cases and I updated our unit tests to avoid hitting these warnings.
2021-08-30 15:38:12 -07:00
orangepizza
52e207a404 add ip address support to certbot/acme lib (2021 ver) (#8904)
* add ip address support to acme saving

* remove client-site check for ip address

* using right prefix for san parsing

* remove type hint for backward compatibility

* remove bare ip blocking check from main_test

* upppercase

* lint tix

* add additional tests for new IP support

* support for ipv6 bare address

* make apache and nginx plugin raise error for certs with ip address

* linting

* add pem file's last newline char

* gen_ss_cert ip support and comment fixup

* fix test coverage

* indent fix and assetTrue to assetIN

* indent mistake, made a note where class end

* acme lib now receive IPs as separate list

* fix typos

* type 2

* fix tests

* Deny IP address on certbot/certbot side as LE don't support it

* remove excess empty line to rerun tox

* comment indent and typo fix

Apply suggestions from code review

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* trim unused functions

* trim unused import

* make raw san list extraction as separate function

* Apply suggestions from code review

mostly comment suggestions here

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* apply patches suggested on review.

* remove excessive empty lines

* update CHANGELOG.md

* added acme lib update about ipaddress support in CHANGELOG.md

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-08-27 06:47:01 -07:00
alexzorin
694c03bd6a lower coverage threshold for rfc2136 integration (#9006) 2021-08-25 07:40:26 -07:00
Brad Warren
058faeadac Propagate requirement that ACME responses are UTF-8 (#9001)
I think this fixes https://github.com/certbot/certbot/issues/8968.

The only other calls with `requests` we make in our code outside of our tests that I could find are:

1. [Here](a8a8a39ff1/certbot/certbot/_internal/eff.py (L91)) where we assume the response is JSON and I think [requests behavior](db575eeedc/requests/models.py (L891-L896)) is sane.
2. [Here](a8a8a39ff1/certbot/certbot/ocsp.py (L190)) where we know the response contains binary data.

I think this is a pretty minor change because we were already assuming the response was UTF-8 in the code here when logging it which I think is a valid assumption because the spec says that [all content should be UTF-8 encoded](https://datatracker.ietf.org/doc/html/rfc8555#section-5).

I added the check for the `Accept` header due to the text [here](https://datatracker.ietf.org/doc/html/rfc8555#section-7.4.2) saying that it can be used to request the certificate in an alternate format such as DER. We currently set the Accept header in our own ACMEv1 client code before downloading the DER certificate, but this isn't required according to [the closest thing I think we have to an ACMEv1 spec](f1894f8d1d/docs/acme-divergences-v1.md (section-742)) so I left the content type check with a comment that it can be removed in the future.

* Revert "add chardet dep (#8965)"

This reverts commit 1129d850d3.

* set response.encoding in acme

* more docs
2021-08-23 10:57:34 -07:00
osirisinferi
295dc5a2a9 certbot-dns-rfc2136: catch error when a hostname is being used for dns_rfc2136_server (#8990)
* Raise separate error when a hostname is being used for `dns_rfc2136_server`

* Explicitly say IP address instead of hostname in docs

* Don't catch ValueError, but actually check the server value

* Add tests

* Add CHANGELOG entry
2021-08-23 09:38:14 +10:00
Brad Warren
a8a8a39ff1 upgrade pip (#9000)
This is just an oldest tests version of https://github.com/certbot/certbot/pull/8993.
2021-08-19 15:15:31 -07:00
Brad Warren
435ae075a5 remove zope from plugin example (#8998) 2021-08-18 09:43:40 -07:00
Adrien Ferrand
06c8113863 Cleanup zope dependencies in plugins and upgrade sphinx (#8997)
This PR removes all zope dependencies from plugins configuration.

It also lets Sphinx upgrade to the next major version by removing the plugin dedicated to zope interfaces documentation. As a consequence, the deprecated zope interfaces are not documented anymore.

* Cleanup zope dependencies in plugins and upgrade sphinx

* Update pinnings
2021-08-18 08:12:55 -07:00
Adrien Ferrand
143ea15253 Remove all non essential references to the old Zope interfaces (#8988)
As a follow-up to #8971, this PR removes all references to the old Zope interfaces, except the ones used to deprecate them and prepare for their removal.

In the process, some documentation and tests about the `Display` objects are simply removed since they are not relevant anymore given that they are removed from the public API.

* Cleanup some interfaces.IInstaller

* Cleanup IConfig doc

* Allmost complete removal

* Remove useless tests

* Fixes

* More cleanup

* More cleanup

* More cleanup

* Remove a non existent reference

* Better type

* Fix lint
2021-08-17 14:51:26 -07:00
Adrien Ferrand
acf48df979 Use latest version of mypy (#8992)
Fixes #8899

This PR removes the pinning upper limit of mypy currently set to <0.900 and adds the required types-* stub packages to make recent versions of mypy work.

* Unpin mypy

* Improve type in TempHandler

* Add types
2021-08-17 10:52:57 -07:00
Adrien Ferrand
6a9e0ec59d Add deprecation warnings for deprecated elements in certbot.display.util (#8989)
Fix #8982.

This PR takes essentially the same approach than in #8970 and https://github.com/certbot/certbot/pull/6859/files#diff-e5eaf744409c293203b898ba9896da75689fd04ff5f1566c035940a5b195c257

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-08-17 09:13:54 -07:00
Adrien Ferrand
5b96cc9c37 Release pip pinning (#8993)
The bug that was requiring pip to stay on 20.2.4 has been fixed on version 21.2.x. Let's release the pip pinning with this PR.
2021-08-16 15:14:22 -07:00
Adrien Ferrand
525c427c60 Cleanup some useless type ignore directives (#8987)
* Cleanup some useless type ignore directives

* Cleanup one more type ignore directive

Co-authored-by: Adrien Ferrand <aferrand@ecomundo.eu>
2021-08-17 07:43:56 +10:00
Adrien Ferrand
23e1e07139 Emit deprecation warnings for Zope interfaces (#8970)
* Monkeypatch certbot.interfaces module to warn about deprecations

* Ignore our own warning

* Fix type

* Add a changelog entry
2021-08-15 07:06:29 +10:00
alexzorin
241a7c32a2 docs: add basic intro to certbot in user guide (#8979)
* docs: add basic intro to certbot in user guide

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-08-13 17:39:12 -07:00
alexzorin
10dc41e83d docs: add "Deleting Certificates" to user guide (#8910)
I want this for #8949.

I think this is quite verbose, but purposefully so as an intervention to try prevent users from hitting this problem. It's more of a "How-To Guide" than a "Reference Guide" (in the lingo of https://documentation.divio.com). 

* docs: add "Deleting Certificates" to user guide

* try a less convoluted explanation

about what the installer did in the first place

* add a warning early on: read the full thing

* erica's copy changes

* rewrite as a how-to guide

* rewrite self-signed step 2 for mental model++

* rewrite intro to "safely deleting certificates"
2021-08-13 14:04:47 -07:00
Adrien Ferrand
6943cea6b7 Reimplement zope interfaces into abc in compatibility tests (#8971)
* Reimplement zope interfaces into abc in compatibility tests

* Refactor to fix lint and mypy warnings

* Fix inheritance
2021-08-13 11:00:33 +10:00
Brad Warren
b4c49cf781 Improve snapcraft remote build (#8985)
[Snapcraft 5.0](https://forum.snapcraft.io/t/release-notes-snapcraft-5-0/25751) implemented creating build IDs based on the project's contents instead of the directory path in https://github.com/snapcore/snapcraft/pull/3554. This is a feature we initially wanted, but it broke our workaround added in https://github.com/certbot/certbot/pull/8719. Our workaround is broken because now that the build ID is based on the project's contents, copying the project to a temporary directory has no effect.

This PR removes the workaround from https://github.com/certbot/certbot/pull/8719 and instead constructs a random build ID that it provides to snapcraft. This provides us with even more randomness to avoid build ID conflicts while avoiding having to copy the project to a temporary directory before every build.

* improve-remote-build

* use lowercase letters
2021-08-12 15:34:40 -07:00
Yaroslav Halchenko
5e87aee968 BF: apache cfg parsing - relax assumption that value cannot contain = (#8930)
* BF: apache cfg parsing - relax assumption that value cannot contain =

* Remove failing test_update_runtime_vars_bad_output

* Add test Define statements: with = in value, and an empty value

* update CHANGELOG

Co-authored-by: Alex Zorin <alex@zorin.id.au>
2021-08-13 07:57:24 +10:00
Brad Warren
693a2a7904 remove outdated example code (#8984)
There are a couple problems with these files.

1. `python -m acme.standalone` from the README hasn't worked since https://github.com/certbot/certbot/pull/7483.
2. The symlinks for the PEM files have been broken since https://github.com/certbot/certbot/pull/7600.

Because of this and the fact [these example files are causing snap build failures](https://dev.azure.com/certbot/certbot/_build/results?buildId=4395&view=logs&j=f44d40a4-7318-5ffe-762c-ae4557889284&t=07786725-57f8-5198-4d13-ea77f640bd5c&l=78), let's delete it.
2021-08-12 14:04:22 -07:00
Brad Warren
3058b6e748 Fix circular import (#8967)
* add internal display util

* Move display constants internal.

* move other utilities internal

* fix OK and CANCEL documentation
2021-08-05 08:49:20 +02:00
Brad Warren
7b78770010 fix egg-info cleanup (#8966) 2021-08-05 07:04:05 +10:00
Brad Warren
cd2dff2db1 Merge pull request #8969 from certbot/candidate-1.18.0
Release 1.18.0
2021-08-03 16:05:39 -07:00
Erica Portnoy
8194e8faef Bump version to 1.19.0 2021-08-03 13:23:45 -07:00
Erica Portnoy
06698ad95f Add contents to certbot/CHANGELOG.md for next version 2021-08-03 13:23:45 -07:00
Erica Portnoy
0d76d1f219 Release 1.18.0 2021-08-03 13:23:13 -07:00
Erica Portnoy
5c3c682b6e Update changelog for 1.18.0 release 2021-08-03 13:12:59 -07:00
Brad Warren
1129d850d3 add chardet dep (#8965) 2021-08-03 10:35:00 +10:00
alexzorin
bdc48e6a32 snap: workaround for snapctl crash in plugin hook (#8955)
* snap: workaround for snapctl crash in plugin hook

* test functionality, not existence
2021-08-02 16:15:46 -07:00
alexzorin
523f8f5e65 stop using deprecated distro.linux_distribution (#8961)
`distro.linux_distribution` was deprecated (https://github.com/python-distro/distro/pull/296) in the release of `distro` at the end of last week. The deprecation is causing the `nopin` nightly tests to fail.

This change migrates Certbot off that function.

As far as I can tell, the Arch Linux edge case described in the code comments no longer happens, but better to be safe than sorry I think.

* stop using deprecated distro.linux_distribution

* update comment

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-08-02 15:39:07 -07:00
Brad Warren
1dabddeb85 make display classes implement IDisplay (#8963) 2021-08-02 11:59:07 -07:00
Brad Warren
f9ef894141 update snapcraft.cfg comment (#8959) 2021-08-01 12:15:01 +10:00
Adrien Ferrand
979e21dcbf Reimplement Certbot zope.interfaces into abstract base classes (#8950)
* Implement certbot services

* Various fixes

* Local oldest requirements

* Clean imports

* Add unit tests for certbot.services

* Clean code

* Protect against nullity of global services

* Fix CLI

* Fix tests

* Consistent test behavior

* Define new ABC classes

* Reimplement services with new ABC classes

* Adapt plugins discovery and selection

* Remove zope interfaces from plugins

* Re-enable delegation for simplicity

* Fix interfaces declaration

* Remove interface implementer

* Interfaces ordering

* Extract zope logic from discovery

* Cleanup imports

* Fixing tests

* Fix main_test

* Finish certbot unit tests

* Fix lint

* Various fixes thanks to mypy

* Fix lint

* Order imports

* Various fixes

* Clean code

* Remove reporter service, migrate display service in certbot.display.util.

* Fix test

* Fix apache compatibility test

* Fix oldest test

* Setup certbot.display.service module

* Reintegrate in util

* Fix imports

* Fix tests and documentation

* Refactor

* Cleanup

* Cleanup

* Clean imports

* Add unit tests

* Borrow sphinx build fix from #8863

* Align zope interfaces on ABC

* Various fixes

* Fix type

* Fix type

* Some cleanup

* Fix lint

* Update certbot/certbot/_internal/configuration.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/_internal/configuration.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Fix imports

* Fix Config contract (accounts_dir property)

* Remove unnecessary interface

* Set NamespaceConfig public, remove Config interface

* Remove Display ABC and implementation of IDisplay

* Clean lint

* Cleanup old decorators

* Contract on plugin constructor only

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/configuration.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/interfaces.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Some corrections

* Add changelog

* Fix --authenticators and --installers flags on plugins subcommand

* Fix multiheritance on the interface Plugin

* Update certbot/certbot/_internal/plugins/manual.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/_internal/plugins/disco.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Add warnings in logger also

* Add deprecation warnings also when plugins are verified.

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-07-29 13:45:29 -07:00
Adrien Ferrand
8133d3e70a Fix python-augeas failure on Windows (v2) (#8951)
This PR is a new approach for fixing #8732 based on the discussions occurred in the first PR #8877.

This PR upgrades python-augeas to the latest version, and avoids tests failure of Windows because of this upgrade. To do so it leverages the [tox multi-platform feature](https://tox.readthedocs.io/en/latest/example/platform.html) and modifications to `tools/venv.py` in order to not install and not test `certbot-apache` on Windows.

* Unpin python-augeas and upgrade current pinnings

* Do not install certbot-apache in Windows dev environments

* Introduce tox specific win packages + remove certbot compatibility on windows

* Add libaugeas to sphinx build

* Redefine lint and mypy targets

* Keep the lint and mypy environments
2021-07-29 11:25:25 -07:00
Brad Warren
08839758bd Finish pinning system rewrite (#8934)
* add oldest pyproject.toml file that works

* make single oldest_constraints.txt file

* remove unused merge_requirements.py

* remove unused import

* make conditional right

* simplify pip_install.py

* fix typo

* bump min dns-lexicon dependency

* fix zope import warning

* pin back wheel

* refactor pinning script

* Add oldest script.

* add pip comment

* add pipstrap extra

* simplify pinning scripts

* remove pipstrap extra

* update contributing

* Add design doc

* Update tools/pinning/DESIGN.md

Co-authored-by: ohemorange <erica@eff.org>

* Update tools/pinning/DESIGN.md

Co-authored-by: ohemorange <erica@eff.org>

* Update tools/pinning/DESIGN.md

Co-authored-by: ohemorange <erica@eff.org>

* Update tools/pinning/DESIGN.md

Co-authored-by: ohemorange <erica@eff.org>

* rename normal to current

* no dummies

* script improvements

* mention need to update setup.py

* try and clarify poetry behavior

* tweak section title

Co-authored-by: ohemorange <erica@eff.org>
2021-07-22 12:00:30 -07:00
Adrien Ferrand
10eecf9c97 Deprecate zope.component in favor of an direct calls to functions from certbot.display.util module (#8835)
* Implement certbot services

* Various fixes

* Local oldest requirements

* Clean imports

* Add unit tests for certbot.services

* Clean code

* Protect against nullity of global services

* Fix CLI

* Fix tests

* Consistent test behavior

* Various fixes

* Clean code

* Remove reporter service, migrate display service in certbot.display.util.

* Fix test

* Fix apache compatibility test

* Fix oldest test

* Setup certbot.display.service module

* Reintegrate in util

* Fix imports

* Fix tests and documentation

* Refactor

* Cleanup

* Cleanup

* Clean imports

* Add unit tests

* Borrow sphinx build fix from #8863

* Fix type

* Add comment

* Do not reuse existing display service, which never exist at that time

* Make get_display() private

* Fix lint

* Make display internal

* Fix circular dependencies

* Fixing circular dependencies

* Rename patch methods and update docstring

* Update deprecation messages

* Update certbot/certbot/_internal/display/obj.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Add links

* Avoid relying on internal certbot packages from certbot-apache

* Keep same behavior for patch_get_utility*

* Better diff

* Add changelog

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-07-19 17:09:06 -07:00
alexzorin
bebd399488 acme: deprecate ACMEv1 client classes (#8931)
* acme: deprecate ACMEv1 client classes

Adds pending deprecations to:
- acme.client.Client
- acme.client.BackwardsCompatibleClientV2

Adds a warning to Certbot when a v1 server is detected.

* move thsi change from 1.17 to 1.18

* revert some whitespace changes
2021-07-16 08:50:16 +10:00
alexzorin
a105b587ac apache: fix crash when authenticating empty vhosts (#8941)
Fixes #8940.
2021-07-15 11:12:14 -07:00
alexzorin
8e29063ba7 pylint: upgrade pinned verson and fix new lints (#8936)
While bumping pinned packages in #8928, we came across a new version of pylint (2.9.3). Upgrading to this version requires some changes to Certbot's code, which is what this change is about.

* pylint: upgrade pinned verson and fix new lints

* maxsplit should be 1, not -1, for rsplit
2021-07-15 11:03:39 -07:00
Brad Warren
117791b582 Remove unneeded certbot-auto files (#8938) 2021-07-14 14:34:54 -07:00
Brad Warren
2ab7857fa5 Do not guess HTTP-01 response encoding (#8942)
* fix http-01 encoding

* improve comment
2021-07-14 14:11:50 -07:00
ohemorange
7ede5c3487 Merge pull request #8933 from certbot/candidate-1.17.0
Update files from 1.17.0 release
2021-07-06 12:38:04 -07:00
Brad Warren
915459258b Bump version to 1.18.0 2021-07-06 08:42:52 -07:00
Brad Warren
d94cf0e1d6 Add contents to certbot/CHANGELOG.md for next version 2021-07-06 08:42:51 -07:00
Brad Warren
952a296e20 Release 1.17.0 2021-07-06 08:42:49 -07:00
Brad Warren
d9a1850eaa Update changelog for 1.17.0 release 2021-07-06 08:41:16 -07:00
alexzorin
667750f3ff docs: explain the situation with --manual renewal (#8911)
* docs: explain the situation with --manual renewal

* note that the non-hook command can't be cronned

* add xref to #renewing-certificates

* update manual description in the plugins table

* redirect manual users towards other plugins

* refer to authentication hook scripts in table
2021-06-28 16:40:24 -07:00
Rene Luria
8b610239bf Adds Infonaniak 3rd party plugin (#8923) 2021-06-25 14:46:37 -04:00
ohemorange
62426caa5a Merge pull request #8919 from alexzorin/standalone-error-ux
Improve standalone errors
2021-06-21 16:54:36 -07:00
Alex Zorin
f137d8424e acme.standalone: expose original socket.error 2021-06-22 09:24:53 +10:00
Alex Zorin
e5c41e76c5 standalone: add an auth_hint 2021-06-22 09:24:44 +10:00
alexzorin
1e114b4ef8 apache: configure nameless vhosts during auth (#8898)
In the apache2 package on Debian-based distros, the default
000-default.conf virtual host does not include a ServerName.

Depending on the FQDN hostname of the machine and DNS setup, Apache
assigns a name to this unnamed vhost at runtime. As a result, the
Apache config end up with vhosts that have duplicative names.

Previously, Certbot did not identify that the nameless vhost could be
a match for the requested identifier, which would, depending on
configuration load order, cause the authenticator to fail.

This change causes Certbot to include all unnamed vhosts on top of
matched vhosts, during authentication. If no vhosts matched, the
existing behavior remains the same.

* apache: configure nameless vhosts during auth

* vhost is only unnamed if ServerName is not set

* also fix test to only match ServerName

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-06-21 07:18:29 -04:00
alexzorin
bc7c953bcc cli: vary renewal advice for hookless manual certs (#8914)
* cli: vary renewal advice for hookless manual certs

1. Don't print that the certificate will be automatically renewed,
because it won't be.
2. Add a "NEXT STEP" telling the user that they will need to manually
re-issue the certificate in order to renew it.

* kill superfluous comma

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* clarify wording of the next step

* fix the test

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2021-06-17 16:36:54 -07:00
alexzorin
60a91eb688 certonly: hide "NEXT STEPS" for dry-runs (#8901)
* certonly: hide "NEXT STEPS" for dry-runs

* add a test
2021-06-14 14:25:43 -07:00
chaptergy
1b025e84e8 Adds njalla, DuckDNS and Porkbun 3rd party plugins (#8907) 2021-06-14 13:23:35 -07:00
kartikynwa
d3555623ba certbot-apache: Add Void Linux overrides (#8891)
* certbot-apache: Add Void Linux overrides

* certbot-apache: Correct distro name to Void Linux
2021-06-12 17:02:16 +10:00
Brad Warren
18ea72faf1 Split out testing extras (#8893)
* split out test extras

* update extras and regenerate pinnings

* pin back mypy
2021-06-11 13:17:50 -07:00
ohemorange
c8255dded5 Add --verbose-level flag and fix logging level calculations (#8900)
Also, update `dev-cli.ini` example to use new flag.

Although https://github.com/bw2/ConfigArgParse/pull/216 allowed setting a `count` action value in a config file, our default detection system won't let us use that functionality. While we should eventually fix that, for now, let developers have a cli.ini with a higher logging level by adding this flag.

Note that this flag is intended to work the same way adding `-vvv`s does; that is, as a modifier to the pre-set level, rather than setting the absolute level. The number it is set to is equivalent to the number of `v`s that would otherwise have been passed, with "2" as the current maximum effective number of levels (warning --> info --> debug).

* Add --verbose-level flag for devs to set in cli.ini

* Update dev-cli.ini to use new flag
2021-06-10 16:45:07 -07:00
ohemorange
b48e336554 Allow nginx parser to handle empty file (#8895)
* Allow parsing empty files

* add unit test

* lint

* update parser_test

* Update configurator_test

* update changelog
2021-06-11 09:21:52 +10:00
alexzorin
0c637860cd cli: improve error messages for enhance errors (#8884)
* cli: improve error messages for enhance errors

* remove status message after enhance config revert
2021-06-10 15:58:11 -07:00
Brad Warren
0b08a80dce Pin pip & co like our other dependencies (#8868)
* use poetry 1.2.0a1

* pin pip normally

* use normal constraints file with pipstrap

* remove unused STRIP_HASHES var

* Check for old poetry versions

* keep pip, setuptools, and wheel pinned in oldest

* remove strip hashes

* pin back pip

* fix new lint error
2021-06-09 17:01:54 -07:00
alexzorin
d7b26c1bb2 cli: dont use argv[0] in user-facing messages (#8857) 2021-06-09 14:31:15 -07:00
Michel Le Bihan
78261dbae2 Fix typo of fulfill in dns_rfc2136 plugin (#8886) 2021-06-06 09:55:24 +10:00
Jonathan Griffin
2ed4e0a17e Fixed typo in common.py (#8881)
Fixed typo:

exterally -> externally
2021-06-03 13:42:56 -07:00
Brad Warren
c372dd8aee Remove local-oldest-requirements files (#8863)
This is part of https://github.com/certbot/certbot/issues/8787. I got a +1 from our packagers at major distros in https://github.com/certbot/certbot/issues/8761.

* remove local-oldest-requirements files

* fix tests

* fix some oldest tests

* list packages on one line in tox.ini

* add changelog entry
2021-06-01 14:46:06 -07:00
Brad Warren
01772280c0 Merge pull request #8879 from certbot/candidate-1.16.0
Release 1.16.0
2021-06-01 14:13:44 -07:00
Erica Portnoy
814d8d1aba Bump version to 1.17.0 2021-06-01 10:52:31 -07:00
Erica Portnoy
a190480517 Add contents to certbot/CHANGELOG.md for next version 2021-06-01 10:52:31 -07:00
Erica Portnoy
7e8f22e136 Release 1.16.0 2021-06-01 10:52:23 -07:00
Erica Portnoy
965a403699 Update changelog for 1.16.0 release 2021-06-01 10:49:17 -07:00
Brad Warren
968cc5801b delete eggs before running poetry (#8865) 2021-05-31 09:03:25 +02:00
Brad Warren
492b578662 Update coverage and pytest (#8875)
* unpin pytest and update pinnings

* ignore external mock warnings

* fix assertion

* fix test_revoke_mutual_exclusive_flags

* fix output count

* capture stdout and stderr separately

* undouble counts

* rename variable

* don't use capture_output

* fix leaky test

* update coverage
2021-05-31 09:01:01 +02:00
ohemorange
e946479b9f Use shortlink for renewal setup instructions (#8874) 2021-05-28 14:50:59 -07:00
Adrien Ferrand
f88105a952 Deprecate usage of IConfig as a singleton in Certbot (#8869)
* Deprecate usage of IConfig as a singleton in Certbot

* Fix local oldest requirements

* Add changelog

* Add tests for certbot.crypto_util.init_save_* functions

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-05-28 12:17:56 -07:00
alexzorin
3380694fa8 windows: fix colors and bold text not rendering (#8872)
Fixes #8848.
2021-05-28 10:36:51 -07:00
ohemorange
18631b99ef Add instructions for setting up a cronjob in the docs (#8870)
* Add instructions for setting up a cronjob in the docs

* Be more specific about where the cron entry will be created

Co-authored-by: alexzorin <alex@zorin.id.au>

* Correct &amp;s to &s

Co-authored-by: alexzorin <alex@zorin.id.au>

* Correct other &amp; to &

Co-authored-by: alexzorin <alex@zorin.id.au>

* De-weasel the double-scheduled-task comment

Co-authored-by: alexzorin <alex@zorin.id.au>

* Have users create directory hooks instead of command line hooks

* Use sudo in command

Co-authored-by: alexzorin <alex@zorin.id.au>

* tell windows users to ignore these instructions instead of telling them they won't work

* Use the same commands that we have in the general instructions

Co-authored-by: alexzorin <alex@zorin.id.au>
2021-05-28 16:27:56 +10:00
Brad Warren
55d461392a Remove unused tools (#8862)
* remove unused tools

* remove deactivate.py
2021-05-28 06:47:44 +10:00
Arthur Lutz
a7a9a8480b [docs/using] Add mention of CentOS as supported by apache plugin (#8871) 2021-05-27 10:45:11 -07:00
Brad Warren
3640b8546e remove ancient comment (#8861) 2021-05-27 22:05:26 +10:00
Brad Warren
1f94c7db20 remove ancient .gitignore (#8864) 2021-05-27 21:52:46 +10:00
alexzorin
a02223a97f cli: later printing of renewal and install retry advice (#8860)
* later printing of renewal and install retry advice

Move printing of advice for automated renewal, and retrying installation
in case of failure, towards the end of `run` and `certonly`.

Also adds some renewal advice for the --csr case (no autorenewal).

* update renewal advice for preconfigured-renewal

* rewrite in terms of "NEXT STEPS" for run/certonly

* fix lint

* re-add "Could not install certificate"

* update --csr renewal advice

* rewrite non-preconfigured-renewal renewal advice
2021-05-26 15:16:12 -07:00
ohemorange
2e31b1ca41 Remove no names found in configuration files because it sounds like an error but actually it is fine (#8866)
* Remove no names found in configuration files because it sounds like an error but actually it is fine

* fix test

* Pose question more grammatically and specifically, and remove extra space

* fix lint

Co-authored-by: Alex Zorin <alex@zorin.id.au>
2021-05-27 07:54:04 +10:00
alexzorin
7ce86f588b windows: always run with --preconfigured-renewal (#8867)
Adds a Pynsist extra_preamble in the Certbot entry_point for the
Windows installer, ensuring the flag is always set.
2021-05-26 15:45:40 +02:00
alexzorin
39b396763a apache/nginx: certbot>=1.10.0 -> 1.10.1 (#8859)
1.10.0 was a bad release and this breaks our oldest Boulder tests.


I bumped the version to 1.10.0 in #8852 to get access to a new public display_util API, but that was the release with the broken deprecation of `--manual-public-ip-logging-ok`. So let's bump it to 1.10.1.
2021-05-25 08:40:18 -07:00
ohemorange
6f27c32db1 Command-line UX overhaul (#8852)
Streamline and reorganize Certbot's CLI output.

This change is a substantial command-line UX overhaul,
based on previous user research. The main goal was to streamline
and clarify output. To see more verbose output, use the -v or -vv flags.

---

* nginx,apache: CLI logging changes

- Add "Successfully deployed ..." message using display_util
- Remove IReporter usage and replace with display_util
- Standardize "... could not find a VirtualHost ..." error

This changes also bumps the version of certbot required by certbot-nginx
and certbot-apache to take use of the new display_util function.

* fix certbot_compatibility_test

since the http plugins now require IDisplay, we need to inject it

* fix dependency version on certbot

* use better asserts

* try fix oldest deps

because certbot 1.10.0 depends on acme>=1.8.0, we need to use
acme==1.8.0 in the -oldest tests

* cli: redesign output of new certificate reporting

Changes the output of run, certonly and certonly --csr. No longer uses
IReporter.

* cli: redesign output of failed authz reporting

* fix problem sorting to be stable between py2 & 3

* add some catch-all error text

* cli: dont use IReporter for EFF donation prompt

* add per-authenticator hints

* pass achalls to auth_hint, write some tests

* exclude static auth hints from coverage

* dont call auth_hint unless derived from .Plugin

* dns fallback hint: dont assume --dns-blah works

--dns-blah won't work for third-party plugins, they need to be specified
using --authenticator dns-blah.

* add code comments about the auth_hint interface

* renew: don't restart the installer for dry-runs

Prevents Certbot from superfluously invoking the installer restart
during dry-run renewals. (This does not affect authenticator restarts).

Additionally removes some CLI output that was reporting the fullchain
path of the renewed certificate.

* update CHANGELOG.md

* cli: redesign output when cert installation failed

- Display a message when certificate installation begins.
- Don't use IReporter, just log errors immediately if restart/rollback
  fails.
- Prompt the user with a command to retry the installation process once
  they have fixed any underlying problems.

* vary by preconfigured_renewal

and move expiry date to be above the renewal advice

* update code comment

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* update code comment

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* fix lint

* derve cert name from cert_path, if possible

* fix type annotation

* text change in nginx hint

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* print message when restarting server after renewal

* log: print "advice" when exiting with an error

When running in non-quiet mode.

* try fix -oldest lock_test.py

* fix docstring

* s/Restarting/Reloading/ when notifying the user

* fix test name

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* type annotations

* s/using the {} plugin/installer: {}/

* copy: avoid "plugin" where possible

* link to user guide#automated-renewals

when not running with --preconfigured-renewal

* cli: reduce default logging verbosity

* fix lock_test: -vv is needed to see logger.debug

* Change comment in log.py to match the change to default verbosity

* Audit and adjust logging levels in apache module

* Audit and adjust logging levels in nginx module

* Audit, adjust logging levels, and improve logging calls in certbot module

* Fix tests to mock correct methods and classes

* typo in non-preconfigured-renewal message

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* fix test

* revert acme version bump

* catch up to python3 changes

* Revert "revert acme version bump"

This reverts commit fa83d6a51c.

* Change ocsp check error to warning since it's non-fatal

* Update storage_test in parallel with last change

* get rid of leading newline on "Deploying [...]"

* shrink renewal and installation success messages

* print logfile rather than logdir in exit handler

* Decrease logging level to info for idempotent operation where enhancement is already set

* Display cert not yet due for renewal message when renewing and no other action will be taken, and change cert to certificate

* also write to logger so it goes in the log file

* Don't double write to log file; fix main test

* cli: remove trailing newline on new cert reporting

* ignore type error

* revert accidental changes to dependencies

* Pass tests in any timezone by using utcfromtimestamp

* Add changelog entry

* fix nits

* Improve wording of try again message

* minor wording change to changelog

* hooks: send hook stdout to CLI stdout

includes both --manual and --{pre,post,renew} hooks

* update docstrings and remove TODO

* add a pending deprecation on execute_command

* add test coverage for both

* update deprecation text

Co-authored-by: ohemorange <ebportnoy@gmail.com>

Co-authored-by: Alex Zorin <alex@zorin.id.au>
Co-authored-by: alexzorin <alex@zor.io>
2021-05-25 10:47:39 +10:00
Brad Warren
099c6c8b24 remove references to certbot-constraints.txt (#8858) 2021-05-24 14:17:11 -07:00
Brad Warren
315ddb247f Upgrade pylint (#8855)
This is part of https://github.com/certbot/certbot/issues/8782. I took it on now because the currently pinned version of `pylint` doesn't work with newer versions of `poetry` which I wanted to upgrade as part of https://github.com/certbot/certbot/issues/8787.

To say a bit more about the specific changes in this PR:

* Newer versions of `pylint` complain if `Popen` isn't used as a context manager. Instead of making this change, I switched to using `subprocess.run` which is simpler and [recommended in the Python docs](https://docs.python.org/3/library/subprocess.html#using-the-subprocess-module). I also disabled this check in a few places where no longer using `Popen` would require significant refactoring.
* The deleted code in `certbot/certbot/_internal/renewal.py` is cruft since https://github.com/certbot/certbot/pull/8685.
* The unused argument to `enable_mod` in the Apache plugin is used in some over the override classes that subclass that class.

* unpin pylint and repin dependencies

* disable raise-missing-from

* disable wrong-input-order

* remove unused code

* misc lint fixes

* remove unused import

* various lint fixes
2021-05-24 10:02:55 -07:00
alexzorin
2df279bc5b cli: dont double-print choosing plugins error (#8850) 2021-05-17 16:39:04 -07:00
osirisinferi
9e6b406218 Move 5040495 CHANGELOG.md entry to correct version (#8851)
The merge of #8789 left the CHANGELOG.md entry at a previous certbot release. This PR puts the entry at the correct certbot version.
2021-05-17 11:04:05 -07:00
Adrien Ferrand
352ee258b7 [Windows] Cleanup Certbot pkg dir before installing to avoid dependencies conflicts (#8836)
Fixes #8824

This PR makes the installer first delete (if exist) the previous `pkg` directory in the Certbot installation in order to avoid dependencies conflicts when a new version of Certbot (with new versions of dependencies) is intaller other an existing one.

I took the simplest approach here, which is to delete specifically the directories known to create conflicts, instead of more complex approaches that involve to factor in some way the complete uninstaller logic. This is because the complexity added without a clear improvement does not worth it in my opinion. More specifically:
* factorizing in some way the uninstaller section in the NSIS template make the installer use any potential new logic of a new installation of Certbot instead of the one applying for the current installation, and may create unexpected errors during installation or at runtime
* calling the existing `uninstaller.exe` would be better, but I could not find a proper way to let NSIS wait for the actual end of the uninstall logic, and again may create unexpected errors during installation or at runtime

* Cleanup Certbot pkg dir before installing to avoid dependencies conflicts

* Add a changelog

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-05-17 10:22:47 -07:00
osirisinferi
5040495741 Use UTF-8 for renewal configuration file encoding (#8789) 2021-05-16 15:17:41 +02:00
Thomas G
bc23e07ee5 Fix incompatibility with lexicon >= v3.6.0 (#8819) 2021-05-16 15:03:53 +02:00
Mads Jensen
466e437a20 Use new GitHub templates. Add funding link (#8845) 2021-05-14 11:43:58 -07:00
Brad Warren
ee3b3656ea Remove old apache tests (#8843)
Apache test farm tests started failing last night due to a change in pyenv. See https://dev.azure.com/certbot/certbot/_build/results?buildId=3948&view=logs&j=f67c2a39-2c4f-5190-915f-6f32a7a4306f&t=96f0f394-f513-5158-f5e7-a26e55aeadbf&l=26943.

I managed to fix that in d94f20f8b7, however, the OSes the tests were failing on were Debian 9 and Ubuntu 16.04. [Debian 9 reached its end-of-life in July 2020](https://wiki.debian.org/DebianReleases) and [Ubuntu 16.04 reached its end of standard support in April 2021](https://wiki.ubuntu.com/Releases). As shown at the same links, Debian 9 still has support from the LTS team and Ubuntu 16.04 has ESM support. Do we still want to support either of these OSes?

If so, we can use the commit I linked in the first sentence of the last paragraph, but I think supporting the OSes through their standard support is good enough. The Certbot team has enough on their plate and especially when the OSes are so old that we can't even use their packaged version of Python anymore which complicates our tests, I think we can just drop support and move on.

I don't have a strong opinion here though so if someone else does, let me know what you'd like to see or make the PR yourself based on the changes in my linked commit and I'll merge it.

You can see the tests passing with this change at https://dev.azure.com/certbot/certbot/_build/results?buildId=3955&view=results.

* Remove apache tests on old OSes

* remove unused pyenv code
2021-05-14 11:27:47 -07:00
miigotu
db40974788 Add 3rd party certbot-dns-godaddy to the docs (#8844)
* Add 3rd party certbot-dns-godaddy to the docs

* fix up rst syntax for godaddy link

Co-authored-by: alexzorin <alex@zor.io>
2021-05-13 09:22:31 +10:00
Brad Warren
89396cefa2 Remove unnecessary release script output (#8820) 2021-05-11 15:42:52 -07:00
alexzorin
c48adc5753 docker: delete CARGO_HOME (#8839) 2021-05-11 01:03:35 +02:00
Brad Warren
c788820f5d Fix sphinx followup (#8841)
I think we should use our `pip_install*` scripts wherever we can and I'm not quite sure yet if I'd call `repoze.sphinx.autointerface` unmaintained.

* use pip_install_editable

* update sphinx comment
2021-05-10 14:32:37 -07:00
Adrien Ferrand
b0552e1939 Fix Sphinx builds (#8838)
Since Saturday the CI pipeline is failing due to several Sphinx errors. See https://dev.azure.com/certbot/certbot/_build/results?buildId=3928&view=logs&j=d74e04fe-9740-597d-e9fa-1d0400037dfd&t=dde413a4-f24c-59a0-9684-e33d79f9aa02

First, the build of certbot-dns-google is failing because of a particular configuration. It seems that this configuration has been written here to activate the support of the RST instruction `.. code-block:: json` in documentation. However, it does not seem to be necessary for a similar situation in certbot-dns-route53 documentation. So let's try to remove it and fix the Sphinx builds.

Second, Sphinx builds were not pinning dependencies, so Sphinx 4.x (that has been released yesterday) started to be used in the pipeline. Sadly this new version is not compatible with the plugin `repoze.sphinx.autointerface`, used to extract documentation from `zope.interface`. So I fixed the pinning and also explicitly pin Sphinx to 3.5.x for now.

Technically speaking the second action is sufficient to fix the first error, but I keep the dedicated solution because it improves the documentation in my opinion.

This situation could be fixed by not requiring `repoze.sphinx.autointerface`, but this is possible only if we remove `zope.interface` from Certbot. Luckily I started the work few days ago ;).

* Remove explicit lexer call in certbot-dns-google doc builds.

* Write a valid JSON file in the documentation

* Apply constraints to sphinx build environments

* Pin Sphinx to 3.5.4

* Update dependencies

* Pin traitlets
2021-05-10 12:11:31 -07:00
Brad Warren
7eae058af5 Remove OS instructions (#8833)
Fixes https://github.com/certbot/certbot/issues/8832.

[These instructions are creating confusion among users](https://github.com/certbot/certbot/issues/8832) and [frustration among packagers](https://pagure.io/fesco/issue/2570) for whom the warning at the top of the OS packaging section doesn't apply. Because of this, I think we should remove them in favor of our instruction generator and snap/docker/pip instructions.

I also told Fedora packagers that we could probably do this in response to them continuing to improve their Certbot packages which they've done through things like the renewal timer that is now enabled by default.
2021-05-07 13:10:02 -07:00
Brad Warren
934de48d44 fix typo (#8828) 2021-05-05 15:49:06 -07:00
Brad Warren
e39c7b5233 Merge pull request #8827 from certbot/candidate-1.15.0
Update files from 1.15.0 release
2021-05-05 15:48:43 -07:00
Brad Warren
56c781aec4 Bump version to 1.16.0 2021-05-04 11:50:12 -07:00
Brad Warren
484309ed95 Add contents to certbot/CHANGELOG.md for next version 2021-05-04 11:50:12 -07:00
Brad Warren
67e3c54744 Release 1.15.0 2021-05-04 11:50:10 -07:00
Brad Warren
bb6a076fda Update changelog for 1.15.0 release 2021-05-04 11:48:09 -07:00
Brad Warren
dd0e590de3 Make a test farm tests package (#8821)
Fixes https://github.com/certbot/certbot/issues/8781.

This PR makes our test farm tests into a normal package so it and its dependencies can be tracked and installed like our other packages.

Other noteworthy changes in this PR:

* Rather than continuing to place logs in your CWD, they're placed in a temporary directory that is printed to the terminal.
*  `tests/letstest/auto_targets.yaml` was deleted rather than renamed because the file is no longer used.

* make a letstest package

* remove deleted deps

* fix letstest install

* add __init__.py

* call main

* Explicitly mention activating venv

* rerename file

* fix version.py path

* clarify "this"

* Use >= instead of caret requirement
2021-05-03 17:42:30 -07:00
Brad Warren
d3d9a05826 fix client email address (#8817)
client-dev@letsencrypt.org is no longer used by the Certbot team so this PR updates the email address in our packages to our current mailing list.
2021-05-03 12:38:54 -07:00
Mads Jensen
2cf1775864 Update assertTrue/False to Python 3 precise asserts (#8792)
* Update assertTrue/False to Python 3 precise asserts

* Fix test failures

* Fix test failures

* More replacements

* Update to Python 3 asserts in acme-module

* Fix Windows test failure

* Fix failures

* Fix test failure

* More replacements

* Don't include the semgrep rules

* Fix test failure
2021-04-29 10:45:08 +10:00
ohemorange
f339d23e54 Remove further references to certbot-auto in the repo (#8814)
* Move version.py to tests/letstest since it's used by test_sdists.sh

* Delete unused components of certbot-auto

* Remove test_leauto_upgrades.sh and references to it

* Remove test_letsencrypt_auto_certonly_standalone.sh and references to it

* Remove outstanding references to certbot-auto

* Remove references to letsencrypt-auto

* find certbot in the correct directory

* delete letsencrypt-auto-source line from .isort.cfg since that directory no longer contains any python code

* remove (-auto) from certbot(-auto)

* delete line from test

* Improve style for version.py
2021-04-27 15:27:21 -07:00
Brad Warren
ac3edc2c1d don't ignore kgs (#8811) 2021-04-26 15:47:49 -07:00
ohemorange
ba912018f8 Remove pytest run from release script (#8810)
Fixes #8802.

Also removed the unused `kgs` cruft while I was here, since it's leftover from the [initial release commit](3c08b512c3) and I'm pretty sure we don't use that anymore.
2021-04-26 15:18:05 -07:00
Brad Warren
c06e40dbef Update certbot-auto modification checks (#8805)
* revert changes to letsencrypt-auto-source/le-auto

* update modification tests
2021-04-26 13:50:10 -07:00
ohemorange
32247b3c89 Remove modifications to certbot-auto from the release script (#8797)
Fixes #8707.

* Remove modifications to certbot-auto from the release script

* Update tools/_release.sh

* Delete tools/eff-pubkey.pem

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-04-22 13:37:46 -07:00
alexzorin
e4f5aced1c docs: add certbot-dns-azure third-party plugin (#8796) 2021-04-22 12:38:18 -07:00
Brad Warren
9292666b28 fix ciphers link (#8799) 2021-04-22 08:55:05 +10:00
Brad Warren
fb967fda15 pin cython (#8794) 2021-04-20 12:12:45 -07:00
osirisinferi
4a404e2a4a Expand manual DNS challenge instructions to include mention of propagation time and tool to check this (#8770)
* Expand manual DNS challenge instructions

* Less jargon

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* Less is more

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* Make more clear where to look at Googles Toolbox

* Reshuffle text

* Show verify instructions only on last dns-01 challenge

* Swap domain and value

* Remove '(also)'

* Fix DNS verify message for mixed challenge types

* Add a lengthy comment about why there's a full stop after `{domain}`

* Typo

Co-authored-by: ohemorange <ebportnoy@gmail.com>
2021-04-14 15:36:14 -07:00
Adrien Ferrand
0dbe17bbd4 Define OS options by a dedicated object in Apache configurator (#8778)
In https://github.com/certbot/certbot/pull/8748#discussion_r605457670 we discussed about changing the dict used to set OS options for Apache configurators into a dedicated object.

* Create _OsOptions class to configure the os specific options of the Apache configurators

* Fix tests

* Clean imports

* Fix naming

* Fix compatibility tests

* Rename a class

* Ensure restart_cmd_alt is set for specific OSes.

* Add docstring

* Fix override

* Fix coverage
2021-04-13 11:18:49 -07:00
Brad Warren
e33090f282 Fix homebrew (#8791)
The macOS tests run on this PR would fail without this change.

* brew update

* add link to upstream issue
2021-04-12 13:36:38 -07:00
Brad Warren
06bece36de Ensure that mock is pinned (#8786)
* List mock as a dependency in pyproject.toml
* Add a code comment to help us remember to remove it when we can
* Run pin.sh
2021-04-09 14:34:50 -07:00
Brad Warren
7f9857a81b Use Python 3 style super (#8777)
This is one of the things that newer versions of `pylint` complains about.

* git grep -l super\( | xargs sed -i 's/super([^)]*)/super()/g'

* fix spacing
2021-04-08 13:04:51 -07:00
Brad Warren
459a254aea Improve tools/snap/build_remote.py output (#8780)
I think this PR improves tools/snap/build_remote.py's output in a number of ways such as:

* Logs of snap builds were being deleted because they weren't being copied out of the temporary directory added in https://github.com/certbot/certbot/pull/8719.
* The lock should now always be acquired before printing output when multiple processes are running which helps prevent processes mixing their output with each other.
* Output is never buffered which ensures that repeated calls to `print` from the same process while it holds the output lock is kept together.
* The case where we printed output about the "chroot problem" and stopped retrying the build has been deleted because with the fix in https://github.com/certbot/certbot/pull/8719, we should be able to recover in this case.
* If the build failed for any reason, we dump as much output about the problem as we can. I think most times we won't need to read this output, but I personally prefer it being there in case we want it for some reason. Due to this change, I also simplified `_build_snap` and `_dump_results` a bit since `_build_snap` handles printing logs as needed.

* print more output

* lock when printing output

* clarify purpose of lock

* preserve logfiles

* python better

* consistently flush output

* remove workspaces dict

* rename variable

* remove unused variable

* don't use all which exits early

* fix typo
2021-04-07 14:52:15 -07:00
ohemorange
c21f277248 Merge pull request #8779 from certbot/candidate-1.14.0
Update files from 1.14.0 release
2021-04-06 16:09:19 -07:00
Brad Warren
04a85742c1 Bump version to 1.15.0 2021-04-06 10:24:35 -07:00
Brad Warren
21be290e24 Add contents to certbot/CHANGELOG.md for next version 2021-04-06 10:24:34 -07:00
Brad Warren
bf40b81b5a Release 1.14.0 2021-04-06 10:24:32 -07:00
Brad Warren
1b6e4028dc Update changelog for 1.14.0 release 2021-04-06 10:17:01 -07:00
Brad Warren
f15d10abc8 Update Dockerfile-dev (#8774)
* switch Dockerfile-dev to Ubuntu Focal

* Make apt noninteractive

* add --no-install-recommends
2021-04-05 16:02:14 -07:00
alexzorin
a12d91aef6 fix various fd leaks (#8747)
* fix various fd leaks

* use context manager for display provider
2021-04-06 00:50:12 +02:00
Adrien Ferrand
c438a397a0 Enable mypy strict mode (#8766)
Built on top of #8748, this PR reenables mypy strict mode and adds the appropriate corrections to pass the types checks.

* Upgrade mypy

* First step for acme

* Cast for the rescue

* Fixing types for certbot

* Fix typing for certbot-nginx

* Finalize type fixes, configure no optional strict check for mypy in tox

* Align requirements

* Isort

* Pylint

* Protocol for python 3.6

* Use Python 3.9 for mypy, make code compatible with Python 3.8<

* Pylint and mypy

* Pragma no cover

* Pythonic NotImplemented constant

* More type definitions

* Add comments

* Simplify typing logic

* Use vararg tuple

* Relax constraints on mypy

* Add more type

* Do not silence error if target is not defined

* Conditionally import Protocol for type checking only

* Clean up imports

* Add comments

* Align python version linting with mypy and coverage

* Just ignore types in an unused module

* Add comments

* Fix lint

* Work in progress

* Finish type control

* Isort

* Fix pylint

* Fix imports

* Fix cli subparser

* Some fixes

* Coverage

* Remove --no-strict-optional (obviously...)

* Update certbot-apache/certbot_apache/_internal/configurator.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/_internal/display/completer.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Cleanup dns_google

* Improve lock controls and fix subparser

* Use the expected interfaces

* Fix code

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-04-05 15:04:21 -07:00
Adrien Ferrand
0f9f902b6e Use typing-extensions to ensure certbot dev environment is compatible with Python 3.6/3.7 (#8776)
Fixes #8773

I took option 2 from the issue mentionned above (importing `typing-extensions` on dev dependencies) to avoid modifying certbot runtime requirements given that what needs to be added is useful for mypy only.

I did not change the Python version used to execute the linting and mypy on the standard tests, given that the tox `docker_dev` target already checks if the development environment is working for Python < 3.8.
2021-04-05 11:53:57 -07:00
Brad Warren
33f177b361 Upgrade Python to 3.8.9. (#8775)
Over the weekend, Python released new versions of Python 3.8 and Python 3.9 partially in response to the OpenSSL CVEs discussed at https://github.com/certbot/certbot/pull/8741#issuecomment-809644789. You can see this mentioned in their changelog at https://docs.python.org/release/3.8.9/whatsnew/changelog.html#build.

This PR updates the windows installer to use that new release so all of our distribution methods that contain their own copy of OpenSSL are patched for the release tomorrow.

You can see tests passing with this change at https://dev.azure.com/certbot/certbot/_build/results?buildId=3751&view=results. You can see Python 3.8.9 being downloaded instead of an older version at https://dev.azure.com/certbot/certbot/_build/results?buildId=3751&view=logs&j=ad29f110-3cce-5317-4ef2-0a692ae1dee7&t=901eeead-396c-5477-aba2-f402fdcfb885&l=1055.
2021-04-05 11:15:09 -07:00
Brad Warren
69479b7277 use standard errno (#8768)
We were originally using `socket.errno` with a `type: ignore` and a comment suggesting that this attribute needs to be included in the typeshed. This is incorrect.

While it's true that [socket imports errno](43682f1e39/Lib/socket.py (L58)), it's not intended to be part of its API. https://docs.python.org/3/library/socket.html has no mention of it.

Instead, we should be using the standard `errno` module and remove this `type: ignore`.
2021-04-05 10:42:18 -07:00
Brad Warren
2622a700e0 Update a few type ignore comments (#8767)
Some are no longer needed and other's comments are out of date.

For the changes to the acme nonce errors, `Exception` doesn't take kwargs. The error message about this our own classes isn't super helpful:
```
In [2]: BadNonce('nonce', 'error', foo='bar')                                                                                                                                                                                                                                                                               
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-54555658ef99> in <module>
----> 1 BadNonce('nonce', 'error', foo='bar')

TypeError: __init__() got an unexpected keyword argument 'foo'
```
but if you try this on `Exception` which these classes inherit from, you get:
```
In [4]: Exception(foo='bar')                                                                                                                                                                                                                                                                                                
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-028b924f74c5> in <module>
----> 1 Exception(foo='bar')

TypeError: Exception() takes no keyword arguments
```
See https://github.com/python/typeshed/pull/2348 for more info.

* remove outdated ignores

* update locking ignore comment

* don't accept kwargs
2021-04-02 16:19:30 -07:00
Adrien Ferrand
06a53cb7df Upgrade to mypy 0.812 (#8748)
Fixes #8425

This PR upgrades mypy to the latest version available, 0.812.

Given the advanced type inference capabilities provided by this newer version, this PRs also fixes various type inconsistencies that are now detected. Here are the non obvious changes done to fix types:
* typing in mixins has been solved using `Protocol` classes, as recommended by mypy (https://mypy.readthedocs.io/en/latest/more_types.html#mixin-classes, https://mypy.readthedocs.io/en/stable/protocols.html)
* `cast` when we are playing with `Union` types

This PR also disables the strict optional checks that have been enable by default in recent versions of mypy. Once this PR is merged, I will create an issue to study how these checks can be enabled.

`typing.Protocol` is available only since Python 3.8. To keep compatibility with Python 3.6, I try to import the class `Protocol` from `typing`, and fallback to assign `object` to `Protocol` if that fails. This way the code is working with all versions of Python, but the mypy check can be run only with Python 3.8+ because it needs the protocol feature. As a consequence, tox runs mypy under Python 3.8.

Alternatives are:
* importing `typing_extensions`, that proposes backport of newest typing features to Python 3.6, but this implies to add a dependency to Certbot just to run mypy
* redesign the concerned classes to not use mixins, or use them differently, but this implies to modify the code itself even if there is nothing wrong with it and it is just a matter of instructing mypy to understand in which context the mixins can be used
* ignoring type for these classes with `# type: ignore` but we loose the benefit of mypy for them

* Upgrade mypy

* First step for acme

* Cast for the rescue

* Fixing types for certbot

* Fix typing for certbot-nginx

* Finalize type fixes, configure no optional strict check for mypy in tox

* Align requirements

* Isort

* Pylint

* Protocol for python 3.6

* Use Python 3.9 for mypy, make code compatible with Python 3.8<

* Pylint and mypy

* Pragma no cover

* Pythonic NotImplemented constant

* More type definitions

* Add comments

* Simplify typing logic

* Use vararg tuple

* Relax constraints on mypy

* Add more type

* Do not silence error if target is not defined

* Conditionally import Protocol for type checking only

* Clean up imports

* Add comments

* Align python version linting with mypy and coverage

* Just ignore types in an unused module

* Add comments

* Fix lint
2021-04-02 11:54:40 -07:00
Brad Warren
584a1a3ece simplify setup.py (#8760)
I recently noticed that we only support versions of `setuptools` that support environment markers which allows us to simplify our `setup.py` files a bit.
2021-04-02 10:37:48 -07:00
Brad Warren
28fac893f4 add and update pynsist template comments (#8759) 2021-04-02 10:37:40 -07:00
Adrien Ferrand
8a84c88fee Remove wheel hack in windows installer construction script (#8752)
In #8649 we added some code to trick pynsist and make it understand that `abi3` wheels for Windows are forward compatible, meaning that the cryptography wheel tagged `cp36-abi3` is in fact compatible with Python 3.6+, and not only Python 3.6.

Since pynsist 2.7 the tool now understand `abi3` wheels properly, and this trick is not needed anymore.

Please note that despite modifying the pynsist pinning in `dev_constraints.txt`, it will have no effect since pynsist currently escape the pinning system. This is handled in https://github.com/certbot/certbot/pull/8749.
2021-04-02 10:37:19 -07:00
Adrien Ferrand
fea0b4e2e5 Pin pynsist (#8749)
* Pin pynsist

* Update dependencies

* Set windows installer a proper python project

* Optimize usage of the venvs

* Add windows-installer when venv is set up

* Fix call

* Remove env marker
2021-04-01 13:57:03 -07:00
Brad Warren
1ea588d504 increase ARM build timeout (#8757) 2021-03-31 12:42:42 -07:00
Brad Warren
24fd4121cf use snapcraft login (#8756) 2021-03-31 12:41:29 -07:00
ohemorange
8759ccaecb Update issue template to list snap as an installation option (#8754) 2021-03-29 13:56:08 -07:00
Brad Warren
f4fc3e636d Redo the majority of Certbot's pinning system (#8741)
* add initial pyproject.toml

* add extra dependencies

* add simple bash script

* polish

* reuse pipstrap

* add requirements.txt

* temporarily remove hashin dep

* Switch to requirements.txt

* remove hashin check

* update requirements.txt again

* remove unnecessary merge

* pin back augeas

* unpin cryptography

* simplify pywin32 pinning

* update comment

* pin back pytest and pylint

* pin back pytest-forked

* pin back coverage

* update script comments

* fix pyopenssl case

* add minimum poetry version

* run pin.sh
2021-03-26 07:51:59 +01:00
Adrien Ferrand
018efc241c Split snap build over three Azure jobs (one per architecture) (#8731)
Fixes #8700

Now that `snapcraft remote-build` truly uses new builds for each call, we can split the builds to have a dedicated Azure job for each target architecture. This PR does that.

* Split snap_build job  on each architecture

* Also parallelize the publish_snap jobs over each architecture
2021-03-25 14:38:34 -07:00
ohemorange
fa25d8356d Remove references to certbot-auto and letsencrypt-auto that we don't need for the final release (#8738)
Fixes #8661.

As mentioned in https://github.com/certbot/certbot/issues/8661#issuecomment-806168214, there are quite a few remaining references, but until we modify the release script, we still need those. The changes here and the list there were created by grepping for the following terms:

```
certbot-auto
cb-auto
cbauto
certbotauto
letsencrypt-auto
le-auto
leauto
letsencryptauto
LEAUTO
LE_AUTO
LETSENCRYPT_AUTO
LETSENCRYPTAUTO
CB_AUTO
CERTBOT_AUTO
CBAUTO
CERTBOTAUTO
```

* Remove references to certbot-auto from certbot code

* Remove references to LEAUTO

* Remove references to CERTBOT_AUTO

* Remove references to letsencrypt-auto

* Remove references to certbot-auto from docs and tools

* remove cli constants header files

* Remove Python virtual environment section
2021-03-24 16:58:15 -07:00
ohemorange
fd62a09197 dump test farm failure logs (#8740) 2021-03-24 16:19:54 -07:00
Brad Warren
8d8b35b7c0 update requirements (#8739) 2021-03-24 15:55:30 -07:00
Brad Warren
74f6f734c8 remove outdated comment (#8736) 2021-03-25 08:00:47 +11:00
Brad Warren
0480959893 use pip in test_sdists.sh (#8737) 2021-03-24 11:50:34 -07:00
ohemorange
f90e93134c Upgrade cryptography to 3.4.6 (#8730)
* Upgrade cryptography to 3.4.6

* Fix comment with instructions for how to use hashin

* run tools/rebuild_certbot_constraints.py

* add deps for building cryptography in snaps

* Update cryptography build dependencies for docker

* Update sources for test farm tests

* Remove rust if it's installed for test farm tests

* source bootstrap script and call sudo as needed
2021-03-24 10:29:12 -07:00
Mads Jensen
d3b74f41e0 Added missing from typing imports. (#8724) 2021-03-23 21:33:47 +01:00
Brad Warren
1d7ddb0c0c fix pylint (#8729) 2021-03-23 13:01:01 -07:00
Brad Warren
54b0b98988 use worker terminology (#8728)
This will be needed for me to update `pytest-xdist` as part of https://github.com/certbot/certbot/issues/8705 since `pytest-xdist` removed the "slave" terminology. See https://github.com/pytest-dev/pytest-xdist/blob/master/CHANGELOG.rst#deprecations-and-removals.
2021-03-23 11:29:01 -07:00
alexzorin
9fdb24331c docs: rewrite "Automated Renewals" in User Guide (#8717) 2021-03-22 15:05:37 -07:00
Adrien Ferrand
84178e2773 Do not reuse existing builds on Launchpad when executing snapcraft remote-build (#8719)
We observed recently several unexpected behavior during the execution of snap jobs in Azure. In particular it seems that `snapcraft remote-build` is tending to reattach to the latest builds on Launchpad triggered by the nightly builds on master, independently from the actual branch, status of the code, or targeted architectures.

Primarily if the builds on Launchpad are stalled for some reason, it blocks effectively any other Azure snap jobs until someone manually cancel the builds on Launchpad. Secondarily it means that the outcome of the builds may be inconsistent, because they can be the result of a build for the master source even if you are on a PR that modifieds these sources (including `snapcraft.yaml`).

After digging in `snapcraft` source code, I realized that the signature computed to understand if a build should be resumed, is not based one some hashes against the snapcraft working directory content, but is simply a hash of the working directory absolute path *itself*. It means that every builds triggered from the working directory `/my/path/certbot` for instance, are recognized as the same unique build on Launchpad side, and may be resumed if they already exist, and so independently from the source code, `snapcraft.yaml` or targeted archs.

For the record, relevant parts in `snapcraft` source code:
82024d3748/snapcraft/project/_project.py (L44)
82024d3748/snapcraft/project/_project.py (L86-L89)
82024d3748/snapcraft/cli/remote.py (L128-L132)

This PR makes effectively the resume build mechanism effectively a noop by moving the source code first in a temporary directory with random name before running `snapcraft remote-build`. This way the signature is never the same and builds are always recognized as brand new builds.

* Invalidate snapcraft remote-build cache by using a temporary workspace.

* Capture one more state in the build
2021-03-22 10:39:09 -07:00
osirisinferi
ae2247163e Remove empty lines from certbot certificates when (#8723)
.. envoked with `--cert-name` or `-d`.
2021-03-22 08:42:23 +11:00
Adrien Ferrand
6bc8b3d2ba Precise the certificate naming convention mechanism in the compatibility document (#8652)
* Precise the certificate naming convention mechanism in a note.

* Add certificate name convention in user guide, refer to it in compatibility page.

* Update certbot/docs/compatibility.rst

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/docs/using.rst

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/docs/using.rst

Co-authored-by: alexzorin <alex@zor.io>

* Improve the note about naming conventions

Co-authored-by: alexzorin <alex@zor.io>
2021-03-22 08:39:54 +11:00
ohemorange
40ae5d939e Fix linux-py39-cover test (#8720)
* update setuptools

* upgrade Markupsafe
2021-03-19 14:27:29 -07:00
Brad Warren
1b39d3dc47 switch to wait_until_running (#8715) 2021-03-16 17:53:43 -07:00
Brad Warren
2324c1bb7a Update installing from source instructions (#8713) 2021-03-15 14:10:44 -07:00
Adrien Ferrand
bc892e04c4 Fixing imports in cli module (#8708)
While working on #8640, I realized that there were some hidden circular dependencies in certbot._internal.cli package. Then cerbot could break if the order of these imports changes.

This PR fixes that and apply isort on top of the result.
2021-03-11 13:17:41 -08:00
Adrien Ferrand
0962b0fc83 Kill current snapcraft build when a "Chroot problem" is encountered (#8442)
* Kill snapcraft build when a "Chroot problem" is encountered

* Display specific helper for "Chroot problem" status and cancel retry mechanism in this case.

* Isolate build tmp directories

* Configure XDG_CACHE_HOME

* Kill snapcraftctl with chroot problem is encountered
2021-03-11 13:08:20 -08:00
Adrien Ferrand
dd6f2f565e Convert Python 2 type hints to Python 3 types annotations (#8640)
Fixes #8427

This PR converts the Python 2 types hints into Python 3 types annotations. I have used the project https://github.com/ilevkivskyi/com2ann which has been designed for that specific purpose and did that very well.

The only remaining things to do were to fix broken type hints that became wrong code after migration, and to fix lines too long with the new syntax.

* Raw execution of com2ann

* Fixing broken type annotations

* Cleanup imports
2021-03-10 11:51:27 -08:00
Brad Warren
f2d8c81e9b remove reference to acme.magic_typing from docs (#8709) 2021-03-09 16:53:44 -08:00
Adrien Ferrand
67b65bb2c0 Deprecate acme.typing_magic module, stop using it in certbot (#8643)
* Deprecate acme.magic_typing, stop to use it in certbot

* Isort

* Add a changelog entry

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-03-09 16:12:32 -08:00
alexzorin
76895457c9 dns-digitalocean: use a 30 second TTL (#8693)
Fixes an issue with long TTLs and caching behavior on DigitalOcean's
DNS hosting service.
2021-03-09 15:56:51 -08:00
Mads Jensen
c02b2d30f2 Removed Python legacy __future__ imports (#8697)
There are still some left, but the `modification_check` test fails. Some are still in `tools`, and they can probably be removed as well. `with_statement` was introduced officially in Python 2.5, so there's really old stuff in the code base.
2021-03-05 16:53:20 -08:00
Brad Warren
94dc6936e7 Final update to certbot-auto (#8706)
Fixes https://github.com/certbot/certbot/issues/8690.

After this PR, we'll let the release script make its automated changes to certbot-auto as part of the 1.14.0 release and then never make any code changes to certbot-auto ever again!

* disable upgrades on debian

* update test_leauto_upgrades.sh

* update changelog
2021-03-05 14:14:32 -08:00
Mads Jensen
a3abcc001a Removed a Python 2 fallback in certbot.Reverter. (#8694)
* Removed a Python 2 fallback in certbot.Reverter.

* Removed a Python < 3.6 fallback in certbot-apache._internal.parser.
2021-03-04 08:10:56 +11:00
Brad Warren
9643e85b4c Merge pull request #8699 from certbot/candidate-1.13.0
Release 1.13.0
2021-03-03 13:00:31 -08:00
Erica Portnoy
9d97be3a84 Bump version to 1.14.0 2021-03-02 13:50:04 -08:00
Erica Portnoy
4d6db0eb71 Add contents to certbot/CHANGELOG.md for next version 2021-03-02 13:50:03 -08:00
Erica Portnoy
92a66454b6 Release 1.13.0 2021-03-02 13:49:58 -08:00
Erica Portnoy
976068b5a0 Update changelog for 1.13.0 release 2021-03-02 13:37:04 -08:00
alexzorin
1e30723003 revoke: try determine the server automatically (#8691)
* revoke: try determine the server automatically

When revoking via --cert-name, use the server from the lineage (unless
overriden by the CLI).

* RenewableCert.storage might be None

* guard against an empty lineage server
2021-03-01 12:56:22 -08:00
Brad Warren
496a4ced25 Remove broken test for typing import failure (#8692)
* remove broken test

* fix coverage

* don't worry about getattr test
2021-02-26 16:05:34 -08:00
alexzorin
fab9bfd878 nginx: authenticate all matching vhosts for HTTP01 (#8663)
* nginx: authenticate all matching vhosts for HTTP01

Previously, the nginx authenticator would set up the HTTP-01 challenge
response on a single HTTP vhost which matched the challenge domain.

The nginx authenticator will now set the challenge response on every
vhost which matches the challenge domain, including duplicates and HTTPS
vhosts.

This makes the authenticator usable behind a CDN where all origin
traffic is performed over HTTPS and also makes the authenticator work
more reliably against "invalid" nginx configurations, such as those
where there are duplicate vhosts.

* some typos

* dont authenticate the same vhost twice

One vhost may appear in both the HTTP and HTTPS vhost lists. Use a set()
to avoid trying to mod the same vhost twice.

* fix type annotations

* rewrite changelog entry
2021-02-26 13:43:22 -08:00
Yuma Mihira
d3ca6af982 Insert new line before "More details about these changes can be found on our GitHub repo." (#8645)
Fixing #8634. It's my first time contributing to this repository, if there's something wrong please let me know.

Before this fix

```
$ python3 extract_changelog.py 1.12.0
...
### Fixed
* Fixed the apache component on openSUSE Tumbleweed which no longer provides
  an apache2ctl symlink and uses apachectl instead.
* Fixed a typo in `certbot/crypto_util.py` causing an error upon attempting `secp521r1` key generation
More details about these changes can be found on our GitHub repo.
```

After this fix

```
$ python3 extract_changelog.py 1.12.0
...
### Fixed
* Fixed the apache component on openSUSE Tumbleweed which no longer provides
  an apache2ctl symlink and uses apachectl instead.
* Fixed a typo in `certbot/crypto_util.py` causing an error upon attempting `secp521r1` key generation

More details about these changes can be found on our GitHub repo.
```
2021-02-25 16:30:48 -08:00
Mads Jensen
540fd6db93 Dictionaries are ordered by insert by default on Python 3.6. (#8678) 2021-02-25 15:41:05 -08:00
Mads Jensen
b0e35c694e Remove import fallback of urllib2 in tests/modification-check. (#8677) 2021-02-25 14:59:11 -08:00
Mads Jensen
67c2b27af7 Stop inheriting from object. It's unneeded on Python 3+. (#8675) 2021-02-25 14:59:00 -08:00
Mads Jensen
135187f03e Python 3 obsoletes explicit __ne__ methods (#8676)
This shouldn't be needed as of Python 3+.

https://stackoverflow.com/questions/4352244/should-ne-be-implemented-as-the-negation-of-eq-in-python#30676267
2021-02-25 14:50:54 -08:00
Brad Warren
e742cfaa21 dont set required to False (#8689) 2021-02-26 08:39:55 +11:00
alexzorin
f71298f661 cli: make key_path and cert_path always be a str (#8687)
There is some code in [`_paths_parser`](ae3ed200c0/certbot/certbot/_internal/cli/paths_parser.py (L17-L34)) which has the effect of varying the value type of `config.cert_path` and `config.key_path` based on the CLI verb. When the verb is `revoke`, the type is a tuple `(path: str, contents: bytes)`, otherwise it is a single `str` representing the file path. (I wasn't able to find a written reason as to why it works this way).

This commit removes that special `revoke` case and ensures it is always a `str`.

Why change it now?

I am trying to write some changes and there's some code in `cert_manager` which only works if the verb is `revoke`, you hack `config.cert_path` to be a tuple beforehand, or you [(not actually in `master`) try sniff for the value type](49911afaa6/certbot/certbot/_internal/cert_manager.py (L224-L227)). I have a bad feeling about such workarounds. I would prefer to just make these variables simpler to use, but I'm open to opinions.

In addition to the test suites, I've manually tested `revoke` (including by `--key-path`) and `install`. Are there other places I may have missed?

Unblocks #8636 and #8671.
2021-02-25 11:32:21 -08:00
alexzorin
025eb16c7a docs: rewrite "Revoking certificates" (#8657)
* docs: rewrite "Revoking certificates"

- `--cert-name` is supported since a long time ago
- `--delete-after-revoke` is default
- Mention that non-default `--server` must be specified
- Document difference between acme key/cert key revocation methods
- Reshuffle text to keep more important things earlier

* minor edits

* remove revocation note

* remove "preauthorization" revocation method

* rewrite deletion note
2021-02-25 10:22:40 -08:00
ohemorange
ae3ed200c0 Remove check for 'fake' in issuer name when renewing certs (#8685)
Fixes #8680.

We seem to have no existing testing code anywhere in this vicinity, so figured I'd get this up quickly then work on that. Manual tests (renew staging certificate, should allow it; renew non-staging cert as staging, should error) passed.

* Remove check for 'fake' in issuer name when renewing certs

* Change fake issuer name to make sure we're not relying on it anywhere
2021-02-24 14:51:57 -08:00
Adrien Ferrand
c3d6fca3eb Make certbot constraint file independent from certbot-auto + update cryptography (#8649)
* Refactor to not depend on certbot-auto dependencies pinning anymore

* Update constraints

* Replaces references

* Upgrade AWS dependencies pinning

* Fix script

* Fix Windows installer builds

* Fixing sdists letstest script

* Pin cryptography on 3.1.1 specifically for RHEL/CentOS 7 to avoid build failures during test_sdists test.

* Finish fix

* Fix VERSION_ID in RHEL 7
2021-02-23 15:29:52 -08:00
Brad Warren
c43f4fe518 upgrade to 3.8.8 (#8682)
Fixes https://github.com/certbot/certbot/issues/8681. https://python-security.readthedocs.io/vuln/ctypes-buffer-overflow-pycarg_repr.html is the best resource I found linking to the original Python bug, when each Python branch was fixed, etc.
2021-02-23 13:20:04 -08:00
Mads Jensen
0f3f07b5cb Removed backport of unittest.assertLogs (#8673)
* Removed backport of unittest.assertLogs

* Update parser_test.py
2021-02-22 09:34:56 +11:00
Mads Jensen
ef265eccaf Remove import fallback for collections.abc (#8674) 2021-02-22 09:23:42 +11:00
Adrien Ferrand
c0eccdd358 Deprecate certbot-auto specific flags (#8641)
This PR deprecates the certbot-auto specific CLI flags, in the perspective of removing them in a future release as said in #8483.

* Deprecate certbot-auto specific flags

* Update changelog

* Clean tests

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-02-12 16:14:46 -08:00
Adrien Ferrand
c59775c3c0 Disable certbot-auto upgrade on RHEL-like systems (#8653)
Fixes #8637

* Disable upgrade for RHEL-like systems

* Remove letstest on Amazon Linux

* Update changelog
2021-02-10 15:17:51 -08:00
Steffen Neumann
cf062f4c6d Fix ubuntu package name (#8654)
Since Ubuntu 18.04 there is python3-certbot-apache which should be the recommended version. 
The Debian package names should probably be updated accordingly.
2021-02-09 12:18:29 -08:00
Brad Warren
3d0dad8718 Remove dependency on six (#8650)
Fixes https://github.com/certbot/certbot/issues/8494.

I left the `six` dependency pinned in `tests/letstest/requirements.txt` and `tools/oldest_constraints.txt` because `six` is still a transitive dependency with our current pinnings.

The extra moving around of imports is due to me using `isort` to help me keep dependencies in sorted order after replacing imports of `six`.

* remove some six usage in acme

* remove six from acme

* remove six.add_metaclass usage

* fix six.moves.zip

* fix six.moves.builtins.open

* six.moves server fixes

* 's/six\.moves\.range/range/g'

* stop using six.moves.xrange

* fix urllib imports

* s/six\.binary_type/bytes/g

* s/six\.string_types/str/g

* 's/six\.text_type/str/g'

* fix six.iteritems usage

* fix itervalues usage

* switch from six.StringIO to io.StringIO

* remove six imports

* misc fixes

* stop using six.reload_module

* no six.PY2

* rip out six

* keep six pinned in oldest constraints

* fix log_test.py

* update changelog
2021-02-09 11:43:15 -08:00
sommersoft
edad9bd82b Fix Sphinx manpage Building (#8646)
* certbot docs: include & orphan 'man/cerbot.rst'; fixes manpage building

* acme docs: include & orphan 'man/jws.rst'; fixes manpage building
2021-02-09 11:29:31 +01:00
Matt W
2a16aa16c3 Update cli.ini (#8603)
* Update cli.ini

Sharing back some extended examples I desired, did not find,  and derived on my own

* Update cli.ini

Alex,
ok - simplified as requested
Matt

* Update cli.ini

removed trailing quote on line 32

* Update certbot/examples/cli.ini

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/examples/cli.ini

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot/examples/cli.ini

Co-authored-by: alexzorin <alex@zor.io>

* remove stray newline

Co-authored-by: alexzorin <alex@zor.io>
2021-02-07 18:19:49 +11:00
Brad Warren
711cc95dc4 Remove mock dependency (#8630)
Fixes https://github.com/certbot/certbot/issues/7913.

I only added the deprecation warning to `certbot.tests.util` because that's the only place where I think someone could be using the `mock` module through our API.

* remove external mock from acme

* update Certbot's mock usage

* remove mock dependency in plugins

* remove external mock from compatibility test

* add changelog entry
2021-02-05 15:51:18 -08:00
Brad Warren
c2ee0d2938 Remove requests[security] dependency (#8626)
Fixes https://github.com/certbot/certbot/issues/7901.

* stop using requests[security]

* add changelog entry

* remove unused import
2021-02-05 15:33:45 -08:00
Brad Warren
c668172ef0 merge dev and dev3 (#8639) 2021-02-04 21:31:47 +11:00
Brad Warren
666ee35e29 remove crufty pytest warning (#8638) 2021-02-04 21:04:03 +11:00
Brad Warren
13af3f7ec2 Cleanup venv scripts (#8629)
Fixes https://github.com/certbot/certbot/issues/8387.

* update _venv_common.py

* delete venv.py scripts

* rename venv script

* update relevant venv3 references

* remove set_python_envvars
2021-02-03 12:03:09 -08:00
Brad Warren
5ad0c254ca Merge pull request #8624 from certbot/external-mock
Fixes #8616.

Add tests with external mock
2021-02-03 12:02:43 -08:00
Brad Warren
236062c2d2 Merge pull request #8632 from certbot/candidate-1.12.0
Release 1.12.0
2021-02-02 13:11:27 -08:00
Erica Portnoy
2bcd8c59db Bump version to 1.13.0 2021-02-02 11:06:48 -08:00
Erica Portnoy
57cba3690d Add contents to certbot/CHANGELOG.md for next version 2021-02-02 11:06:47 -08:00
Erica Portnoy
786a130b7d Release 1.12.0 2021-02-02 11:06:40 -08:00
Erica Portnoy
df866b907b Update changelog for 1.12.0 release 2021-02-02 10:58:41 -08:00
Brad Warren
f0b32783f0 Start disabling certbot-auto upgrades (#8623)
* add amazon linux to auto targets

* disable updates outside of debian and rhel

* test certbot-auto with disabled upgrades

* try new approach to testing

* remove bad space

* tweak error text

* add changelog entry

* fix bad certbot-auto commit

* test new error text

* update changelog

* update error text
2021-02-01 13:11:04 -08:00
Brad Warren
534af33a50 add external-mock tests to azure config 2021-01-29 15:32:04 -08:00
Brad Warren
2e33aec8a8 add tests with external mock library 2021-01-29 15:31:11 -08:00
ohemorange
bdfb9f19c4 Remove deprecated options as early as possible using an explicit list (#8617)
* Remove deprecated options as early as possible using an explicit list

* add deprecated options to cli init import list

* use correct dict comprehension syntax for py3

* lint

* add test for renewal reconstitution code

* add test to ensure we're not saving deprecated values

* comment code
2021-01-28 12:34:50 -08:00
Brad Warren
b4e955a60e Switch away from ubuntu-latest (#8606)
I noticed warnings on Azure like [this](https://dev.azure.com/certbot/certbot/_build/results?buildId=3311&view=logs&j=d74e04fe-9740-597d-e9fa-1d0400037dfd) which say:

> ##[warning]Ubuntu-latest pipelines will use Ubuntu-20.04 soon. For more details, see https://github.com/actions/virtual-environments/issues/1816

I was worried about us suddenly switching to Ubuntu 20.04 and things breaking so I tested that `ubuntu-20.04` works and am opening this PR to switch things over explicitly now. I'd rater have our VM images pinned to specific versions than a generic version specification like `latest` which might see an upgrade and break our tests unexpectedly.

I ran the notification code on Ubuntu 20.04 at https://dev.azure.com/certbot/certbot/_build/results?buildId=3315&view=results and you can see the notification at https://opensource.eff.org/eff-open-source/pl/ojjhde5j4jyw7dcurd5zfduymr.
2021-01-25 15:20:51 -08:00
Adrien Ferrand
7399807ff2 Drop Python 2 support (#8591)
Fixes #8389 #8584.

This PR makes the necessary modifications to officially drop Python 2 support in the Certbot project.

I did not remove the specific Python 2 compatibility branches that has been added in various places in the codebase, to reduce the size of this PR and this will be done in a future one

* Update classifiers and python_requires in setup.py

* Remove warnings about Python 2 deprecation

* Remove Azure jobs on Python 2.7

* Remove references to python 2 in documentation

* Pin dnspython to 2.1.0

* Update changelog

* Remove warning ignore
2021-01-25 15:07:43 -08:00
1119 changed files with 35566 additions and 40617 deletions

View File

@@ -1,8 +1,8 @@
# Configuring Azure Pipelines with Certbot
Let's begin. All pipelines are defined in `.azure-pipelines`. Currently there are two:
* `.azure-pipelines/main.yml` is the main one, executed on PRs for master, and pushes to master,
* `.azure-pipelines/advanced.yml` add installer testing on top of the main pipeline, and is executed for `test-*` branches, release branches, and nightly run for master.
* `.azure-pipelines/main.yml` is the main one, executed on PRs for main, and pushes to main,
* `.azure-pipelines/advanced.yml` add installer testing on top of the main pipeline, and is executed for `test-*` branches, release branches, and nightly run for main.
Several templates are defined in `.azure-pipelines/templates`. These YAML files aggregate common jobs configuration that can be reused in several pipelines.
@@ -64,7 +64,7 @@ Azure Pipeline needs RW on code, RO on metadata, RW on checks, commit statuses,
RW access here is required to allow update of the pipelines YAML files from Azure DevOps interface, and to
update the status of builds and PRs on GitHub side when Azure Pipelines are triggered.
Note however that no admin access is defined here: this means that Azure Pipelines cannot do anything with
protected branches, like master, and cannot modify the security context around this on GitHub.
protected branches, like main, and cannot modify the security context around this on GitHub.
Access can be defined for all or only selected repositories, which is nice.
```
@@ -91,11 +91,11 @@ grant permissions from Azure Pipelines to GitHub in order to setup a GitHub OAut
then are way too large (admin level on almost everything), while the classic approach does not add any more
permissions, and works perfectly well.__
- Select GitHub in "Select your repository section", choose certbot/certbot in Repository, master in default branch.
- Select GitHub in "Select your repository section", choose certbot/certbot in Repository, main in default branch.
- Click on YAML option for "Select a template"
- Choose a name for the pipeline (eg. test-pipeline), and browse to the actual pipeline YAML definition in the
"YAML file path" input (eg. `.azure-pipelines/test-pipeline.yml`)
- Click "Save & queue", choose the master branch to build the first pipeline, and click "Save and run" button.
- Click "Save & queue", choose the main branch to build the first pipeline, and click "Save and run" button.
_Done. Pipeline is operational. Repeat to add more pipelines from existing YAML files in `.azure-pipelines`._

View File

@@ -9,6 +9,7 @@ variables:
# We don't publish our Docker images in this pipeline, but when building them
# for testing, let's use the nightly tag.
dockerTag: nightly
snapBuildTimeout: 5400
stages:
- template: templates/stages/test-and-package-stage.yml

View File

@@ -1,8 +1,18 @@
trigger: none
# We run the test suite on commits to main so codecov gets coverage data
# about the main branch and can use it to track coverage changes.
trigger:
- main
pr:
- master
- main
- '*.x'
variables:
# We set this here to avoid coverage data being uploaded from things like our
# nightly pipeline. This is done because codecov (helpfully) keeps track of
# the number of coverage uploads for a commit and displays a warning when
# comparing two commits with an unequal number of uploads. Only uploading
# coverage here should keep the number of uploads it sees consistent.
uploadCoverage: true
jobs:
- template: templates/jobs/standard-tests-jobs.yml

View File

@@ -1,4 +1,4 @@
# Nightly pipeline running each day for master.
# Nightly pipeline running each day for main.
trigger: none
pr: none
schedules:
@@ -6,13 +6,14 @@ schedules:
displayName: Nightly build
branches:
include:
- master
- main
always: true
variables:
dockerTag: nightly
snapBuildTimeout: 19800
stages:
- template: templates/stages/test-and-package-stage.yml
- template: templates/stages/deploy-stage.yml
- template: templates/stages/notify-failure-stage.yml
- template: templates/stages/changelog-stage.yml
- template: templates/stages/nightly-deploy-stage.yml

View File

@@ -8,11 +8,9 @@ pr: none
variables:
dockerTag: ${{variables['Build.SourceBranchName']}}
snapBuildTimeout: 19800
stages:
- template: templates/stages/test-and-package-stage.yml
- template: templates/stages/changelog-stage.yml
- template: templates/stages/deploy-stage.yml
parameters:
snapReleaseChannel: beta
- template: templates/stages/notify-failure-stage.yml
- template: templates/stages/release-deploy-stage.yml

View File

@@ -0,0 +1,128 @@
# As (somewhat) described at
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops#context,
# each template only has access to the parameters passed into it. To help make
# use of this design, we define snapReleaseChannel without a default value
# which requires the user of this template to define it as described at
# https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/parameters-name?view=azure-pipelines#remarks.
# This makes the user of this template be explicit while allowing them to
# define their own parameters with defaults that make sense for that context.
parameters:
- name: snapReleaseChannel
type: string
values:
- edge
- beta
jobs:
# This job relies on credentials used to publish the Certbot snaps. This
# credential file was created by running:
#
# snapcraft logout
# snapcraft export-login --channels=beta,edge snapcraft.cfg
# (provide the shared snapcraft credentials when prompted)
#
# Then the file was added as a secure file in Azure pipelines
# with the name snapcraft.cfg by following the instructions at
# https://docs.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops
# including authorizing the file for use in the "nightly" and "release"
# pipelines as described at
# https://docs.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops#q-how-do-i-authorize-a-secure-file-for-use-in-a-specific-pipeline.
#
# This file has a maximum lifetime of one year and the current file will
# expire on 2024-02-10. The file will need to be updated before then to
# prevent automated deploys from breaking.
#
# Revoking these credentials can be done by changing the password of the
# account used to generate the credentials. See
# https://forum.snapcraft.io/t/revoking-exported-credentials/19031 for
# more info.
- job: publish_snap
pool:
vmImage: ubuntu-22.04
variables:
- group: certbot-common
strategy:
matrix:
amd64:
SNAP_ARCH: amd64
arm32v6:
SNAP_ARCH: armhf
arm64v8:
SNAP_ARCH: arm64
steps:
- bash: |
set -e
sudo apt-get update
sudo apt-get install -y --no-install-recommends snapd
sudo snap install --classic snapcraft
displayName: Install dependencies
- task: DownloadPipelineArtifact@2
inputs:
artifact: snaps_$(SNAP_ARCH)
path: $(Build.SourcesDirectory)/snap
displayName: Retrieve Certbot snaps
- task: DownloadSecureFile@1
name: snapcraftCfg
inputs:
secureFile: snapcraft.cfg
- bash: |
set -e
export SNAPCRAFT_STORE_CREDENTIALS=$(cat "$(snapcraftCfg.secureFilePath)")
for SNAP_FILE in snap/*.snap; do
tools/retry.sh eval snapcraft upload --release=${{ parameters.snapReleaseChannel }} "${SNAP_FILE}"
done
displayName: Publish to Snap store
# The credentials used in the following jobs are for the shared
# certbotbot account on Docker Hub. The credentials are stored
# in a service account which was created by following the
# instructions at
# https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#sep-docreg.
# The name given to this service account must match the value
# given to containerRegistry below. The authentication used when
# creating this service account was a personal access token
# rather than a password to bypass 2FA. When Brad set this up,
# Azure Pipelines failed to verify the credentials with an error
# like "access is forbidden with a JWT issued from a personal
# access token", but after saving them without verification, the
# access token worked when the pipeline actually ran. "Grant
# access to all pipelines" should also be checked on the service
# account. The access token can be deleted on Docker Hub if
# these credentials need to be revoked.
- job: publish_docker_by_arch
pool:
vmImage: ubuntu-22.04
strategy:
matrix:
arm32v6:
DOCKER_ARCH: arm32v6
arm64v8:
DOCKER_ARCH: arm64v8
amd64:
DOCKER_ARCH: amd64
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: docker_$(DOCKER_ARCH)
path: $(Build.SourcesDirectory)
displayName: Retrieve Docker images
- bash: set -e && docker load --input $(Build.SourcesDirectory)/images.tar
displayName: Load Docker images
- task: Docker@2
inputs:
command: login
containerRegistry: docker-hub
displayName: Login to Docker Hub
- bash: set -e && tools/docker/deploy_images.sh $(dockerTag) $DOCKER_ARCH
displayName: Deploy the Docker images by architecture
- job: publish_docker_multiarch
dependsOn: publish_docker_by_arch
pool:
vmImage: ubuntu-22.04
steps:
- task: Docker@2
inputs:
command: login
containerRegistry: docker-hub
displayName: Login to Docker Hub
- bash: set -e && tools/docker/deploy_manifests.sh $(dockerTag) all
displayName: Deploy the Docker multiarch manifests

View File

@@ -2,104 +2,49 @@ jobs:
- job: extended_test
variables:
- name: IMAGE_NAME
value: ubuntu-18.04
value: ubuntu-22.04
- name: PYTHON_VERSION
value: 3.9
value: 3.13
- group: certbot-common
strategy:
matrix:
linux-py36:
PYTHON_VERSION: 3.6
TOXENV: py36
linux-py37:
PYTHON_VERSION: 3.7
TOXENV: py37
linux-py38:
PYTHON_VERSION: 3.8
TOXENV: py38
linux-py37-nopin:
PYTHON_VERSION: 3.7
TOXENV: py37
CERTBOT_NO_PIN: 1
linux-boulder-v1-integration-certbot-oldest:
PYTHON_VERSION: 3.6
linux-py311:
PYTHON_VERSION: 3.11
TOXENV: py311
linux-py312:
PYTHON_VERSION: 3.12
TOXENV: py312
linux-isolated:
TOXENV: 'isolated-acme,isolated-certbot,isolated-apache,isolated-cloudflare,isolated-digitalocean,isolated-dnsimple,isolated-dnsmadeeasy,isolated-gehirn,isolated-google,isolated-linode,isolated-luadns,isolated-nsone,isolated-ovh,isolated-rfc2136,isolated-route53,isolated-sakuracloud,isolated-nginx'
linux-integration-certbot-oldest:
PYTHON_VERSION: 3.10
TOXENV: integration-certbot-oldest
ACME_SERVER: boulder-v1
linux-boulder-v2-integration-certbot-oldest:
PYTHON_VERSION: 3.6
TOXENV: integration-certbot-oldest
ACME_SERVER: boulder-v2
linux-boulder-v1-integration-nginx-oldest:
PYTHON_VERSION: 3.6
linux-integration-nginx-oldest:
PYTHON_VERSION: 3.10
TOXENV: integration-nginx-oldest
ACME_SERVER: boulder-v1
linux-boulder-v2-integration-nginx-oldest:
PYTHON_VERSION: 3.6
TOXENV: integration-nginx-oldest
ACME_SERVER: boulder-v2
linux-boulder-v1-py27-integration:
PYTHON_VERSION: 2.7
linux-py310-integration:
PYTHON_VERSION: 3.10
TOXENV: integration
ACME_SERVER: boulder-v1
linux-boulder-v2-py27-integration:
PYTHON_VERSION: 2.7
linux-py311-integration:
PYTHON_VERSION: 3.11
TOXENV: integration
ACME_SERVER: boulder-v2
linux-boulder-v1-py36-integration:
PYTHON_VERSION: 3.6
linux-py312-integration:
PYTHON_VERSION: 3.12
TOXENV: integration
ACME_SERVER: boulder-v1
linux-boulder-v2-py36-integration:
PYTHON_VERSION: 3.6
TOXENV: integration
ACME_SERVER: boulder-v2
linux-boulder-v1-py37-integration:
PYTHON_VERSION: 3.7
TOXENV: integration
ACME_SERVER: boulder-v1
linux-boulder-v2-py37-integration:
PYTHON_VERSION: 3.7
TOXENV: integration
ACME_SERVER: boulder-v2
linux-boulder-v1-py38-integration:
PYTHON_VERSION: 3.8
TOXENV: integration
ACME_SERVER: boulder-v1
linux-boulder-v2-py38-integration:
PYTHON_VERSION: 3.8
TOXENV: integration
ACME_SERVER: boulder-v2
linux-boulder-v1-py39-integration:
PYTHON_VERSION: 3.9
TOXENV: integration
ACME_SERVER: boulder-v1
linux-boulder-v2-py39-integration:
PYTHON_VERSION: 3.9
TOXENV: integration
ACME_SERVER: boulder-v2
# python 3.13 integration tests are not run here because they're run as
# part of the standard test suite
nginx-compat:
TOXENV: nginx_compat
linux-integration-rfc2136:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 3.8
IMAGE_NAME: ubuntu-22.04
PYTHON_VERSION: 3.12
TOXENV: integration-dns-rfc2136
docker-dev:
TOXENV: docker_dev
macos-farmtest-apache2:
# We run one of these test farm tests on macOS to help ensure the
# tests continue to work on the platform.
IMAGE_NAME: macOS-10.15
PYTHON_VERSION: 3.8
le-modification:
IMAGE_NAME: ubuntu-22.04
TOXENV: modification
farmtest-apache2:
PYTHON_VERSION: 3.12
TOXENV: test-farm-apache2
farmtest-leauto-upgrades:
PYTHON_VERSION: 3.7
TOXENV: test-farm-leauto-upgrades
farmtest-certonly-standalone:
PYTHON_VERSION: 3.7
TOXENV: test-farm-certonly-standalone
farmtest-sdists:
PYTHON_VERSION: 3.7
TOXENV: test-farm-sdists
pool:
vmImage: $(IMAGE_NAME)
steps:

View File

@@ -1,17 +1,18 @@
jobs:
- job: docker_build
pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-24.04
strategy:
matrix:
arm32v6:
DOCKER_ARCH: arm32v6
arm64v8:
DOCKER_ARCH: arm64v8
amd64:
DOCKER_ARCH: amd64
# Do not run the heavy non-amd64 builds for test branches
${{ if not(startsWith(variables['Build.SourceBranchName'], 'test-')) }}:
arm32v6:
DOCKER_ARCH: arm32v6
arm64v8:
DOCKER_ARCH: arm64v8
# The default timeout of 60 minutes is a little low for compiling
# cryptography on ARM architectures.
timeoutInMinutes: 180
steps:
- bash: set -e && tools/docker/build.sh $(dockerTag) $DOCKER_ARCH
displayName: Build the Docker images
@@ -31,98 +32,41 @@ jobs:
path: $(Build.ArtifactStagingDirectory)
artifact: docker_$(DOCKER_ARCH)
displayName: Store Docker artifact
- job: docker_run
- job: docker_test
dependsOn: docker_build
pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-22.04
strategy:
matrix:
arm32v6:
DOCKER_ARCH: arm32v6
arm64v8:
DOCKER_ARCH: arm64v8
amd64:
DOCKER_ARCH: amd64
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: docker_amd64
artifact: docker_$(DOCKER_ARCH)
path: $(Build.SourcesDirectory)
displayName: Retrieve Docker images
- bash: set -e && docker load --input $(Build.SourcesDirectory)/images.tar
displayName: Load Docker images
- bash: |
set -ex
DOCKER_IMAGES=$(docker images --filter reference='*/certbot' --filter reference='*/dns-*' --format '{{.Repository}}:{{.Tag}}')
for DOCKER_IMAGE in ${DOCKER_IMAGES}
do docker run --rm "${DOCKER_IMAGE}" plugins --prepare
done
set -e && tools/docker/test.sh $(dockerTag) $DOCKER_ARCH
displayName: Run integration tests for Docker images
- job: installer_build
pool:
vmImage: vs2017-win2016
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
architecture: x86
addToPath: true
- script: python windows-installer/construct.py
displayName: Build Certbot installer
- task: CopyFiles@2
inputs:
sourceFolder: $(System.DefaultWorkingDirectory)/windows-installer/build/nsis
contents: '*.exe'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)
# If we change the artifact's name, it should also be changed in tools/create_github_release.py
artifact: windows-installer
displayName: Publish Windows installer
- job: installer_run
dependsOn: installer_build
strategy:
matrix:
win2019:
imageName: windows-2019
win2016:
imageName: vs2017-win2016
pool:
vmImage: $(imageName)
steps:
- powershell: |
if ($PSVersionTable.PSVersion.Major -ne 5) {
throw "Powershell version is not 5.x"
}
condition: eq(variables['imageName'], 'vs2017-win2016')
displayName: Check Powershell 5.x is used in vs2017-win2016
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
addToPath: true
- task: DownloadPipelineArtifact@2
inputs:
artifact: windows-installer
path: $(Build.SourcesDirectory)/bin
displayName: Retrieve Windows installer
- script: |
python -m venv venv
venv\Scripts\python tools\pipstrap.py
venv\Scripts\python tools\pip_install.py -e certbot-ci
env:
PIP_NO_BUILD_ISOLATION: no
displayName: Prepare Certbot-CI
- script: |
set PATH=%ProgramFiles(x86)%\Certbot\bin;%PATH%
venv\Scripts\python -m pytest certbot-ci\windows_installer_integration_tests --allow-persistent-changes --installer-path $(Build.SourcesDirectory)\bin\certbot-beta-installer-win32.exe
displayName: Run windows installer integration tests
- script: |
set PATH=%ProgramFiles(x86)%\Certbot\bin;%PATH%
venv\Scripts\python -m pytest certbot-ci\certbot_integration_tests\certbot_tests -n 4
displayName: Run certbot integration tests
- job: snaps_build
pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-22.04
strategy:
matrix:
amd64:
SNAP_ARCH: amd64
armhf:
SNAP_ARCH: armhf
arm64:
SNAP_ARCH: arm64
timeoutInMinutes: 0
variables:
# Do not run the heavy non-amd64 builds for test branches
${{ if not(startsWith(variables['Build.SourceBranchName'], 'test-')) }}:
ARCHS: amd64 arm64 armhf
${{ if startsWith(variables['Build.SourceBranchName'], 'test-') }}:
ARCHS: amd64
steps:
- script: |
set -e
@@ -132,7 +76,7 @@ jobs:
displayName: Install dependencies
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
versionSpec: 3.12
addToPath: true
- task: DownloadSecureFile@1
name: credentials
@@ -144,7 +88,7 @@ jobs:
git config --global user.name "$(Build.RequestedFor)"
mkdir -p ~/.local/share/snapcraft/provider/launchpad
cp $(credentials.secureFilePath) ~/.local/share/snapcraft/provider/launchpad/credentials
python3 tools/snap/build_remote.py ALL --archs ${ARCHS} --timeout 19800
python3 tools/snap/build_remote.py ALL --archs ${SNAP_ARCH} --timeout $(snapBuildTimeout)
displayName: Build snaps
- script: |
set -e
@@ -154,42 +98,41 @@ jobs:
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifact: snaps
artifact: snaps_$(SNAP_ARCH)
displayName: Store snaps artifacts
- job: snap_run
dependsOn: snaps_build
pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-22.04
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
versionSpec: 3.12
addToPath: true
- script: |
set -e
sudo apt-get update
sudo apt-get install -y --no-install-recommends nginx-light snapd
python3 -m venv venv
venv/bin/python tools/pipstrap.py
venv/bin/python tools/pip_install.py -U tox
displayName: Install dependencies
- task: DownloadPipelineArtifact@2
inputs:
artifact: snaps
artifact: snaps_amd64
path: $(Build.SourcesDirectory)/snap
displayName: Retrieve Certbot snaps
- script: |
set -e
sudo snap install --dangerous --classic snap/certbot_*_amd64.snap
sudo snap install --dangerous --classic snap/certbot_*.snap
displayName: Install Certbot snap
- script: |
set -e
venv/bin/python -m tox -e integration-external,apacheconftest-external-with-pebble
venv/bin/python -m tox run -e integration-external,apacheconftest-external-with-pebble
displayName: Run tox
- job: snap_dns_run
dependsOn: snaps_build
pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-22.04
steps:
- script: |
set -e
@@ -198,20 +141,19 @@ jobs:
displayName: Install dependencies
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
versionSpec: 3.12
addToPath: true
- task: DownloadPipelineArtifact@2
inputs:
artifact: snaps
artifact: snaps_amd64
path: $(Build.SourcesDirectory)/snap
displayName: Retrieve Certbot snaps
- script: |
set -e
python3 -m venv venv
venv/bin/python tools/pipstrap.py
venv/bin/python tools/pip_install.py -e certbot-ci
displayName: Prepare Certbot-CI
- script: |
set -e
sudo -E venv/bin/pytest certbot-ci/snap_integration_tests/dns_tests --allow-persistent-changes --snap-folder $(Build.SourcesDirectory)/snap --snap-arch amd64
sudo -E venv/bin/pytest certbot-ci/src/snap_integration_tests/dns_tests --allow-persistent-changes --snap-folder $(Build.SourcesDirectory)/snap --snap-arch amd64
displayName: Test DNS plugins snaps

View File

@@ -1,82 +1,55 @@
jobs:
- job: test
variables:
PYTHON_VERSION: 3.9
PYTHON_VERSION: 3.13
strategy:
matrix:
macos-py27:
IMAGE_NAME: macOS-10.15
PYTHON_VERSION: 2.7
TOXENV: py27
macos-py39:
IMAGE_NAME: macOS-10.15
PYTHON_VERSION: 3.9
TOXENV: py39
windows-py36:
IMAGE_NAME: vs2017-win2016
PYTHON_VERSION: 3.6
TOXENV: py36
windows-py38-cover:
IMAGE_NAME: vs2017-win2016
PYTHON_VERSION: 3.8
TOXENV: py38-cover
windows-integration-certbot:
IMAGE_NAME: vs2017-win2016
PYTHON_VERSION: 3.8
TOXENV: integration-certbot
linux-oldest-tests-1:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 3.6
TOXENV: '{acme,apache,apache-v2,certbot}-oldest'
linux-oldest-tests-2:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 3.6
TOXENV: '{dns,nginx}-oldest'
linux-py27:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 2.7
TOXENV: py27
linux-py36:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 3.6
TOXENV: py36
linux-py39-cover:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 3.9
TOXENV: py39-cover
linux-py37-lint:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 3.7
TOXENV: lint
linux-py36-mypy:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 3.6
macos-cover:
IMAGE_NAME: macOS-15
TOXENV: cover
# As of pip 23.1.0, builds started failing on macOS unless this flag was set.
# See https://github.com/certbot/certbot/pull/9717#issuecomment-1610861794.
PIP_USE_PEP517: "true"
linux-oldest:
IMAGE_NAME: ubuntu-22.04
PYTHON_VERSION: 3.10
TOXENV: oldest
linux-py310:
# linux unit tests with the oldest python we support
IMAGE_NAME: ubuntu-22.04
PYTHON_VERSION: 3.10
TOXENV: py310
linux-cover:
# linux unit+cover tests with the newest python we support
IMAGE_NAME: ubuntu-22.04
TOXENV: cover
linux-lint:
IMAGE_NAME: ubuntu-22.04
TOXENV: lint-posix
linux-mypy:
IMAGE_NAME: ubuntu-22.04
TOXENV: mypy
linux-integration:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 3.8
IMAGE_NAME: ubuntu-22.04
TOXENV: integration
ACME_SERVER: pebble
apache-compat:
IMAGE_NAME: ubuntu-18.04
IMAGE_NAME: ubuntu-22.04
TOXENV: apache_compat
le-modification:
IMAGE_NAME: ubuntu-18.04
TOXENV: modification
apacheconftest:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 2.7
IMAGE_NAME: ubuntu-22.04
TOXENV: apacheconftest-with-pebble
nginxroundtrip:
IMAGE_NAME: ubuntu-18.04
PYTHON_VERSION: 2.7
IMAGE_NAME: ubuntu-22.04
TOXENV: nginxroundtrip
validate-changelog:
IMAGE_NAME: ubuntu-22.04
TOXENV: validate-changelog
pool:
vmImage: $(IMAGE_NAME)
steps:
- template: ../steps/tox-steps.yml
- job: test_sphinx_builds
pool:
vmImage: ubuntu-latest
vmImage: ubuntu-22.04
steps:
- template: ../steps/sphinx-steps.yml

View File

@@ -3,13 +3,13 @@ stages:
jobs:
- job: prepare
pool:
vmImage: vs2017-win2016
vmImage: ubuntu-latest
steps:
# If we change the output filename from `release_notes.md`, it should also be changed in tools/create_github_release.py
- bash: |
set -e
CERTBOT_VERSION="$(cd certbot && python -c "import certbot; print(certbot.__version__)" && cd ~-)"
"${BUILD_REPOSITORY_LOCALPATH}\tools\extract_changelog.py" "${CERTBOT_VERSION}" >> "${BUILD_ARTIFACTSTAGINGDIRECTORY}/release_notes.md"
CERTBOT_VERSION="$(cd certbot/src && python -c "import certbot; print(certbot.__version__)" && cd ~-)"
"${BUILD_REPOSITORY_LOCALPATH}/tools/extract_changelog.py" "${CERTBOT_VERSION}" >> "${BUILD_ARTIFACTSTAGINGDIRECTORY}/release_notes.md"
displayName: Prepare changelog
- task: PublishPipelineArtifact@1
inputs:

View File

@@ -1,99 +0,0 @@
parameters:
- name: snapReleaseChannel
type: string
default: edge
values:
- edge
- beta
stages:
- stage: Deploy
jobs:
# This job relies on credentials used to publish the Certbot snaps. This
# credential file was created by running:
#
# snapcraft logout
# snapcraft login (provide the shared snapcraft credentials when prompted)
# snapcraft export-login --channels=beta,edge snapcraft.cfg
#
# Then the file was added as a secure file in Azure pipelines
# with the name snapcraft.cfg by following the instructions at
# https://docs.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops
# including authorizing the file in all pipelines as described at
# https://docs.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops#how-do-i-authorize-a-secure-file-for-use-in-all-pipelines.
#
# This file has a maximum lifetime of one year and the current
# file will expire on 2021-07-28 which is also tracked by
# https://github.com/certbot/certbot/issues/7931. The file will
# need to be updated before then to prevent automated deploys
# from breaking.
#
# Revoking these credentials can be done by changing the password of the
# account used to generate the credentials. See
# https://forum.snapcraft.io/t/revoking-exported-credentials/19031 for
# more info.
- job: publish_snap
pool:
vmImage: ubuntu-18.04
variables:
- group: certbot-common
steps:
- bash: |
set -e
sudo apt-get update
sudo apt-get install -y --no-install-recommends snapd
sudo snap install --classic snapcraft
displayName: Install dependencies
- task: DownloadPipelineArtifact@2
inputs:
artifact: snaps
path: $(Build.SourcesDirectory)/snap
displayName: Retrieve Certbot snaps
- task: DownloadSecureFile@1
name: snapcraftCfg
inputs:
secureFile: snapcraft.cfg
- bash: |
set -e
mkdir -p .snapcraft
ln -s $(snapcraftCfg.secureFilePath) .snapcraft/snapcraft.cfg
for SNAP_FILE in snap/*.snap; do
tools/retry.sh eval snapcraft upload --release=${{ parameters.snapReleaseChannel }} "${SNAP_FILE}"
done
displayName: Publish to Snap store
- job: publish_docker
pool:
vmImage: ubuntu-18.04
strategy:
matrix:
amd64:
DOCKER_ARCH: amd64
arm32v6:
DOCKER_ARCH: arm32v6
arm64v8:
DOCKER_ARCH: arm64v8
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: docker_$(DOCKER_ARCH)
path: $(Build.SourcesDirectory)
displayName: Retrieve Docker images
- bash: set -e && docker load --input $(Build.SourcesDirectory)/images.tar
displayName: Load Docker images
- task: Docker@2
inputs:
command: login
# The credentials used here are for the shared certbotbot account
# on Docker Hub. The credentials are stored in a service account
# which was created by following the instructions at
# https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#sep-docreg.
# The name given to this service account must match the value
# given to containerRegistry below. "Grant access to all
# pipelines" should also be checked. To revoke these
# credentials, we can change the password on the certbotbot
# Docker Hub account or remove the account from the
# Certbot organization on Docker Hub.
containerRegistry: docker-hub
displayName: Login to Docker Hub
- bash: set -e && tools/docker/deploy.sh $(dockerTag) $DOCKER_ARCH
displayName: Deploy the Docker images

View File

@@ -0,0 +1,6 @@
stages:
- stage: Deploy
jobs:
- template: ../jobs/common-deploy-jobs.yml
parameters:
snapReleaseChannel: edge

View File

@@ -1,19 +0,0 @@
stages:
- stage: On_Failure
jobs:
- job: notify_mattermost
variables:
- group: certbot-common
pool:
vmImage: ubuntu-latest
steps:
- bash: |
set -e
MESSAGE="\
---\n\
##### Azure Pipeline
*Repo* $(Build.Repository.ID) - *Pipeline* $(Build.DefinitionName) #$(Build.BuildNumber) - *Branch/PR* $(Build.SourceBranchName)\n\
:warning: __Pipeline has failed__: [Link to the build](https://dev.azure.com/$(Build.Repository.ID)/_build/results?buildId=$(Build.BuildId)&view=results)\n\n\
---"
curl -i -X POST --data-urlencode "payload={\"text\":\"${MESSAGE}\"}" "$(MATTERMOST_URL)"
condition: failed()

View File

@@ -0,0 +1,27 @@
stages:
- stage: Deploy
jobs:
- template: ../jobs/common-deploy-jobs.yml
parameters:
snapReleaseChannel: beta
- job: create_github_release
pool:
vmImage: ubuntu-22.04
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: changelog
path: '$(Pipeline.Workspace)'
- task: GitHubRelease@1
inputs:
# this "github-releases" credential is what azure pipelines calls a
# "service connection". it needs to be recreated annually. instructions
# to do so and further information about the token are available at
# https://github.com/EFForg/certbot-misc/wiki/Azure-Pipelines-setup#regenerating-github-release-credentials-for-use-on-azure
#
# as of writing this, the current token will expire on Wed, Feb 25 2026.
gitHubConnection: github-releases
title: ${{ format('Certbot {0}', replace(variables['Build.SourceBranchName'], 'v', '')) }}
releaseNotesFilePath: '$(Pipeline.Workspace)/release_notes.md'
assets: '$(Build.SourcesDirectory)/packages/{*.tar.gz,SHA256SUMS*}'
addChangeLog: false

View File

@@ -1,15 +1,16 @@
steps:
- bash: |
set -e
sudo apt-get update
sudo apt-get install -y --no-install-recommends libaugeas-dev
FINAL_STATUS=0
declare -a FAILED_BUILDS
python3 -m venv .venv
source .venv/bin/activate
python tools/pipstrap.py
tools/venv.py
source venv/bin/activate
for doc_path in */docs
do
echo ""
echo "##[group]Building $doc_path"
pip install -q -e $doc_path/..[docs]
if ! sphinx-build -W --keep-going -b html $doc_path $doc_path/_build/html; then
FINAL_STATUS=1
FAILED_BUILDS[${#FAILED_BUILDS[@]}]="${doc_path%/docs}"

View File

@@ -1,6 +1,18 @@
# This does not include the dependencies needed to build cryptography. See
# https://cryptography.io/en/latest/installation/
steps:
# We run brew update because we've seen attempts to install an older version
# of a package fail. See
# https://github.com/actions/virtual-environments/issues/3165.
#
# We untap homebrew/core and homebrew/cask and unset HOMEBREW_NO_INSTALL_FROM_API (which
# is set by the CI macOS env) because GitHub has been having issues, making these jobs
# fail on git clones: https://github.com/orgs/Homebrew/discussions/4612.
- bash: |
set -e
unset HOMEBREW_NO_INSTALL_FROM_API
brew untap homebrew/core homebrew/cask
brew update
brew install augeas
condition: startswith(variables['IMAGE_NAME'], 'macOS')
displayName: Install MacOS dependencies
@@ -8,32 +20,19 @@ steps:
set -e
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
python-dev \
gcc \
libaugeas0 \
libssl-dev \
libffi-dev \
ca-certificates \
nginx-light \
openssl
libaugeas-dev \
nginx-light
sudo systemctl stop nginx
sudo sysctl net.ipv4.ip_unprivileged_port_start=0
condition: startswith(variables['IMAGE_NAME'], 'ubuntu')
displayName: Install Linux dependencies
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION)
addToPath: true
# tools/pip_install.py is used to pin packages to a known working version
# except in tests where the environment variable CERTBOT_NO_PIN is set.
# virtualenv is listed here explicitly to make sure it is upgraded when
# CERTBOT_NO_PIN is set to work around failures we've seen when using an older
# version of virtualenv. The option "-I" is set so when CERTBOT_NO_PIN is also
# set, pip updates dependencies it thinks are already satisfied to avoid some
# problems with its lack of real dependency resolution.
- bash: |
set -e
python tools/pipstrap.py
python tools/pip_install.py -I tox virtualenv
python3 tools/pip_install.py tox
displayName: Install runtime dependencies
- task: DownloadSecureFile@1
name: testFarmPem
@@ -45,9 +44,34 @@ steps:
export TARGET_BRANCH="`echo "${BUILD_SOURCEBRANCH}" | sed -E 's!refs/(heads|tags)/!!g'`"
[ -z "${SYSTEM_PULLREQUEST_TARGETBRANCH}" ] || export TARGET_BRANCH="${SYSTEM_PULLREQUEST_TARGETBRANCH}"
env
python -m tox
python3 -m tox run
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
AWS_EC2_PEM_FILE: $(testFarmPem.secureFilePath)
displayName: Run tox
# For now, let's omit `set -e` and avoid the script exiting with a nonzero
# status code to prevent problems here from causing build failures. If
# this turns out to work well, we can change this.
- bash: |
python3 tools/pip_install.py -I coverage
case "$AGENT_OS" in
Darwin)
CODECOV_URL="https://uploader.codecov.io/latest/macos/codecov"
;;
Linux)
CODECOV_URL="https://uploader.codecov.io/latest/linux/codecov"
;;
Windows_NT)
CODECOV_URL="https://uploader.codecov.io/latest/windows/codecov.exe"
;;
*)
echo "Unexpected OS"
exit 0
esac
curl --retry 3 -o codecov "$CODECOV_URL"
chmod +x codecov
coverage xml
./codecov || echo "Uploading coverage data failed"
condition: and(eq(variables['uploadCoverage'], true), or(startsWith(variables['TOXENV'], 'cover'), startsWith(variables['TOXENV'], 'integration')))
displayName: Upload coverage data

View File

@@ -1,5 +1,24 @@
[run]
omit = */setup.py
source =
acme
certbot
certbot-apache
certbot-dns-cloudflare
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
[report]
omit = */setup.py
show_missing = True

View File

@@ -8,5 +8,4 @@
.git
.tox
venv
venv3
docs

12
.envrc
View File

@@ -1,12 +0,0 @@
# This file is just a nicety for developers who use direnv. When you cd under
# the Certbot repo, Certbot's virtual environment will be automatically
# activated and then deactivated when you cd elsewhere. Developers have to have
# direnv set up and run `direnv allow` to allow this file to execute on their
# system. You can find more information at https://direnv.net/.
. venv3/bin/activate
# direnv doesn't support modifying PS1 so we unset it to squelch the error
# it'll otherwise print about this being done in the activate script. See
# https://github.com/direnv/direnv/wiki/PS1. If you would like your shell
# prompt to change like it normally does, see
# https://github.com/direnv/direnv/wiki/Python#restoring-the-ps1.
unset PS1

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
custom: https://supporters.eff.org/donate/support-work-on-certbot

69
.github/ISSUE_TEMPLATE/bug.yaml vendored Normal file
View File

@@ -0,0 +1,69 @@
name: Bug Report
description: File a bug report.
title: "[Bug]: "
type: Bug
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! If you're
having trouble using Certbot and aren't sure you've found a bug,
please first try asking for help at https://community.letsencrypt.org/.
There is a much larger community there of people familiar with the
project who will be able to more quickly answer your questions.
- type: input
attributes:
label: OS
description: |
Describe your Operating System. Examples: Ubuntu 18.04, CentOS 8 Stream
placeholder: Ubuntu 24.04
validations:
required: true
- type: input
attributes:
label: Installation method
description: |
How did you install Certbot? Examples: snap, pip, apt, yum
placeholder: snap
validations:
required: true
- type: input
attributes:
label: Certbot Version
description: |
If you're not sure, you can find this by running `certbot --version`.
placeholder: 1.0.0
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: What happened?
description: |
I ran this command and it produced this output. Example:
```
$ sudo certbot certonly -d adfsfasdf.asdfasdf --staging
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Requesting a certificate for example.com
An unexpected error occurred:
Invalid identifiers requested :: Cannot issue for "adfsfasdf.asdfasdf": Domain name does not end with a valid public suffix (TLD)
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
```
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: Certbot's behavior differed from what I expected because.
placeholder: "What was expected?"
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Here is a Certbot log showing the issue (if available). Logs are stored in `/var/log/letsencrypt` by default. Feel free to redact domains, e-mail and IP addresses as you see fit.
render: shell

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Let's Encrypt Community Support
url: https://community.letsencrypt.org/
about: If you're having trouble using Certbot and aren't sure you've found a bug or request for a new feature, please first try asking for help here. There is a much larger community there of people familiar with the project who will be able to more quickly answer your questions.
- name: Certbot Security Policy
url: https://github.com/certbot/certbot/security/advisories/new
about: Please report security vulnerabilities here.

27
.github/ISSUE_TEMPLATE/feature.yaml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Feature Request
description: Suggest a new feature or improvement to Certbot
title: "[Feature Request]: "
type: Feature
body:
- type: textarea
id: problem
attributes:
label: What problem does this feature solve or what does it enhance?
description: Explain what this feature addresses, or the benefit it provides.
placeholder: For example, "Currently, users have to manually do X, which is time-consuming."
validations:
required: true
- type: textarea
id: solution
attributes:
label: Proposed Solution
description: Describe the solution you'd like to see implemented.
placeholder: For example, "Implement a new button that automatically does X."
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
description: Have you considered any alternative solutions?
placeholder: For example, "We considered Y, but Z is a better approach because..."

15
.github/ISSUE_TEMPLATE/task.yaml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Task
description: A codebase upkeep task such as managing deprecations and refactoring
title: "[Task]: "
type: Task
body:
- type: textarea
id: problem
attributes:
label: Task description
description: Describe the work that needs to happen, and why.
placeholder: >
For example, "In issue [link here], we noted that we cannot update [dependency] until
[something happens]. That thing has happened, so now we should update [dependency]."
validations:
required: true

7
.github/codecov.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
# This disables all reporting from codecov. Let's just set it up to collect
# data for now and then we can play with the settings here.
comment: false
coverage:
status:
project: off
patch: off

7
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,7 @@
## Pull Request Checklist
- [ ] The Certbot team has recently expressed interest in reviewing a PR for this. If not, this PR may be closed due our limited resources and need to prioritize how we spend them.
- [ ] If the change being made is to a [distributed component](https://certbot.eff.org/docs/contributing.html#code-components-and-layout), add a description of your change to the `newsfragments` directory. This should be a file called `<title>.<type>`, where `<title>` is either a GitHub issue number or some other unique name starting with `+`, and `<type>` is either `changed`, `fixed`, or `added`.
* For example, if you fixed a bug for issue number 42, create a file called `42.fixed` and put a description of your change in that file.
- [ ] Add or update any documentation as needed to support the changes in this PR.
- [ ] Include your name in `AUTHORS.md` if you like.

35
.github/stale.yml vendored
View File

@@ -1,35 +0,0 @@
# Configuration for https://github.com/marketplace/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 365
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
# When changing this value, be sure to also update markComment below.
daysUntilClose: 30
# Ignore issues with an assignee (defaults to false)
exemptAssignees: true
# Label to use when marking as stale
staleLabel: needs-update
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
We've made a lot of changes to Certbot since this issue was opened. If you
still have this issue with an up-to-date version of Certbot, can you please
add a comment letting us know? This helps us to better see what issues are
still affecting our users. If there is no activity in the next 30 days, this
issue will be automatically closed.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
This issue has been closed due to lack of activity, but if you think it
should be reopened, please open a new issue with a link to this one and we'll
take a look.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 1
# Don't mark pull requests as stale.
only: issues

14
.github/workflows/assigned.yaml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Issue Assigned
on:
issues:
types: [assigned]
jobs:
send-mattermost-message:
runs-on: ubuntu-latest
steps:
- uses: mattermost/action-mattermost-notify@master
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_ASSIGN_WEBHOOK }}
TEXT: >
${{ github.event.assignee.login }} assigned to "${{ github.event.issue.title }}": ${{ github.event.issue.html_url }}

20
.github/workflows/merged.yaml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: Merge Event
on:
pull_request_target:
types:
- closed
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: mattermost/action-mattermost-notify@master
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_MERGE_WEBHOOK }}
TEXT: >
[${{ github.repository }}] |
[${{ github.event.pull_request.title }}
#${{ github.event.number }}](https://github.com/${{ github.repository }}/pull/${{ github.event.number }})
was merged into main by ${{ github.actor }}

25
.github/workflows/notify_weekly.yaml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Weekly Github Update
on:
schedule:
# Every week on Thursday @ 10:00
- cron: "0 10 * * 4"
workflow_dispatch:
jobs:
send-mattermost-message:
runs-on: ubuntu-latest
steps:
- name: Create Mattermost Message
run: |
DATE=$(date --date="7 days ago" +"%Y-%m-%d")
echo "ASSIGNED_PRS=https://github.com/pulls?q=is%3Apr+is%3Aopen+updated%3A%3E%3D${DATE}+assignee%3A*+user%3Acertbot" >> $GITHUB_ENV
echo "UPDATED_URL=https://github.com/issues?q=is%3Aissue+is%3Aopen+sort%3Acomments-desc+updated%3A%3E%3D${DATE}+user%3Acertbot" >> $GITHUB_ENV
- uses: mattermost/action-mattermost-notify@master
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_CHANNEL: private-certbot
TEXT: |
## Updates In the Past Week
- Most commented in the last week: [link](${{ env.UPDATED_URL }})
- Updated (assigned) PRs in the last week: [link](${{ env.ASSIGNED_PRS }})

16
.github/workflows/review_requested.yaml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: Review Requested
on:
pull_request_target:
types: [review_requested]
jobs:
send-mattermost-message:
# Don't notify for the interim step of certbot/eff-devs being assigned
if: ${{ github.event.requested_reviewer.login != ''}}
runs-on: ubuntu-latest
steps:
- uses: mattermost/action-mattermost-notify@master
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_ASSIGN_WEBHOOK }}
TEXT: >
Review requested from ${{ github.event.requested_reviewer.login }} for "${{ github.event.pull_request.title }}": ${{ github.event.pull_request.html_url }}

51
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: Update Stale Issues
on:
schedule:
# Run 1:24AM every night
- cron: '24 1 * * *'
workflow_dispatch:
permissions:
issues: write
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v6
with:
# Idle number of days before marking issues stale
days-before-issue-stale: 365
# Never mark PRs as stale
days-before-pr-stale: -1
# Idle number of days before closing stale issues
days-before-issue-close: 30
# Never close PRs
days-before-pr-close: -1
# Ignore issues with an assignee
exempt-all-issue-assignees: true
# Label to use when marking as stale
stale-issue-label: stale-needs-update
# Label to use when issue is automatically closed
close-issue-label: auto-closed
stale-issue-message: >
We've made a lot of changes to Certbot since this issue was opened. If you
still have this issue with an up-to-date version of Certbot, can you please
add a comment letting us know? This helps us to better see what issues are
still affecting our users. If there is no activity in the next 30 days, this
issue will be automatically closed.
close-issue-message: >
This issue has been closed due to lack of activity, but if you think it
should be reopened, please open a new issue with a link to this one and we'll
take a look.
# Limit the number of actions per run. As of writing this, GitHub's
# rate limit is 1000 requests per hour so we're still a ways off. See
# https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limits-for-requests-from-github-actions.
operations-per-run: 180

16
.gitignore vendored
View File

@@ -4,16 +4,16 @@
build/
dist*/
/venv*/
/kgs/
/.tox/
/releases*/
/log*
letsencrypt.log
certbot.log
letsencrypt-auto-source/letsencrypt-auto.sig.lzma.base64
poetry.lock
# coverage
.coverage
.coverage.*
/htmlcov/
/.vagrant
@@ -27,16 +27,12 @@ tags
.idea
.ropeproject
.vscode
*.sublime-project
*.sublime-workspace
# auth --cert-path --chain-path
/*.pem
# letstest
tests/letstest/letest-*/
tests/letstest/*.pem
tests/letstest/venv/
tests/letstest/venv3/
.venv
# pytest cache
@@ -65,3 +61,7 @@ certbot-dns*/certbot-dns*_arm*.txt
/certbot_amd64*.txt
/certbot_arm*.txt
certbot-dns*/snap
snapcraft.cfg
# pyenv files
.python-version

View File

@@ -1,7 +1,7 @@
[settings]
skip_glob=venv*
skip=letsencrypt-auto-source
force_sort_within_sections=True
force_single_line=True
order_by_type=False
line_length=400
src_paths=acme/src,acme/tests,certbot*/tests,certbot/src,certbot*/src/certbot*

742
.pylintrc
View File

@@ -1,51 +1,373 @@
[MASTER]
[MAIN]
# use as many jobs as there are cores
jobs=0
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Specify a configuration file.
#rcfile=
# Load and enable all available extensions. Use --list-extensions to see a list
# all available extensions.
#enable-all-extensions=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# In error mode, messages with a category besides ERROR or FATAL are
# suppressed, and no reports are done by default. Error mode is compatible with
# disabling specific errors.
#errors-only=
# Profiled execution.
profile=no
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
# Pickle collected data for later comparisons.
persistent=yes
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=linter_plugin
# Always return a 0 (non-error) status code, even if lint errors are found.
# This is primarily useful in continuous integration scripts.
#exit-zero=
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-allow-list=
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
# for backward compatibility.)
extension-pkg-whitelist=pywintypes,win32api,win32file,win32security
# Return non-zero exit code if any of these messages/categories are detected,
# even if score is above --fail-under value. Syntax same as enable. Messages
# specified are enabled, while categories only check already-enabled messages.
fail-on=
# Specify a score threshold under which the program will exit with error.
fail-under=10
# Interpret the stdin as a python script, whose filename needs to be passed as
# the module_or_package argument.
#from-stdin=
# Files or directories to be skipped. They should be base names, not paths.
ignore=CVS
# Add files or directories matching the regular expressions patterns to the
# ignore-list. The regex matches against paths and can be in Posix or Windows
# format. Because '\' represents the directory delimiter on Windows systems, it
# can't be used as an escape character.
# CERTBOT COMMENT
# Changing this line back to the default of `ignore-paths=` is being tracked by
# https://github.com/certbot/certbot/issues/7908.
ignore-paths=.*/_internal/tests/
# Files or directories matching the regular expression patterns are skipped.
# The regex matches against base names, not paths. The default value ignores
# Emacs file locks
ignore-patterns=^\.#
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
# CERTBOT COMMENT
# This is needed for pylint to import linter_plugin.py since
# https://github.com/PyCQA/pylint/pull/3396.
init-hook="import pylint.config, os, sys; sys.path.append(os.path.dirname(next(pylint.config.find_default_config_files())))"
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use, and will cap the count on Windows to
# avoid hangs.
jobs=0
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
# complex, nested conditions.
limit-inference-results=100
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=linter_plugin
# Pickle collected data for later comparisons.
persistent=yes
# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.10
# Discover python modules and packages in the file system subtree.
recursive=no
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
# In verbose mode, extra non-checker-related info will be displayed.
#verbose=
[BASIC]
# Naming style matching correct argument names.
argument-naming-style=snake_case
# Regular expression matching correct argument names. Overrides argument-
# naming-style. If left empty, argument names will be checked with the set
# naming style.
#argument-rgx=
# Naming style matching correct attribute names.
attr-naming-style=snake_case
# Regular expression matching correct attribute names. Overrides attr-naming-
# style. If left empty, attribute names will be checked with the set naming
# style.
#attr-rgx=
# Bad variable names which should always be refused, separated by a comma.
bad-names=foo,
bar,
baz,
toto,
tutu,
tata
# Bad variable names regexes, separated by a comma. If names match any regex,
# they will always be refused
bad-names-rgxs=
# Naming style matching correct class attribute names.
class-attribute-naming-style=any
# Regular expression matching correct class attribute names. Overrides class-
# attribute-naming-style. If left empty, class attribute names will be checked
# with the set naming style.
#class-attribute-rgx=
# Naming style matching correct class constant names.
class-const-naming-style=UPPER_CASE
# Regular expression matching correct class constant names. Overrides class-
# const-naming-style. If left empty, class constant names will be checked with
# the set naming style.
#class-const-rgx=
# Naming style matching correct class names.
class-naming-style=PascalCase
# Regular expression matching correct class names. Overrides class-naming-
# style. If left empty, class names will be checked with the set naming style.
#class-rgx=
# Naming style matching correct constant names.
const-naming-style=UPPER_CASE
# Regular expression matching correct constant names. Overrides const-naming-
# style. If left empty, constant names will be checked with the set naming
# style.
#const-rgx=
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming style matching correct function names.
function-naming-style=snake_case
# Regular expression matching correct function names. Overrides function-
# naming-style. If left empty, function names will be checked with the set
# naming style.
function-rgx=[a-z_][a-z0-9_]{2,40}$
# Good variable names which should always be accepted, separated by a comma.
good-names=i,
j,
k,
ex,
Run,
_,
fd,
logger
# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted
good-names-rgxs=
# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
# Naming style matching correct inline iteration names.
inlinevar-naming-style=any
# Regular expression matching correct inline iteration names. Overrides
# inlinevar-naming-style. If left empty, inline iteration names will be checked
# with the set naming style.
#inlinevar-rgx=
# Naming style matching correct method names.
method-naming-style=snake_case
# Regular expression matching correct method names. Overrides method-naming-
# style. If left empty, method names will be checked with the set naming style.
method-rgx=[a-z_][a-z0-9_]{2,50}$
# Naming style matching correct module names.
module-naming-style=snake_case
# Regular expression matching correct module names. Overrides module-naming-
# style. If left empty, module names will be checked with the set naming style.
#module-rgx=
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=(__.*__)|(test_[A-Za-z0-9_]*)|(_.*)|(.*Test$)
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty
# Regular expression matching correct type variable names. If left empty, type
# variable names will be checked with the set naming style.
#typevar-rgx=
# Naming style matching correct variable names.
variable-naming-style=snake_case
# Regular expression matching correct variable names. Overrides variable-
# naming-style. If left empty, variable names will be checked with the set
# naming style.
variable-rgx=[a-z_][a-z0-9_]{1,30}$
[CLASSES]
# Warn about protected attribute access inside special methods
check-protected-access-in-special-methods=no
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
setUp,
__post_init__
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=cls
[EXCEPTIONS]
# Exceptions that will emit a warning when caught.
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
# git history told me that "This does something silly/broken..."
#indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module.
max-module-lines=1250
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[IMPORTS]
# List of modules that can be imported at any level, not just the top level
# one.
allow-any-import-level=
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Deprecated modules which should not be used, separated by a comma.
deprecated-modules=
# Output a graph (.gv or any supported image format) of external dependencies
# to the given file (report RP0402 must not be disabled).
ext-import-graph=
# Output a graph (.gv or any supported image format) of all (i.e. internal and
# external) dependencies to the given file (report RP0402 must not be
# disabled).
import-graph=
# Output a graph (.gv or any supported image format) of internal dependencies
# to the given file (report RP0402 must not be disabled).
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
# Couples of modules and preferred modules, separated by a comma.
preferred-modules=
[LOGGING]
# The type of string formatting that logging methods do. `old` means using %
# formatting, `new` is for `{}` formatting.
logging-format-style=old
# Logging modules to check that the string format arguments are in logging
# function parameter format.
logging-modules=logging,logger
[MESSAGES CONTROL]
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time. See also the "--disable" option for examples.
#enable=
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
# UNDEFINED.
confidence=HIGH,
CONTROL_FLOW,
INFERENCE,
INFERENCE_FAILURE,
UNDEFINED
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
# CERTBOT COMMENT
# 1) Once certbot codebase is claimed to be compatible exclusively with Python 3,
# the useless-object-inheritance check can be enabled again, and code fixed accordingly.
@@ -53,261 +375,203 @@ extension-pkg-whitelist=pywintypes,win32api,win32file,win32security
# See https://github.com/PyCQA/pylint/issues/1498.
# 3) Same as point 2 for no-value-for-parameter.
# See https://github.com/PyCQA/pylint/issues/2820.
disable=fixme,locally-disabled,locally-enabled,bad-continuation,no-self-use,invalid-name,cyclic-import,duplicate-code,design,import-outside-toplevel,useless-object-inheritance,unsubscriptable-object,no-value-for-parameter,no-else-return,no-else-raise,no-else-break,no-else-continue
# 4) raise-missing-from makes it an error to raise an exception from except
# block without using explicit exception chaining. While explicit exception
# chaining results in a slightly more informative traceback, I don't think
# it's beneficial enough for us to change all of our current instances and
# give Certbot developers errors about this when they're working on new code
# in the future. You can read more about exception chaining and this pylint
# check at
# https://blog.ram.rachum.com/post/621791438475296768/improving-python-exception-chaining-with.
# 5) wrong-import-order generates false positives and a pylint developer
# suggests that people using isort should disable this check at
# https://github.com/PyCQA/pylint/issues/3817#issuecomment-687892090.
# 6) unspecified-encoding generates errors when encoding is not specified in
# in a call to the built-in open function. This relates more to a design decision
# (unspecified encoding makes the open function use the default encoding of the system)
# than a clear flaw on which a check should be enforced. Anyway the project does
# not need to enforce encoding on files so we disable this check.
# 7) consider-using-f-string is "suggesting" to move to f-string when possible with an error. This
# clearly relates to code design and not to potential defects in the code, let's just ignore that.
disable=fixme,locally-disabled,invalid-name,cyclic-import,duplicate-code,design,import-outside-toplevel,useless-object-inheritance,unsubscriptable-object,no-value-for-parameter,no-else-return,no-else-raise,no-else-break,no-else-continue,raise-missing-from,wrong-import-order,unspecified-encoding,consider-using-f-string,raw-checker-failed,bad-inline-option,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,use-symbolic-message-instead
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs
# (visual studio) and html. You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=text
# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
files-output=no
# Tells whether to display a full report or only the messages
reports=yes
# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Add a comment according to your evaluation note. This is used by the global
# evaluation report (RP0004).
comment=no
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member
[BASIC]
[METHOD_ARGS]
# Required attributes for module, separated by a comma
required-attributes=
# List of builtins function names that should not be used, separated by a comma
bad-functions=map,filter,apply,input,file
# Good variable names which should always be accepted, separated by a comma
good-names=f,i,j,k,ex,Run,_,fd,logger
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no
# Regular expression matching correct function names
function-rgx=[a-z_][a-z0-9_]{2,40}$
# Naming hint for function names
function-name-hint=[a-z_][a-z0-9_]{2,40}$
# Regular expression matching correct variable names
variable-rgx=[a-z_][a-z0-9_]{1,30}$
# Naming hint for variable names
variable-name-hint=[a-z_][a-z0-9_]{2,30}$
# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Regular expression matching correct attribute names
attr-rgx=[a-z_][a-z0-9_]{2,30}$
# Naming hint for attribute names
attr-name-hint=[a-z_][a-z0-9_]{2,30}$
# Regular expression matching correct argument names
argument-rgx=[a-z_][a-z0-9_]{2,30}$
# Naming hint for argument names
argument-name-hint=[a-z_][a-z0-9_]{2,30}$
# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
# Regular expression matching correct class names
class-rgx=[A-Z_][a-zA-Z0-9]+$
# Naming hint for class names
class-name-hint=[A-Z_][a-zA-Z0-9]+$
# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Regular expression matching correct method names
method-rgx=[a-z_][a-z0-9_]{2,50}$
# Naming hint for method names
method-name-hint=[a-z_][a-z0-9_]{2,50}$
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=(__.*__)|(test_[A-Za-z0-9_]*)|(_.*)|(.*Test$)
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# List of qualified names (i.e., library.method) which require a timeout
# parameter e.g. 'requests.api.get,requests.api.post'
timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO
notes=FIXME,
XXX,
TODO
# Regular expression of note tags to take in consideration.
notes-rgx=
[LOGGING]
[REFACTORING]
# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging,logger
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
# it will be considered as an explicit return statement and no message will be
# printed.
never-returning-functions=sys.exit,argparse.parse_error
[VARIABLES]
[REPORTS]
# Tells whether we should check for unused import in __init__ files.
init-import=no
# Python expression which should return a score less than or equal to 10. You
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
# 'convention', and 'info' which contain the number of messages in each
# category, as well as 'statement' which is the total number of statements
# analyzed. This score is used by the global evaluation report (RP0004).
evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=(unused)?_.*|dummy
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details.
msg-template=
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
#output-format=
# Tells whether to display a full report or only the messages.
reports=no
# Activate the evaluation score.
score=yes
[SIMILARITIES]
# Comments are removed from the similarity computation
ignore-comments=yes
# Docstrings are removed from the similarity computation
ignore-docstrings=yes
# Imports are removed from the similarity computation
ignore-imports=yes
# Signatures are removed from the similarity computation
ignore-signatures=yes
# Minimum lines number of a similarity.
min-similarity-lines=6
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
[STRING]
# Ignore imports when computing similarities.
ignore-imports=yes
# This flag controls whether inconsistent-quotes generates a warning when the
# character used as a quote delimiter is used inconsistently within a module.
check-quote-consistency=no
[FORMAT]
# Maximum number of characters on a single line.
max-line-length=100
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
# List of optional constructs for which whitespace checking is disabled
no-space-check=trailing-comma
# Maximum number of lines in a module
max-module-lines=1250
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Number of spaces of indent required inside a hanging or continued line.
# This does something silly/broken...
#indent-after-paren=4
# This flag controls whether the implicit-str-concat should generate a warning
# on implicit string concatenation in sequences defined over several lines.
check-str-concat-over-line-jumps=no
[TYPECHECK]
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None.
ignore-none=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of symbolic message names to ignore for Mixin members.
ignored-checks-for-mixins=no-member,
not-async-context-manager,
not-context-manager,
attribute-defined-outside-init
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace,Field,Header,JWS,closing
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis
ignored-modules=pkg_resources,confargparse,argparse,six.moves,six.moves.urllib
# import errors ignored only in 1.4.4
# https://bitbucket.org/logilab/pylint/commits/cd000904c9e2
ignored-modules=confargparse,argparse
# List of classes names for which member attributes should not be checked
# (useful for classes with attributes dynamically set).
ignored-classes=Field,Header,JWS,closing
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# When zope mode is activated, add a predefined set of Zope acquired attributes
# to generated-members.
zope=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E0201 when accessed. Python regular
# expressions are accepted.
generated-members=REQUEST,acl_users,aq_parent
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
# Regex pattern to define which classes are considered mixins.
mixin-class-rgx=.*[Mm]ixin
# List of decorators that change the signature of a decorated function.
signature-mutators=
[IMPORTS]
[VARIABLES]
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=regsub,TERMIOS,Bastion,rexec
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid defining new builtins when possible.
additional-builtins=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled)
ext-import-graph=
# List of names allowed to shadow builtins
allowed-redefined-builtins=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,
_cb
# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
[CLASSES]
# Argument names that match this expression will be ignored.
ignored-argument-names=_.*|^ignored_|^unused_
# List of interface methods to ignore, separated by a comma. This is used for
# instance to not check methods defined in Zope's Interface base class.
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by,implementedBy,providedBy
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io

View File

@@ -17,9 +17,13 @@ Authors
* [Alex Halderman](https://github.com/jhalderm)
* [Alex Jordan](https://github.com/strugee)
* [Alex Zorin](https://github.com/alexzorin)
* [Alexis Hancock](https://github.com/zoracon)
* [Amir Omidi](https://github.com/aaomidi)
* [Amjad Mashaal](https://github.com/TheNavigat)
* [amplifi](https://github.com/amplifi)
* [Andrew Murray](https://github.com/radarhere)
* [Andrzej Górski](https://github.com/andrzej3393)
* [Anna Glasgall](https://github.com/aglasgall)
* [Anselm Levskaya](https://github.com/levskaya)
* [Antoine Jacoutot](https://github.com/ajacoutot)
* [April King](https://github.com/april)
@@ -65,6 +69,7 @@ Authors
* [Daniel Convissor](https://github.com/convissor)
* [Daniel "Drex" Drexler](https://github.com/aeturnum)
* [Daniel Huang](https://github.com/dhuang)
* [Daniel McMahon] (https://github.com/igloodan)
* [Dave Guarino](https://github.com/daguar)
* [David cz](https://github.com/dave-cz)
* [David Dworken](https://github.com/ddworken)
@@ -89,6 +94,7 @@ Authors
* [Felix Yan](https://github.com/felixonmars)
* [Filip Ochnik](https://github.com/filipochnik)
* [Florian Klink](https://github.com/flokli)
* [Francesco Colista](https://github.com/fcolista)
* [Francois Marier](https://github.com/fmarier)
* [Frank](https://github.com/Frankkkkk)
* [Frederic BLANC](https://github.com/fblanc)
@@ -115,8 +121,10 @@ Authors
* [Jacob Sachs](https://github.com/jsachs)
* [Jairo Llopis](https://github.com/Yajo)
* [Jakub Warmuz](https://github.com/kuba)
* [James Balazs](https://github.com/jamesbalazs)
* [James Kasten](https://github.com/jdkasten)
* [Jason Grinblat](https://github.com/ptychomancer)
* [Jawshua](https://github.com/jawshua)
* [Jay Faulkner](https://github.com/jayofdoom)
* [J.C. Jones](https://github.com/jcjones)
* [Jeff Hodges](https://github.com/jmhodges)
@@ -131,6 +139,7 @@ Authors
* [John Reed](https://github.com/leerspace)
* [Jonas Berlin](https://github.com/xkr47)
* [Jonathan Herlin](https://github.com/Jonher937)
* [Jonathan Vanasco](https://github.com/jvanasco)
* [Jon Walsh](https://github.com/code-tree)
* [Joona Hoikkala](https://github.com/joohoi)
* [Josh McCullough](https://github.com/JoshMcCullough)
@@ -138,6 +147,7 @@ Authors
* [Joubin Jabbari](https://github.com/joubin)
* [Juho Juopperi](https://github.com/jkjuopperi)
* [Kane York](https://github.com/riking)
* [Katsuyoshi Ozaki](https://github.com/moratori)
* [Kenichi Maehashi](https://github.com/kmaehashi)
* [Kenneth Skovhede](https://github.com/kenkendk)
* [Kevin Burke](https://github.com/kevinburke)
@@ -146,6 +156,7 @@ Authors
* [LeCoyote](https://github.com/LeCoyote)
* [Lee Watson](https://github.com/TheReverend403)
* [Leo Famulari](https://github.com/lfam)
* [Leon G](https://github.com/LeonGr)
* [lf](https://github.com/lf-)
* [Liam Marshall](https://github.com/liamim)
* [Lior Sabag](https://github.com/liorsbg)
@@ -156,6 +167,7 @@ Authors
* [Luca Ebach](https://github.com/lucebac)
* [Luca Olivetti](https://github.com/olivluca)
* [Luke Rogers](https://github.com/lukeroge)
* [Lukhnos Liu](https://github.com/lukhnos)
* [Maarten](https://github.com/mrtndwrd)
* [Mads Jensen](https://github.com/atombrella)
* [Maikel Martens](https://github.com/krukas)
@@ -173,6 +185,7 @@ Authors
* [Mathieu Leduc-Hamel](https://github.com/mlhamel)
* [Matt Bostock](https://github.com/mattbostock)
* [Matthew Ames](https://github.com/SuperMatt)
* [Matthew W. Thomas](https://github.com/mwt)
* [Michael Schumacher](https://github.com/schumaml)
* [Michael Strache](https://github.com/Jarodiv)
* [Michael Sverdlin](https://github.com/sveder)
@@ -197,24 +210,30 @@ Authors
* [osirisinferi](https://github.com/osirisinferi)
* Patrick Figel
* [Patrick Heppler](https://github.com/PatrickHeppler)
* [Paul Buonopane](https://github.com/Zenexer)
* [Paul Feitzinger](https://github.com/pfeyz)
* [Paulo Dias](https://github.com/paulojmdias)
* [Pavan Gupta](https://github.com/pavgup)
* [Pavel Pavlov](https://github.com/ghost355)
* [Peter Conrad](https://github.com/pconrad-fb)
* [Peter Eckersley](https://github.com/pde)
* [Peter Mosmans](https://github.com/PeterMosmans)
* [Phil Martin](https://github.com/frillip)
* [Philippe Langlois](https://github.com/langloisjp)
* [Philipp Spitzer](https://github.com/spitza)
* [Piero Steinger](https://github.com/Jadaw1n)
* [Pierre Jaury](https://github.com/kaiyou)
* [Piotr Kasprzyk](https://github.com/kwadrat)
* [Prayag Verma](https://github.com/pra85)
* [Preston Locke](https://github.com/Preston12321)
* [Q Misell][https://magicalcodewit.ch]
* [Rasesh Patel](https://github.com/raspat1)
* [Reinaldo de Souza Jr](https://github.com/juniorz)
* [Remi Rampin](https://github.com/remram44)
* [Rémy HUBSCHER](https://github.com/Natim)
* [Rémy Léone](https://github.com/sieben)
* [Richard Barnes](https://github.com/r-barnes)
* [Richard Harman](https://github.com/warewolf)
* [Richard Panek](https://github.com/kernelpanek)
* [Robert Buchholz](https://github.com/rbu)
* [Robert Dailey](https://github.com/pahrohfit)
@@ -227,6 +246,7 @@ Authors
* [Sagi Kedmi](https://github.com/sagi)
* [Sam Lanning](https://github.com/samlanning)
* [sapics](https://github.com/sapics)
* [SATOH Fumiyasu](https://github.com/fumiyas)
* [Scott Barr](https://github.com/scottjbarr)
* [Scott Merrill](https://github.com/skpy)
* [Sebastian Bögl](https://github.com/TheBoegl)
@@ -272,6 +292,7 @@ Authors
* [Wilfried Teiken](https://github.com/wteiken)
* [Willem Fibbe](https://github.com/fibbers)
* [William Budington](https://github.com/Hainish)
* [Will Greenberg](https://github.com/wgreenberg)
* [Will Newby](https://github.com/willnewby)
* [Will Oller](https://github.com/willoller)
* [Yan](https://github.com/diracdeltas)
@@ -282,3 +303,4 @@ Authors
* [Yuseong Cho](https://github.com/g6123)
* [Zach Shepherd](https://github.com/zjs)
* [陈三](https://github.com/chenxsan)
* [Shahar Naveh](https://github.com/ShaharNaveh)

View File

@@ -1,5 +1,8 @@
<!---
zoracon: (This is an old comment below, not sure how accurate this is anymore.
Since Github seems to lean more towards Markdown these days, it's still probably accurate)
This file serves as an entry point for GitHub's Contributing
Guidelines [1] only.
@@ -19,19 +22,15 @@ to the Sphinx generated docs is provided below.
Hi! Welcome to the Certbot project. We look forward to collaborating with you.
If you're reporting a bug in Certbot, please make sure to include:
- The version of Certbot you're running.
- The operating system you're running it on.
- The commands you ran.
- What you expected to happen, and
- What actually happened.
If you're reporting a bug in Certbot. Please open an issue: https://github.com/certbot/certbot/issues/new/choose.
If you're having trouble using Certbot and aren't sure you've found a bug, please first try asking for help at https://community.letsencrypt.org/. There is a much larger community there of people familiar with the project who will be able to more quickly answer your questions.
If you're a developer, we have some helpful information in our
[Developer's Guide](https://certbot.eff.org/docs/contributing.html) to get you
started. In particular, we recommend you read these sections
started. In particular, we recommend you read these sections:
- [EFF's Public Projects Code of Conduct](https://www.eff.org/pages/eppcode)
- [Finding issues to work on](https://certbot.eff.org/docs/contributing.html#find-issues-to-work-on)
- [Coding style](https://certbot.eff.org/docs/contributing.html#coding-style)
- [Submitting a pull request](https://certbot.eff.org/docs/contributing.html#submitting-a-pull-request)
- [EFF's Public Projects Code of Conduct](https://www.eff.org/pages/eppcode)

View File

@@ -1,20 +0,0 @@
# This Dockerfile builds an image for development.
FROM debian:buster
# Note: this only exposes the port to other docker containers.
EXPOSE 80 443
WORKDIR /opt/certbot/src
COPY . .
RUN apt-get update && \
apt-get install apache2 git python3-dev python3-venv gcc libaugeas0 \
libssl-dev libffi-dev ca-certificates openssl nginx-light -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
RUN VENV_NAME="../venv3" python3 tools/venv3.py
ENV PATH /opt/certbot/venv3/bin:$PATH

View File

@@ -1,22 +0,0 @@
If you're having trouble using Certbot and aren't sure you've found a bug or
request for a new feature, please first try asking for help at
https://community.letsencrypt.org/. There is a much larger community there of
people familiar with the project who will be able to more quickly answer your
questions.
## My operating system is (include version):
## I installed Certbot with (certbot-auto, OS package manager, pip, etc):
## I ran this command and it produced this output:
## Certbot's behavior differed from what I expected because:
## Here is a Certbot log showing the issue (if available):
###### Logs are stored in `/var/log/letsencrypt` by default. Feel free to redact domains, e-mail and IP addresses as you see fit.
## Here is the relevant nginx server block or Apache virtualhost for the domain I am configuring:

16
SECURITY.md Normal file
View File

@@ -0,0 +1,16 @@
# Security Policy
## Supported Versions
Explanation on supported versions [here](https://github.com/certbot/certbot/wiki/Architectural-Decision-Records#-update-to-certbots-version-policy-and-end-of-life-support-on-previous-major-versions)
| Major Version | Support Level |
| ------- | ------------------ |
| >= 4.0 | Full Support |
| 3.x | Discretionary Backports |
| <=2.x | None |
## Reporting a Vulnerability
Security vulnerabilities can be reported using GitHub's [private vulnerability reporting tool](https://github.com/certbot/certbot/security/advisories/new).

33
acme/.readthedocs.yaml Normal file
View File

@@ -0,0 +1,33 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: acme/docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
fail_on_warning: true
# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
- epub
# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: acme/readthedocs.org.requirements.txt

View File

@@ -1,8 +1,8 @@
include LICENSE.txt
include README.rst
include pytest.ini
recursive-include docs *
recursive-include examples *
recursive-include tests *
recursive-include src/acme/_internal/tests/testdata *
include src/acme/py.typed
global-exclude __pycache__
global-exclude *.py[cod]

File diff suppressed because it is too large Load Diff

View File

@@ -1,344 +0,0 @@
"""Crypto utilities."""
import binascii
import contextlib
import logging
import os
import re
import socket
import josepy as jose
from OpenSSL import crypto
from OpenSSL import SSL # type: ignore # https://github.com/python/typeshed/issues/2052
from acme import errors
from acme.magic_typing import Callable
from acme.magic_typing import Tuple
from acme.magic_typing import Union
logger = logging.getLogger(__name__)
# Default SSL method selected here is the most compatible, while secure
# SSL method: TLSv1_METHOD is only compatible with
# TLSv1_METHOD, while SSLv23_METHOD is compatible with all other
# methods, including TLSv2_METHOD (read more at
# https://www.openssl.org/docs/ssl/SSLv23_method.html). _serve_sni
# should be changed to use "set_options" to disable SSLv2 and SSLv3,
# in case it's used for things other than probing/serving!
_DEFAULT_SSL_METHOD = SSL.SSLv23_METHOD # type: ignore
class _DefaultCertSelection(object):
def __init__(self, certs):
self.certs = certs
def __call__(self, connection):
server_name = connection.get_servername()
return self.certs.get(server_name, None)
class SSLSocket(object): # pylint: disable=too-few-public-methods
"""SSL wrapper for sockets.
:ivar socket sock: Original wrapped socket.
:ivar dict certs: Mapping from domain names (`bytes`) to
`OpenSSL.crypto.X509`.
:ivar method: See `OpenSSL.SSL.Context` for allowed values.
:ivar alpn_selection: Hook to select negotiated ALPN protocol for
connection.
:ivar cert_selection: Hook to select certificate for connection. If given,
`certs` parameter would be ignored, and therefore must be empty.
"""
def __init__(self, sock, certs=None,
method=_DEFAULT_SSL_METHOD, alpn_selection=None,
cert_selection=None):
self.sock = sock
self.alpn_selection = alpn_selection
self.method = method
if not cert_selection and not certs:
raise ValueError("Neither cert_selection or certs specified.")
if cert_selection and certs:
raise ValueError("Both cert_selection and certs specified.")
if cert_selection is None:
cert_selection = _DefaultCertSelection(certs)
self.cert_selection = cert_selection
def __getattr__(self, name):
return getattr(self.sock, name)
def _pick_certificate_cb(self, connection):
"""SNI certificate callback.
This method will set a new OpenSSL context object for this
connection when an incoming connection provides an SNI name
(in order to serve the appropriate certificate, if any).
:param connection: The TLS connection object on which the SNI
extension was received.
:type connection: :class:`OpenSSL.Connection`
"""
pair = self.cert_selection(connection)
if pair is None:
logger.debug("Certificate selection for server name %s failed, dropping SSL",
connection.get_servername())
return
key, cert = pair
new_context = SSL.Context(self.method)
new_context.set_options(SSL.OP_NO_SSLv2)
new_context.set_options(SSL.OP_NO_SSLv3)
new_context.use_privatekey(key)
new_context.use_certificate(cert)
if self.alpn_selection is not None:
new_context.set_alpn_select_callback(self.alpn_selection)
connection.set_context(new_context)
class FakeConnection(object):
"""Fake OpenSSL.SSL.Connection."""
# pylint: disable=missing-function-docstring
def __init__(self, connection):
self._wrapped = connection
def __getattr__(self, name):
return getattr(self._wrapped, name)
def shutdown(self, *unused_args):
# OpenSSL.SSL.Connection.shutdown doesn't accept any args
return self._wrapped.shutdown()
def accept(self): # pylint: disable=missing-function-docstring
sock, addr = self.sock.accept()
context = SSL.Context(self.method)
context.set_options(SSL.OP_NO_SSLv2)
context.set_options(SSL.OP_NO_SSLv3)
context.set_tlsext_servername_callback(self._pick_certificate_cb)
if self.alpn_selection is not None:
context.set_alpn_select_callback(self.alpn_selection)
ssl_sock = self.FakeConnection(SSL.Connection(context, sock))
ssl_sock.set_accept_state()
logger.debug("Performing handshake with %s", addr)
try:
ssl_sock.do_handshake()
except SSL.Error as error:
# _pick_certificate_cb might have returned without
# creating SSL context (wrong server name)
raise socket.error(error)
return ssl_sock, addr
def probe_sni(name, host, port=443, timeout=300, # pylint: disable=too-many-arguments
method=_DEFAULT_SSL_METHOD, source_address=('', 0),
alpn_protocols=None):
"""Probe SNI server for SSL certificate.
:param bytes name: Byte string to send as the server name in the
client hello message.
:param bytes host: Host to connect to.
:param int port: Port to connect to.
:param int timeout: Timeout in seconds.
:param method: See `OpenSSL.SSL.Context` for allowed values.
:param tuple source_address: Enables multi-path probing (selection
of source interface). See `socket.creation_connection` for more
info. Available only in Python 2.7+.
:param alpn_protocols: Protocols to request using ALPN.
:type alpn_protocols: `list` of `bytes`
:raises acme.errors.Error: In case of any problems.
:returns: SSL certificate presented by the server.
:rtype: OpenSSL.crypto.X509
"""
context = SSL.Context(method)
context.set_timeout(timeout)
socket_kwargs = {'source_address': source_address}
try:
logger.debug(
"Attempting to connect to %s:%d%s.", host, port,
" from {0}:{1}".format(
source_address[0],
source_address[1]
) if any(source_address) else ""
)
socket_tuple = (host, port) # type: Tuple[str, int]
sock = socket.create_connection(socket_tuple, **socket_kwargs) # type: ignore
except socket.error as error:
raise errors.Error(error)
with contextlib.closing(sock) as client:
client_ssl = SSL.Connection(context, client)
client_ssl.set_connect_state()
client_ssl.set_tlsext_host_name(name) # pyOpenSSL>=0.13
if alpn_protocols is not None:
client_ssl.set_alpn_protos(alpn_protocols)
try:
client_ssl.do_handshake()
client_ssl.shutdown()
except SSL.Error as error:
raise errors.Error(error)
return client_ssl.get_peer_certificate()
def make_csr(private_key_pem, domains, must_staple=False):
"""Generate a CSR containing a list of domains as subjectAltNames.
:param buffer private_key_pem: Private key, in PEM PKCS#8 format.
:param list domains: List of DNS names to include in subjectAltNames of CSR.
:param bool must_staple: Whether to include the TLS Feature extension (aka
OCSP Must Staple: https://tools.ietf.org/html/rfc7633).
:returns: buffer PEM-encoded Certificate Signing Request.
"""
private_key = crypto.load_privatekey(
crypto.FILETYPE_PEM, private_key_pem)
csr = crypto.X509Req()
extensions = [
crypto.X509Extension(
b'subjectAltName',
critical=False,
value=', '.join('DNS:' + d for d in domains).encode('ascii')
),
]
if must_staple:
extensions.append(crypto.X509Extension(
b"1.3.6.1.5.5.7.1.24",
critical=False,
value=b"DER:30:03:02:01:05"))
csr.add_extensions(extensions)
csr.set_pubkey(private_key)
csr.set_version(2)
csr.sign(private_key, 'sha256')
return crypto.dump_certificate_request(
crypto.FILETYPE_PEM, csr)
def _pyopenssl_cert_or_req_all_names(loaded_cert_or_req):
common_name = loaded_cert_or_req.get_subject().CN
sans = _pyopenssl_cert_or_req_san(loaded_cert_or_req)
if common_name is None:
return sans
return [common_name] + [d for d in sans if d != common_name]
def _pyopenssl_cert_or_req_san(cert_or_req):
"""Get Subject Alternative Names from certificate or CSR using pyOpenSSL.
.. todo:: Implement directly in PyOpenSSL!
.. note:: Although this is `acme` internal API, it is used by
`letsencrypt`.
:param cert_or_req: Certificate or CSR.
:type cert_or_req: `OpenSSL.crypto.X509` or `OpenSSL.crypto.X509Req`.
:returns: A list of Subject Alternative Names.
:rtype: `list` of `unicode`
"""
# This function finds SANs by dumping the certificate/CSR to text and
# searching for "X509v3 Subject Alternative Name" in the text. This method
# is used to support PyOpenSSL version 0.13 where the
# `_subjectAltNameString` and `get_extensions` methods are not available
# for CSRs.
# constants based on PyOpenSSL certificate/CSR text dump
part_separator = ":"
parts_separator = ", "
prefix = "DNS" + part_separator
if isinstance(cert_or_req, crypto.X509):
# pylint: disable=line-too-long
func = crypto.dump_certificate # type: Union[Callable[[int, crypto.X509Req], bytes], Callable[[int, crypto.X509], bytes]]
else:
func = crypto.dump_certificate_request
text = func(crypto.FILETYPE_TEXT, cert_or_req).decode("utf-8")
# WARNING: this function does not support multiple SANs extensions.
# Multiple X509v3 extensions of the same type is disallowed by RFC 5280.
match = re.search(r"X509v3 Subject Alternative Name:(?: critical)?\s*(.*)", text)
# WARNING: this function assumes that no SAN can include
# parts_separator, hence the split!
sans_parts = [] if match is None else match.group(1).split(parts_separator)
return [part.split(part_separator)[1]
for part in sans_parts if part.startswith(prefix)]
def gen_ss_cert(key, domains, not_before=None,
validity=(7 * 24 * 60 * 60), force_san=True, extensions=None):
"""Generate new self-signed certificate.
:type domains: `list` of `unicode`
:param OpenSSL.crypto.PKey key:
:param bool force_san:
:param extensions: List of additional extensions to include in the cert.
:type extensions: `list` of `OpenSSL.crypto.X509Extension`
If more than one domain is provided, all of the domains are put into
``subjectAltName`` X.509 extension and first domain is set as the
subject CN. If only one domain is provided no ``subjectAltName``
extension is used, unless `force_san` is ``True``.
"""
assert domains, "Must provide one or more hostnames for the cert."
cert = crypto.X509()
cert.set_serial_number(int(binascii.hexlify(os.urandom(16)), 16))
cert.set_version(2)
if extensions is None:
extensions = []
extensions.append(
crypto.X509Extension(
b"basicConstraints", True, b"CA:TRUE, pathlen:0"),
)
cert.get_subject().CN = domains[0]
# TODO: what to put into cert.get_subject()?
cert.set_issuer(cert.get_subject())
if force_san or len(domains) > 1:
extensions.append(crypto.X509Extension(
b"subjectAltName",
critical=False,
value=b", ".join(b"DNS:" + d.encode() for d in domains)
))
cert.add_extensions(extensions)
cert.gmtime_adj_notBefore(0 if not_before is None else not_before)
cert.gmtime_adj_notAfter(validity)
cert.set_pubkey(key)
cert.sign(key, "sha256")
return cert
def dump_pyopenssl_chain(chain, filetype=crypto.FILETYPE_PEM):
"""Dump certificate chain into a bundle.
:param list chain: List of `OpenSSL.crypto.X509` (or wrapped in
:class:`josepy.util.ComparableX509`).
:returns: certificate chain bundle
:rtype: bytes
"""
# XXX: returns empty string when no chain is available, which
# shuts up RenewableCert, but might not be the best solution...
def _dump_cert(cert):
if isinstance(cert, jose.ComparableX509):
cert = cert.wrapped
return crypto.dump_certificate(filetype, cert)
# assumes that OpenSSL.crypto.dump_certificate includes ending
# newline character
return b"".join(_dump_cert(cert) for cert in chain)

View File

@@ -1,16 +0,0 @@
"""Shim class to not have to depend on typing module in prod."""
import sys
class TypingClass(object):
"""Ignore import errors by getting anything"""
def __getattr__(self, name):
return None
try:
# mypy doesn't respect modifying sys.modules
from typing import * # pylint: disable=wildcard-import, unused-wildcard-import
from typing import Collection, IO # type: ignore
except ImportError:
# mypy complains because TypingClass is not a module
sys.modules[__name__] = TypingClass() # type: ignore

View File

@@ -1,668 +0,0 @@
"""ACME protocol messages."""
import json
import josepy as jose
import six
from acme import challenges
from acme import errors
from acme import fields
from acme import jws
from acme import util
from acme.mixins import ResourceMixin
try:
from collections.abc import Hashable
except ImportError: # pragma: no cover
from collections import Hashable
OLD_ERROR_PREFIX = "urn:acme:error:"
ERROR_PREFIX = "urn:ietf:params:acme:error:"
ERROR_CODES = {
'accountDoesNotExist': 'The request specified an account that does not exist',
'alreadyRevoked': 'The request specified a certificate to be revoked that has' \
' already been revoked',
'badCSR': 'The CSR is unacceptable (e.g., due to a short key)',
'badNonce': 'The client sent an unacceptable anti-replay nonce',
'badPublicKey': 'The JWS was signed by a public key the server does not support',
'badRevocationReason': 'The revocation reason provided is not allowed by the server',
'badSignatureAlgorithm': 'The JWS was signed with an algorithm the server does not support',
'caa': 'Certification Authority Authorization (CAA) records forbid the CA from issuing' \
' a certificate',
'compound': 'Specific error conditions are indicated in the "subproblems" array',
'connection': ('The server could not connect to the client to verify the'
' domain'),
'dns': 'There was a problem with a DNS query during identifier validation',
'dnssec': 'The server could not validate a DNSSEC signed domain',
'incorrectResponse': 'Response received didn\'t match the challenge\'s requirements',
# deprecate invalidEmail
'invalidEmail': 'The provided email for a registration was invalid',
'invalidContact': 'The provided contact URI was invalid',
'malformed': 'The request message was malformed',
'rejectedIdentifier': 'The server will not issue certificates for the identifier',
'orderNotReady': 'The request attempted to finalize an order that is not ready to be finalized',
'rateLimited': 'There were too many requests of a given type',
'serverInternal': 'The server experienced an internal error',
'tls': 'The server experienced a TLS error during domain verification',
'unauthorized': 'The client lacks sufficient authorization',
'unsupportedContact': 'A contact URL for an account used an unsupported protocol scheme',
'unknownHost': 'The server could not resolve a domain name',
'unsupportedIdentifier': 'An identifier is of an unsupported type',
'externalAccountRequired': 'The server requires external account binding',
}
ERROR_TYPE_DESCRIPTIONS = dict(
(ERROR_PREFIX + name, desc) for name, desc in ERROR_CODES.items())
ERROR_TYPE_DESCRIPTIONS.update(dict( # add errors with old prefix, deprecate me
(OLD_ERROR_PREFIX + name, desc) for name, desc in ERROR_CODES.items()))
def is_acme_error(err):
"""Check if argument is an ACME error."""
if isinstance(err, Error) and (err.typ is not None):
return (ERROR_PREFIX in err.typ) or (OLD_ERROR_PREFIX in err.typ)
return False
@six.python_2_unicode_compatible
class Error(jose.JSONObjectWithFields, errors.Error):
"""ACME error.
https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00
:ivar unicode typ:
:ivar unicode title:
:ivar unicode detail:
"""
typ = jose.Field('type', omitempty=True, default='about:blank')
title = jose.Field('title', omitempty=True)
detail = jose.Field('detail', omitempty=True)
@classmethod
def with_code(cls, code, **kwargs):
"""Create an Error instance with an ACME Error code.
:unicode code: An ACME error code, like 'dnssec'.
:kwargs: kwargs to pass to Error.
"""
if code not in ERROR_CODES:
raise ValueError("The supplied code: %s is not a known ACME error"
" code" % code)
typ = ERROR_PREFIX + code
return cls(typ=typ, **kwargs)
@property
def description(self):
"""Hardcoded error description based on its type.
:returns: Description if standard ACME error or ``None``.
:rtype: unicode
"""
return ERROR_TYPE_DESCRIPTIONS.get(self.typ)
@property
def code(self):
"""ACME error code.
Basically self.typ without the ERROR_PREFIX.
:returns: error code if standard ACME code or ``None``.
:rtype: unicode
"""
code = str(self.typ).split(':')[-1]
if code in ERROR_CODES:
return code
return None
def __str__(self):
return b' :: '.join(
part.encode('ascii', 'backslashreplace') for part in
(self.typ, self.description, self.detail, self.title)
if part is not None).decode()
class _Constant(jose.JSONDeSerializable, Hashable): # type: ignore
"""ACME constant."""
__slots__ = ('name',)
POSSIBLE_NAMES = NotImplemented
def __init__(self, name):
super(_Constant, self).__init__()
self.POSSIBLE_NAMES[name] = self # pylint: disable=unsupported-assignment-operation
self.name = name
def to_partial_json(self):
return self.name
@classmethod
def from_json(cls, jobj):
if jobj not in cls.POSSIBLE_NAMES: # pylint: disable=unsupported-membership-test
raise jose.DeserializationError(
'{0} not recognized'.format(cls.__name__))
return cls.POSSIBLE_NAMES[jobj]
def __repr__(self):
return '{0}({1})'.format(self.__class__.__name__, self.name)
def __eq__(self, other):
return isinstance(other, type(self)) and other.name == self.name
def __hash__(self):
return hash((self.__class__, self.name))
def __ne__(self, other):
return not self == other
class Status(_Constant):
"""ACME "status" field."""
POSSIBLE_NAMES = {} # type: dict
STATUS_UNKNOWN = Status('unknown')
STATUS_PENDING = Status('pending')
STATUS_PROCESSING = Status('processing')
STATUS_VALID = Status('valid')
STATUS_INVALID = Status('invalid')
STATUS_REVOKED = Status('revoked')
STATUS_READY = Status('ready')
STATUS_DEACTIVATED = Status('deactivated')
class IdentifierType(_Constant):
"""ACME identifier type."""
POSSIBLE_NAMES = {} # type: dict
IDENTIFIER_FQDN = IdentifierType('dns') # IdentifierDNS in Boulder
class Identifier(jose.JSONObjectWithFields):
"""ACME identifier.
:ivar IdentifierType typ:
:ivar unicode value:
"""
typ = jose.Field('type', decoder=IdentifierType.from_json)
value = jose.Field('value')
class Directory(jose.JSONDeSerializable):
"""Directory."""
_REGISTERED_TYPES = {} # type: dict
class Meta(jose.JSONObjectWithFields):
"""Directory Meta."""
_terms_of_service = jose.Field('terms-of-service', omitempty=True)
_terms_of_service_v2 = jose.Field('termsOfService', omitempty=True)
website = jose.Field('website', omitempty=True)
caa_identities = jose.Field('caaIdentities', omitempty=True)
external_account_required = jose.Field('externalAccountRequired', omitempty=True)
def __init__(self, **kwargs):
kwargs = {self._internal_name(k): v for k, v in kwargs.items()}
super(Directory.Meta, self).__init__(**kwargs)
@property
def terms_of_service(self):
"""URL for the CA TOS"""
return self._terms_of_service or self._terms_of_service_v2
def __iter__(self):
# When iterating over fields, use the external name 'terms_of_service' instead of
# the internal '_terms_of_service'.
for name in super(Directory.Meta, self).__iter__():
yield name[1:] if name == '_terms_of_service' else name
def _internal_name(self, name):
return '_' + name if name == 'terms_of_service' else name
@classmethod
def _canon_key(cls, key):
return getattr(key, 'resource_type', key)
@classmethod
def register(cls, resource_body_cls):
"""Register resource."""
resource_type = resource_body_cls.resource_type
assert resource_type not in cls._REGISTERED_TYPES
cls._REGISTERED_TYPES[resource_type] = resource_body_cls
return resource_body_cls
def __init__(self, jobj):
canon_jobj = util.map_keys(jobj, self._canon_key)
# TODO: check that everything is an absolute URL; acme-spec is
# not clear on that
self._jobj = canon_jobj
def __getattr__(self, name):
try:
return self[name.replace('_', '-')]
except KeyError as error:
raise AttributeError(str(error))
def __getitem__(self, name):
try:
return self._jobj[self._canon_key(name)]
except KeyError:
raise KeyError('Directory field "' + self._canon_key(name) + '" not found')
def to_partial_json(self):
return self._jobj
@classmethod
def from_json(cls, jobj):
jobj['meta'] = cls.Meta.from_json(jobj.pop('meta', {}))
return cls(jobj)
class Resource(jose.JSONObjectWithFields):
"""ACME Resource.
:ivar acme.messages.ResourceBody body: Resource body.
"""
body = jose.Field('body')
class ResourceWithURI(Resource):
"""ACME Resource with URI.
:ivar unicode ~.uri: Location of the resource.
"""
uri = jose.Field('uri') # no ChallengeResource.uri
class ResourceBody(jose.JSONObjectWithFields):
"""ACME Resource Body."""
class ExternalAccountBinding(object):
"""ACME External Account Binding"""
@classmethod
def from_data(cls, account_public_key, kid, hmac_key, directory):
"""Create External Account Binding Resource from contact details, kid and hmac."""
key_json = json.dumps(account_public_key.to_partial_json()).encode()
decoded_hmac_key = jose.b64.b64decode(hmac_key)
url = directory["newAccount"]
eab = jws.JWS.sign(key_json, jose.jwk.JWKOct(key=decoded_hmac_key),
jose.jwa.HS256, None,
url, kid)
return eab.to_partial_json()
class Registration(ResourceBody):
"""Registration Resource Body.
:ivar josepy.jwk.JWK key: Public key.
:ivar tuple contact: Contact information following ACME spec,
`tuple` of `unicode`.
:ivar unicode agreement:
"""
# on new-reg key server ignores 'key' and populates it based on
# JWS.signature.combined.jwk
key = jose.Field('key', omitempty=True, decoder=jose.JWK.from_json)
# Contact field implements special behavior to allow messages that clear existing
# contacts while not expecting the `contact` field when loading from json.
# This is implemented in the constructor and *_json methods.
contact = jose.Field('contact', omitempty=True, default=())
agreement = jose.Field('agreement', omitempty=True)
status = jose.Field('status', omitempty=True)
terms_of_service_agreed = jose.Field('termsOfServiceAgreed', omitempty=True)
only_return_existing = jose.Field('onlyReturnExisting', omitempty=True)
external_account_binding = jose.Field('externalAccountBinding', omitempty=True)
phone_prefix = 'tel:'
email_prefix = 'mailto:'
@classmethod
def from_data(cls, phone=None, email=None, external_account_binding=None, **kwargs):
"""
Create registration resource from contact details.
The `contact` keyword being passed to a Registration object is meaningful, so
this function represents empty iterables in its kwargs by passing on an empty
`tuple`.
"""
# Note if `contact` was in kwargs.
contact_provided = 'contact' in kwargs
# Pop `contact` from kwargs and add formatted email or phone numbers
details = list(kwargs.pop('contact', ()))
if phone is not None:
details.append(cls.phone_prefix + phone)
if email is not None:
details.extend([cls.email_prefix + mail for mail in email.split(',')])
# Insert formatted contact information back into kwargs
# or insert an empty tuple if `contact` provided.
if details or contact_provided:
kwargs['contact'] = tuple(details)
if external_account_binding:
kwargs['external_account_binding'] = external_account_binding
return cls(**kwargs)
def __init__(self, **kwargs):
"""Note if the user provides a value for the `contact` member."""
if 'contact' in kwargs:
# Avoid the __setattr__ used by jose.TypedJSONObjectWithFields
object.__setattr__(self, '_add_contact', True)
super(Registration, self).__init__(**kwargs)
def _filter_contact(self, prefix):
return tuple(
detail[len(prefix):] for detail in self.contact # pylint: disable=not-an-iterable
if detail.startswith(prefix))
def _add_contact_if_appropriate(self, jobj):
"""
The `contact` member of Registration objects should not be required when
de-serializing (as it would be if the Fields' `omitempty` flag were `False`), but
it should be included in serializations if it was provided.
:param jobj: Dictionary containing this Registrations' data
:type jobj: dict
:returns: Dictionary containing Registrations data to transmit to the server
:rtype: dict
"""
if getattr(self, '_add_contact', False):
jobj['contact'] = self.encode('contact')
return jobj
def to_partial_json(self):
"""Modify josepy.JSONDeserializable.to_partial_json()"""
jobj = super(Registration, self).to_partial_json()
return self._add_contact_if_appropriate(jobj)
def fields_to_partial_json(self):
"""Modify josepy.JSONObjectWithFields.fields_to_partial_json()"""
jobj = super(Registration, self).fields_to_partial_json()
return self._add_contact_if_appropriate(jobj)
@property
def phones(self):
"""All phones found in the ``contact`` field."""
return self._filter_contact(self.phone_prefix)
@property
def emails(self):
"""All emails found in the ``contact`` field."""
return self._filter_contact(self.email_prefix)
@Directory.register
class NewRegistration(ResourceMixin, Registration):
"""New registration."""
resource_type = 'new-reg'
resource = fields.Resource(resource_type)
class UpdateRegistration(ResourceMixin, Registration):
"""Update registration."""
resource_type = 'reg'
resource = fields.Resource(resource_type)
class RegistrationResource(ResourceWithURI):
"""Registration Resource.
:ivar acme.messages.Registration body:
:ivar unicode new_authzr_uri: Deprecated. Do not use.
:ivar unicode terms_of_service: URL for the CA TOS.
"""
body = jose.Field('body', decoder=Registration.from_json)
new_authzr_uri = jose.Field('new_authzr_uri', omitempty=True)
terms_of_service = jose.Field('terms_of_service', omitempty=True)
class ChallengeBody(ResourceBody):
"""Challenge Resource Body.
.. todo::
Confusingly, this has a similar name to `.challenges.Challenge`,
as well as `.achallenges.AnnotatedChallenge`. Please use names
such as ``challb`` to distinguish instances of this class from
``achall``.
:ivar acme.challenges.Challenge: Wrapped challenge.
Conveniently, all challenge fields are proxied, i.e. you can
call ``challb.x`` to get ``challb.chall.x`` contents.
:ivar acme.messages.Status status:
:ivar datetime.datetime validated:
:ivar messages.Error error:
"""
__slots__ = ('chall',)
# ACMEv1 has a "uri" field in challenges. ACMEv2 has a "url" field. This
# challenge object supports either one, but should be accessed through the
# name "uri". In Client.answer_challenge, whichever one is set will be
# used.
_uri = jose.Field('uri', omitempty=True, default=None)
_url = jose.Field('url', omitempty=True, default=None)
status = jose.Field('status', decoder=Status.from_json,
omitempty=True, default=STATUS_PENDING)
validated = fields.RFC3339Field('validated', omitempty=True)
error = jose.Field('error', decoder=Error.from_json,
omitempty=True, default=None)
def __init__(self, **kwargs):
kwargs = {self._internal_name(k): v for k, v in kwargs.items()}
super(ChallengeBody, self).__init__(**kwargs)
def encode(self, name):
return super(ChallengeBody, self).encode(self._internal_name(name))
def to_partial_json(self):
jobj = super(ChallengeBody, self).to_partial_json()
jobj.update(self.chall.to_partial_json())
return jobj
@classmethod
def fields_from_json(cls, jobj):
jobj_fields = super(ChallengeBody, cls).fields_from_json(jobj)
jobj_fields['chall'] = challenges.Challenge.from_json(jobj)
return jobj_fields
@property
def uri(self):
"""The URL of this challenge."""
return self._url or self._uri
def __getattr__(self, name):
return getattr(self.chall, name)
def __iter__(self):
# When iterating over fields, use the external name 'uri' instead of
# the internal '_uri'.
for name in super(ChallengeBody, self).__iter__():
yield name[1:] if name == '_uri' else name
def _internal_name(self, name):
return '_' + name if name == 'uri' else name
class ChallengeResource(Resource):
"""Challenge Resource.
:ivar acme.messages.ChallengeBody body:
:ivar unicode authzr_uri: URI found in the 'up' ``Link`` header.
"""
body = jose.Field('body', decoder=ChallengeBody.from_json)
authzr_uri = jose.Field('authzr_uri')
@property
def uri(self):
"""The URL of the challenge body."""
return self.body.uri
class Authorization(ResourceBody):
"""Authorization Resource Body.
:ivar acme.messages.Identifier identifier:
:ivar list challenges: `list` of `.ChallengeBody`
:ivar tuple combinations: Challenge combinations (`tuple` of `tuple`
of `int`, as opposed to `list` of `list` from the spec).
:ivar acme.messages.Status status:
:ivar datetime.datetime expires:
"""
identifier = jose.Field('identifier', decoder=Identifier.from_json, omitempty=True)
challenges = jose.Field('challenges', omitempty=True)
combinations = jose.Field('combinations', omitempty=True)
status = jose.Field('status', omitempty=True, decoder=Status.from_json)
# TODO: 'expires' is allowed for Authorization Resources in
# general, but for Key Authorization '[t]he "expires" field MUST
# be absent'... then acme-spec gives example with 'expires'
# present... That's confusing!
expires = fields.RFC3339Field('expires', omitempty=True)
wildcard = jose.Field('wildcard', omitempty=True)
@challenges.decoder
def challenges(value): # pylint: disable=no-self-argument,missing-function-docstring
return tuple(ChallengeBody.from_json(chall) for chall in value)
@property
def resolved_combinations(self):
"""Combinations with challenges instead of indices."""
return tuple(tuple(self.challenges[idx] for idx in combo)
for combo in self.combinations) # pylint: disable=not-an-iterable
@Directory.register
class NewAuthorization(ResourceMixin, Authorization):
"""New authorization."""
resource_type = 'new-authz'
resource = fields.Resource(resource_type)
class UpdateAuthorization(ResourceMixin, Authorization):
"""Update authorization."""
resource_type = 'authz'
resource = fields.Resource(resource_type)
class AuthorizationResource(ResourceWithURI):
"""Authorization Resource.
:ivar acme.messages.Authorization body:
:ivar unicode new_cert_uri: Deprecated. Do not use.
"""
body = jose.Field('body', decoder=Authorization.from_json)
new_cert_uri = jose.Field('new_cert_uri', omitempty=True)
@Directory.register
class CertificateRequest(ResourceMixin, jose.JSONObjectWithFields):
"""ACME new-cert request.
:ivar josepy.util.ComparableX509 csr:
`OpenSSL.crypto.X509Req` wrapped in `.ComparableX509`
"""
resource_type = 'new-cert'
resource = fields.Resource(resource_type)
csr = jose.Field('csr', decoder=jose.decode_csr, encoder=jose.encode_csr)
class CertificateResource(ResourceWithURI):
"""Certificate Resource.
:ivar josepy.util.ComparableX509 body:
`OpenSSL.crypto.X509` wrapped in `.ComparableX509`
:ivar unicode cert_chain_uri: URI found in the 'up' ``Link`` header
:ivar tuple authzrs: `tuple` of `AuthorizationResource`.
"""
cert_chain_uri = jose.Field('cert_chain_uri')
authzrs = jose.Field('authzrs')
@Directory.register
class Revocation(ResourceMixin, jose.JSONObjectWithFields):
"""Revocation message.
:ivar .ComparableX509 certificate: `OpenSSL.crypto.X509` wrapped in
`.ComparableX509`
"""
resource_type = 'revoke-cert'
resource = fields.Resource(resource_type)
certificate = jose.Field(
'certificate', decoder=jose.decode_cert, encoder=jose.encode_cert)
reason = jose.Field('reason')
class Order(ResourceBody):
"""Order Resource Body.
:ivar identifiers: List of identifiers for the certificate.
:vartype identifiers: `list` of `.Identifier`
:ivar acme.messages.Status status:
:ivar authorizations: URLs of authorizations.
:vartype authorizations: `list` of `str`
:ivar str certificate: URL to download certificate as a fullchain PEM.
:ivar str finalize: URL to POST to to request issuance once all
authorizations have "valid" status.
:ivar datetime.datetime expires: When the order expires.
:ivar ~.Error error: Any error that occurred during finalization, if applicable.
"""
identifiers = jose.Field('identifiers', omitempty=True)
status = jose.Field('status', decoder=Status.from_json,
omitempty=True)
authorizations = jose.Field('authorizations', omitempty=True)
certificate = jose.Field('certificate', omitempty=True)
finalize = jose.Field('finalize', omitempty=True)
expires = fields.RFC3339Field('expires', omitempty=True)
error = jose.Field('error', omitempty=True, decoder=Error.from_json)
@identifiers.decoder
def identifiers(value): # pylint: disable=no-self-argument,missing-function-docstring
return tuple(Identifier.from_json(identifier) for identifier in value)
class OrderResource(ResourceWithURI):
"""Order Resource.
:ivar acme.messages.Order body:
:ivar str csr_pem: The CSR this Order will be finalized with.
:ivar authorizations: Fully-fetched AuthorizationResource objects.
:vartype authorizations: `list` of `acme.messages.AuthorizationResource`
:ivar str fullchain_pem: The fetched contents of the certificate URL
produced once the order was finalized, if it's present.
:ivar alternative_fullchains_pem: The fetched contents of alternative certificate
chain URLs produced once the order was finalized, if present and requested during
finalization.
:vartype alternative_fullchains_pem: `list` of `str`
"""
body = jose.Field('body', decoder=Order.from_json)
csr_pem = jose.Field('csr_pem', omitempty=True)
authorizations = jose.Field('authorizations')
fullchain_pem = jose.Field('fullchain_pem', omitempty=True)
alternative_fullchains_pem = jose.Field('alternative_fullchains_pem', omitempty=True)
@Directory.register
class NewOrder(Order):
"""New order."""
resource_type = 'new-order'

View File

@@ -1,65 +0,0 @@
"""Useful mixins for Challenge and Resource objects"""
class VersionedLEACMEMixin(object):
"""This mixin stores the version of Let's Encrypt's endpoint being used."""
@property
def le_acme_version(self):
"""Define the version of ACME protocol to use"""
return getattr(self, '_le_acme_version', 1)
@le_acme_version.setter
def le_acme_version(self, version):
# We need to use object.__setattr__ to not depend on the specific implementation of
# __setattr__ in current class (eg. jose.TypedJSONObjectWithFields raises AttributeError
# for any attempt to set an attribute to make objects immutable).
object.__setattr__(self, '_le_acme_version', version)
def __setattr__(self, key, value):
if key == 'le_acme_version':
# Required for @property to operate properly. See comment above.
object.__setattr__(self, key, value)
else:
super(VersionedLEACMEMixin, self).__setattr__(key, value) # pragma: no cover
class ResourceMixin(VersionedLEACMEMixin):
"""
This mixin generates a RFC8555 compliant JWS payload
by removing the `resource` field if needed (eg. ACME v2 protocol).
"""
def to_partial_json(self):
"""See josepy.JSONDeserializable.to_partial_json()"""
return _safe_jobj_compliance(super(ResourceMixin, self),
'to_partial_json', 'resource')
def fields_to_partial_json(self):
"""See josepy.JSONObjectWithFields.fields_to_partial_json()"""
return _safe_jobj_compliance(super(ResourceMixin, self),
'fields_to_partial_json', 'resource')
class TypeMixin(VersionedLEACMEMixin):
"""
This mixin allows generation of a RFC8555 compliant JWS payload
by removing the `type` field if needed (eg. ACME v2 protocol).
"""
def to_partial_json(self):
"""See josepy.JSONDeserializable.to_partial_json()"""
return _safe_jobj_compliance(super(TypeMixin, self),
'to_partial_json', 'type')
def fields_to_partial_json(self):
"""See josepy.JSONObjectWithFields.fields_to_partial_json()"""
return _safe_jobj_compliance(super(TypeMixin, self),
'fields_to_partial_json', 'type')
def _safe_jobj_compliance(instance, jobj_method, uncompliant_field):
if hasattr(instance, jobj_method):
jobj = getattr(instance, jobj_method)()
if instance.le_acme_version == 2:
jobj.pop(uncompliant_field, None)
return jobj
raise AttributeError('Method {0}() is not implemented.'.format(jobj_method)) # pragma: no cover

View File

@@ -1,7 +0,0 @@
"""ACME utilities."""
import six
def map_keys(dikt, func):
"""Map dictionary keys."""
return {func(key): value for key, value in six.iteritems(dikt)}

View File

@@ -0,0 +1,5 @@
Crypto_util
-----------
.. automodule:: acme.crypto_util
:members:

5
acme/docs/api/jws.rst Normal file
View File

@@ -0,0 +1,5 @@
JWS
---
.. automodule:: acme.jws
:members:

5
acme/docs/api/util.rst Normal file
View File

@@ -0,0 +1,5 @@
Util
----
.. automodule:: acme.util
:members:

View File

@@ -37,6 +37,7 @@ extensions = [
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'sphinx_rtd_theme',
]
autodoc_member_order = 'bysource'
@@ -58,7 +59,7 @@ master_doc = 'index'
# General information about the project.
project = u'acme-python'
copyright = u'2015-2015, Let\'s Encrypt Project'
copyright = u'2015, Let\'s Encrypt Project'
author = u'Let\'s Encrypt Project'
# The version info for the project you're documenting, acts as replacement for
@@ -87,7 +88,6 @@ language = 'en'
# directories to ignore when looking for source files.
exclude_patterns = [
'_build',
'man/*'
]
# The reST default role (used for this markup: `text`) to use for all
@@ -123,14 +123,7 @@ todo_include_todos = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# https://docs.readthedocs.io/en/stable/faq.html#i-want-to-use-the-read-the-docs-theme-locally
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the

View File

@@ -3,6 +3,6 @@ usage: jws [-h] [--compact] {sign,verify} ...
positional arguments:
{sign,verify}
optional arguments:
options:
-h, --help show this help message and exit
--compact

View File

@@ -1 +1,3 @@
:orphan:
.. literalinclude:: ../jws-help.txt

View File

@@ -27,10 +27,11 @@ Workflow:
"""
from contextlib import contextmanager
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
import josepy as jose
import OpenSSL
from acme import challenges
from acme import client
@@ -68,10 +69,11 @@ def new_csr_comp(domain_name, pkey_pem=None):
"""Create certificate signing request."""
if pkey_pem is None:
# Create private key.
pkey = OpenSSL.crypto.PKey()
pkey.generate_key(OpenSSL.crypto.TYPE_RSA, CERT_PKEY_BITS)
pkey_pem = OpenSSL.crypto.dump_privatekey(OpenSSL.crypto.FILETYPE_PEM,
pkey)
pkey = rsa.generate_private_key(public_exponent=65537, key_size=CERT_PKEY_BITS)
pkey_pem = pkey.private_bytes(encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.PKCS8,
encryption_algorithm=serialization.NoEncryption())
csr_pem = crypto_util.make_csr(pkey_pem, [domain_name])
return pkey_pem, csr_pem
@@ -163,16 +165,13 @@ def example_http():
# Register account and accept TOS
net = client.ClientNetwork(acc_key, user_agent=USER_AGENT)
directory = messages.Directory.from_json(net.get(DIRECTORY_URL).json())
directory = client.ClientV2.get_directory(DIRECTORY_URL, net)
client_acme = client.ClientV2(directory, net=net)
# Terms of Service URL is in client_acme.directory.meta.terms_of_service
# Registration Resource: regr
# Creates account with contact information.
email = ('fake@example.com')
regr = client_acme.new_account(
messages.NewRegistration.from_data(
email=email, terms_of_service_agreed=True))
messages.NewRegistration.from_data(terms_of_service_agreed=True))
# Create domain private key and CSR
pkey_pem, csr_pem = new_csr_comp(DOMAIN)
@@ -200,9 +199,7 @@ def example_http():
# Revoke certificate
fullchain_com = jose.ComparableX509(
OpenSSL.crypto.load_certificate(
OpenSSL.crypto.FILETYPE_PEM, fullchain_pem))
fullchain_com = x509.load_pem_x509_certificate(fullchain_pem.encode())
try:
client_acme.revoke(fullchain_com, 0) # revocation reason = 0
@@ -215,8 +212,7 @@ def example_http():
try:
regr = client_acme.query_registration(regr)
except errors.Error as err:
if err.typ == messages.OLD_ERROR_PREFIX + 'unauthorized' \
or err.typ == messages.ERROR_PREFIX + 'unauthorized':
if err.typ == messages.ERROR_PREFIX + 'unauthorized':
# Status is deactivated.
pass
raise

View File

@@ -1,2 +0,0 @@
python -m acme.standalone -p 1234
curl -k https://localhost:1234

View File

@@ -1 +0,0 @@
../../../acme/testdata/rsa2048_cert.pem

View File

@@ -1 +0,0 @@
../../../acme/testdata/rsa2048_key.pem

55
acme/pyproject.toml Normal file
View File

@@ -0,0 +1,55 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "acme"
dynamic = ["version"]
description = "ACME protocol implementation in Python"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.10"
authors = [
{ name = "Certbot Project", email = "certbot-dev@eff.org" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Security",
]
dependencies = [
"cryptography>=43.0.0",
"josepy>=2.0.0",
# PyOpenSSL>=25.0.0 is just needed to satisfy mypy right now so this dependency can probably be
# relaxed to >=24.0.0 if needed.
"PyOpenSSL>=25.0.0",
"pyrfc3339",
"requests>=2.25.1",
]
[project.optional-dependencies]
docs = [
"Sphinx>=1.0", # autodoc_member_order = 'bysource', autodoc_default_flags
"sphinx_rtd_theme",
]
test = [
"pytest",
"pytest-xdist",
"typing-extensions",
]
[project.urls]
Homepage = "https://github.com/certbot/certbot"
[tool.setuptools]
package-dir = {"" = "src"}
[tool.setuptools.packages.find]
where = ["src"]

View File

@@ -1,2 +0,0 @@
[pytest]
norecursedirs = .* build dist CVS _darcs {arch} *.egg

View File

@@ -7,4 +7,7 @@
# in --editable mode (-e), just "pip install acme[docs]" does not work as
# expected and "pip install -e acme[docs]" must be used instead
# We also pin our dependencies for increased stability.
-c ../tools/requirements.txt
-e acme[docs]

View File

@@ -1,2 +0,0 @@
[bdist_wheel]
universal = 1

View File

@@ -1,78 +1,7 @@
from distutils.version import LooseVersion
import sys
from setuptools import __version__ as setuptools_version
from setuptools import find_packages
from setuptools import setup
version = '1.12.0.dev0'
# Please update tox.ini when modifying dependency version requirements
install_requires = [
'cryptography>=2.1.4',
# formerly known as acme.jose:
# 1.1.0+ is required to avoid the warnings described at
# https://github.com/certbot/josepy/issues/13.
'josepy>=1.1.0',
'PyOpenSSL>=17.3.0',
'pyrfc3339',
'pytz',
'requests[security]>=2.6.0', # security extras added in 2.4.1
'requests-toolbelt>=0.3.0',
'setuptools>=39.0.1',
'six>=1.11.0',
]
setuptools_known_environment_markers = (LooseVersion(setuptools_version) >= LooseVersion('36.2'))
if setuptools_known_environment_markers:
install_requires.append('mock ; python_version < "3.3"')
elif 'bdist_wheel' in sys.argv[1:]:
raise RuntimeError('Error, you are trying to build certbot wheels using an old version '
'of setuptools. Version 36.2+ of setuptools is required.')
elif sys.version_info < (3,3):
install_requires.append('mock')
dev_extras = [
'pytest',
'pytest-xdist',
'tox',
]
docs_extras = [
'Sphinx>=1.0', # autodoc_member_order = 'bysource', autodoc_default_flags
'sphinx_rtd_theme',
]
version = '5.1.0'
setup(
name='acme',
version=version,
description='ACME protocol implementation in Python',
url='https://github.com/letsencrypt/letsencrypt',
author="Certbot Project",
author_email='client-dev@letsencrypt.org',
license='Apache License 2.0',
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Security',
],
packages=find_packages(),
include_package_data=True,
install_requires=install_requires,
extras_require={
'dev': dev_extras,
'docs': docs_extras,
},
)

View File

@@ -2,28 +2,20 @@
This module is an implementation of the `ACME protocol`_.
.. _`ACME protocol`: https://ietf-wg-acme.github.io/acme
.. _`ACME protocol`: https://datatracker.ietf.org/doc/html/rfc8555
"""
import sys
import warnings
# This code exists to keep backwards compatibility with people using acme.jose
# before it became the standalone josepy package.
#
# It is based on
# https://github.com/requests/requests/blob/1278ecdf71a312dc2268f3bfc0aabfab3c006dcf/requests/packages.py
import josepy as jose
import josepy as jose # noqa: F401
for mod in list(sys.modules):
# This traversal is apparently necessary such that the identities are
# preserved (acme.jose.* is josepy.*)
if mod == 'josepy' or mod.startswith('josepy.'):
sys.modules['acme.' + mod.replace('josepy', 'jose', 1)] = sys.modules[mod]
if sys.version_info[0] == 2:
warnings.warn(
"Python 2 support will be dropped in the next release of acme. "
"Please upgrade your Python version.",
PendingDeprecationWarning,
) # pragma: no cover

View File

@@ -0,0 +1 @@
"""acme's internal implementation"""

View File

@@ -0,0 +1 @@
"""acme tests"""

View File

@@ -1,20 +1,17 @@
"""Tests for acme.challenges."""
import sys
import unittest
from unittest import mock
import urllib.parse as urllib_parse
import josepy as jose
import OpenSSL
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from josepy.jwk import JWKEC
import pytest
import requests
from six.moves.urllib import parse as urllib_parse
from acme import errors
from acme._internal.tests import test_util
import test_util
CERT = test_util.load_comparable_cert('cert.pem')
CERT = test_util.load_cert('cert.pem')
KEY = jose.JWKRSA(key=test_util.load_rsa_private_key('rsa512_key.pem'))
@@ -24,7 +21,7 @@ class ChallengeTest(unittest.TestCase):
from acme.challenges import Challenge
from acme.challenges import UnrecognizedChallenge
chall = UnrecognizedChallenge({"type": "foo"})
self.assertEqual(chall, Challenge.from_json(chall.jobj))
assert chall == Challenge.from_json(chall.jobj)
class UnrecognizedChallengeTest(unittest.TestCase):
@@ -35,12 +32,11 @@ class UnrecognizedChallengeTest(unittest.TestCase):
self.chall = UnrecognizedChallenge(self.jobj)
def test_to_partial_json(self):
self.assertEqual(self.jobj, self.chall.to_partial_json())
assert self.jobj == self.chall.to_partial_json()
def test_from_json(self):
from acme.challenges import UnrecognizedChallenge
self.assertEqual(
self.chall, UnrecognizedChallenge.from_json(self.jobj))
assert self.chall == UnrecognizedChallenge.from_json(self.jobj)
class KeyAuthorizationChallengeResponseTest(unittest.TestCase):
@@ -56,26 +52,26 @@ class KeyAuthorizationChallengeResponseTest(unittest.TestCase):
from acme.challenges import KeyAuthorizationChallengeResponse
response = KeyAuthorizationChallengeResponse(
key_authorization='foo.oKGqedy-b-acd5eoybm2f-NVFxvyOoET5CNy3xnv8WY')
self.assertTrue(response.verify(self.chall, KEY.public_key()))
assert response.verify(self.chall, KEY.public_key())
def test_verify_wrong_token(self):
from acme.challenges import KeyAuthorizationChallengeResponse
response = KeyAuthorizationChallengeResponse(
key_authorization='bar.oKGqedy-b-acd5eoybm2f-NVFxvyOoET5CNy3xnv8WY')
self.assertFalse(response.verify(self.chall, KEY.public_key()))
assert not response.verify(self.chall, KEY.public_key())
def test_verify_wrong_thumbprint(self):
from acme.challenges import KeyAuthorizationChallengeResponse
response = KeyAuthorizationChallengeResponse(
key_authorization='foo.oKGqedy-b-acd5eoybm2f-NVFxv')
self.assertFalse(response.verify(self.chall, KEY.public_key()))
assert not response.verify(self.chall, KEY.public_key())
def test_verify_wrong_form(self):
from acme.challenges import KeyAuthorizationChallengeResponse
response = KeyAuthorizationChallengeResponse(
key_authorization='.foo.oKGqedy-b-acd5eoybm2f-'
'NVFxvyOoET5CNy3xnv8WY')
self.assertFalse(response.verify(self.chall, KEY.public_key()))
assert not response.verify(self.chall, KEY.public_key())
class DNS01ResponseTest(unittest.TestCase):
@@ -94,12 +90,11 @@ class DNS01ResponseTest(unittest.TestCase):
self.response = self.chall.response(KEY)
def test_to_partial_json(self):
self.assertEqual({k: v for k, v in self.jmsg.items() if k != 'keyAuthorization'},
self.msg.to_partial_json())
assert {} == self.msg.to_partial_json()
def test_from_json(self):
from acme.challenges import DNS01Response
self.assertEqual(self.msg, DNS01Response.from_json(self.jmsg))
assert self.msg == DNS01Response.from_json(self.jmsg)
def test_from_json_hashable(self):
from acme.challenges import DNS01Response
@@ -109,12 +104,12 @@ class DNS01ResponseTest(unittest.TestCase):
key2 = jose.JWKRSA.load(test_util.load_vector('rsa256_key.pem'))
public_key = key2.public_key()
verified = self.response.simple_verify(self.chall, "local", public_key)
self.assertFalse(verified)
assert not verified
def test_simple_verify_success(self):
public_key = KEY.public_key()
verified = self.response.simple_verify(self.chall, "local", public_key)
self.assertTrue(verified)
assert verified
class DNS01Test(unittest.TestCase):
@@ -129,20 +124,19 @@ class DNS01Test(unittest.TestCase):
}
def test_validation_domain_name(self):
self.assertEqual('_acme-challenge.www.example.com',
self.msg.validation_domain_name('www.example.com'))
assert '_acme-challenge.www.example.com' == \
self.msg.validation_domain_name('www.example.com')
def test_validation(self):
self.assertEqual(
"rAa7iIg4K2y63fvUhCfy8dP1Xl7wEhmQq0oChTcE3Zk",
self.msg.validation(KEY))
assert "rAa7iIg4K2y63fvUhCfy8dP1Xl7wEhmQq0oChTcE3Zk" == \
self.msg.validation(KEY)
def test_to_partial_json(self):
self.assertEqual(self.jmsg, self.msg.to_partial_json())
assert self.jmsg == self.msg.to_partial_json()
def test_from_json(self):
from acme.challenges import DNS01
self.assertEqual(self.msg, DNS01.from_json(self.jmsg))
assert self.msg == DNS01.from_json(self.jmsg)
def test_from_json_hashable(self):
from acme.challenges import DNS01
@@ -165,13 +159,11 @@ class HTTP01ResponseTest(unittest.TestCase):
self.response = self.chall.response(KEY)
def test_to_partial_json(self):
self.assertEqual({k: v for k, v in self.jmsg.items() if k != 'keyAuthorization'},
self.msg.to_partial_json())
assert {} == self.msg.to_partial_json()
def test_from_json(self):
from acme.challenges import HTTP01Response
self.assertEqual(
self.msg, HTTP01Response.from_json(self.jmsg))
assert self.msg == HTTP01Response.from_json(self.jmsg)
def test_from_json_hashable(self):
from acme.challenges import HTTP01Response
@@ -185,15 +177,16 @@ class HTTP01ResponseTest(unittest.TestCase):
def test_simple_verify_good_validation(self, mock_get):
validation = self.chall.validation(KEY)
mock_get.return_value = mock.MagicMock(text=validation)
self.assertTrue(self.response.simple_verify(
self.chall, "local", KEY.public_key()))
mock_get.assert_called_once_with(self.chall.uri("local"), verify=False)
assert self.response.simple_verify(
self.chall, "local", KEY.public_key())
mock_get.assert_called_once_with(self.chall.uri("local"), verify=False,
timeout=mock.ANY)
@mock.patch("acme.challenges.requests.get")
def test_simple_verify_bad_validation(self, mock_get):
mock_get.return_value = mock.MagicMock(text="!")
self.assertFalse(self.response.simple_verify(
self.chall, "local", KEY.public_key()))
assert not self.response.simple_verify(
self.chall, "local", KEY.public_key())
@mock.patch("acme.challenges.requests.get")
def test_simple_verify_whitespace_validation(self, mock_get):
@@ -201,23 +194,34 @@ class HTTP01ResponseTest(unittest.TestCase):
mock_get.return_value = mock.MagicMock(
text=(self.chall.validation(KEY) +
HTTP01Response.WHITESPACE_CUTSET))
self.assertTrue(self.response.simple_verify(
self.chall, "local", KEY.public_key()))
mock_get.assert_called_once_with(self.chall.uri("local"), verify=False)
assert self.response.simple_verify(
self.chall, "local", KEY.public_key())
mock_get.assert_called_once_with(self.chall.uri("local"), verify=False,
timeout=mock.ANY)
@mock.patch("acme.challenges.requests.get")
def test_simple_verify_connection_error(self, mock_get):
mock_get.side_effect = requests.exceptions.RequestException
self.assertFalse(self.response.simple_verify(
self.chall, "local", KEY.public_key()))
assert not self.response.simple_verify(
self.chall, "local", KEY.public_key())
@mock.patch("acme.challenges.requests.get")
def test_simple_verify_port(self, mock_get):
self.response.simple_verify(
self.chall, domain="local",
account_public_key=KEY.public_key(), port=8080)
self.assertEqual("local:8080", urllib_parse.urlparse(
mock_get.mock_calls[0][1][0]).netloc)
assert "local:8080" == urllib_parse.urlparse(
mock_get.mock_calls[0][1][0]).netloc
@mock.patch("acme.challenges.requests.get")
def test_simple_verify_timeout(self, mock_get):
self.response.simple_verify(self.chall, "local", KEY.public_key())
mock_get.assert_called_once_with(self.chall.uri("local"), verify=False,
timeout=30)
mock_get.reset_mock()
self.response.simple_verify(self.chall, "local", KEY.public_key(), timeout=1234)
mock_get.assert_called_once_with(self.chall.uri("local"), verify=False,
timeout=1234)
class HTTP01Test(unittest.TestCase):
@@ -233,152 +237,28 @@ class HTTP01Test(unittest.TestCase):
}
def test_path(self):
self.assertEqual(self.msg.path, '/.well-known/acme-challenge/'
'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA')
assert self.msg.path == '/.well-known/acme-challenge/' \
'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA'
def test_uri(self):
self.assertEqual(
'http://example.com/.well-known/acme-challenge/'
'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA',
self.msg.uri('example.com'))
assert 'http://example.com/.well-known/acme-challenge/' \
'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA' == \
self.msg.uri('example.com')
def test_to_partial_json(self):
self.assertEqual(self.jmsg, self.msg.to_partial_json())
assert self.jmsg == self.msg.to_partial_json()
def test_from_json(self):
from acme.challenges import HTTP01
self.assertEqual(self.msg, HTTP01.from_json(self.jmsg))
assert self.msg == HTTP01.from_json(self.jmsg)
def test_from_json_hashable(self):
from acme.challenges import HTTP01
hash(HTTP01.from_json(self.jmsg))
def test_good_token(self):
self.assertTrue(self.msg.good_token)
self.assertFalse(
self.msg.update(token=b'..').good_token)
class TLSALPN01ResponseTest(unittest.TestCase):
def setUp(self):
from acme.challenges import TLSALPN01
self.chall = TLSALPN01(
token=jose.b64decode(b'a82d5ff8ef740d12881f6d3c2277ab2e'))
self.domain = u'example.com'
self.domain2 = u'example2.com'
self.response = self.chall.response(KEY)
self.jmsg = {
'resource': 'challenge',
'type': 'tls-alpn-01',
'keyAuthorization': self.response.key_authorization,
}
def test_to_partial_json(self):
self.assertEqual({k: v for k, v in self.jmsg.items() if k != 'keyAuthorization'},
self.response.to_partial_json())
def test_from_json(self):
from acme.challenges import TLSALPN01Response
self.assertEqual(self.response, TLSALPN01Response.from_json(self.jmsg))
def test_from_json_hashable(self):
from acme.challenges import TLSALPN01Response
hash(TLSALPN01Response.from_json(self.jmsg))
def test_gen_verify_cert(self):
key1 = test_util.load_pyopenssl_private_key('rsa512_key.pem')
cert, key2 = self.response.gen_cert(self.domain, key1)
self.assertEqual(key1, key2)
self.assertTrue(self.response.verify_cert(self.domain, cert))
def test_gen_verify_cert_gen_key(self):
cert, key = self.response.gen_cert(self.domain)
self.assertTrue(isinstance(key, OpenSSL.crypto.PKey))
self.assertTrue(self.response.verify_cert(self.domain, cert))
def test_verify_bad_cert(self):
self.assertFalse(self.response.verify_cert(self.domain,
test_util.load_cert('cert.pem')))
def test_verify_bad_domain(self):
key1 = test_util.load_pyopenssl_private_key('rsa512_key.pem')
cert, key2 = self.response.gen_cert(self.domain, key1)
self.assertEqual(key1, key2)
self.assertFalse(self.response.verify_cert(self.domain2, cert))
def test_simple_verify_bad_key_authorization(self):
key2 = jose.JWKRSA.load(test_util.load_vector('rsa256_key.pem'))
self.response.simple_verify(self.chall, "local", key2.public_key())
@mock.patch('acme.challenges.TLSALPN01Response.verify_cert', autospec=True)
def test_simple_verify(self, mock_verify_cert):
mock_verify_cert.return_value = mock.sentinel.verification
self.assertEqual(
mock.sentinel.verification, self.response.simple_verify(
self.chall, self.domain, KEY.public_key(),
cert=mock.sentinel.cert))
mock_verify_cert.assert_called_once_with(
self.response, self.domain, mock.sentinel.cert)
@mock.patch('acme.challenges.socket.gethostbyname')
@mock.patch('acme.challenges.crypto_util.probe_sni')
def test_probe_cert(self, mock_probe_sni, mock_gethostbyname):
mock_gethostbyname.return_value = '127.0.0.1'
self.response.probe_cert('foo.com')
mock_gethostbyname.assert_called_once_with('foo.com')
mock_probe_sni.assert_called_once_with(
host='127.0.0.1', port=self.response.PORT, name='foo.com',
alpn_protocols=['acme-tls/1'])
self.response.probe_cert('foo.com', host='8.8.8.8')
mock_probe_sni.assert_called_with(
host='8.8.8.8', port=mock.ANY, name='foo.com',
alpn_protocols=['acme-tls/1'])
@mock.patch('acme.challenges.TLSALPN01Response.probe_cert')
def test_simple_verify_false_on_probe_error(self, mock_probe_cert):
mock_probe_cert.side_effect = errors.Error
self.assertFalse(self.response.simple_verify(
self.chall, self.domain, KEY.public_key()))
class TLSALPN01Test(unittest.TestCase):
def setUp(self):
from acme.challenges import TLSALPN01
self.msg = TLSALPN01(
token=jose.b64decode('a82d5ff8ef740d12881f6d3c2277ab2e'))
self.jmsg = {
'type': 'tls-alpn-01',
'token': 'a82d5ff8ef740d12881f6d3c2277ab2e',
}
def test_to_partial_json(self):
self.assertEqual(self.jmsg, self.msg.to_partial_json())
def test_from_json(self):
from acme.challenges import TLSALPN01
self.assertEqual(self.msg, TLSALPN01.from_json(self.jmsg))
def test_from_json_hashable(self):
from acme.challenges import TLSALPN01
hash(TLSALPN01.from_json(self.jmsg))
def test_from_json_invalid_token_length(self):
from acme.challenges import TLSALPN01
self.jmsg['token'] = jose.encode_b64jose(b'abcd')
self.assertRaises(
jose.DeserializationError, TLSALPN01.from_json, self.jmsg)
@mock.patch('acme.challenges.TLSALPN01Response.gen_cert')
def test_validation(self, mock_gen_cert):
mock_gen_cert.return_value = ('cert', 'key')
self.assertEqual(('cert', 'key'), self.msg.validation(
KEY, cert_key=mock.sentinel.cert_key, domain=mock.sentinel.domain))
mock_gen_cert.assert_called_once_with(key=mock.sentinel.cert_key,
domain=mock.sentinel.domain)
assert self.msg.good_token
assert not self.msg.update(token=b'..').good_token
class DNSTest(unittest.TestCase):
@@ -393,24 +273,27 @@ class DNSTest(unittest.TestCase):
}
def test_to_partial_json(self):
self.assertEqual(self.jmsg, self.msg.to_partial_json())
assert self.jmsg == self.msg.to_partial_json()
def test_from_json(self):
from acme.challenges import DNS
self.assertEqual(self.msg, DNS.from_json(self.jmsg))
assert self.msg == DNS.from_json(self.jmsg)
def test_from_json_hashable(self):
from acme.challenges import DNS
hash(DNS.from_json(self.jmsg))
def test_gen_check_validation(self):
self.assertTrue(self.msg.check_validation(
self.msg.gen_validation(KEY), KEY.public_key()))
ec_key_secp384r1 = JWKEC(key=test_util.load_ecdsa_private_key('ec_secp384r1_key.pem'))
for key, alg in [(KEY, jose.RS256), (ec_key_secp384r1, jose.ES384)]:
with self.subTest(key=key, alg=alg):
assert self.msg.check_validation(
self.msg.gen_validation(key, alg=alg), key.public_key())
def test_gen_check_validation_wrong_key(self):
key2 = jose.JWKRSA.load(test_util.load_vector('rsa1024_key.pem'))
self.assertFalse(self.msg.check_validation(
self.msg.gen_validation(KEY), key2.public_key()))
assert not self.msg.check_validation(
self.msg.gen_validation(KEY), key2.public_key())
def test_check_validation_wrong_payload(self):
validations = tuple(
@@ -418,28 +301,32 @@ class DNSTest(unittest.TestCase):
for payload in (b'', b'{}')
)
for validation in validations:
self.assertFalse(self.msg.check_validation(
validation, KEY.public_key()))
assert not self.msg.check_validation(
validation, KEY.public_key())
def test_check_validation_wrong_fields(self):
bad_validation = jose.JWS.sign(
payload=self.msg.update(
token=b'x' * 20).json_dumps().encode('utf-8'),
alg=jose.RS256, key=KEY)
self.assertFalse(self.msg.check_validation(
bad_validation, KEY.public_key()))
assert not self.msg.check_validation(bad_validation, KEY.public_key())
def test_gen_response(self):
with mock.patch('acme.challenges.DNS.gen_validation') as mock_gen:
mock_gen.return_value = mock.sentinel.validation
response = self.msg.gen_response(KEY)
from acme.challenges import DNSResponse
self.assertTrue(isinstance(response, DNSResponse))
self.assertEqual(response.validation, mock.sentinel.validation)
assert isinstance(response, DNSResponse)
assert response.validation == mock.sentinel.validation
def test_validation_domain_name(self):
self.assertEqual(
'_acme-challenge.le.wtf', self.msg.validation_domain_name('le.wtf'))
assert '_acme-challenge.le.wtf' == self.msg.validation_domain_name('le.wtf')
def test_validation_domain_name_ecdsa(self):
ec_key_secp384r1 = JWKEC(key=test_util.load_ecdsa_private_key('ec_secp384r1_key.pem'))
assert self.msg.check_validation(
self.msg.gen_validation(ec_key_secp384r1, alg=jose.ES384),
ec_key_secp384r1.public_key()) is True
class DNSResponseTest(unittest.TestCase):
@@ -455,8 +342,6 @@ class DNSResponseTest(unittest.TestCase):
from acme.challenges import DNSResponse
self.msg = DNSResponse(validation=self.validation)
self.jmsg_to = {
'resource': 'challenge',
'type': 'dns',
'validation': self.validation,
}
self.jmsg_from = {
@@ -466,19 +351,18 @@ class DNSResponseTest(unittest.TestCase):
}
def test_to_partial_json(self):
self.assertEqual(self.jmsg_to, self.msg.to_partial_json())
assert self.jmsg_to == self.msg.to_partial_json()
def test_from_json(self):
from acme.challenges import DNSResponse
self.assertEqual(self.msg, DNSResponse.from_json(self.jmsg_from))
assert self.msg == DNSResponse.from_json(self.jmsg_from)
def test_from_json_hashable(self):
from acme.challenges import DNSResponse
hash(DNSResponse.from_json(self.jmsg_from))
def test_check_validation(self):
self.assertTrue(
self.msg.check_validation(self.chall, KEY.public_key()))
assert self.msg.check_validation(self.chall, KEY.public_key())
class JWSPayloadRFC8555Compliant(unittest.TestCase):
@@ -487,12 +371,11 @@ class JWSPayloadRFC8555Compliant(unittest.TestCase):
from acme.challenges import HTTP01Response
challenge_body = HTTP01Response()
challenge_body.le_acme_version = 2
jobj = challenge_body.json_dumps(indent=2).encode()
# RFC8555 states that challenge responses must have an empty payload.
self.assertEqual(jobj, b'{}')
assert jobj == b'{}'
if __name__ == '__main__':
unittest.main() # pragma: no cover
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
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="server_name") as mocked:
yield mocked
@pytest.fixture(autouse=True)
def mock_sleep():
with mock.patch("time.sleep") as mocked:
yield mocked

View File

@@ -0,0 +1,270 @@
"""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._internal.tests import test_util
class FormatTest(unittest.TestCase):
def test_to_cryptography_encoding(self):
from acme.crypto_util import Format
assert Format.DER.to_cryptography_encoding() == serialization.Encoding.DER
assert Format.PEM.to_cryptography_encoding() == serialization.Encoding.PEM
class MiscTests(unittest.TestCase):
def test_dump_cryptography_chain(self):
from acme.crypto_util import dump_cryptography_chain
cert1 = test_util.load_cert('rsa2048_cert.pem')
cert2 = test_util.load_cert('rsa4096_cert.pem')
chain = [cert1, cert2]
dumped = dump_cryptography_chain(chain)
# default is PEM encoding Encoding.PEM
assert isinstance(dumped, bytes)
class CryptographyCertOrReqSANTest(unittest.TestCase):
"""Test for acme.crypto_util._cryptography_cert_or_req_san."""
@classmethod
def _call(cls, loader, name):
# pylint: disable=protected-access
from acme.crypto_util import _cryptography_cert_or_req_san
return _cryptography_cert_or_req_san(loader(name))
@classmethod
def _get_idn_names(cls):
"""Returns expected names from '{cert,csr}-idnsans.pem'."""
chars = [chr(i) for i in itertools.chain(range(0x3c3, 0x400),
range(0x641, 0x6fc),
range(0x1820, 0x1877))]
return [''.join(chars[i: i + 45]) + '.invalid'
for i in range(0, len(chars), 45)]
def _call_cert(self, name):
return self._call(test_util.load_cert, name)
def _call_csr(self, name):
return self._call(test_util.load_csr, name)
def test_cert_no_sans(self):
assert self._call_cert('cert.pem') == []
def test_cert_two_sans(self):
assert self._call_cert('cert-san.pem') == \
['example.com', 'www.example.com']
def test_cert_hundred_sans(self):
assert self._call_cert('cert-100sans.pem') == \
['example{0}.com'.format(i) for i in range(1, 101)]
def test_cert_idn_sans(self):
assert self._call_cert('cert-idnsans.pem') == \
self._get_idn_names()
def test_csr_no_sans(self):
assert self._call_csr('csr-nosans.pem') == []
def test_csr_one_san(self):
assert self._call_csr('csr.pem') == ['example.com']
def test_csr_two_sans(self):
assert self._call_csr('csr-san.pem') == \
['example.com', 'www.example.com']
def test_csr_six_sans(self):
assert self._call_csr('csr-6sans.pem') == \
['example.com', 'example.org', 'example.net',
'example.info', 'subdomain.example.com',
'other.subdomain.example.com']
def test_csr_hundred_sans(self):
assert self._call_csr('csr-100sans.pem') == \
['example{0}.com'.format(i) for i in range(1, 101)]
def test_csr_idn_sans(self):
assert self._call_csr('csr-idnsans.pem') == \
self._get_idn_names()
def test_critical_san(self):
assert self._call_cert('critical-san.pem') == \
['chicago-cubs.venafi.example', 'cubs.venafi.example']
class GenMakeSelfSignedCertTest(unittest.TestCase):
"""Test for make_self_signed_cert."""
def setUp(self):
self.cert_count = 5
self.serial_num: list[int] = []
self.privkey = rsa.generate_private_key(public_exponent=65537, key_size=2048)
@classmethod
def _call(cls, *args, **kwargs):
from acme.crypto_util import make_self_signed_cert
with pytest.warns(DeprecationWarning, match='make_self_signed_cert is deprecated'):
return make_self_signed_cert(*args, **kwargs)
def test_sn_collisions(self):
for _ in range(self.cert_count):
cert = self._call(self.privkey, ['dummy'], force_san=True,
ips=[ipaddress.ip_address("10.10.10.10")])
self.serial_num.append(cert.serial_number)
assert len(set(self.serial_num)) >= self.cert_count
def test_no_ips(self):
self._call(self.privkey, ['dummy'])
@mock.patch("acme.crypto_util._now")
def test_expiry_times(self, mock_now):
from datetime import datetime, timedelta, timezone
not_before = 1736200830
validity = 100
not_before_dt = datetime.fromtimestamp(not_before)
validity_td = timedelta(validity)
not_after_dt = not_before_dt + validity_td
cert = self._call(
self.privkey,
['dummy'],
not_before=not_before_dt,
validity=validity_td,
)
# TODO: This should be `not_valid_before_utc` once we raise the minimum
# cryptography version.
# https://github.com/certbot/certbot/issues/10105
with warnings.catch_warnings():
warnings.filterwarnings(
'ignore',
message='Properties that return.*datetime object'
)
self.assertEqual(cert.not_valid_before, not_before_dt)
self.assertEqual(cert.not_valid_after, not_after_dt)
now = not_before + 1
now_dt = datetime.fromtimestamp(now)
mock_now.return_value = now_dt.replace(tzinfo=timezone.utc)
valid_after_now_dt = now_dt + validity_td
cert = self._call(
self.privkey,
['dummy'],
validity=validity_td,
)
with warnings.catch_warnings():
warnings.filterwarnings(
'ignore',
message='Properties that return.*datetime object'
)
self.assertEqual(cert.not_valid_before, now_dt)
self.assertEqual(cert.not_valid_after, valid_after_now_dt)
def test_no_name(self):
with pytest.raises(AssertionError):
self._call(self.privkey, ips=[ipaddress.ip_address("1.1.1.1")])
self._call(self.privkey)
def test_extensions(self):
extension_type = x509.TLSFeature([x509.TLSFeatureType.status_request])
extension = x509.Extension(
x509.TLSFeature.oid,
False,
extension_type
)
cert = self._call(
self.privkey,
ips=[ipaddress.ip_address("1.1.1.1")],
extensions=[extension]
)
self.assertIn(extension, cert.extensions)
class MakeCSRTest(unittest.TestCase):
"""Test for standalone functions."""
@classmethod
def _call_with_key(cls, *args, **kwargs):
privkey = rsa.generate_private_key(public_exponent=65537, key_size=2048)
privkey_pem = privkey.private_bytes(
serialization.Encoding.PEM,
serialization.PrivateFormat.PKCS8,
serialization.NoEncryption(),
)
from acme.crypto_util import make_csr
return make_csr(privkey_pem, *args, **kwargs)
def test_make_csr(self):
csr_pem = self._call_with_key(["a.example", "b.example"])
assert b"--BEGIN CERTIFICATE REQUEST--" in csr_pem
assert b"--END CERTIFICATE REQUEST--" in csr_pem
csr = x509.load_pem_x509_csr(csr_pem)
assert len(csr.extensions) == 1
assert list(
csr.extensions.get_extension_for_class(x509.SubjectAlternativeName).value
) == [
x509.DNSName("a.example"),
x509.DNSName("b.example"),
]
def test_make_csr_ip(self):
csr_pem = self._call_with_key(
["a.example"],
False,
[ipaddress.ip_address("127.0.0.1"), ipaddress.ip_address("::1")],
)
assert b"--BEGIN CERTIFICATE REQUEST--" in csr_pem
assert b"--END CERTIFICATE REQUEST--" in csr_pem
csr = x509.load_pem_x509_csr(csr_pem)
assert len(csr.extensions) == 1
assert list(
csr.extensions.get_extension_for_class(x509.SubjectAlternativeName).value
) == [
x509.DNSName("a.example"),
x509.IPAddress(ipaddress.ip_address("127.0.0.1")),
x509.IPAddress(ipaddress.ip_address("::1")),
]
def test_make_csr_must_staple(self):
csr_pem = self._call_with_key(["a.example"], must_staple=True)
csr = x509.load_pem_x509_csr(csr_pem)
assert len(csr.extensions) == 2
assert list(csr.extensions.get_extension_for_class(x509.TLSFeature).value) == [
x509.TLSFeatureType.status_request
]
def test_make_csr_without_hostname(self):
with pytest.raises(ValueError):
self._call_with_key()
def test_make_csr_invalid_key_type(self):
privkey = x25519.X25519PrivateKey.generate()
privkey_pem = privkey.private_bytes(
serialization.Encoding.PEM,
serialization.PrivateFormat.PKCS8,
serialization.NoEncryption(),
)
from acme.crypto_util import make_csr
with pytest.raises(ValueError):
make_csr(privkey_pem, ["a.example"])
if __name__ == '__main__':
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

View File

@@ -0,0 +1,86 @@
"""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(self):
assert "Invalid nonce ('xxx'): error" == str(self.error)
class MissingNonceTest(unittest.TestCase):
"""Tests for acme.errors.MissingNonce."""
def setUp(self):
from acme.errors import MissingNonce
self.response = mock.MagicMock(headers={})
self.response.request.method = 'FOO'
self.error = MissingNonce(self.response)
def test_str(self):
assert "FOO" in str(self.error)
assert "{}" in str(self.error)
class PollErrorTest(unittest.TestCase):
"""Tests for acme.errors.PollError."""
def setUp(self):
from acme.errors import PollError
self.timeout = PollError(
exhausted={mock.sentinel.AR},
updated={})
self.invalid = PollError(exhausted=set(), updated={
mock.sentinel.AR: mock.sentinel.AR2})
def test_timeout(self):
assert self.timeout.timeout
assert not self.invalid.timeout
def test_repr(self):
assert 'PollError(exhausted=%s, updated={sentinel.AR: ' \
'sentinel.AR2})' % repr(set()) == repr(self.invalid)
class ValidationErrorTest(unittest.TestCase):
"""Tests for acme.errors.ValidationError"""
def setUp(self):
from acme.errors import ValidationError
from acme.challenges import DNS01
from acme.messages import Error
from acme.messages import Authorization
from acme.messages import AuthorizationResource
from acme.messages import IDENTIFIER_FQDN
from acme.messages import ChallengeBody
from acme.messages import Identifier
self.challenge_error = Error(typ='custom', detail='bar')
failed_authzr = AuthorizationResource(
body=Authorization(
identifier=Identifier(typ=IDENTIFIER_FQDN, value="example.com"),
challenges=[ChallengeBody(
chall=DNS01(),
error=self.challenge_error,
)]
)
)
self.error = ValidationError([failed_authzr])
def test_repr(self):
err_message = str(self.error)
assert 'Authorization for example.com failed' in err_message
assert 'Challenge dns-01 failed' in err_message
assert str(self.challenge_error) in err_message
if __name__ == "__main__":
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

View File

@@ -0,0 +1,58 @@
"""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):
assert 'x' == self.field.decode('x')
def test_decode_bad(self):
with pytest.raises(jose.DeserializationError):
self.field.decode('y')
def test_encode(self):
assert 'x' == self.field.encode('x')
def test_encode_override(self):
assert 'y' == self.field.encode('y')
class RFC3339FieldTest(unittest.TestCase):
"""Tests for acme.fields.RFC3339Field."""
def setUp(self):
self.decoded = datetime.datetime(2015, 3, 27, tzinfo=datetime.timezone.utc)
self.encoded = '2015-03-27T00:00:00Z'
def test_default_encoder(self):
from acme.fields import RFC3339Field
assert self.encoded == RFC3339Field.default_encoder(self.decoded)
def test_default_encoder_naive_fails(self):
from acme.fields import RFC3339Field
with pytest.raises(ValueError):
RFC3339Field.default_encoder(datetime.datetime.now())
def test_default_decoder(self):
from acme.fields import RFC3339Field
assert self.decoded == RFC3339Field.default_decoder(self.encoded)
def test_default_decoder_raises_deserialization_error(self):
from acme.fields import RFC3339Field
with pytest.raises(jose.DeserializationError):
RFC3339Field.default_decoder('')
if __name__ == '__main__':
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

View File

@@ -0,0 +1,53 @@
"""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 = importlib.import_module(acme_jose_path)
josepy_mod = importlib.import_module(josepy_path)
assert acme_jose_mod is josepy_mod
assert getattr(acme_jose_mod, attribute) is getattr(josepy_mod, attribute)
# We use the imports below with eval, but pylint doesn't
# understand that.
import josepy # pylint: disable=unused-import # noqa: F401
import acme # pylint: disable=unused-import # noqa: F401
acme_jose_mod = eval(acme_jose_path) # pylint: disable=eval-used
josepy_mod = eval(josepy_path) # pylint: disable=eval-used
assert acme_jose_mod is josepy_mod
assert getattr(acme_jose_mod, attribute) is getattr(josepy_mod, attribute)
def test_top_level():
_test_it('', 'RS512')
def test_submodules():
# This test ensures that the modules in josepy that were
# available at the time it was moved into its own package are
# available under acme.jose. Backwards compatibility with new
# modules or testing code is not maintained.
mods_and_attrs = [('b64', 'b64decode',),
('errors', 'Error',),
('interfaces', 'JSONDeSerializable',),
('json_util', 'Field',),
('jwa', 'HS256',),
('jwk', 'JWK',),
('jws', 'JWS',),
('util', 'ImmutableMap',),]
for mod, attr in mods_and_attrs:
_test_it(mod, attr)
if __name__ == '__main__':
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

View File

@@ -1,9 +1,11 @@
"""Tests for acme.jws."""
import sys
import unittest
import josepy as jose
import pytest
import test_util
from acme._internal.tests import test_util
KEY = jose.JWKRSA.load(test_util.load_vector('rsa512_key.pem'))
@@ -19,15 +21,15 @@ class HeaderTest(unittest.TestCase):
except (ValueError, TypeError):
assert True
else:
assert False # pragma: no cover
pytest.fail("Exception from jose.b64decode wasn't raised") # pragma: no cover
def test_nonce_decoder(self):
from acme.jws import Header
nonce_field = Header._fields['nonce']
self.assertRaises(
jose.DeserializationError, nonce_field.decode, self.wrong_nonce)
self.assertEqual(b'foo', nonce_field.decode(self.good_nonce))
with pytest.raises(jose.DeserializationError):
nonce_field.decode(self.wrong_nonce)
assert b'foo' == nonce_field.decode(self.good_nonce)
class JWSTest(unittest.TestCase):
@@ -45,22 +47,22 @@ class JWSTest(unittest.TestCase):
jws = JWS.sign(payload=b'foo', key=self.privkey,
alg=jose.RS256, nonce=self.nonce,
url=self.url, kid=self.kid)
self.assertEqual(jws.signature.combined.nonce, self.nonce)
self.assertEqual(jws.signature.combined.url, self.url)
self.assertEqual(jws.signature.combined.kid, self.kid)
self.assertEqual(jws.signature.combined.jwk, None)
assert jws.signature.combined.nonce == self.nonce
assert jws.signature.combined.url == self.url
assert jws.signature.combined.kid == self.kid
assert jws.signature.combined.jwk is None
# TODO: check that nonce is in protected header
self.assertEqual(jws, JWS.from_json(jws.to_json()))
assert jws == JWS.from_json(jws.to_json())
def test_jwk_serialize(self):
from acme.jws import JWS
jws = JWS.sign(payload=b'foo', key=self.privkey,
alg=jose.RS256, nonce=self.nonce,
url=self.url)
self.assertEqual(jws.signature.combined.kid, None)
self.assertEqual(jws.signature.combined.jwk, self.pubkey)
assert jws.signature.combined.kid is None
assert jws.signature.combined.jwk == self.pubkey
if __name__ == '__main__':
unittest.main() # pragma: no cover
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

View File

@@ -1,17 +1,17 @@
"""Tests for acme.messages."""
import sys
import json
import unittest
from unittest import mock
import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
import pytest
from acme import challenges
import test_util
from acme._internal.tests import test_util
CERT = test_util.load_comparable_cert('cert.der')
CSR = test_util.load_comparable_csr('csr.der')
CERT = test_util.load_cert('cert.der')
CSR = test_util.load_csr('csr.der')
KEY = test_util.load_rsa_private_key('rsa512_key.pem')
@@ -19,7 +19,10 @@ class ErrorTest(unittest.TestCase):
"""Tests for acme.messages.Error."""
def setUp(self):
from acme.messages import Error, ERROR_PREFIX
from acme.messages import Error
from acme.messages import ERROR_PREFIX
from acme.messages import Identifier
from acme.messages import IDENTIFIER_FQDN
self.error = Error.with_code('malformed', detail='foo', title='title')
self.jobj = {
'detail': 'foo',
@@ -27,54 +30,84 @@ class ErrorTest(unittest.TestCase):
'type': ERROR_PREFIX + 'malformed',
}
self.error_custom = Error(typ='custom', detail='bar')
self.identifier = Identifier(typ=IDENTIFIER_FQDN, value='example.com')
self.subproblem = Error.with_code('caa', detail='bar', title='title', identifier=self.identifier)
self.error_with_subproblems = Error.with_code('malformed', detail='foo', title='title', subproblems=[self.subproblem])
self.empty_error = Error()
def test_default_typ(self):
from acme.messages import Error
self.assertEqual(Error().typ, 'about:blank')
assert Error().typ == 'about:blank'
def test_from_json_empty(self):
from acme.messages import Error
self.assertEqual(Error(), Error.from_json('{}'))
assert Error() == Error.from_json('{}')
def test_from_json_hashable(self):
from acme.messages import Error
hash(Error.from_json(self.error.to_json()))
def test_from_json_with_subproblems(self):
from acme.messages import Error
parsed_error = Error.from_json(self.error_with_subproblems.to_json())
assert 1 == len(parsed_error.subproblems)
assert self.subproblem == parsed_error.subproblems[0]
def test_description(self):
self.assertEqual('The request message was malformed', self.error.description)
self.assertTrue(self.error_custom.description is None)
assert 'The request message was malformed' == self.error.description
assert self.error_custom.description is None
def test_code(self):
from acme.messages import Error
self.assertEqual('malformed', self.error.code)
self.assertEqual(None, self.error_custom.code)
self.assertEqual(None, Error().code)
assert 'malformed' == self.error.code
assert self.error_custom.code is None
assert Error().code is None
def test_is_acme_error(self):
from acme.messages import is_acme_error, Error
self.assertTrue(is_acme_error(self.error))
self.assertFalse(is_acme_error(self.error_custom))
self.assertFalse(is_acme_error(Error()))
self.assertFalse(is_acme_error(self.empty_error))
self.assertFalse(is_acme_error("must pet all the {dogs|rabbits}"))
from acme.messages import Error
from acme.messages import is_acme_error
assert is_acme_error(self.error)
assert not is_acme_error(self.error_custom)
assert not is_acme_error(Error())
assert not is_acme_error(self.empty_error)
assert not is_acme_error("must pet all the {dogs|rabbits}")
def test_unicode_error(self):
from acme.messages import Error, is_acme_error
from acme.messages import Error
from acme.messages import is_acme_error
arabic_error = Error.with_code(
'malformed', detail=u'\u0639\u062f\u0627\u0644\u0629', title='title')
self.assertTrue(is_acme_error(arabic_error))
assert is_acme_error(arabic_error)
def test_with_code(self):
from acme.messages import Error, is_acme_error
self.assertTrue(is_acme_error(Error.with_code('badCSR')))
self.assertRaises(ValueError, Error.with_code, 'not an ACME error code')
from acme.messages import Error
from acme.messages import is_acme_error
assert is_acme_error(Error.with_code('badCSR'))
with pytest.raises(ValueError):
Error.with_code('not an ACME error code')
def test_str(self):
self.assertEqual(
str(self.error),
u"{0.typ} :: {0.description} :: {0.detail} :: {0.title}"
.format(self.error))
assert str(self.error) == \
u"{0.typ} :: {0.description} :: {0.detail} :: {0.title}" \
.format(self.error)
assert str(self.error_with_subproblems) == \
(u"{0.typ} :: {0.description} :: {0.detail} :: {0.title}\n"+
u"Problem for {1.identifier.value}: {1.typ} :: {1.description} :: {1.detail} :: {1.title}").format(
self.error_with_subproblems, self.subproblem)
# this test is based on a minimal reproduction of a contextmanager/immutable
# exception related error: https://github.com/python/cpython/issues/99856
def test_setting_traceback(self):
assert self.error_custom.__traceback__ is None
try:
1/0
except ZeroDivisionError as e:
self.error_custom.__traceback__ = e.__traceback__
assert self.error_custom.__traceback__ is not None
class ConstantTest(unittest.TestCase):
@@ -84,35 +117,35 @@ class ConstantTest(unittest.TestCase):
from acme.messages import _Constant
class MockConstant(_Constant): # pylint: disable=missing-docstring
POSSIBLE_NAMES = {} # type: Dict
POSSIBLE_NAMES: dict = {}
self.MockConstant = MockConstant # pylint: disable=invalid-name
self.const_a = MockConstant('a')
self.const_b = MockConstant('b')
def test_to_partial_json(self):
self.assertEqual('a', self.const_a.to_partial_json())
self.assertEqual('b', self.const_b.to_partial_json())
assert 'a' == self.const_a.to_partial_json()
assert 'b' == self.const_b.to_partial_json()
def test_from_json(self):
self.assertEqual(self.const_a, self.MockConstant.from_json('a'))
self.assertRaises(
jose.DeserializationError, self.MockConstant.from_json, 'c')
assert self.const_a == self.MockConstant.from_json('a')
with pytest.raises(jose.DeserializationError):
self.MockConstant.from_json('c')
def test_from_json_hashable(self):
hash(self.MockConstant.from_json('a'))
def test_repr(self):
self.assertEqual('MockConstant(a)', repr(self.const_a))
self.assertEqual('MockConstant(b)', repr(self.const_b))
assert 'MockConstant(a)' == repr(self.const_a)
assert 'MockConstant(b)' == repr(self.const_b)
def test_equality(self):
const_a_prime = self.MockConstant('a')
self.assertNotEqual(self.const_a, self.const_b)
self.assertEqual(self.const_a, const_a_prime)
assert self.const_a != self.const_b
assert self.const_a == const_a_prime
self.assertNotEqual(self.const_a, self.const_b)
self.assertEqual(self.const_a, const_a_prime)
assert self.const_a != self.const_b
assert self.const_a == const_a_prime
class DirectoryTest(unittest.TestCase):
@@ -121,12 +154,16 @@ class DirectoryTest(unittest.TestCase):
def setUp(self):
from acme.messages import Directory
self.dir = Directory({
'new-reg': 'reg',
mock.MagicMock(resource_type='new-cert'): 'cert',
'newReg': 'reg',
'newCert': 'cert',
'meta': Directory.Meta(
terms_of_service='https://example.com/acme/terms',
website='https://www.example.com/',
caa_identities=['example.com'],
profiles={
"example": "some profile",
"other example": "a different profile"
}
),
})
@@ -135,30 +172,33 @@ class DirectoryTest(unittest.TestCase):
Directory({'foo': 'bar'})
def test_getitem(self):
self.assertEqual('reg', self.dir['new-reg'])
from acme.messages import NewRegistration
self.assertEqual('reg', self.dir[NewRegistration])
self.assertEqual('reg', self.dir[NewRegistration()])
assert 'reg' == self.dir['newReg']
def test_getitem_fails_with_key_error(self):
self.assertRaises(KeyError, self.dir.__getitem__, 'foo')
with pytest.raises(KeyError):
self.dir.__getitem__('foo')
def test_getattr(self):
self.assertEqual('reg', self.dir.new_reg)
assert 'reg' == self.dir.newReg
def test_getattr_fails_with_attribute_error(self):
self.assertRaises(AttributeError, self.dir.__getattr__, 'foo')
with pytest.raises(AttributeError):
self.dir.__getattr__('foo')
def test_to_json(self):
self.assertEqual(self.dir.to_json(), {
'new-reg': 'reg',
'new-cert': 'cert',
assert self.dir.to_json() == {
'newReg': 'reg',
'newCert': 'cert',
'meta': {
'terms-of-service': 'https://example.com/acme/terms',
'termsOfService': 'https://example.com/acme/terms',
'website': 'https://www.example.com/',
'caaIdentities': ['example.com'],
'profiles': {
'example': 'some profile',
'other example': 'a different profile'
}
},
})
}
def test_from_json_deserialization_unknown_key_success(self): # pylint: disable=no-self-use
from acme.messages import Directory
@@ -169,7 +209,7 @@ class DirectoryTest(unittest.TestCase):
for k in self.dir.meta:
if k == 'terms_of_service':
result = self.dir.meta[k] == 'https://example.com/acme/terms'
self.assertTrue(result)
assert result
class ExternalAccountBindingTest(unittest.TestCase):
@@ -178,17 +218,43 @@ class ExternalAccountBindingTest(unittest.TestCase):
self.key = jose.jwk.JWKRSA(key=KEY.public_key())
self.kid = "kid-for-testing"
self.hmac_key = "hmac-key-for-testing"
self.hmac_alg = "HS256"
self.dir = Directory({
'newAccount': 'http://url/acme/new-account',
})
def test_from_data(self):
from acme.messages import ExternalAccountBinding
eab = ExternalAccountBinding.from_data(self.key, self.kid, self.hmac_key, self.dir)
eab = ExternalAccountBinding.from_data(self.key, self.kid, self.hmac_key, self.dir, self.hmac_alg)
self.assertEqual(len(eab), 3)
self.assertEqual(sorted(eab.keys()), sorted(['protected', 'payload', 'signature']))
assert len(eab) == 3
assert sorted(eab.keys()) == sorted(['protected', 'payload', 'signature'])
def test_from_data_invalid_hmac_alg(self):
from acme.messages import ExternalAccountBinding
invalid_alg = "HS9999"
with pytest.raises(ValueError) as info:
ExternalAccountBinding.from_data(self.key, self.kid, self.hmac_key, self.dir, invalid_alg)
assert "Invalid value for hmac_alg" in str(info.value)
def test_from_data_default_hmac_alg(self):
from acme.messages import ExternalAccountBinding
eab_default = ExternalAccountBinding.from_data(self.key, self.kid, self.hmac_key, self.dir)
assert len(eab_default) == 3
assert sorted(eab_default.keys()) == sorted(['protected', 'payload', 'signature'])
eab_explicit = ExternalAccountBinding.from_data(
self.key, self.kid, self.hmac_key, self.dir, "HS256"
)
assert eab_default == eab_explicit
protected_default = json.loads(
jose.b64.b64decode(eab_default['protected']).decode()
)
assert protected_default['alg'] == 'HS256'
class RegistrationTest(unittest.TestCase):
"""Tests for acme.messages.Registration."""
@@ -216,39 +282,42 @@ class RegistrationTest(unittest.TestCase):
def test_from_data(self):
from acme.messages import Registration
reg = Registration.from_data(phone='1234', email='admin@foo.com')
self.assertEqual(reg.contact, (
assert reg.contact == (
'tel:1234',
'mailto:admin@foo.com',
))
)
def test_new_registration_from_data_with_eab(self):
from acme.messages import NewRegistration, ExternalAccountBinding, Directory
from acme.messages import Directory
from acme.messages import ExternalAccountBinding
from acme.messages import NewRegistration
key = jose.jwk.JWKRSA(key=KEY.public_key())
kid = "kid-for-testing"
hmac_key = "hmac-key-for-testing"
hmac_alg = "HS256"
directory = Directory({
'newAccount': 'http://url/acme/new-account',
})
eab = ExternalAccountBinding.from_data(key, kid, hmac_key, directory)
eab = ExternalAccountBinding.from_data(key, kid, hmac_key, directory, hmac_alg)
reg = NewRegistration.from_data(email='admin@foo.com', external_account_binding=eab)
self.assertEqual(reg.contact, (
assert reg.contact == (
'mailto:admin@foo.com',
))
self.assertEqual(sorted(reg.external_account_binding.keys()),
sorted(['protected', 'payload', 'signature']))
)
assert sorted(reg.external_account_binding.keys()) == \
sorted(['protected', 'payload', 'signature'])
def test_phones(self):
self.assertEqual(('1234',), self.reg.phones)
assert ('1234',) == self.reg.phones
def test_emails(self):
self.assertEqual(('admin@foo.com',), self.reg.emails)
assert ('admin@foo.com',) == self.reg.emails
def test_to_partial_json(self):
self.assertEqual(self.jobj_to, self.reg.to_partial_json())
assert self.jobj_to == self.reg.to_partial_json()
def test_from_json(self):
from acme.messages import Registration
self.assertEqual(self.reg, Registration.from_json(self.jobj_from))
assert self.reg == Registration.from_json(self.jobj_from)
def test_from_json_hashable(self):
from acme.messages import Registration
@@ -259,13 +328,13 @@ class RegistrationTest(unittest.TestCase):
empty_new_reg = NewRegistration()
new_reg_with_contact = NewRegistration(contact=())
self.assertEqual(empty_new_reg.contact, ())
self.assertEqual(new_reg_with_contact.contact, ())
assert empty_new_reg.contact == ()
assert new_reg_with_contact.contact == ()
self.assertTrue('contact' not in empty_new_reg.to_partial_json())
self.assertTrue('contact' not in empty_new_reg.fields_to_partial_json())
self.assertTrue('contact' in new_reg_with_contact.to_partial_json())
self.assertTrue('contact' in new_reg_with_contact.fields_to_partial_json())
assert 'contact' not in empty_new_reg.to_partial_json()
assert 'contact' not in empty_new_reg.fields_to_partial_json()
assert 'contact' in new_reg_with_contact.to_partial_json()
assert 'contact' in new_reg_with_contact.fields_to_partial_json()
class UpdateRegistrationTest(unittest.TestCase):
@@ -274,9 +343,8 @@ class UpdateRegistrationTest(unittest.TestCase):
def test_empty(self):
from acme.messages import UpdateRegistration
jstring = '{"resource": "reg"}'
self.assertEqual(jstring, UpdateRegistration().json_dumps())
self.assertEqual(
UpdateRegistration(), UpdateRegistration.json_loads(jstring))
assert '{}' == UpdateRegistration().json_dumps()
assert UpdateRegistration() == UpdateRegistration.json_loads(jstring)
class RegistrationResourceTest(unittest.TestCase):
@@ -289,11 +357,11 @@ class RegistrationResourceTest(unittest.TestCase):
terms_of_service=mock.sentinel.terms_of_service)
def test_to_partial_json(self):
self.assertEqual(self.regr.to_json(), {
assert self.regr.to_json() == {
'body': mock.sentinel.body,
'uri': mock.sentinel.uri,
'terms_of_service': mock.sentinel.terms_of_service,
})
}
class ChallengeResourceTest(unittest.TestCase):
@@ -301,8 +369,8 @@ class ChallengeResourceTest(unittest.TestCase):
def test_uri(self):
from acme.messages import ChallengeResource
self.assertEqual('http://challb', ChallengeResource(body=mock.MagicMock(
uri='http://challb'), authzr_uri='http://authz').uri)
assert 'http://challb' == ChallengeResource(body=mock.MagicMock(
uri='http://challb'), authzr_uri='http://authz').uri
class ChallengeBodyTest(unittest.TestCase):
@@ -322,7 +390,7 @@ class ChallengeBodyTest(unittest.TestCase):
error=error)
self.jobj_to = {
'uri': 'http://challb',
'url': 'http://challb',
'status': self.status,
'type': 'dns',
'token': 'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA',
@@ -336,22 +404,22 @@ class ChallengeBodyTest(unittest.TestCase):
}
def test_encode(self):
self.assertEqual(self.challb.encode('uri'), self.challb.uri)
assert self.challb.encode('uri') == self.challb.uri
def test_to_partial_json(self):
self.assertEqual(self.jobj_to, self.challb.to_partial_json())
assert self.jobj_to == self.challb.to_partial_json()
def test_from_json(self):
from acme.messages import ChallengeBody
self.assertEqual(self.challb, ChallengeBody.from_json(self.jobj_from))
assert self.challb == ChallengeBody.from_json(self.jobj_from)
def test_from_json_hashable(self):
from acme.messages import ChallengeBody
hash(ChallengeBody.from_json(self.jobj_from))
def test_proxy(self):
self.assertEqual(jose.b64decode(
'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA'), self.challb.token)
assert jose.b64decode(
'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA') == self.challb.token
class AuthorizationTest(unittest.TestCase):
@@ -369,20 +437,17 @@ class AuthorizationTest(unittest.TestCase):
chall=challenges.DNS(
token=b'DGyRejmCefe7v4NfDGDKfA')),
)
combinations = ((0,), (1,))
from acme.messages import Authorization
from acme.messages import Identifier
from acme.messages import IDENTIFIER_FQDN
identifier = Identifier(typ=IDENTIFIER_FQDN, value='example.com')
self.authz = Authorization(
identifier=identifier, combinations=combinations,
challenges=self.challbs)
identifier=identifier, challenges=self.challbs)
self.jobj_from = {
'identifier': identifier.to_json(),
'challenges': [challb.to_json() for challb in self.challbs],
'combinations': combinations,
}
def test_from_json(self):
@@ -393,12 +458,6 @@ class AuthorizationTest(unittest.TestCase):
from acme.messages import Authorization
hash(Authorization.from_json(self.jobj_from))
def test_resolved_combinations(self):
self.assertEqual(self.authz.resolved_combinations, (
(self.challbs[0],),
(self.challbs[1],),
))
class AuthorizationResourceTest(unittest.TestCase):
"""Tests for acme.messages.AuthorizationResource."""
@@ -408,7 +467,7 @@ class AuthorizationResourceTest(unittest.TestCase):
authzr = AuthorizationResource(
uri=mock.sentinel.uri,
body=mock.sentinel.body)
self.assertTrue(isinstance(authzr, jose.JSONDeSerializable))
assert isinstance(authzr, jose.JSONDeSerializable)
class CertificateRequestTest(unittest.TestCase):
@@ -419,10 +478,9 @@ class CertificateRequestTest(unittest.TestCase):
self.req = CertificateRequest(csr=CSR)
def test_json_de_serializable(self):
self.assertTrue(isinstance(self.req, jose.JSONDeSerializable))
assert isinstance(self.req, jose.JSONDeSerializable)
from acme.messages import CertificateRequest
self.assertEqual(
self.req, CertificateRequest.from_json(self.req.to_json()))
assert self.req == CertificateRequest.from_json(self.req.to_json())
class CertificateResourceTest(unittest.TestCase):
@@ -435,10 +493,9 @@ class CertificateResourceTest(unittest.TestCase):
cert_chain_uri=mock.sentinel.cert_chain_uri)
def test_json_de_serializable(self):
self.assertTrue(isinstance(self.certr, jose.JSONDeSerializable))
assert isinstance(self.certr, jose.JSONDeSerializable)
from acme.messages import CertificateResource
self.assertEqual(
self.certr, CertificateResource.from_json(self.certr.to_json()))
assert self.certr == CertificateResource.from_json(self.certr.to_json())
class RevocationTest(unittest.TestCase):
@@ -462,25 +519,66 @@ class OrderResourceTest(unittest.TestCase):
body=mock.sentinel.body, uri=mock.sentinel.uri)
def test_to_partial_json(self):
self.assertEqual(self.regr.to_json(), {
assert self.regr.to_json() == {
'body': mock.sentinel.body,
'uri': mock.sentinel.uri,
'authorizations': None,
})
}
def test_json_de_serializable(self):
from acme.messages import ChallengeBody
from acme.messages import STATUS_PENDING
challbs = (
ChallengeBody(
uri='http://challb1', status=STATUS_PENDING,
chall=challenges.HTTP01(token=b'IlirfxKKXAsHtmzK29Pj8A')),
ChallengeBody(uri='http://challb2', status=STATUS_PENDING,
chall=challenges.DNS(
token=b'DGyRejmCefe7v4NfDGDKfA')),
)
from acme.messages import Authorization
from acme.messages import AuthorizationResource
from acme.messages import Identifier
from acme.messages import IDENTIFIER_FQDN
identifier = Identifier(typ=IDENTIFIER_FQDN, value='example.com')
authz = AuthorizationResource(uri="http://authz1",
body=Authorization(
identifier=identifier,
challenges=challbs))
from acme.messages import Order
body = Order(identifiers=(identifier,), status=STATUS_PENDING,
authorizations=tuple(challb.uri for challb in challbs))
from acme.messages import OrderResource
orderr = OrderResource(uri="http://order1", body=body,
csr_pem=b'test blob',
authorizations=(authz,))
self.assertEqual(orderr,
OrderResource.from_json(orderr.to_json()))
class NewOrderTest(unittest.TestCase):
"""Tests for acme.messages.NewOrder."""
def setUp(self):
from acme.messages import NewOrder
self.reg = NewOrder(
self.order = NewOrder(
identifiers=mock.sentinel.identifiers)
def test_to_partial_json(self):
self.assertEqual(self.reg.to_json(), {
assert self.order.to_json() == {
'identifiers': mock.sentinel.identifiers,
})
}
def test_default_profile_empty(self):
assert self.order.profile is None
def test_non_empty_profile(self):
from acme.messages import NewOrder
order = NewOrder(identifiers=mock.sentinel.identifiers, profile='example')
assert order.to_json() == {
'identifiers': mock.sentinel.identifiers,
'profile': 'example',
}
class JWSPayloadRFC8555Compliant(unittest.TestCase):
@@ -489,12 +587,11 @@ class JWSPayloadRFC8555Compliant(unittest.TestCase):
from acme.messages import NewAuthorization
new_order = NewAuthorization()
new_order.le_acme_version = 2
jobj = new_order.json_dumps(indent=2).encode()
# RFC8555 states that JWS bodies must not have a resource field.
self.assertEqual(jobj, b'{}')
assert jobj == b'{}'
if __name__ == '__main__':
unittest.main() # pragma: no cover
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

View File

@@ -0,0 +1,199 @@
"""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(unittest.TestCase):
"""Tests for acme.standalone.HTTP01Server."""
def setUp(self):
self.account_key = jose.JWK.load(
test_util.load_vector('rsa1024_key.pem'))
self.resources: set = set()
from acme.standalone import HTTP01Server
self.server = HTTP01Server(('', 0), resources=self.resources)
self.port = self.server.socket.getsockname()[1]
self.thread = threading.Thread(target=self.server.serve_forever)
self.thread.start()
def tearDown(self):
self.server.shutdown()
self.thread.join()
self.server.server_close()
def test_index(self):
response = requests.get(
'http://localhost:{0}'.format(self.port), verify=False)
assert response.text == 'ACME client standalone challenge solver'
assert response.ok
def test_404(self):
response = requests.get(
'http://localhost:{0}/foo'.format(self.port), verify=False)
assert response.status_code == http_client.NOT_FOUND
def _test_http01(self, add):
chall = challenges.HTTP01(token=(b'x' * 16))
response, validation = chall.response_and_validation(self.account_key)
from acme.standalone import HTTP01RequestHandler
resource = HTTP01RequestHandler.HTTP01Resource(
chall=chall, response=response, validation=validation)
if add:
self.resources.add(resource)
return resource.response.simple_verify(
resource.chall, 'localhost', self.account_key.public_key(),
port=self.port)
def test_http01_found(self):
assert self._test_http01(add=True)
def test_http01_not_found(self):
assert not self._test_http01(add=False)
def test_timely_shutdown(self):
from acme.standalone import HTTP01Server
with HTTP01Server(('', 0), resources=set(), timeout=0.05) as server:
server_thread = threading.Thread(target=server.serve_forever)
server_thread.start()
with socket.socket() as client:
client.connect(('localhost', server.socket.getsockname()[1]))
stop_thread = threading.Thread(target=server.shutdown)
stop_thread.start()
server_thread.join(5.)
is_hung = server_thread.is_alive()
try:
client.shutdown(socket.SHUT_RDWR)
except: # pragma: no cover, pylint: disable=bare-except
# may raise error because socket could already be closed
pass
assert not is_hung, 'Server shutdown should not be hung'
class BaseDualNetworkedServersTest(unittest.TestCase):
"""Test for acme.standalone.BaseDualNetworkedServers."""
class SingleProtocolServer(socketserver.TCPServer):
"""Server that only serves on a single protocol. FreeBSD has this behavior for AF_INET6."""
def __init__(self, *args, **kwargs):
ipv6 = kwargs.pop("ipv6", False)
if ipv6:
self.address_family = socket.AF_INET6
kwargs["bind_and_activate"] = False
else:
self.address_family = socket.AF_INET
super().__init__(*args, **kwargs)
if ipv6:
# NB: On Windows, socket.IPPROTO_IPV6 constant may be missing.
# We use the corresponding value (41) instead.
level = getattr(socket, "IPPROTO_IPV6", 41)
self.socket.setsockopt(level, socket.IPV6_V6ONLY, 1)
try:
self.server_bind()
self.server_activate()
except:
self.server_close()
raise
@mock.patch("socket.socket.bind")
def test_fail_to_bind(self, mock_bind):
from errno import EADDRINUSE
from acme.standalone import BaseDualNetworkedServers
mock_bind.side_effect = OSError(EADDRINUSE, "Fake addr in use error")
with pytest.raises(socket.error) as exc_info:
BaseDualNetworkedServers(
BaseDualNetworkedServersTest.SingleProtocolServer,
('', 0), socketserver.BaseRequestHandler)
assert exc_info.value.errno == EADDRINUSE
def test_ports_equal(self):
from acme.standalone import BaseDualNetworkedServers
servers = BaseDualNetworkedServers(
BaseDualNetworkedServersTest.SingleProtocolServer,
('', 0),
socketserver.BaseRequestHandler)
socknames = servers.getsocknames()
prev_port = None
# assert ports are equal
for sockname in socknames:
port = sockname[1]
if prev_port:
assert prev_port == port
prev_port = port
for server in servers.servers:
server.server_close()
class HTTP01DualNetworkedServersTest(unittest.TestCase):
"""Tests for acme.standalone.HTTP01DualNetworkedServers."""
def setUp(self):
self.account_key = jose.JWK.load(
test_util.load_vector('rsa1024_key.pem'))
self.resources: set = set()
from acme.standalone import HTTP01DualNetworkedServers
self.servers = HTTP01DualNetworkedServers(('', 0), resources=self.resources)
self.port = self.servers.getsocknames()[0][1]
self.servers.serve_forever()
def tearDown(self):
self.servers.shutdown_and_server_close()
def test_index(self):
response = requests.get(
'http://localhost:{0}'.format(self.port), verify=False)
assert response.text == 'ACME client standalone challenge solver'
assert response.ok
def test_404(self):
response = requests.get(
'http://localhost:{0}/foo'.format(self.port), verify=False)
assert response.status_code == http_client.NOT_FOUND
def _test_http01(self, add):
chall = challenges.HTTP01(token=(b'x' * 16))
response, validation = chall.response_and_validation(self.account_key)
from acme.standalone import HTTP01RequestHandler
resource = HTTP01RequestHandler.HTTP01Resource(
chall=chall, response=response, validation=validation)
if add:
self.resources.add(resource)
return resource.response.simple_verify(
resource.chall, 'localhost', self.account_key.public_key(),
port=self.port)
def test_http01_found(self):
assert self._test_http01(add=True)
def test_http01_not_found(self):
assert not self._test_http01(add=False)
if __name__ == "__main__":
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover

View File

@@ -0,0 +1,61 @@
"""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 josepy.util import ComparableECKey
def load_vector(*names):
"""Load contents of a test vector."""
# luckily, resource_string opens file in binary mode
vector_ref = importlib.resources.files(__package__).joinpath('testdata', *names)
return vector_ref.read_bytes()
def _guess_loader(filename: str, loader_pem: Callable, loader_der: Callable) -> Callable:
_, ext = os.path.splitext(filename)
if ext.lower() == ".pem":
return loader_pem
elif ext.lower() == ".der":
return loader_der
else: # pragma: no cover
raise ValueError("Loader could not be recognized based on extension")
def load_cert(*names: str) -> x509.Certificate:
"""Load certificate."""
loader = _guess_loader(
names[-1], x509.load_pem_x509_certificate, x509.load_der_x509_certificate
)
return loader(load_vector(*names))
def load_csr(*names: str) -> x509.CertificateSigningRequest:
"""Load certificate request."""
loader = _guess_loader(names[-1], x509.load_pem_x509_csr, x509.load_der_x509_csr)
return loader(load_vector(*names))
def load_rsa_private_key(*names):
"""Load RSA private key."""
loader = _guess_loader(names[-1], serialization.load_pem_private_key,
serialization.load_der_private_key)
return jose.ComparableRSAKey(loader(
load_vector(*names), password=None, backend=default_backend()))
def load_ecdsa_private_key(*names):
"""Load ECDSA private key."""
loader = _guess_loader(names[-1], serialization.load_pem_private_key,
serialization.load_der_private_key)
return ComparableECKey(loader(
load_vector(*names), password=None, backend=default_backend()))

View File

@@ -15,3 +15,7 @@ and for the certificates:
openssl req -key rsa2048_key.pem -new -subj '/CN=example.com' -x509 -outform DER > cert.der
openssl req -key rsa2048_key.pem -new -subj '/CN=example.com' -x509 > rsa2048_cert.pem
openssl req -key rsa1024_key.pem -new -subj '/CN=example.com' -x509 > rsa1024_cert.pem
and for the elliptic key curves:
openssl genpkey -algorithm EC -out ec_secp384r1.pem -pkeyopt ec_paramgen_curve:P-384 -pkeyopt ec_param_enc:named_curve

View File

@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDizCCAnOgAwIBAgIIPNBLQXwhoUkwDQYJKoZIhvcNAQELBQAwKDEmMCQGA1UE
AxMdUGViYmxlIEludGVybWVkaWF0ZSBDQSAxNzNiMjYwHhcNMjAwNTI5MTkxODA5
WhcNMjUwNTI5MTkxODA5WjAWMRQwEgYDVQQDEwsxOTIuMC4yLjE0NTCCASIwDQYJ
KoZIhvcNAQEBBQADggEPADCCAQoCggEBALyChb+NDA26GF1AfC0nzEdfOTchKw0h
q41xEjonvg5UXgZf/aH/ntvugIkYP0MaFifNAjebOVVsemEVEtyWcUKTfBHKZGbZ
ukTDwFIjfTccCfo6U/B2H7ZLzJIywl8DcUw9DypadeQBm8PS0VVR2ncy73dvaqym
crhAwlASyXU0mhLqRDMMxfg5Bn/FWpcsIcDpLmPn8Q/FvdRc2t5ryBNw/aWOlwqT
Oy16nbfLj2T0zG1A3aPuD+eT/JFUe/o3K7R+FAx7wt+RziQO46wLVVF1SueZUrIU
zqN04Gl8Kt1WM2SniZ0gq/rORUNcPtT0NAEsEslTQfA+Trq6j2peqyMCAwEAAaOB
yjCBxzAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUF
BwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFHj1mwZzP//nMIH2i58NRUl/arHn
MB8GA1UdIwQYMBaAFF5DVAKabvIUvKFHGouscA2Qdpe6MDEGCCsGAQUFBwEBBCUw
IzAhBggrBgEFBQcwAYYVaHR0cDovLzEyNy4wLjAuMTo0MDAyMBUGA1UdEQQOMAyH
BMAAApGHBMsAcQEwDQYJKoZIhvcNAQELBQADggEBAHjSgDg76/UCIMSYddyhj18r
LdNKjA7p8ovnErSkebFT4lIZ9f3Sma9moNr0w64M33NamuFyHe/KTdk90mvoW8Uu
26aDekiRIeeMakzbAtDKn67tt2tbedKIYRATcSYVwsV46uZKbM621dZKIjjxOWpo
IY6rZYrku8LYhoXJXOqRduV3cTRVuTm5bBa9FfVNtt6N1T5JOtKKDEhuSaF4RSug
PDy3hQIiHrVvhPfVrXU3j6owz/8UCS5549inES9ONTFrvM9o0H1R/MsmGNXR5hF5
iJqHKC7n8LZujhVnoFIpHu2Dsiefbfr+yRYJS4I+ezy6Nq/Ok8rc8zp0eoX+uyY=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDmzCCAoOgAwIBAgIIFdxeZP+v2rgwDQYJKoZIhvcNAQELBQAwKDEmMCQGA1UE
AxMdUGViYmxlIEludGVybWVkaWF0ZSBDQSA0M2M5NTcwHhcNMjAwNTMwMDQwNzMw
WhcNMjUwNTMwMDQwNzMwWjAOMQwwCgYDVQQDEwM6OjEwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQC7VidVduJvqKtrSH0fw6PjE0cqL4Kfzo7klexWUkHG
KVAa0fRVZFZ462jxKOt417V2U4WJQ6WHHO9PJ+3gW62d/MhCw8FRtUQS4nYFjqB6
32+RFU21VRN7cWoQEqSwnEPbh/v/zv/KS5JhQ+swWUo79AOLm1kjnZWCKtcqh1Lc
Ug5Tkpot6luoxTKp52MkchvXDpj0q2B/XpLJ8/pw5cqjv7mH12EDOK2HXllA+WwX
ZpstcEhaA4FqtaHOW/OHnwTX5MUbINXE5YYHVEDR6moVM31/W/3pe9NDUMTDE7Si
lVQnZbXM9NYbzZqlh+WhemDWwnIfGI6rtsfNEiirVEOlAgMBAAGjgeIwgd8wDgYD
VR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNV
HRMBAf8EAjAAMB0GA1UdDgQWBBS8DL+MZfDIy6AKky69Tgry2Vxq5DAfBgNVHSME
GDAWgBRAsFqVenRRKgB1YPzWKzb9bzZ/ozAxBggrBgEFBQcBAQQlMCMwIQYIKwYB
BQUHMAGGFWh0dHA6Ly8xMjcuMC4wLjE6NDAwMjAtBgNVHREEJjAkhxAAAAAAAAAA
AAAAAAAAAAABhxCjvjLzIG7HXQlWDO6YWF7FMA0GCSqGSIb3DQEBCwUAA4IBAQBY
M9UTZ3uaKMQ+He9kWR3p9jh6hTSD0FNi79ZdfkG0lgSzhhduhN7OhzQH2ihUUfa6
rtKTw74fGbszhizCd9UB8YPKlm3si1Xbg6ZUQlA1RtoQo7RUGEa6ZbR68PKGm9Go
hTTFIl/JS8jzxBR8jywZdyqtprUx+nnNUDiNk0hJtFLhw7OJH0AHlAUNqHsfD08m
HXRdaV6q14HXU5g31slBat9H4D6tCU/2uqBURwW0wVdnqh4QeRfAeqiatJS9EmSF
ctbc7n894Idy2Xce7NFoIy5cht3m6Rd42o/LmBsJopBmQcDPZT70/XzRtc2qE0cS
CzBIGQHUJ6BfmBjrCQnp
-----END CERTIFICATE-----

View File

@@ -0,0 +1,16 @@
-----BEGIN CERTIFICATE REQUEST-----
MIICbTCCAVUCAQIwADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKT/
CE7Y5EYBvI4p7Frt763upIKHDHO/R5/TWMjG8Jm9qTMui8sbMgyh2Yh+lR/j/5Xd
tQrhgC6wx10MrW2+3JtYS88HP1p6si8zU1dbK34n3NyyklR2RivW0R7dXgnYNy7t
5YcDYLCrbRMIPINV/uHrmzIHWYUDNcZVdAfIM2AHfKYuV6Mepcn///5GR+l4GcAh
Nkf9CW8OdAIuKdbyLCxVr0mUW/vJz1b12uxPsgUdax9sjXgZdT4pfMXADsFd1NeF
atpsXU073inqtHru+2F9ijHTQ75TC+u/rr6eYl3BnBntac0gp/ADtDBii7/Q1JOO
Bhq7xJNqqxIEdiyM7zcCAwEAAaAoMCYGCSqGSIb3DQEJDjEZMBcwFQYDVR0RBA4w
DIcEwAACkYcEywBxATANBgkqhkiG9w0BAQsFAAOCAQEADG5g3zdbSCaXpZhWHkzE
Mek3f442TUE1pB+ITRpthmM4N3zZWETYmbLCIAO624uMrRnbCCMvAoLs/L/9ETg/
XMMFtonQC8u9i9tV8B1ceBh8lpIfa+8b9TMWH3bqnrbWQ+YIl+Yd0gXiCZWJ9vK4
eM1Gddu/2bR6s/k4h/XAWRgEexqk57EHr1z0N+T9OoX939n3mVcNI+u9kfd5VJ0z
VyA3R8WR6T6KlEl5P5pcWe5Kuyhi7xMmLVImXqBtvKq4O1AMfM+gQr/yn9aE8IRq
khP7JrMBLUIub1c/qu2TfvnynNPSM/ZcOX+6PHdHmRkR3nI0Ndpv7Ntv31FTplAm
Dw==
-----END CERTIFICATE REQUEST-----

View File

@@ -0,0 +1,16 @@
-----BEGIN CERTIFICATE REQUEST-----
MIIChTCCAW0CAQIwADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOIc
UAppcqJfTkSqqOFqGt1v7lIJZPOcF4bcKI3d5cHAGbOuVxbC7uMaDuObwYLzoiED
qnvs1NaEq2phO6KsgGESB7IE2LUjJivO7OnSZjNRpL5si/9egvBiNCn/50lULaWG
gLEuyMfk3awZy2mVAymy7Grhbx069A4TH8TqsHuq2RpKyuDL27e/jUt6yYecb3pu
hWMiWy3segif4tI46pkOW0/I6DpxyYD2OqOvzxm/voS9RMqE2+7YJA327H7bEi3N
lJZEZ1zy7clZ9ga5fBQaetzbg2RyxTrZ7F919NQXSFoXgxb10Eg64wIpz0L3ooCm
GEHehsZZexa3J5ccIvMCAwEAAaBAMD4GCSqGSIb3DQEJDjExMC8wLQYDVR0RBCYw
JIcQAAAAAAAAAAAAAAAAAAAAAYcQo74y8yBux10JVgzumFhexTANBgkqhkiG9w0B
AQsFAAOCAQEALvwVn0A/JPTCiNzcozHFnp5M23C9PXCplWc5u4k34d4XXzpSeFDz
fL4gy7NpYIueme2K2ppw2j3PNQUdR6vQ5a75sriegWYrosL+7Q6Joh51ZyEUZQoD
mNl4M4S4oX85EaChR6NFGBywTfjFarYi32XBTbFE7rK8N8KM+DQkNdwL1MXqaHWz
F1obQKpNXlLedbCBOteV5Eg4zG3565zu/Gw/NhwzzV3mQmgxUcd1sMJxAfHQz4Vl
ImLL+xMcR03nDsH2bgtDbK2tJm7WszSxA9tC+Xp2lRewxrnQloRWPYDz177WGQ5Q
SoGDzTTtA6uWZxG8h7CkNLOGvA8LtU2rNA==
-----END CERTIFICATE REQUEST-----

View File

@@ -0,0 +1,16 @@
-----BEGIN CERTIFICATE REQUEST-----
MIICdjCCAV4CAQAwADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANoV
T1pdvRUUBOqvm7M2ebLEHV7higUH7qAGUZEkfP6W4YriYVY+IHrH1svNPSa+oPTK
7weDNmT11ehWnGyECIM9z2r2Hi9yVV0ycxh4hWQ4Nt8BAKZwCwaXpyWm7Gj6m2Ez
pSN5Dd67g5YAQBrUUh1+RRbFi9c0Ls/6ZOExMvfg8kqt4c2sXCgH1IFnxvvOjBYo
p7xh0x3L1Akyax0tw8qgQp/z5mkupmVDNJYPFmbzFPMNyDR61ed6QUTDg7P4UAuF
kejLLzFvz5YaO7vC+huaTuPhInAhpzqpr4yU97KIjos2/83Itu/Cv8U1RAeEeRTk
h0WjUfltoem/5f8bIdsCAwEAAaAxMC8GCSqGSIb3DQEJDjEiMCAwHgYDVR0RBBcw
FYINYS5leGVtcGxlLmNvbYcEwAACbzANBgkqhkiG9w0BAQsFAAOCAQEAQ7n/hYen
5INHlcslHPYCQ/BAbX6Ou+Y8hUu8puWNVpE2OM95L2C87jbWwTmCRnkFBwtyoNqo
j3DXVW2RYv8y/exq7V6Y5LtpHTgwfugINJ3XlcVzA4Vnf1xqOxv3kwejkq74RuXn
xd5N28srgiFqb0e4tOAWVI8Tw27bgBqjoXl0QDFPZpctqUia5bcDJ9WzNSM7VaO1
CBNGHBRz+zL8sqoqJA4HV58tjcgzl+1RtGM+iUHxXpnH+aCNKWIUINrAzIm4Sm00
93RJjhb1kdNR0BC7ikWVbAWaVviHdvATK/RfpmhWDqfEaNgBpvT91GnkhpzctSFD
ro0yCUUXXrIr0w==
-----END CERTIFICATE REQUEST-----

View File

@@ -0,0 +1,6 @@
-----BEGIN PRIVATE KEY-----
MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDArTn0pbFk3xHfKeXte
xJgS4JVdJQ8mqvezhaNpULZPnwb+mcKLlrj6f5SRM52yREGhZANiAAQcrMoPMVqV
rHnDGGz5HUKLNmXfChlNgsrwsruawXF+M283CA6eckAjTXNyiC/ounWmvtoKsZG0
2UQOfQUNSCANId/r986yRGc03W6RJSkcRp86qBYjNsLgbZpber/3+M4=
-----END PRIVATE KEY-----

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