Analysis and correction of errors in the logs Dovecot and Postfix (CentOS, RedHat)

This article is devoted to analysis, test and fix mistakes when using Postfix and Dovecot.

Firewall settings

Open the ports 25, 110, 143, 465, 993, 995, 585, make changes in iptables

RH-Firewall-1-INPUT-Panel for INPUT and FORWARD

#SMTP
-A RH-Firewall-1-INPUT-p tcp-m tcp-dport 25-m state-state NEW-j ACCEPT
#POP3
-A RH-Firewall-1-INPUT-p tcp-m tcp-dport 110-m state-state NEW-j ACCEPT
#IMAP
-A RH-Firewall-1-INPUT-p tcp-m tcp –dport 143-m state-state NEW-j ACCEPT
#SSMTP
-A RH-Firewall-1-INPUT-p tcp-m tcp –dport 465-m state-state NEW-j ACCEPT
#IMAP4-SSL
-A RH-Firewall-1-INPUT-p tcp-m tcp –dport 585-m state-state NEW-j ACCEPT
#IMAPS
-A RH-Firewall-1-INPUT-p tcp-m tcp-dport 993-m state-state NEW-j ACCEPT
#SSL-POP
-A RH-Firewall-1-INPUT-p tcp-m tcp-dport 995-m state-state NEW-j ACCEPT

The first and very important in all phases of this manual connection via Telnet/telnet

Generate a Base64 password/login

#perl-MMIME:: Base64-e ‘ print encode_base64 (“00user@demo1.ru 00pass”); ‘

Authorization to use the command

AUTH PLAIN AGFsc2lyX3J1ADY2Njk4Mm1heA = =

Check mail via telnet
How to test the mail on the server demo1.ru using the telnet utility?
Command to log on to mail server:

#telnet demo1.ru 110

Specify a user name:

user user@demo1.ru

Specify the password for the user:

pass PassW0rd

Get a list of emails:

list

Read the letter (where x is the number of letters)

RETR (x)

To exit type

Quit

Sending mail via telnet
How to test sending mail on the server demo1.ru using the telnet utility?

Command to log on to mail server:
#telnet demo1.ru 25

Trying aaa.bbb.ccc.ddd…

Connected to demo1.ru (aaa.bbb.ccc.ddd).

Escape character is ‘ ^ ‘.]

220 demo1.ru ESMTP Sendmail x.y.z/x.y.z; Fri, 7 Mar 2008 10:09:22 +0200

Type the greeting:

HELO eee.fff.ggg.hhh

(where eee.fff.ggg.hhh is your IP address from which you run telnet)

250 demo1.ru Hello mail.server.ua [aaa.bbb.ccc.ddd] pleased to meet you

Specify the sender address (must be in the same domain as the mail server: server.ua)

mail from: taras@demo1.ru

250 2.1.0 taras@demo1.ru … …. Sender ok

Specify the recipient (mailto@mail.kiev.ua):

RCPT to: mailto@demo2.ru

250 2.1.5 taras… Recipient ok

Type the command

data

354 Enter mail, end with “.” on a line by itself

Subject: the subject of the test letters

The text of the letter

and at the end of the letter one pixel in a row to finish

.

250 2.0.0 x2789MjQ008048 Message accepted for delivery

Enter to exit

Quit

221 2.0.0 demo1.ru closing connection

Connection closed by foreign host.

Basic commands Postfix

Again try to send all messages from the queue
#postsuper-r ALL

Remove the entire queue
#postsuper-d ALL

View current queue
#postqueue-p

View the current config
#postconf

Prosmtret′ standard config
#postconf-d

Output parameter values in the current config
#postconf < parameter >

Delete all temporary files after the fall of the system or the postfix-a
#postsuper-p

View the config files with no comments

#grep-v-E “^ $ # |” main.cf

Create a config file with no comments
#grep-v-E “^ $ # |” main.cf > main.cf_

Errors in the maillog log

Postfix/local [2678]: A794313690A: to =, relay = local, delay = 0, status = bounced (unknown user: “test@domain.com”) or group

error indicates that the system could not find the user, if you are sure that it is there, check the law. If you are using PAM then check right to/etc/passwd and/etc/group files I put 644

Jun 18 15:59:46 mail postfix/smtpd [16261]: A37211D628E: reject: RCPT from unknown [217.23.124.178]: 554 < # # # # # # # @list. ru >: Recipient address rejected: Relay access denied; from = to = < # # # # # # # # @list. ru > proto = ESMTP helo =

This error indicates that the send mail that is not possible, since you are or are not logged in, or the address/IP RCPT from banned releu. Check it out, you can add the mynetworks 0.0.0.0/0 this will mean that you agree to send through the mail (DO NOT LEAVE THIS SETTING or spam through you will fall and your program is banned)

Also recommend reading bug article