2023-09-17 20:14:32 +02:00
|
|
|
{ config, lib, ... }:
|
2023-03-01 18:44:56 +01:00
|
|
|
let
|
2023-09-17 20:10:55 +02:00
|
|
|
sogo-hostname = "mail.${config.networking.domain}";
|
2023-03-01 18:44:56 +01:00
|
|
|
in
|
|
|
|
{
|
2023-07-07 17:12:59 +02:00
|
|
|
sops.secrets = {
|
|
|
|
sogo_ldap_search = {
|
|
|
|
key = "portunus/search-password";
|
|
|
|
owner = config.systemd.services.sogo.serviceConfig.User;
|
|
|
|
};
|
2023-04-13 18:38:37 +02:00
|
|
|
};
|
2023-04-03 23:14:12 +02:00
|
|
|
|
2023-03-07 17:59:22 +01:00
|
|
|
services = {
|
2023-07-04 12:45:51 +02:00
|
|
|
memcached.enable = true;
|
2023-03-07 17:59:22 +01:00
|
|
|
sogo = {
|
|
|
|
enable = true;
|
|
|
|
language = "German";
|
|
|
|
extraConfig = ''
|
2023-07-04 12:45:51 +02:00
|
|
|
WOWorkersCount = 10;
|
|
|
|
SOGoUserSources = ({
|
|
|
|
type = ldap;
|
|
|
|
CNFieldName = cn;
|
|
|
|
UIDFieldName = uid;
|
|
|
|
IDFieldName = uid;
|
|
|
|
|
|
|
|
baseDN = "ou=users, dc=ifsr, dc=de";
|
|
|
|
bindDN = "uid=search, ou=users, dc=ifsr, dc=de";
|
|
|
|
bindPassword = LDAP_SEARCH;
|
|
|
|
hostname = "ldap://localhost";
|
|
|
|
canAuthenticate = YES;
|
|
|
|
id = directory;
|
2023-03-07 17:59:22 +01:00
|
|
|
|
2023-07-04 12:45:51 +02:00
|
|
|
});
|
2023-07-19 17:44:49 +02:00
|
|
|
SOGoProfileURL = "postgresql://sogo@%2frun%2Fpostgresql/sogo/sogo_user_profile";
|
|
|
|
OCSSessionsFolderURL = "postgresql://sogo@%2frun%2Fpostgresql/sogo/sogo_sessions_folder";
|
|
|
|
OCSFolderInfoURL = "postgresql://sogo:POSTGRES_PASSWORD@%2frun%2Fpostgresql/sogo/sogo_folder_info";
|
2023-07-04 14:00:06 +02:00
|
|
|
SOGoSieveServer = sieve://127.0.0.1:4190;
|
|
|
|
SOGoSieveScriptsEnabled = YES;
|
|
|
|
SOGoVacationEnabled = YES;
|
2023-09-03 22:56:26 +02:00
|
|
|
SOGoJunkFolderName = Spam;
|
|
|
|
|
2023-07-04 12:45:51 +02:00
|
|
|
'';
|
2023-04-13 18:38:37 +02:00
|
|
|
configReplaces = {
|
2023-07-07 17:12:59 +02:00
|
|
|
"LDAP_SEARCH" = config.sops.secrets.sogo_ldap_search.path;
|
2023-04-13 18:38:37 +02:00
|
|
|
};
|
|
|
|
vhostName = "${sogo-hostname}";
|
2023-03-22 11:24:14 +01:00
|
|
|
timezone = "Europe/Berlin";
|
2023-03-07 17:59:22 +01:00
|
|
|
};
|
2023-04-13 18:52:15 +02:00
|
|
|
postgresql = {
|
|
|
|
enable = true;
|
|
|
|
ensureUsers = [
|
|
|
|
{
|
|
|
|
name = "sogo";
|
2023-12-14 15:42:10 +01:00
|
|
|
ensureDBOwnership = true;
|
2023-04-13 18:52:15 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
ensureDatabases = [ "sogo" ];
|
|
|
|
};
|
2023-03-07 13:06:24 +01:00
|
|
|
|
2023-03-07 17:59:22 +01:00
|
|
|
nginx = {
|
|
|
|
recommendedProxySettings = true;
|
2023-04-13 18:38:37 +02:00
|
|
|
virtualHosts."${sogo-hostname}" = {
|
2023-07-04 12:45:51 +02:00
|
|
|
extraConfig = ''
|
|
|
|
proxy_busy_buffers_size 64k;
|
|
|
|
proxy_buffers 8 64k;
|
|
|
|
proxy_buffer_size 64k;
|
|
|
|
'';
|
2023-03-07 17:59:22 +01:00
|
|
|
locations = {
|
2023-07-04 12:45:51 +02:00
|
|
|
"^~/SOGo".extraConfig = lib.mkForce ''
|
|
|
|
proxy_pass http://127.0.0.1:20000;
|
|
|
|
proxy_redirect http://127.0.0.1:20000 default;
|
|
|
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header x-webobjects-server-protocol HTTP/1.0;
|
|
|
|
proxy_set_header x-webobjects-remote-host 127.0.0.1;
|
|
|
|
proxy_set_header x-webobjects-server-port $server_port;
|
|
|
|
proxy_set_header x-webobjects-server-name $server_name;
|
|
|
|
proxy_set_header x-webobjects-server-url $scheme://$host;
|
|
|
|
proxy_connect_timeout 90;
|
|
|
|
proxy_send_timeout 90;
|
|
|
|
proxy_read_timeout 90;
|
|
|
|
proxy_buffer_size 64k;
|
|
|
|
proxy_buffers 8 64k;
|
|
|
|
proxy_busy_buffers_size 64k;
|
|
|
|
proxy_temp_file_write_size 64k;
|
|
|
|
client_max_body_size 50m;
|
|
|
|
client_body_buffer_size 128k;
|
|
|
|
break;
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
2023-03-07 17:59:22 +01:00
|
|
|
};
|
2023-04-13 18:38:37 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-03-07 13:06:24 +01:00
|
|
|
|
2023-07-04 12:45:51 +02:00
|
|
|
# one of these prevents access to sendmail, don't know which one
|
|
|
|
systemd.services.sogo.serviceConfig = {
|
|
|
|
LockPersonality = lib.mkForce false;
|
|
|
|
|
|
|
|
MemoryDenyWriteExecute = lib.mkForce false;
|
|
|
|
NoNewPrivileges = lib.mkForce false;
|
|
|
|
PrivateDevices = lib.mkForce false;
|
|
|
|
PrivateUsers = lib.mkForce false;
|
|
|
|
ProtectClock = lib.mkForce false;
|
|
|
|
ProtectHostname = lib.mkForce false;
|
|
|
|
ProtectKernelLogs = lib.mkForce false;
|
|
|
|
ProtectKernelModules = lib.mkForce false;
|
|
|
|
ProtectKernelTunables = lib.mkForce false;
|
|
|
|
RestrictAddressFamilies = lib.mkForce [ ];
|
|
|
|
RestrictRealtime = lib.mkForce false;
|
|
|
|
RestrictSUIDSGID = lib.mkForce false;
|
|
|
|
SystemCallArchitectures = lib.mkForce "";
|
|
|
|
SystemCallFilter = lib.mkForce [ ];
|
|
|
|
ReadWriteDirectories = "/var/lib/postfix/queue/maildrop";
|
|
|
|
|
|
|
|
};
|
2023-03-07 13:06:24 +01:00
|
|
|
}
|