Jump to content

Certbot: Difference between revisions

m
imported>Onny
(Add recommendation to prefer security.acme module)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[https://github.com/certbot/certbot Certbot] is [https://www.eff.org/ Electronic Frontier Foundation]'s [[ACME]] client, which is written in Python and provides conveniences like automatic web server configuration and a built-in webserver for the HTTP challenge. Certbot is recommended by [https://letsencrypt.org/ Let's Encrypt].
[https://github.com/certbot/certbot Certbot] is [https://www.eff.org/ Electronic Frontier Foundation]'s [[ACME]] client, which is written in Python and provides conveniences like automatic web server configuration and a built-in webserver for the HTTP challenge. Certbot is recommended by [https://letsencrypt.org/ Let's Encrypt].


{{Note|It is recommended to use the the ACME service module, available through <code>security.acme</code>, instead of ''certbot''. Please consult the documentation on how to use it.}}
{{Note|It is recommended to use the the ACME service module, available through <code>security.acme</code>, instead of ''certbot''. Please consult the [[ACME | ACME page]] on how to use it.}}


== Installation ==
== Installation ==
Line 8: Line 8:
Install ''certbot'' application and enable ''systemd-timer'' for automated renewal of certificates
Install ''certbot'' application and enable ''systemd-timer'' for automated renewal of certificates
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
services.certbot.enable = true;
services.certbot = {
  enable = true;
  agreeTerms = true;
};
</nowiki>}}
</nowiki>}}
== Usage ==
== Usage ==
Line 14: Line 17:
It is possible to use several different methods to generate and configure certificates. Verification is done manually, via web servers or DNS records. Not all methods are covered here, for more information please consult the [https://eff-certbot.readthedocs.io/en/stable/ upstream documentation].
It is possible to use several different methods to generate and configure certificates. Verification is done manually, via web servers or DNS records. Not all methods are covered here, for more information please consult the [https://eff-certbot.readthedocs.io/en/stable/ upstream documentation].
   
   
Generated certificates and keys by using the commands below will be stored as <code>/etc/letsencrypt/live/example.org/fullchain.pem</code> and <code>/etc/letsencrypt/live/example.org/privkey.pem</code>.
Generated certificates and keys by using the commands below will be stored as <code>/etc/letsencrypt/live/example.org/fullchain.pem</code> and <code>/etc/letsencrypt/live/example.org/privkey.pem</code>, readable by the <code>acme</code> group.
 
To make the keys readable by a third party user or application, you could set custom ACL permissions. In this example we grant the user <code>maddy</code> read permissions for the certificate folder:
 
<syntaxhighlight lang="console">
# sudo setfacl -R -m u:maddy:rX /etc/letsencrypt/{live,archive}
</syntaxhighlight>


=== Manual DNS challenge ===
=== Manual DNS challenge ===
Line 50: Line 47:
services.certbot = {
services.certbot = {
   enable = true;
   enable = true;
  agreeTerms = true;
   package = pkgs.certbot.withPlugins (ps: with ps; [ certbot-dns-inwx ]);
   package = pkgs.certbot.withPlugins (ps: with ps; [ certbot-dns-inwx ]);
}
}
Line 63: Line 61:


Now that a specific domain is configured to get renewed using the plugin, the ''systemd-timer'' of the ''certbot'' module will automatically renew it after expiration.
Now that a specific domain is configured to get renewed using the plugin, the ''systemd-timer'' of the ''certbot'' module will automatically renew it after expiration.
[[Category:Server]]
[[Category:Applications]]
trusted
602

edits