G
G
gh0sty2019-12-08 18:00:54
Email
gh0sty, 2019-12-08 18:00:54

How to make Postfix send mail outside with DKIM?

Can't set up email forwarding. It all started with the fact that external smtp services did not want to connect to any for my application ( this question ). Well I also decided to configure postfix. Set up postfix. But he didn't send letters out in the same way. On some forum, I read that many mail receiving services do not accept letters with poor security and I decided to install DKIM. But still, nothing worked. Sorry, I don't know how to set up a mail server at all.
postfix config:

# Дефолтные настройки
...
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mydomain.com
mydomain = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, mydomain.com, localhost.mydomain.com, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = localhost
inet_protocols = all
home_mailbox = Maildir/
virtual_alias_maps = hash:/etc/postfix/virtual

# mydomain.com - везде мой оригинальный домен

openkim config:
# Command-line options specified here will override the contents of
# /etc/opendkim.conf. See opendkim(8) for a complete list of options.
#DAEMON_OPTS=""
# Change to /var/spool/postfix/var/run/opendkim to use a Unix socket with
# postfix in a chroot:
#RUNDIR=/var/spool/postfix/var/run/opendkim
RUNDIR=/var/run/opendkim
#
# Uncomment to specify an alternate socket
# Note that setting this will override any Socket value in opendkim.conf
# default:
SOCKET="local:/var/spool/postfix/var/run/opendkim/opendkim.sock"
# listen on all interfaces on port 54321:
#SOCKET=inet:54321
# listen on loopback on port 12345:
#SOCKET=inet:[email protected]
# listen on 192.0.2.1 on port 12345:
#SOCKET=inet:[email protected]
USER=opendkim
GROUP=opendkim
PIDFILE=$RUNDIR/$NAME.pid
EXTRAAFTER=

DNS:
5ded0eb34b3ed771070044.png
Doing:
echo "Test DKIM" | mail -s "Testing DKIM" -a "Smtp: localhost:25" -a "From: [email protected]" -a "Return-path: [email protected]" [email protected]

And the log outputs:
...
Dec  8 06:36:04 mydomain postfix/qmgr[20126]: 147534143E: from=<[email protected]>, size=382, nrcpt=1 (queue active)
Dec  8 06:36:04 mydomain postfix/qmgr[20126]: 606CA413C2: from=<[email protected]>, size=382, nrcpt=1 (queue active)
Dec  8 06:36:23 mydomain postfix/pickup[20125]: BD701413AA: uid=1001 from=<[email protected]>
Dec  8 06:36:23 mydomain postfix/cleanup[20142]: BD701413AA: message-id=<[email protected]>
Dec  8 06:36:23 mydomain postfix/qmgr[20126]: BD701413AA: from=<[email protected]>, size=348, nrcpt=1 (queue active)
Dec  8 06:36:34 mydomain postfix/smtp[20128]: connect to mx.yandex.ru[xx.xx.xx.xx]:25: Connection timed out
Dec  8 06:36:34 mydomain postfix/smtp[20130]: connect to mx.yandex.ru[xx.xx.xx.x]:25: Connection timed out
Dec  8 06:36:34 mydomain postfix/smtp[20129]: connect to mx00.mail.com[xx.xx.xx.xx]:25: Connection timed out
Dec  8 06:36:34 mydomain postfix/smtp[20132]: connect to mx.yandex.ru[xx.xx.xx.xx]:25: Connection timed out
Dec  8 06:36:34 mydomain postfix/smtp[20131]: connect to mx.yandex.ru[xx.xx.xx.xx]:25: Connection timed out
Dec  8 06:36:34 mydomain postfix/smtp[20131]: connect to mx.yandex.ru[xx:xx:xx]:25: Network is unreachable
Dec  8 06:36:53 mydomain postfix/smtp[20143]: connect to mx.yandex.ru[xx.xx.xx.xx]:25: Connection timed out
Dec  8 06:36:53 mydomain postfix/smtp[20143]: connect to mx.yandex.ru[xx:xx::xx]:25: Network is unreachable
...
Dec  8 06:37:04 mydomain postfix/smtp[20129]: BF8F34138A: to=<[email protected]>, relay=none, delay=74075, delays=74015/0.02/60/0, dsn=4.4.1, status=deferred (connect to mx01.mail.com[xx.xx.xx.xx]:25: Connection timed out)

# Все попытки заканчиваются на Network is unreachable или Connection timed out

It's just that right now I would sit down to play with DNS, then I would try to open ports. Seriously, I wasted a lot of time on this. Maybe it's still a problem with ports, or MX records. I would just like to send letters from this server. Tell me pliz) I've been suffering for 2 days.
UPD:
Changed RUNDIR to "/var/spool/postfix/var/run/opendkim", restarted - still the same.
In /etc/mailname - mydomain.com.
With gmail it's the same.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akelsey, 2019-12-08
@gh0sty

At the Hoster where you have a postfix - port TCP: 25 is prohibited (common practice).
Test with telnet, telnet smtp.yandex.ru 25 for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question