feat: added ldaps

This commit is contained in:
silver 2023-05-21 12:17:06 +01:00
parent ad2c9dad6b
commit 81b41087fe

View file

@ -31,9 +31,14 @@ Gonna use a priper nixos module for this
}; };
domain = { domain = {
tld = mkOption {
type = types.str;
default = "ie";
};
base = mkOption { base = mkOption {
type = types.str; type = types.str;
default = "skynet.ie"; default = "skynet";
}; };
sub = mkOption { sub = mkOption {
@ -82,18 +87,37 @@ Gonna use a priper nixos module for this
# for ldap # for ldap
389 389
636
]; ];
# using https://nixos.wiki/wiki/OpenLDAP for base config
systemd.services.openldap = {
wants = [ "acme-${cfg.domain.base}.service" ];
after = [ "acme-${cfg.domain.base}.service" ];
};
users.groups.certs.members = [ "openldap" ];
services.openldap = { services.openldap = {
enable = true; enable = true;
/* enable plain connections only */ /* enable plain and secure connections */
urlList = [ "ldap:///" ]; urlList = [ "ldap:///" "ldaps:///" ];
settings = { settings = {
attrs = { attrs = {
olcLogLevel = "conns config"; olcLogLevel = "conns config";
/* settings for acme ssl */
olcTLSCACertificateFile = "/var/lib/acme/${cfg.domain.base}/full.pem";
olcTLSCertificateFile = "/var/lib/acme/${cfg.domain.base}/cert.pem";
olcTLSCertificateKeyFile = "/var/lib/acme/${cfg.domain.base}/key.pem";
olcTLSCipherSuite = "HIGH:MEDIUM:+3DES:+RC4:+aNULL";
olcTLSCRLCheck = "none";
olcTLSVerifyClient = "never";
olcTLSProtocolMin = "3.1";
}; };
children = { children = {
@ -161,7 +185,7 @@ Gonna use a priper nixos module for this
}; };
services.nginx.virtualHosts."${cfg.domain.sub}.${cfg.domain.base}" = { services.nginx.virtualHosts."${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}" = {
forceSSL = true; forceSSL = true;
useACMEHost = "skynet"; useACMEHost = "skynet";
locations."/".proxyPass = "http://localhost:${cfg.frontend.port}"; locations."/".proxyPass = "http://localhost:${cfg.frontend.port}";