Traduções: English - Português (Brasil)
Como enviar e-mails com o Exim através de um túnel SSH
A. Comece o túnel ssh
ssh $HOST -L 2525:$MSERVER:25
(onde $HOST é o serviço pelo qual fornece o túnel e $MSERVER é o serviço SMTP que você deseja usar)
B. Configure o exim
1. Adicione um novo arquivo de transporte /etc/exim4/conf.d/transport/40_tunneled_smtp :
################################# # This transport is used for delivering messages over SSH-tunneled SMTP # connections to port 2525 on localhost
ssh_tunneled_smtp: debug_print = "T: tunneled remote_smtp for $local_part@$domain" driver = smtp allow_localhost = true port = 2525 hosts = 127.0.0.1 hosts_override = true
2. Edite /etc/exim4/conf.d/router/200_exim4-config_primary. Na seão 'smarthost:', mude
transport = remote_smtp_smarthost
para
transport = ssh_tunneled_smtp
3. reinicie o serviço
Algumas variações
- Selecione que o transporte será através de um arquivo:
transport = ${lookup{transport}lsearch{/etc/roaming/exim_options}{$value}{remote_smtp_smarthost}}
então, /etc/roaming/exim_options poderá conter:
transport: ssh_tunneled_smtp
ou nada para usar o padrão
- Tentativa de enviar somente através de uma rede:
1. Adicione um novo arquivo /etc/exim4/conf.d/main/04_roaming :
# If the file /etc/roaming/not_online exists, don't send the messages but # enqueue them only queue_only_file = /etc/roaming/not_online
2. Adicione o gancho para criar e remover o arquivo:
iface home inet static [...] up echo '' > /etc/roaming/exim_options up rm -f /etc/roaming/not_online
iface work inet static [...] up echo 'transport: ssh_tunneled_smtp' > /etc/roaming/exim_options up touch /etc/roaming/not_online
Enrico Zini
FixMe: página desatualizada.