Certbot+DNS+flake upadte
This commit is contained in:
1 parent
b23ab9be23
commit
acafdbbdd2
20 files changed
+393
-180
No files matched your search
@@ -0,0 +1,99 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.skyg.server.dns.local-ca;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
skyg.server.dns.local-ca = {
|
||||
enable = mkEnableOption "Local Certificate Authority for DNS domains";
|
||||
|
||||
caCert = mkOption {
|
||||
description = "Path to the local CA certificate";
|
||||
type = types.str;
|
||||
default = "/etc/ssl/local-ca/cert.pem";
|
||||
};
|
||||
|
||||
caKey = mkOption {
|
||||
description = "Path to the local CA private key";
|
||||
type = types.str;
|
||||
default = "/etc/ssl/local-ca/key.pem";
|
||||
};
|
||||
|
||||
domain = mkOption {
|
||||
description = "Domain name for the local CA";
|
||||
type = types.str;
|
||||
default = "local-ca.skyg.internal";
|
||||
};
|
||||
|
||||
organizationalUnit = mkOption {
|
||||
description = "Organizational unit for the local CA certificate";
|
||||
type = types.str;
|
||||
default = "Skyg Internal CA";
|
||||
};
|
||||
|
||||
organization = mkOption {
|
||||
description = "Organization for the local CA certificate";
|
||||
type = types.str;
|
||||
default = "Skyg";
|
||||
};
|
||||
|
||||
country = mkOption {
|
||||
description = "Country code for the local CA certificate";
|
||||
type = types.str;
|
||||
default = "CA";
|
||||
};
|
||||
|
||||
email = mkOption {
|
||||
description = "Email address for the local CA";
|
||||
type = types.str;
|
||||
default = "admin@skyg.ca";
|
||||
};
|
||||
|
||||
certificateLifetime = mkOption {
|
||||
description = "Certificate lifetime in days";
|
||||
type = types.int;
|
||||
default = 365;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.openssl ];
|
||||
|
||||
# Create directory for local CA
|
||||
environment.etc."ssl/local-ca" = {
|
||||
recursive = true;
|
||||
owner = "root";
|
||||
group = "root";
|
||||
mode = "0755";
|
||||
};
|
||||
|
||||
# Create local CA certificate (this would typically be generated by a script)
|
||||
# For now, we'll just set up the structure and configuration
|
||||
systemd.services.local-ca-setup = {
|
||||
description = "Setup local Certificate Authority";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = ''
|
||||
mkdir -p /etc/ssl/local-ca
|
||||
# In a real implementation, you would generate the CA certificate here
|
||||
# openssl req -new -x509 -nodes -days ${toString cfg.certificateLifetime} \
|
||||
# -subj "/C=${cfg.country}/O=${cfg.organization}/OU=${cfg.organizationalUnit}/CN=${cfg.domain}/emailAddress=${cfg.email}" \
|
||||
# -keyout ${cfg.caKey} -out ${cfg.caCert}
|
||||
'';
|
||||
User = "root";
|
||||
};
|
||||
};
|
||||
|
||||
# Configuration for services to trust local CA
|
||||
environment.etc."ssl/certs/ca-certificates.crt".text = ''
|
||||
# Local CA certificates would be added here
|
||||
# This is a placeholder for where local CA certs would be included
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user