Skip to content

Instantly share code, notes, and snippets.

@huglester
Last active December 7, 2018 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huglester/fe7e6684be56fdb96cc4e7d88dcdceab to your computer and use it in GitHub Desktop.
Save huglester/fe7e6684be56fdb96cc4e7d88dcdceab to your computer and use it in GitHub Desktop.
/etc/exim.routers.pre.conf
mv /etc/exim.routers.pre.conf /etc/exim.routers.pre.conf_BUG
echo 'lookuphost:
driver = dnslookup
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = "${perl{check_limits}}"
transport = remote_smtp
no_more' > /etc/exim.routers.pre.conf
service exim reload
cp -f /etc/exim.routers.pre.conf_BUG /etc/exim.routers.pre.conf
service exim restart
# https://p5r.uk/blog/2017/smtp-via-ssh-tunnel.html
ssh-keygen -t ed25519 -f /root/.ssh/smtp_tunnel
ssh-copy-id -i /root/.ssh/smtp_tunnel user@mx.example.com
command="nc localhost 25",no-X11-forwarding,no-agent-forwarding,no-port-forwarding ssh-ed25519 AAAAC3Nz…
/etc/systemd/system/smtp-submission.socket
[Unit]
Description=SSH Tunnel to mx.example.com for SMTP submissions
[Socket]
ListenStream=25
Accept=yes
[Install]
WantedBy=sockets.target
-----
/etc/systemd/system/smtp-submission@.service
[Unit]
Description=SSH Tunnel to mx.example.com for SMTP submissions
[Service]
ExecStart=-/usr/bin/ssh -q -T -i /root/.ssh/tunnel_key user@mx.example.com
StandardInput=socket
------
systemctl enable smtp-submission.socket
systemctl start smtp-submission.socket
systemctl status smtp-submission.socket
systemctl enable smtp2-submission.socket
systemctl start smtp2-submission.socket
systemctl status smtp2-submission.socket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment