Use proxychains-ng instead of tsocks

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2024-08-26 11:59:12 +08:00
parent ef4fd68829
commit 8e5a45ac91
1 changed files with 16 additions and 7 deletions

View File

@ -1254,9 +1254,9 @@ in
after = [ "sockets.service" ]; after = [ "sockets.service" ];
serviceConfig = { serviceConfig = {
Restart = "on-failure"; Restart = "on-failure";
User = "hydra-queue-runner"; # TODO needs new user both here and there User = "hydra-queue-runner"; # TODO needs new user here
Group = "hydra"; Group = "hydra";
ExecStart = "${pkgs.openssh}/bin/ssh -N -D 127.0.0.1:1587 zolaupd@5.78.86.156"; ExecStart = "${pkgs.openssh}/bin/ssh -N -D 127.0.0.1:1587 ssh_tunnel@5.78.86.156";
}; };
}; };
@ -1264,10 +1264,6 @@ in
m-labs-intl.com socks: m-labs-intl.com socks:
* : * :
''; '';
environment.etc."tsocks.conf".text = ''
server = 127.0.0.1
server_port = 1587
'';
systemd.services.postfix-rebuild-sender-relay = { systemd.services.postfix-rebuild-sender-relay = {
description = "Postfix Rebuild Sender Dependent Relayhost Maps"; description = "Postfix Rebuild Sender Dependent Relayhost Maps";
serviceConfig = { serviceConfig = {
@ -1285,6 +1281,19 @@ in
enablePop3Ssl = true; enablePop3Ssl = true;
certificateScheme = "acme-nginx"; certificateScheme = "acme-nginx";
} // (import /etc/nixos/secret/email_settings.nix); } // (import /etc/nixos/secret/email_settings.nix);
ssh_proxy_conf = builtins.toFile "proxychains.conf" ''
strict_chain
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 192.168.1.0/255.255.255.0
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
localnet 94.190.212.123/255.255.255.255
localnet 202.77.7.238/255.255.255.255
localnet 2001:470:18:390::2/255.255.255.255
[ProxyList]
socks5 127.0.0.1 1587
'';
services.postfix = { services.postfix = {
config = { config = {
sender_dependent_relayhost_maps = "hash:/etc/postfix/sender_relay"; sender_dependent_relayhost_maps = "hash:/etc/postfix/sender_relay";
@ -1293,7 +1302,7 @@ in
masterConfig.socks = { masterConfig.socks = {
type = "unix"; type = "unix";
command = "pipe"; command = "pipe";
args = "flags=R user=nobody argv=${pkgs.tsocks}/bin/tsocks ${pkgs.postfix}/bin/sendmail -oi -f $sender $recipient"; args = "flags=R user=nobody argv=${pkgs.proxychains-ng}/bin/proxychains4 -f ${config.ssh_proxy_conf} ${pkgs.postfix}/bin/sendmail -oi -f $sender $recipient";
}; };
}; };
}; };