Portál AbcLinuxu, 25. května 2024 18:08


Dotaz: Autorizase SASL a Postfix

Petr Ullmann avatar 29.10.2010 13:12 Petr Ullmann | skóre: 19 | blog: Linuxový bloček | Praha - Kobylisy
Autorizase SASL a Postfix
Přečteno: 342×
Odpovědět | Admin
Zdravím, měl bych ještě jeden problém. Kombinoval jsem návod z AbcLinuxu, inspiraci z kofiguračních souborů původního serveru a inspiraci z netu, abych dal dohromady smtp autorizaci. Došel jsem do stádia, kdy autorizace funguje. Tím myslím, že pokud daný účet na server existuje, tak se autorizuje. Pokud ne, je spojení odmítnuto. Pokud ale v poštovním klientu nastavím, aby žádnou autorizaci neposílal, tak mail server stejně odešle.

Otázka tedy je, jak udělat, aby při anonymním příhlášení spojení taky odmítnul.

Už do toho koukám celkem dlouho, takže možná něco pořád přehlížím.

/etc/sasl2/smtpd.conf
pwcheck_method: authdaemond
log_level: 3
mech_list: plain login
authdaemond_path:/var/run/authdaemon.courier-imap/socket
Výše uvedená autorizace funguje pouze pokud do adresáře /var/run/authdaemon.courier-imap je pro skupinu other právo spouštět. Což asi taky není úplně v pořádku.

/etc/postfix/master.cf
#
# Postfix master process configuration file.  For details on the format
# of the file, see the Postfix master(5) manual page.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
amavis    unix  -       -       n       -       5       smtp
  -o smtp_data_done_timeout=1200
  -o smtp_send_xforward_command=yes
  -o disable_dns_lookups=yes
  -o max_use=20
submission inet n      -       n       -       -       smtpd
     -o smtpd_etrn_restrictions=reject
     -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps    inet  n       -       n       -       -       smtpd -o smtpd_tls_wrappermode=yes
#  -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission   inet    n       -       n       -       -       smtpd
#  -o smtpd_etrn_restrictions=reject
#  -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
#628      inet  n       -       n       -       -       qmqpd

pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
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
smtp      unix  -       -       n       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       n       -       -       smtp
	-o fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     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
127.0.0.1:10025 inet	n	-	n	-	-	smtpd
  -o content_filter=
  -o smtpd_delay_reject=no
  -o smtpd_client_restrictions=permit_mynetworks,reject
  -o smtpd_helo_restrictions=
  -o smtpd_sender_restrictions=
  -o smtpd_recipient_restrictions=permit_mynetworks,reject
  -o smtpd_data_restrictions=reject_unauth_pipelining
  -o smtpd_end_of_data_restrictions=
  -o smtpd_restriction_classes=
  -o mynetworks=127.0.0.0/8
  -o smtpd_error_sleep_time=0
  -o smtpd_soft_error_limit=1001
  -o smtpd_hard_error_limit=1000
  -o smtpd_client_connection_count_limit=0
  -o smtpd_client_connection_rate_limit=0
  -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings
  -o local_header_rewrite_clients=
  -o local_recipient_maps=
  -o relay_recipient_maps=
scache	  unix  -       -       n       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
cyrus	    unix	-	      n	      n	      -	      -	      pipe
  user=cyrus argv=/usr/lib/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
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=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
# do not filter locally delivered mail when USE_AMAVIS=yes
#  (don't set content_filter=vscan in main.cf)
#vscan     unix  -       n       n       -       10       pipe
#  user=vscan argv=/usr/sbin/amavis ${sender} ${recipient}
procmail  unix  -       n       n       -       -       pipe
  flags=R user=nobody argv=/usr/bin/procmail -t -m /etc/procmailrc ${sender} ${recipient}
retry	  unix	-	-	n	-	-	error
proxywrite unix	-	-	n	-	1	proxymap
/etc/postfix/main.cf (část týkající se sasl)
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd

smtpd_client_restrictions = permit_mynetworks,
			    permit_sasl_authenticated,
			    reject_unknown_sender_domain,
			    check_sender_access hash:/etc/postfix/access,
			    reject_rhsbl_client blackhole.securityusage.com,
			    reject_rbl_client sbl-xbl.spamhaus.org,
			    reject_rbl_client relays.mail-abuse.org,
			    reject_rbl_client dialups.mail-abuse.org,
			    reject_rbl_client blackholes.mail-abuse.org,
			    reject_rbl_client blackholes.easynet.nl,
			    reject_rbl_client bl.spamcop.net,
			    reject_rbl_client dnsbl.njabl.org,
			    permit

smtpd_recipient_restrictions = permit_mynetworks,
			       reject_non_fqdn_recipient,
			       permit_sasl_authenticated,
			       reject_unknown_recipient_domain,
			       check_recipient_access hash:/etc/postfix/access,
			       reject_unauth_destination,
			       permit

smtpd_sender_restrictions = permit_mynetworks,
			    permit_sasl_authenticated,
			    reject_non_fqdn_sender,
			    reject_unknown_sender_domain,
			    check_sender_access hash:/etc/postfix/access,
			    reject
Budu zase rád za každou radu a nasměrování.

Díky moc.
Forza Linux!!!
Nástroje: Začni sledovat (0) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

29.10.2010 13:39 Jirka
Rozbalit Rozbalit vše Re: Autorizase SASL a Postfix
Odpovědět | | Sbalit | Link | Blokovat | Admin
nebude to jako tento problem s SASL+Postfix?
Petr Ullmann avatar 2.11.2010 10:14 Petr Ullmann | skóre: 19 | blog: Linuxový bloček | Praha - Kobylisy
Rozbalit Rozbalit vše Re: Autorizase SASL a Postfix
Tak problém vyřešen. Možné ne tak elegantně, ale zatím to funguje. Z konfigurace main.cf jsem vyhodil permit_mynetwork a už bez autorizace nepošle nikam. Jestli bude mít někdo ještě jiný lepší návrh tak sem s ním :-) Byl to akt zoufalství, který vyšel :-)
Forza Linux!!!

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.