Назад | Перейти на главную страницу

Создайте сеть с 2-мя постфиксными серверами

Я пытаюсь создать сеть с двумя постфиксными серверами (с именами mail1 и mail2). Моя цель - чтобы первый сервер отправлял почту второму.

Итак, я установил postfix на 2 centos. Когда я пытаюсь сделать простое:

echo "mail bodyy"| mail -s "test mail" root

У меня такая ошибка:

(lost connection with mail2.test.com[X.X.X.34] while receiving the initial server greeting)
                                         root@test.com

-- 0 Kbytes in 1 Request.

Я добавил оба сервера в / etc / hosts, чтобы серверы могли разрешать имена хостов друг друга.

Думая, что это проблема DNS, я добавил это

smtp_host_lookup=native,dns
disable_dns_lookups = yes
ignore_mx_lookup_error = yes

В конф. По-прежнему есть ошибка.

Когда я пытаюсь сделать telnet от первого постфикса до второго на порту 25, у меня напрямую

Connection closed by foreign host.

Порт 25 открыт, и я добавил оба сервера в /etc/allow.allow

Я также отключил firewalld и selinux на обоих серверах.

postfix check

ничего не говорит

Вот конф первого Postfix

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
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 = mail1.test.com

mydomain = test.com

smtp_host_lookup=native,dns
disable_dns_lookups = yes
ignore_mx_lookup_error = yes 

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

#myorigin = /etc/mailname
myorigin = $mydomain

mydestination = mail2.test.com
relayhost = mail2.test.com
mynetworks = 127.0.0.0/8, X.X.X.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
#inet_protocols = all
inet_protocols = ipv4

home_mailbox = Maildir/

# SMTP-Auth settings
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject

Вот конф второго постфикса

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
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 = mail1.test.com

mydomain = test.com

smtp_host_lookup=native,dns
disable_dns_lookups = yes
ignore_mx_lookup_error = yes

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

#myorigin = /etc/mailname
myorigin = $mydomain

mydestination = $myhostname, $mydomain, localhost.$mydomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8, X.X.X.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
#inet_protocols = all
inet_protocols = ipv4

home_mailbox = Maildir/

# SMTP-Auth settings
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject

Вы знаете, что не так с моими серверами? Спасибо.