Port-forward imap, smtp, submission
This commit is contained in:
parent
6328946703
commit
d8976486dc
|
@ -176,7 +176,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.nginx = {
|
services = {
|
||||||
|
nginx = {
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"${cfg.smtp.hostname}".locations."/metrics" = {
|
"${cfg.smtp.hostname}".locations."/metrics" = {
|
||||||
proxyPass = "http://localhost:${toString metricsPort}/metrics";
|
proxyPass = "http://localhost:${toString metricsPort}/metrics";
|
||||||
|
@ -187,6 +188,42 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xinetd = {
|
||||||
|
enable = true;
|
||||||
|
services = let
|
||||||
|
genService = { name, port, protocols ? [ "tcp" ] }:
|
||||||
|
map (protocol: {
|
||||||
|
inherit name;
|
||||||
|
service = "/usr/bin/env";
|
||||||
|
extraConfig = "redirect = 127.0.0.1 ${toString port}";
|
||||||
|
}) protocols;
|
||||||
|
in concatMap genService [
|
||||||
|
{
|
||||||
|
name = "imap";
|
||||||
|
port = 9143;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "imaps";
|
||||||
|
port = 9993;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "smtp";
|
||||||
|
port = 9025;
|
||||||
|
protocols = [ "tcp" "udp" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "submission";
|
||||||
|
port = 9587;
|
||||||
|
protocols = [ "tcp" "udp" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "submissions";
|
||||||
|
port = 9465;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
fudo.secrets.host-secrets."${hostname}" = {
|
fudo.secrets.host-secrets."${hostname}" = {
|
||||||
mailLdapProxyEnv = {
|
mailLdapProxyEnv = {
|
||||||
source-file = pkgs.writeText "ldap-proxy.env" ''
|
source-file = pkgs.writeText "ldap-proxy.env" ''
|
||||||
|
@ -246,7 +283,7 @@ in {
|
||||||
"${hostSecrets.dovecotLdapConfig.target-file}:/run/dovecot2/conf.d/ldap.conf:ro"
|
"${hostSecrets.dovecotLdapConfig.target-file}:/run/dovecot2/conf.d/ldap.conf:ro"
|
||||||
"${cfg.smtp.ssl-directory}:/run/certs/smtp"
|
"${cfg.smtp.ssl-directory}:/run/certs/smtp"
|
||||||
];
|
];
|
||||||
ports = [ "25:25" "587:587" "465:465" "2525:2525" ];
|
ports = [ "9025:25" "9587:587" "9465:465" ];
|
||||||
depends_on = [ "imap" "ldap-proxy" ];
|
depends_on = [ "imap" "ldap-proxy" ];
|
||||||
};
|
};
|
||||||
nixos = {
|
nixos = {
|
||||||
|
@ -301,7 +338,7 @@ in {
|
||||||
imap = {
|
imap = {
|
||||||
service = {
|
service = {
|
||||||
networks = [ "internal_network" ];
|
networks = [ "internal_network" ];
|
||||||
ports = [ "143:143" "993:993" ];
|
ports = [ "9143:143" "9993:993" ];
|
||||||
volumes = [
|
volumes = [
|
||||||
"${cfg.state-directory}/dovecot:/state"
|
"${cfg.state-directory}/dovecot:/state"
|
||||||
"${hostSecrets.dovecotLdapConfig.target-file}:/run/dovecot2/conf.d/ldap.conf:ro"
|
"${hostSecrets.dovecotLdapConfig.target-file}:/run/dovecot2/conf.d/ldap.conf:ro"
|
||||||
|
|
Loading…
Reference in New Issue