X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fftp.nix;h=417af87e7a98a1aff34001fbdab1f4ddd6d9be4c;hb=5400b9b6f65451d41a9106fae6fc00f97d83f4ef;hp=ada5f416bed9ca0d82a68c72883986d48491fe57;hpb=fe696f35f5e0789d4bc448bca4bbaf93d1182175;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/ftp.nix b/modules/private/ftp.nix index ada5f41..417af87 100644 --- a/modules/private/ftp.nix +++ b/modules/private/ftp.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, myconfig, ... }: +{ lib, pkgs, config, ... }: let package = pkgs.pure-ftpd.override { ldapFtpId = "immaeFtp"; }; in @@ -14,7 +14,10 @@ in }; config = lib.mkIf config.services.pure-ftpd.enable { - security.acme.certs."ftp" = config.services.myCertificates.certConfig // { + services.duplyBackup.profiles.ftp = { + rootDir = "/var/lib/ftp"; + }; + security.acme.certs."ftp" = config.myServices.certificates.certConfig // { domain = "eldiron.immae.eu"; postRun = '' systemctl restart pure-ftpd.service @@ -52,17 +55,17 @@ in user = "ftp"; group = "ftp"; text = '' - LDAPServer ${myconfig.env.ftp.ldap.host} + LDAPServer ${config.myEnv.ftp.ldap.host} LDAPPort 389 LDAPUseTLS True - LDAPBaseDN ${myconfig.env.ftp.ldap.base} - LDAPBindDN ${myconfig.env.ftp.ldap.dn} - LDAPBindPW ${myconfig.env.ftp.ldap.password} + LDAPBaseDN ${config.myEnv.ftp.ldap.base} + LDAPBindDN ${config.myEnv.ftp.ldap.dn} + LDAPBindPW ${config.myEnv.ftp.ldap.password} LDAPDefaultUID 500 LDAPForceDefaultUID False LDAPDefaultGID 100 LDAPForceDefaultGID False - LDAPFilter ${myconfig.env.ftp.ldap.filter} + LDAPFilter ${config.myEnv.ftp.ldap.filter} LDAPAuthMethod BIND @@ -72,6 +75,11 @@ in ''; }]; + services.filesWatcher.pure-ftpd = { + restart = true; + paths = [ "/var/secrets/pure-ftpd-ldap" ]; + }; + systemd.services.pure-ftpd = let configFile = pkgs.writeText "pure-ftpd.conf" '' PassivePortRange 40000 50000 @@ -105,7 +113,7 @@ in MaxDiskUsage 99 CustomerProof yes TLS 1 - CertFile ${config.security.acme.directory}/ftp/full.pem + CertFile ${config.security.acme.certs.ftp.directory}/full.pem ''; in { description = "Pure-FTPd server";