From a3f4e289e17fe8ea046c967f672cf003d1f7308d Mon Sep 17 00:00:00 2001 From: tenksom Date: Wed, 1 Mar 2023 18:44:56 +0100 Subject: [PATCH 1/6] The born of sogo --- modules/sogo.nix | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 modules/sogo.nix diff --git a/modules/sogo.nix b/modules/sogo.nix new file mode 100644 index 0000000..91b2797 --- /dev/null +++ b/modules/sogo.nix @@ -0,0 +1,31 @@ +{config, pkgs, ... }: +let + hostname = "webmail.${config.fsr.domain}"; + domain = config.fsr.domain; + +in +{ + services = { + sogo = { + enable = true; + language = "German"; + extraConfig = " + WOWorkersCount = 10; + SOGoUserSources = ({ + type = ldap; + CNFieldName = cn; + UIDFieldName = uid; + baseDN = "ou = users, dc=ifsr, dc=de"; + bindDN = "uid=search, ou=users, dc=ifsr, dc=de"; + bindPassword = qwertz; + hostname = "ldap://localhost"; + }); + + "; + } + postgresql = { + enable = true; + } + + } + From 4f5137c6b90d195dc0451813a6ba6be0f7a62779 Mon Sep 17 00:00:00 2001 From: tenksom Date: Tue, 7 Mar 2023 13:06:24 +0100 Subject: [PATCH 2/6] Adding ldap, nginx, postgresql config in SOGo --- modules/sogo.nix | 50 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/modules/sogo.nix b/modules/sogo.nix index 91b2797..1931c59 100644 --- a/modules/sogo.nix +++ b/modules/sogo.nix @@ -1,15 +1,20 @@ {config, pkgs, ... }: let - hostname = "webmail.${config.fsr.domain}"; + SOGo-hostname = "mail.${config.fsr.domain}"; domain = config.fsr.domain; - in { + sops.secrets.sogo_ldap_search = { + key = "portunus_search"; + # owner = config.systemd.services keine Ahnung was hier hin soll + + + }; services = { sogo = { enable = true; language = "German"; - extraConfig = " + extraConfig = '' WOWorkersCount = 10; SOGoUserSources = ({ type = ldap; @@ -17,15 +22,40 @@ in UIDFieldName = uid; baseDN = "ou = users, dc=ifsr, dc=de"; bindDN = "uid=search, ou=users, dc=ifsr, dc=de"; - bindPassword = qwertz; + bindPassword = ${config.sops.secrets.SOGo_ldap_search.path}; hostname = "ldap://localhost"; - }); + canAuthenticate = YES; + id = directory; + + }); + SOGoProfileURL = "postgresql://sogo:sogo@localhost:5432/ - "; - } + ''; # Hier ist bindPassword noch nicht vollständig + }; postgresql = { - enable = true; - } + ensureUsers = [{ + name = "SOGo"; + }]; + ensureDatabases = [ "SOGo" ]; + }; + + nginx = { + recommendedProxySettings = true; + virtualHosts."${SOGo-hostname}" = { + forceSSL = true; + enableACME = true; + locations = { + "/" = { + proxyPass = "http://127.0.0.1:443"; + proxyWebsockets = true; + }; + }; - } + + + + }; + + }; +} From 6e36183995ab3bee6bb3ab4bceebc037f1f31f1c Mon Sep 17 00:00:00 2001 From: tenksom Date: Tue, 7 Mar 2023 17:59:22 +0100 Subject: [PATCH 3/6] Adding new lines for postgresql --- modules/sogo.nix | 106 +++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/modules/sogo.nix b/modules/sogo.nix index 1931c59..41d34bc 100644 --- a/modules/sogo.nix +++ b/modules/sogo.nix @@ -1,61 +1,61 @@ -{config, pkgs, ... }: +{ config, pkgs, ... }: let - SOGo-hostname = "mail.${config.fsr.domain}"; - domain = config.fsr.domain; + SOGo-hostname = "mail.${config.fsr.domain}"; + domain = config.fsr.domain; in { - sops.secrets.sogo_ldap_search = { - key = "portunus_search"; - # owner = config.systemd.services keine Ahnung was hier hin soll - - - }; - services = { - sogo = { - enable = true; - language = "German"; - extraConfig = '' - WOWorkersCount = 10; - SOGoUserSources = ({ - type = ldap; - CNFieldName = cn; - UIDFieldName = uid; - baseDN = "ou = users, dc=ifsr, dc=de"; - bindDN = "uid=search, ou=users, dc=ifsr, dc=de"; - bindPassword = ${config.sops.secrets.SOGo_ldap_search.path}; - hostname = "ldap://localhost"; - canAuthenticate = YES; - id = directory; - - }); - SOGoProfileURL = "postgresql://sogo:sogo@localhost:5432/ - - ''; # Hier ist bindPassword noch nicht vollständig - }; - postgresql = { - ensureUsers = [{ - name = "SOGo"; - }]; - ensureDatabases = [ "SOGo" ]; - }; - - nginx = { - recommendedProxySettings = true; - virtualHosts."${SOGo-hostname}" = { - forceSSL = true; - enableACME = true; - locations = { - "/" = { - proxyPass = "http://127.0.0.1:443"; - proxyWebsockets = true; - }; - }; - + sops.secrets.sogo_ldap_search = { + key = "portunus_search"; + # owner = config.systemd.services keine Ahnung was hier hin soll + }; + services = { + sogo = { + enable = true; + language = "German"; + extraConfig = '' + WOWorkersCount = 10; + SOGoUserSources = ({ + type = ldap; + CNFieldName = cn; + UIDFieldName = uid; + baseDN = "ou = users, dc=ifsr, dc=de"; + bindDN = "uid=search, ou=users, dc=ifsr, dc=de"; + bindPassword = ${config.sops.secrets.SOGo_ldap_search.path}; + hostname = "ldap://localhost"; + canAuthenticate = YES; + id = directory; + + }); + SOGoProfileURL = "postgresql://sogo:sogo@localhost:5432/sogo/sogo_user_profile"; + SOGoFolderInfoURL = "postgreql://sogo:sogo@localhost:5432/sogo/sogo_folder_info"; + OCSSessionsFolderURL = "postgresql://sogo:sogo@localhost:5432/sogo/sogo_sessions_folder"; + + ''; # Hier ist bindPassword noch nicht vollständig + }; + postgresql = { + ensureUsers = [{ + name = "SOGo"; + }]; + ensureDatabases = [ "SOGo" ]; + }; + + nginx = { + recommendedProxySettings = true; + virtualHosts."${SOGo-hostname}" = { + forceSSL = true; + enableACME = true; + locations = { + "/" = { + proxyPass = "http://127.0.0.1:443"; + proxyWebsockets = true; + }; + }; - }; - - }; + }; + + }; + } } From c83ea08ee8eaf2dd973efc4240f9fa08fee5895f Mon Sep 17 00:00:00 2001 From: tenksom Date: Wed, 22 Mar 2023 11:24:14 +0100 Subject: [PATCH 4/6] added timezone and vhostname --- modules/sogo.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/sogo.nix b/modules/sogo.nix index 41d34bc..094ed4f 100644 --- a/modules/sogo.nix +++ b/modules/sogo.nix @@ -33,6 +33,8 @@ in OCSSessionsFolderURL = "postgresql://sogo:sogo@localhost:5432/sogo/sogo_sessions_folder"; ''; # Hier ist bindPassword noch nicht vollständig + vhostName = "${SOGo-hostname}"; + timezone = "Europe/Berlin"; }; postgresql = { ensureUsers = [{ @@ -57,5 +59,5 @@ in }; }; - } + }; } From 6ab7985a6a0dfd72d35ac0d396dc00df5be3b9e0 Mon Sep 17 00:00:00 2001 From: tenksom Date: Wed, 22 Mar 2023 12:09:21 +0100 Subject: [PATCH 5/6] Fixed wrong port --- modules/sogo.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/sogo.nix b/modules/sogo.nix index 094ed4f..94d04f8 100644 --- a/modules/sogo.nix +++ b/modules/sogo.nix @@ -50,7 +50,7 @@ in enableACME = true; locations = { "/" = { - proxyPass = "http://127.0.0.1:443"; + proxyPass = "http://127.0.0.1:20000"; proxyWebsockets = true; }; }; From e37482ef0a35776cfca6b20032d679d8233a1009 Mon Sep 17 00:00:00 2001 From: revol-xut Date: Mon, 3 Apr 2023 23:05:00 +0200 Subject: [PATCH 6/6] nixpkgs fmt --- modules/sogo.nix | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/sogo.nix b/modules/sogo.nix index 94d04f8..ffcae44 100644 --- a/modules/sogo.nix +++ b/modules/sogo.nix @@ -15,23 +15,23 @@ in enable = true; language = "German"; extraConfig = '' - WOWorkersCount = 10; - SOGoUserSources = ({ - type = ldap; - CNFieldName = cn; - UIDFieldName = uid; - baseDN = "ou = users, dc=ifsr, dc=de"; - bindDN = "uid=search, ou=users, dc=ifsr, dc=de"; - bindPassword = ${config.sops.secrets.SOGo_ldap_search.path}; - hostname = "ldap://localhost"; - canAuthenticate = YES; - id = directory; + WOWorkersCount = 10; + SOGoUserSources = ({ + type = ldap; + CNFieldName = cn; + UIDFieldName = uid; + baseDN = "ou = users, dc=ifsr, dc=de"; + bindDN = "uid=search, ou=users, dc=ifsr, dc=de"; + bindPassword = ${config.sops.secrets.SOGo_ldap_search.path}; + hostname = "ldap://localhost"; + canAuthenticate = YES; + id = directory; - }); - SOGoProfileURL = "postgresql://sogo:sogo@localhost:5432/sogo/sogo_user_profile"; - SOGoFolderInfoURL = "postgreql://sogo:sogo@localhost:5432/sogo/sogo_folder_info"; - OCSSessionsFolderURL = "postgresql://sogo:sogo@localhost:5432/sogo/sogo_sessions_folder"; - + }); + SOGoProfileURL = "postgresql://sogo:sogo@localhost:5432/sogo/sogo_user_profile"; + SOGoFolderInfoURL = "postgreql://sogo:sogo@localhost:5432/sogo/sogo_folder_info"; + OCSSessionsFolderURL = "postgresql://sogo:sogo@localhost:5432/sogo/sogo_sessions_folder"; + ''; # Hier ist bindPassword noch nicht vollständig vhostName = "${SOGo-hostname}"; timezone = "Europe/Berlin";