tried stream config, this doesn't work still

This commit is contained in:
twoneis 2025-02-26 01:22:34 +01:00
parent 545a491ac8
commit 2832f7b608
2 changed files with 43 additions and 24 deletions

View file

@ -2,7 +2,7 @@
conf = { conf = {
ssh.enable = true; ssh.enable = true;
nginx.enable = true; nginx.enable = true;
mail.enable = false; # broken mail.enable = true; # broken
website.enable = true; website.enable = true;
fedi.enable = true; fedi.enable = true;
matrix.enable = true; matrix.enable = true;

View file

@ -2,20 +2,39 @@
inherit (config) conf; inherit (config) conf;
inherit (lib) mkIf; inherit (lib) mkIf;
in mkIf conf.mail.enable { in mkIf conf.mail.enable {
services.nginx = { services.nginx.streamConfig = ''
virtualHosts = { # Proxy SMTP
"webadmin.chpu.eu" = { server {
useACMEHost = "chpu.eu"; server_name chpu.eu mail.chpu.eu;
forceSSL = true; listen 25 proxy_protocol;
serverAliases = [ proxy_pass 127.0.0.1:10025;
"mta-sts.chpu.eu" proxy_protocol on;
"autoconfig.chpu.eu" }
"autodiscover.chpu.eu"
]; # Proxy IMAPS
locations."/".proxyPass = "http://localhost:9090"; server {
}; server_name chpu.eu mail.chpu.eu;
}; listen 993 proxy_protocol;
}; proxy_pass 127.0.0.1:10993;
proxy_protocol on;
}
# Proxy SMTPS
server {
server_name chpu.eu mail.chpu.eu;
listen 465 proxy_protocol;
proxy_pass 127.0.0.1:10465;
proxy_protocol on;
}
# Proxy HTTPS
server {
server_name chpu.eu mail.chpu.eu;
listen 443 proxy_protocol;
proxy_pass 127.0.0.1:10443;
proxy_protocol on;
}
'';
users.users."stalwart-mail".extraGroups = [ "nginx" ]; users.users."stalwart-mail".extraGroups = [ "nginx" ];
@ -34,27 +53,27 @@ in mkIf conf.mail.enable {
enable = true; enable = true;
implicit = true; implicit = true;
}; };
proxy.trusted-networks = [
"127.0.0.0/8"
"::1"
"10.0.0.0/8"
];
listener = { listener = {
submissions = { submissions = {
protocol = "smtp"; protocol = "smtp";
bind = "[::]:465"; bind = "127.0.0.1:10465";
}; };
smtp = { smtp = {
protocol = "smtp"; protocol = "smtp";
bind = "[::]:25"; bind = "127.0.0.1:10025";
}; };
imaps = { imaps = {
protocol = "imap"; protocol = "imap";
bind = "[::]:993"; bind = "127.0.0.1:10993";
};
jmap = {
protocol = "http";
bind = "[::]:8080";
url = "https://mail.chpu.eu";
}; };
management = { management = {
protocol = "http"; protocol = "http";
bind = [ "127.0.0.1:9090" ]; bind = [ "127.0.0.1:10443" ];
}; };
}; };
}; };