Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/acme: Various fixes #191861

Merged
merged 3 commits into from
Oct 6, 2022
Merged

nixos/acme: Various fixes #191861

merged 3 commits into from
Oct 6, 2022

Conversation

m1cr0man
Copy link
Contributor

@m1cr0man m1cr0man commented Sep 19, 2022

Description of changes

Closes #191794 - Adds an AmbientCapabilities line to permit binding on port 80

Closes #190493 - Adds a check for an actual account key file rather than any file/folder in accounts

WIP #180980 - Will fix the web server config for nginx. No response will fix in another PR.

CC @NixOS/acme

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

Fixes NixOS#191794

Lego threw a permission denied error binding to port 80.
AmbientCapabilities with CAP_NET_BIND_SERVICE was required.
Also added a test for this.
Fixes NixOS#190493

Check if an actual key file exists. This does not
completely cover the work accountHash does to ensure
that a new account is registered when account
related options are changed.
Lego has a built-in mechanism for sleeping for a random amount
of time before renewing a certificate. In our environment this
is not only unnecessary (as our systemd timer takes care of it)
but also unwanted since it slows down the execution of the
systemd service encompassing it, thus also slowing down the
start up of any services its depending on.

Also added FixedRandomDelay to the timer for more predictability.
@m1cr0man
Copy link
Contributor Author

m1cr0man commented Oct 4, 2022

Implemented the changes discussed in review comments. I am marking this as ready for review now since I don't know what the best course of action is to resolve #180980 for now, and will fix it at a later date.

@m1cr0man m1cr0man marked this pull request as ready for review October 4, 2022 21:32
@m1cr0man m1cr0man requested a review from a team October 4, 2022 21:32
@winterqt
Copy link
Member

winterqt commented Oct 5, 2022

@ofborg test acme

Comment on lines 12 to 16
# Avoid a random 0-8 minute sleep when testing renewals.
# We are not using LE servers in testing so this is not
# going to impact their load.
# See https://github.com/go-acme/lego/issues/1656
extraLegoRenewFlags = ["-no-random-sleep"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering this is removed in the subsequent commit, would it make sense to just not add it in this commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm normally pretty adverse to editing commits because it alerts all the related issues again when you force push. Also I think these commits show a good evolution of the feature?

@winterqt
Copy link
Member

winterqt commented Oct 5, 2022

re: "This does not completely cover the work accountHash does to ensure that a new account is registered when account related options are changed."

What is this referencing, the new mechanism?

@m1cr0man
Copy link
Contributor Author

m1cr0man commented Oct 5, 2022

re: "This does not completely cover the work accountHash does to ensure that a new account is registered when account related options are changed."

What is this referencing, the new mechanism?

So accountHash works to ensure that we are putting accounts for particular configurations in their own folder. The check for an existing cert file is solving a different issue, that's what I'm implying. Does that make sense?

@winterqt
Copy link
Member

winterqt commented Oct 6, 2022

Yeah, well enough. :)

Copy link
Member

@winterqt winterqt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused as to why the port 80 issue wasn't caught earlier, but I won't make this wait on an answer for that. Thanks as always, @m1cr0man!

@winterqt winterqt merged commit 49c0fd7 into NixOS:master Oct 6, 2022
@m1cr0man
Copy link
Contributor Author

m1cr0man commented Oct 6, 2022

I'm confused as to why the port 80 issue wasn't caught earlier, but I won't make this wait on an answer for that. Thanks as always, @m1cr0man!

We didn't actually have an automated test for that configuration 😅 I added one in this PR though. Thanks for merging!

@m1cr0man m1cr0man deleted the acme branch October 6, 2022 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants