Inoltro postfix tramite un altro server postfix


1

Ho un server postfix sulla mia LAN in esecuzione con Virtualmin. Ho un totale di 4 domini su questo server e devo essere in grado di inviare e ricevere e-mail da e verso i domini su questo server.

Il problema è che il mio ISP (Comcast) blocca la porta 25 in entrata e in uscita.

Quindi, ho un VPS remoto che speravo di usare per inoltrare la posta, sia in entrata che in uscita sulla porta 587. Su questo VPS è installato Postfix su Virtualmin.

Quindi ho i quattro domini:

domain.com domain2.com domain3.com domain4.com

Se invio un'e-mail da user1@domain.com, voglio che venga inoltrato attraverso il mio server di posta esterno (mail.domain.com, anche sulla mia VPN come 10.1.0.10) e verso la sua destinazione. Nel frattempo, se qualcuno invia un'email a user1@domain.com i miei record MX lo faranno recapitare a mail.domain.com e quindi sulla mia rete attraverso la porta 587 e la mia VPN.

Ho fatto un po 'di questo riguardo. Posso colpire il mio VPS ma ricevo alcuni messaggi di errore. Immagino di avere problemi a capire come rendere un utente sul mio VPS in grado di inoltrare la posta attraverso questo server Postfix per passare l'autenticazione SASL.

Ecco il mio main.cf sul mio server Postfix sulla mia LAN:

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated     defer_unauth_destination
myhostname = cactuar.domain.local
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = cactuar.domain.local, localhost.domain.local, , localhost
relayhost = [10.1.0.10]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
recipient_delimiter = +
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks     permit_sasl_authenticated reject_unauth_destination
allow_percent_hack = no

# enable SASL authentication 
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication. 
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption 
smtp_use_tls = yes
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

questo è il mio main.cf sul mio VPS mail.domain.com remoto:

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated     defer_unauth_destination
myhostname = mail.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain $mydomain
relaydomains = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 10.0.0.0/8
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
recipient_delimiter = +
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks     permit_sasl_authenticated reject_unauth_destination
allow_percent_hack = no
transport_maps = hash:/etc/postfix/transport

# SASL SUPPORT FOR CLIENTS
#
# The following options set parameters needed by Postfix to enable
# Cyrus-SASL support for authentication of mail clients.
#
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks     permit_sasl_authenticated reject_unauth_destination
smtp_sasl_auth_enable = yes
myorigin = $mydomain

Quando invio un'email dal mio server di casa a Internet, ottengo i seguenti risultati mail.log:

Sul mio server di casa:

Dec  5 12:41:02 cactuar postfix/qmgr[29509]: DEA6EC1725: from=<user1@domain.com>, size=655, nrcpt=1 (queue active)
Dec  5 12:41:03 cactuar dovecot: imap(domain): Connection closed in=748 out=2203
Dec  5 12:41:03 cactuar postfix/smtp[32026]: DEA6EC1725: to=<me@gmail.com>, relay=10.1.0.10[10.1.0.10]:587, delay=0.29, delays=0.08/0.04/0.17/0, dsn=4.7.8, status=deferred (SASL authentication failed; server 10.1.0.10[10.1.0.10] said: 535 5.7.8 Error: authentication failed: generic failure)

Sul mio VPS remoto quando arriva una mail dal mio server di casa:

Dec  5 13:43:34 kupo postfix/smtpd[29636]: connect from unknown[10.0.0.24]
Dec  5 13:43:34 kupo postfix/smtpd[29636]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
Dec  5 13:43:34 kupo postfix/smtpd[29636]: warning: SASL authentication failure: Password verification failed
Dec  5 13:43:34 kupo postfix/smtpd[29636]: warning: unknown[10.0.0.24]: SASL PLAIN authentication failed: generic failure
Dec  5 13:43:34 kupo postfix/smtpd[29636]: disconnect from unknown[10.0.0.24]

Ho configurato un utente in saslauthd usando il comando saslpasswd2 -c <username>, ho quel nome utente nel mio server interno quando mi collego al VPS remoto e saslauthd è in esecuzione su entrambe le macchine.

Sperando che qualcuno mi possa guidare per risolvere questo problema.

Grazie per tutto l'aiuto che potete fornire.


Bene, il primo indizio è proprio lì nella voce di registro finale: SASL authentication failure: cannot connect to saslauthd server: No such file or directory. È necessario configurare qualche altro meccanismo di autenticazione (chiavi precondivise TLS, ad esempio), oppure avviare SASL.
un CVn il

Ciao. Ho installato un utente in saslauthd usando saslpasswd2 -c <username>, sto usando quel nome utente sul mio server di casa per provare a connettermi e saslauthd è in esecuzione.
Jguy,

Si prega di modificare la tua domanda per includere ulteriori informazioni. La domanda, non i commenti, dovrebbe essere la fonte autorevole di tutte le informazioni necessarie per rispondere alla domanda.
un CVn il
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.