sasl2 SMTP auth greift nicht bei Verwendung von telnet

SusiG

Registered User
Vielleicht habe ich einen Denkfehler, aber wäre nett, falls einer mir erklären könnte, warum hier der Postfix SMTP-Server trotz "smtpd_sasl_auth_enable = yes" die lokale Zustellung per telnet ohne Anmeldung annimmt. Logisch wäre für mich, wenn der Server nach Eingabe von "MAIL FROM: [email protected]" abbrechen würde.

Soll es kein Denkfehler sondern eine Fehlkonfiguration des Servers sein, wäre ich für jeden Hinweis dankbar, wie ich die beheben kann.

Sender: irgendeiner mit der E-Mail Adresse [email protected]
Server: mail.server.tld (Postfix auf Debian Etch)
Recipient: [email protected] (existiert bereits auf dem Server)

Code:
telnet mail.server.tld 25

220 mail.server.tld ESMTP Postfix (Debian/GNU)
EHLO domain.tld
250-mail.server.tld
250-PIPELINING
250-SIZE 52428800
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN CRAM-MD5 LOGIN DIGEST-MD5
250-AUTH=PLAIN CRAM-MD5 LOGIN DIGEST-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM: [email protected]
250 2.1.0 Ok
RCPT TO: [email protected]
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
test from [email protected] to [email protected]
.
250 2.0.0 Ok: queued as 070D52BAC8
 
Poste doch mal bitte deine Einstellungen zu
- mynetworks
- smtpd_sender_restrictions
- smtpd_client_restrictions
 
sorry, "lokale Zustellung" war hier von mir falsch eingesetzt aber ich wollte meinen, der Empfänger liegt auf dem Server. Aber der Absender startet schon die SMTP-Sitzung per telnet von einem entfernten Rechner aus, was nicht funktionnieren sollte. Es tut aber :confused:

Hier meine Einstellungen:

main.cf

Code:
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
default_destination_concurrency_limit = 20
inet_interfaces = all
local_destination_concurrency_limit = 2
local_recipient_maps = unix:passwd.byname $alias_maps
local_transport = local
mailbox_command = /usr/lib/dovecot/deliver
mailbox_size_limit = 0
message_size_limit = 52428800

mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = server.tld
myhostname = mail.server.tld
mynetworks = 127.0.0.0/8
myorigin = $mydomain

recipient_delimiter = +
relayhost =
sendmail_path = /usr/sbin/sendmail
smtp_tls_session_cache_database = sdbm:/etc/postfix/smtp_sessionid_cache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)

smtpd_data_restrictions = reject_multi_recipient_bounce,
	reject_unauth_pipelining
	smtpd_helo_required = yes

smtpd_helo_restrictions = permit_mynetworks,
	permit_sasl_authenticated,
	reject_invalid_helo_hostname,
	reject_non_fqdn_helo_hostname

smtpd_recipient_restrictions = reject_non_fqdn_recipient,
	reject_unknown_recipient_domain,
	permit_mynetworks, 
	permit_sasl_authenticated,
	reject_unauth_destination,
	reject_unlisted_recipient

smtpd_sender_restrictions = reject_non_fqdn_sender,
	reject_unknown_sender_domain,
	permit_mynetworks,
	permit_sasl_authenticated

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous

smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/postfix/postfix.cert.pem
smtpd_tls_key_file = /etc/postfix/postfix.key.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = sdbm:/etc/postfix/smtpd_sessionid_cache
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom

virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_alias_maps.cf
virtual_gid_maps = static:2000
virtual_mailbox_base = /var/mail/virtual/
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
virtual_transport = dovecot
virtual_uid_maps = static:2000

saslfinger -s

Code:
saslfinger - postfix Cyrus sasl configuration Mon Dec 15 11:53:48 CET 2008
version: 1.0.2
mode: server-side SMTP AUTH

-- basics --
Postfix: 2.3.8
System: Debian GNU/Linux 4.0 \n \l

-- smtpd is linked to --
        libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xa2a1c000)

-- active SMTP AUTH and TLS parameters for smtpd --
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/postfix/postfix.cert.pem
smtpd_tls_key_file = /etc/postfix/postfix.key.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = sdbm:/etc/postfix/smtpd_sessionid_cache
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes


-- listing of /usr/lib/sasl2 --
total 816
drwxr-xr-x  2 root root  4096 2008-12-15 01:52 .
drwxr-xr-x 52 root root 36864 2008-12-15 00:52 ..
-rw-r--r--  1 root root 13304 2006-12-13 22:26 libanonymous.a
-rw-r--r--  1 root root   855 2006-12-13 22:26 libanonymous.la
-rw-r--r--  1 root root 12844 2006-12-13 22:26 libanonymous.so
-rw-r--r--  1 root root 12844 2006-12-13 22:26 libanonymous.so.2
-rw-r--r--  1 root root 12844 2006-12-13 22:26 libanonymous.so.2.0.22
-rw-r--r--  1 root root 15502 2006-12-13 22:26 libcrammd5.a
-rw-r--r--  1 root root   841 2006-12-13 22:26 libcrammd5.la
-rw-r--r--  1 root root 15052 2006-12-13 22:26 libcrammd5.so
-rw-r--r--  1 root root 15052 2006-12-13 22:26 libcrammd5.so.2
-rw-r--r--  1 root root 15052 2006-12-13 22:26 libcrammd5.so.2.0.22
-rw-r--r--  1 root root 46320 2006-12-13 22:26 libdigestmd5.a
-rw-r--r--  1 root root   864 2006-12-13 22:26 libdigestmd5.la
-rw-r--r--  1 root root 43040 2006-12-13 22:26 libdigestmd5.so
-rw-r--r--  1 root root 43040 2006-12-13 22:26 libdigestmd5.so.2
-rw-r--r--  1 root root 43040 2006-12-13 22:26 libdigestmd5.so.2.0.22
-rw-r--r--  1 root root 13482 2006-12-13 22:26 liblogin.a
-rw-r--r--  1 root root   835 2006-12-13 22:26 liblogin.la
-rw-r--r--  1 root root 13384 2006-12-13 22:26 liblogin.so
-rw-r--r--  1 root root 13384 2006-12-13 22:26 liblogin.so.2
-rw-r--r--  1 root root 13384 2006-12-13 22:26 liblogin.so.2.0.22
-rw-r--r--  1 root root 29300 2006-12-13 22:26 libntlm.a
-rw-r--r--  1 root root   829 2006-12-13 22:26 libntlm.la
-rw-r--r--  1 root root 28776 2006-12-13 22:26 libntlm.so
-rw-r--r--  1 root root 28776 2006-12-13 22:26 libntlm.so.2
-rw-r--r--  1 root root 28776 2006-12-13 22:26 libntlm.so.2.0.22
-rw-r--r--  1 root root 13818 2006-12-13 22:26 libplain.a
-rw-r--r--  1 root root   835 2006-12-13 22:26 libplain.la
-rw-r--r--  1 root root 13992 2006-12-13 22:26 libplain.so
-rw-r--r--  1 root root 13992 2006-12-13 22:26 libplain.so.2
-rw-r--r--  1 root root 13992 2006-12-13 22:26 libplain.so.2.0.22
-rw-r--r--  1 root root 21726 2006-12-13 22:26 libsasldb.a
-rw-r--r--  1 root root   856 2006-12-13 22:25 libsasldb.la
-rw-r--r--  1 root root 17980 2006-12-13 22:26 libsasldb.so
-rw-r--r--  1 root root 17980 2006-12-13 22:26 libsasldb.so.2
-rw-r--r--  1 root root 17980 2006-12-13 22:26 libsasldb.so.2.0.22
-rw-r--r--  1 root root 23576 2006-12-13 22:26 libsql.a
-rw-r--r--  1 root root   964 2006-12-13 22:26 libsql.la
-rw-r--r--  1 root root 23072 2006-12-13 22:26 libsql.so
-rw-r--r--  1 root root 23072 2006-12-13 22:26 libsql.so.2
-rw-r--r--  1 root root 23072 2006-12-13 22:26 libsql.so.2.0.22




-- content of /etc/postfix/sasl/smtpd.conf --
pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
log_level: 3

sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: --- replaced ---
sql_passwd: --- replaced ---
sql_database: accessdb
sql_select: SELECT password FROM mails where user='%u'

-- active services in /etc/postfix/master.cf --
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
smtp      inet  n       -       -       -       -       smtpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
        -o fallback_relay=
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}

-- mechanisms on localhost --
250-AUTH PLAIN CRAM-MD5 LOGIN DIGEST-MD5
250-AUTH=PLAIN CRAM-MD5 LOGIN DIGEST-MD5


-- end of saslfinger output --
 
... der Empfänger liegt auf dem Server.
Welche andere Möglichkeit soll dann jemand externes haben, Deinen Empfängern eine Mail zu schicken? ;) Das muss auch ohne AUTH und Verschlüsselung gehen.
Etwas anderes ist es, wenn jemand externes eine Mail an einen Empfänger, der nicht auf Deinem Server gehostet wird, senden kann -- dann hättest Du ein offenes Relay, das dringend abgestellt werden müsste.
 
also war doch ein Denkfehler ... Trotzdem kann so dann jeder der per telnet auf meinen Server kommt, an mich jederzeit E-mail senden. Was mich irritiert hat, wie es bei den grossen Provider funktionniert, denn bei denen ist ein auth erforderlich:

Code:
250-AUTH=LOGIN CRAM-MD5 PLAIN
250-AUTH CRAM-MD5 LOGIN PLAIN
250 STARTTLS
MAIL FROM: [email protected]
550 5.1.8 Only registrated user are allowed

250-AUTH PLAIN LOGIN
250-STARTTLS
MAIL FROM: [email protected]
501 Keine Authentifizierung
 
Last edited by a moderator:
Auch bei großen Providern kann dir Jeder jederzeit eine Mail senden, genauso wie jeder beliebige Mensch dir jeden Tag Post in den Briefkasten stecken kann.
 
ja, das ist mir mittlerweile klar.

Nur, bei einem Punkt bin ich mit den grossen Providern nicht vergleichbar:

bei mir kann jeder SMTP-Sitzung per telnet ausführen aber bei denen muss sich jeder zuerst authentifizieren (s. oben), obwohl beide Seiten von jedem E-Mail empfangen können. Und genau das möchte ich gern geklärt haben.

Danke
 
Wo genau muss ich mich authentifizieren um eine Mail zu senden? Ich kann dir zum. sagen wo man das nicht muss. Beispielsweise T-Online, GMX, 1und1, Strato, eigentlich überall. Sonst wäre es doch ziemlich sinnlos.
Ich glaube du hast da irgendwas noch nicht so ganz verstanden :-)
 
z.B bei den 2 grossen bei United Internet (smtp.wxx.de und smtp.gxx.net), habe ich oben die telnet Sitzungen gepostet.
 
Moment, smtp.gmx.de ist der Server, mit welchem GMX User ihre eMail versenden. Annehmen tut gmx Mails auf mx0.gmx.de
Das ist schon ein Unterschied.
 
ah ha, wir kommen der Sache schon näher.
Wenn ich dich richtig verstanden habe, geht das nur über 2 Mailservers. Den einen nur zum Empfangen konfiguriert und den anderen nur zum Senden mit auth. Ja?
 
Geht was nur über zwei Mailserver? Es kommt halt auf das Setup und den Bedarf an. Ich kenne Firmen die haben nur einen Mailserver, und Firmen, die haben 20 Mailserver.
 
nein, damit möchte ich fragen, ob die Moglichkeit die User beim Senden zur Auth zu zwingen nur dann besteht, wenn POP3 und SMTP getrennt sind.
 
die User beim Senden zur Auth zu zwingen
Das tut Dein Setup ja schon -- auch ohne, dass ein getrenntes System verwendet wird. Allerdings kommt die Fehlermeldung nicht schon nach dem MAIL FROM: (wie in dem gmx-Beispiel), sondern nach dem nächsten Schritt, wenn das RCTP TO: übermittelt wurde. Sobald eine Adresse mit einem Ziel außerhalb Deines Servers angegeben wird, kommt die Meldung "554 5.7.1 <[email protected]>: Relay access denied". Nur wenn Du vorher die AUTH-Phase durchgeführt hast, kommt diese Fehlermeldung nicht.
 
Miteinander zu tun haben sie schon, denn z.B in meinem Fall, dovecot dient als Transport für Postfix.
 
Allerdings kommt die Fehlermeldung nicht schon nach dem MAIL FROM: (wie in dem gmx-Beispiel), sondern nach dem nächsten Schritt, wenn das RCTP TO: übermittelt wurde.

Ja, das habe ich schon im voraus probiert. Zustellung nach aussen wird jedenfalls unterbunden (also kein open relay). Aber was mich nur stört ist ein telnet ohne auth, wenn SMTP und POP3/IMAP auf dem selben Server sind.
 
Bei GMX geht das ganze auch ohne Auth, dein Problem liegt darin, dass dir die Funktionsweise eines MTAs nicht klar ist.

Hier mal wies bei gmx auch geht mit telnet.

Code:
$ nc mx0.gmx.de 25
220 mx0.gmx.net GMX Mailservices ESMTP {mx051}
ehlo mail.meinserver.de
250-mx0.gmx.net GMX Mailservices
250-8BITMIME
250-ENHANCEDSTATUSCODES
250 SIZE
mail from: [email protected]
250 2.1.0 ok {mx051}
rcpt to: [email protected]
250 2.1.5 ok {mx051}
data
354 mx0.gmx.net Go ahead {mx051}
huhu telnet geht auch mitm gmx mta
.
250 2.6.0 Message accepted {mx051}
quit
221 2.0.0 GMX Mailservices {mx051}
 
Was stört Dich an dem telnet-Befehl? Ob ich nun sendmail -f, ein awk-Script, telnet oder netcat verwende (alles schon gemacht), ist egal. Der MTA sieht keinen Unterschied.
 
Back
Top