• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] openSUSE 13.2 -> postfix mail über smtp.strato.de

huby

Member
Hallo Leute,

nach Installation von openSUSE 13.2 versuche ich nun Postfix wieder so einzurichten dass ausgehende mails über smtp.strato.de versendet werden. Aus Sicherheitsgründen bietet Strato nur noch verschlüsselte Verbindungen und da ist vermutlich der Knackpunkt.
Wie es hier heißt, sollte Port 587 bei Verwendung als Relay verwendet werden.
Ich habe Postfix mithilfe von Yast wie folgt eingerichtet:
  1. "Ausgehender Mailserver" => smtp.strato.de:587 eingetragen (Yast macht daraus ein [smtp.strato.de]:587)
  2. TLS-Verschlüsselung => Erzwingen
  3. Authentifizierung => Bennutzername und Passwort eingetragen
Yast generiert daraus die /etc/postfix/main.cf wie folgt:
Code:
pc:~> cat /etc/postfix/main.cf|gawk '/^[^ #]/ { print };'
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
smtpd_banner = $myhostname ESMTP
debug_peer_level = 2
debugger_command =
	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
	 ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = maildrop
html_directory = /usr/share/doc/packages/postfix-doc/html
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/packages/postfix-doc/samples
readme_directory = /usr/share/doc/packages/postfix-doc/README_FILES
biff = no
content_filter = 
delay_warning_time = 1h
disable_dns_lookups = no
disable_mime_output_conversion = no
disable_vrfy_command = yes
inet_interfaces = localhost
inet_protocols = all
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_domains = meine-domain.de
masquerade_exceptions = root
mydestination = $myhostname,localhost.$myhostname,$mydomain
myhostname = pc.meine-domain.de
mynetworks_style = subnet
relayhost = [smtp.strato.de]:587
alias_maps = hash:/etc/aliases
canonical_maps = hash:/etc/postfix/canonical
relocated_maps = hash:/etc/postfix/relocated
sender_canonical_maps = hash:/etc/postfix/sender_canonical
transport_maps = hash:/etc/postfix/transport
mail_spool_directory = /var/mail
message_strip_characters = \0
defer_transports = 
mailbox_command = 
mailbox_transport = 
mailbox_size_limit = 0
message_size_limit = 0
strict_8bitmime = no
strict_rfc821_envelopes = no
smtpd_delay_reject = yes
smtpd_helo_required = no
smtpd_client_restrictions = 
smtpd_helo_restrictions = 
smtpd_sender_restrictions = hash:/etc/postfix/access
smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = 
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_auth_enable = no
relay_clientcerts = 
smtp_use_tls = yes
smtp_enforce_tls = yes
smtp_tls_CAfile = 
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_cert_file = /etc/ssl/
smtp_tls_key_file = /etc/ssl/
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_session_cache
smtpd_use_tls = no
smtpd_tls_CAfile = 
smtpd_tls_CApath = 
smtpd_tls_cert_file = 
smtpd_tls_key_file = 
smtpd_tls_ask_ccert = no
smtpd_tls_received_header = no
relay_domains = $mydestination, hash:/etc/postfix/relay
virtual_alias_domains = hash:/etc/postfix/virtual
virtual_alias_maps = hash:/etc/postfix/virtual
DIe /etc/sysconfig/postfix sieht so aus:
Code:
pc:~> cat /etc/sysconfig/postfix|gawk '/^[^ #]/ { print };'
POSTFIX_RELAYHOST="[smtp.strato.de]:587"
POSTFIX_LISTEN=""
POSTFIX_INET_PROTO=""
POSTFIX_MYHOSTNAME=""
POSTFIX_MASQUERADE_DOMAIN=""
POSTFIX_LOCALDOMAINS="\$myhostname,localhost.\$myhostname,\$mydomain"
POSTFIX_NULLCLIENT="no"
POSTFIX_DIALUP="no"
POSTFIX_NODNS="no"
POSTFIX_CHROOT="no"
POSTFIX_UPDATE_CHROOT_JAIL="no"
POSTFIX_WITH_LDAP="no"
POSTFIX_WITH_MYSQL="no"
POSTFIX_MYSQL_CONN="socket"
POSTFIX_LAPTOP="no"
POSTFIX_UPDATE_MAPS="yes"
POSTFIX_MAP_LIST="virtual transport access canonical sender_canonical relocated sasl_passwd:600 relay_ccerts helo_access relay"
POSTFIX_TRANSPORT_MAPS=""
POSTFIX_RBL_HOSTS=""
POSTFIX_BASIC_SPAM_PREVENTION="off"
POSTFIX_SMTPD_CLIENT_RESTRICTIONS=""
POSTFIX_SMTPD_HELO_RESTRICTIONS=""
POSTFIX_SMTPD_SENDER_RESTRICTIONS=""
POSTFIX_SMTPD_RECIPIENT_RESTRICTIONS=""
POSTFIX_MDA="local"
POSTFIX_SMTP_AUTH_SERVER="no"
POSTFIX_SMTP_AUTH="yes"
POSTFIX_SMTP_AUTH_OPTIONS=""
POSTFIX_SMTP_TLS_SERVER="no"
POSTFIX_SMTP_TLS_SERVER_LEGACY_SUPPORT="no"
POSTFIX_SMTP_TLS_CLIENT="must"
POSTFIX_SSL_PATH="/etc/ssl"
POSTFIX_TLS_CAFILE=""
POSTFIX_TLS_CERTFILE=""
POSTFIX_TLS_KEYFILE=""
POSTFIX_SSL_COUNTRY=""
POSTFIX_SSL_STATE=""
POSTFIX_SSL_LOCALITY=""
POSTFIX_SSL_ORGANIZATION=""
POSTFIX_SSL_ORGANIZATIONAL_UNIT=""
POSTFIX_SSL_COMMON_NAME=""
POSTFIX_SSL_EMAIL_ADDRESS=""
POSTFIX_ADD_MAILBOX_SIZE_LIMIT="0"
POSTFIX_ADD_MESSAGE_SIZE_LIMIT="0"
POSTFIX_REGISTER_SLP="yes"
POSTFIX_ADD_MYNETWORKS_STYLE="subnet"
POSTFIX_NODAEMON="no"
Die /etc/postfix/sasl_passwd ist korrekt!
Gemäß dieser Anleitung sollte das eigentlich passen, allerdings ist dieses Beispiel ohne Verschlüsselung.
In der /etc/postfix/master.cf habe ich, wie hier beschrieben, folgende Zeile auskommentiert:
Code:
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
Die komplette /etc/postfix/master.cf sieht jetzt so aus:
Code:
smtp      inet  n       -       n       -       -       smtpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
relay     unix  -       -       n       -       -       smtp
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache

Der Mailversand mit lokalen Adressen funktioniert einwandfrei.
Beim Versuch eine eMail an eine externe Adresse, also über smtp.strato.de:587, zu versenden scheitert mit folgenden Meldungen:
Code:
pc:~ # mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
547DF856E2     9799 Sat Nov 29 15:18:31  meine-strato-eMail-Adresse
                          (TLS is required, but our TLS engine is unavailable)
                                        meine-eMail@gmx.net

-- 10 Kbytes in 1 Request.
und:
Code:
pc:~ # systemctl status postfix.service -l
postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled)
   Active: active (running) since Sa 2014-11-29 15:08:07 CET; 12min ago
  Process: 1759 ExecStartPost=/etc/postfix/system/cond_slp register (code=exited, status=0/SUCCESS)
  Process: 1755 ExecStartPost=/etc/postfix/system/wait_qmgr 60 (code=exited, status=0/SUCCESS)
  Process: 1525 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 1520 ExecStartPre=/etc/postfix/system/update_postmaps (code=exited, status=0/SUCCESS)
  Process: 1513 ExecStartPre=/etc/postfix/system/update_chroot (code=exited, status=0/SUCCESS)
  Process: 1511 ExecStartPre=/etc/postfix/system/config_postfix (code=exited, status=0/SUCCESS)
  Process: 1495 ExecStartPre=/bin/echo Starting mail service (Postfix) (code=exited, status=0/SUCCESS)
 Main PID: 1754 (master)
   CGroup: /system.slice/postfix.service
           ├─1754 /usr/lib/postfix/master -w
           ├─1756 pickup -l -t fifo -u
           └─1757 qmgr -l -t fifo -u

Nov 29 15:18:31 pc postfix/cleanup[2892]: 547DF856E2: message-id=<20141129141831.547DF856E2@pc.sonners.de>
Nov 29 15:18:31 pc postfix/qmgr[1757]: 547DF856E2: from=<meine-strato-eMail-Adresse>, size=9799, nrcpt=1 (queue active)
Nov 29 15:18:31 pc postfix/smtpd[2889]: disconnect from localhost[127.0.0.1]
Nov 29 15:18:31 pc postfix/smtp[2893]: warning: connect to private/tlsmgr: Connection refused
Nov 29 15:18:31 pc postfix/smtp[2893]: warning: problem talking to server private/tlsmgr: Connection refused
Nov 29 15:18:32 pc postfix/smtp[2893]: warning: connect to private/tlsmgr: Connection refused
Nov 29 15:18:32 pc postfix/smtp[2893]: warning: problem talking to server private/tlsmgr: Connection refused
Nov 29 15:18:32 pc postfix/smtp[2893]: warning: no entropy for TLS key generation: disabling TLS support
Nov 29 15:18:32 pc postfix/smtp[2893]: connect to smtp.strato.de[2a01:238:20a:202:55f0::1133]:587: Network is unreachable
Nov 29 15:18:32 pc postfix/smtp[2893]: 547DF856E2: to=<meine-eMail@gmx.net>, relay=smtp.strato.de[81.169.145.133]:587, delay=1.5, delays=0.1/1.1/0.31/0, dsn=4.7.5, status=deferred (TLS is required, but our TLS engine is unavailable)
Dabei fällt mit "warning: connect to private/tlsmgr: Connection refused" auf.
Könnte private etwas mit dem Verzeichnis /etc/ssl/private/ zu tun haben, dieses ist nämlich leer?
/etc/ssl/certs ist eine Verknüpfung mit /var/lib/ca-certificates/pem
Gemäß dieser Anleitung bräuchte ich noch cert und key files.
Brauch ich die auch wenn ich mich nur bei einem Relay-Server anmelde?
Mit einem eMail-Programm wie Kmail funktionierts doch auch ohne.

Bin für jeden Tipp dankbar!

huby
 

drcux

Hacker
http://serversupportforum.de/forum/mail/55084-postfix-authentifizierung-am-relayhost-smtp-strato-de-587-a.html
 
OP
H

huby

Member
Hallo drcux,

Danke für Deine Antwort.
Inzwischen funktionierts! :)
Mithilfe dieser und dieser Anleitung habe ich nun ein *.crt und ein *.key -file erstellt und die main.cf wie folgt geändert:
Code:
smtp_tls_cert_file = /etc/ssl/private/meine-domain.de/selfmail.cert
smtp_tls_key_file = /etc/ssl/private/meine-domain.de/selfmail.key
Falls man jedoch mit Yast -> E-Mail-Server die Konfiguration nochmal ändern möchte, überschreibt Yast diesen Eintrag wieder und auch die oben beschriebene Änderung in der master.cf.
Ansonsten funktionierts jetzt, Danke
 

spoensche

Moderator
Teammitglied
Code:
smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination

Ich weiss ja nicht, ob das so wirklich gewollt ist, aber mit dieser Einstellung, kann jeder aus den Netzen in mynetworks ohne jegliche Authentifizierung e-Mails verschicken, also auc der Spambot den der freundliche Nachbar installiert hat.

Du hast also keinerlei Sicherheitsvorkehrungen getroffen.

Du solltest den Mailserver also schleunigst vom Netz nehmen. Alleine schon aus rechtlichen Gründen, weil du als Betreiber den sonst möglicherweise entstandenen Schaden voll tragen musst. Das kann von einer saftigen Geldstrafe bis zu Gefängnis sein.

Mal abgesehen davon, gibt es genug Spambots im Netz,. die 95% des gesamten Mailverkehrs stemmen, also nimm das Ding vom Netz bis du weisst was du da tust.
 
OP
H

huby

Member
Danke für Deinen Hinweis,
der ist jedoch bei mir zuhause hinter einer Firewall im lokalen Netz, also nicht so gefährdet.
Bin jedoch für Anregungen zur zusätzlichen Absicherung trotzdem dankbar.
 
Oben