# ACME/SSL we now have our own letsencrypt-like service for internal certificates: ## howto trust the CA ``` security.pki.certificateFiles = [(pkgs.fetchurl { url = "http://ca.r/ca.crt"; # can be also downloaded from some other location like github/cgit sha256 = "sha256-tEp7OCiFx+6CFj5WzNym7wiBfWfyioeyQLLndf6glDQ="; })] ``` ## get a certificate from CA (need to trust CA first) ``` services.nginx.virtualHosts."myservice.r" = { enableACME = true; } security.acme.certs."myservice.r".server = "https://ca.r/acme/acme/directory"; ``` ## example set-up ``` { services.nginx = { enable = true; recommendedTlsSettings = true; virtualHosts = { "catalonia.r" = { listen = [ { addr = "catalonia.r"; port = 80; } { addr = "catalonia.r"; port = 443; ssl = true; } ]; useACMEHost = "catalonia.r"; sslCertificate = "/var/lib/acme/catalonia.r/fullchain.pem"; sslCertificateKey = "/var/lib/acme/catalonia.r/key.pem"; addSSL = true; }; }; }; security.acme = { acceptTerms = true; certs."catalonia.r" = { email = "xkey@irc.r"; server = "https://ca.r/acme/acme/directory"; }; }; networking.firewall.allowedTCPPorts = [ 80 443 ]; } ```