Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comm.software.mailserver > #6467 > unrolled thread

postfix access

Started byUlli Horlacher <framstag@tandem-fahren.de>
First post2021-08-03 18:39 +0000
Last post2021-08-04 13:51 +0200
Articles 4 — 3 participants

Back to article view | Back to de.comm.software.mailserver


Contents

  postfix access Ulli Horlacher <framstag@tandem-fahren.de> - 2021-08-03 18:39 +0000
    Re: postfix access Thomas Hochstein <thh@thh.name> - 2021-08-03 21:14 +0200
      Re: postfix access Matthias Andree <matthias.andree@gmx.de> - 2021-08-04 11:53 +0200
        Re: postfix access Thomas Hochstein <thh@thh.name> - 2021-08-04 13:51 +0200

#6467 — postfix access

FromUlli Horlacher <framstag@tandem-fahren.de>
Date2021-08-03 18:39 +0000
Subjectpostfix access
Message-ID<sec2heUebitL1@news.in-ulm.de>
Nachdem ich tausende von Spams via protection.outlook.com bekommen habe
und Microsoft (wie ueblich) Beschwerden ignoriert habe ich die Domain
gesperrt:

root@tandem:/etc/postfix# grep protection.outlook.com access
protection.outlook.com          521 550 E-mail rejected: protection.outlook.com is classified as a spammer domain

Das funktioniert auch :

root@tandem:/etc/postfix# grep protection.outlook.com /var/log/mail.log|head
2021-08-01 06:27:31  connect from mail-bn7nam10olkn2109.outbound.protection.outlook.com[40.92.40.109]
2021-08-01 06:27:32  NOQUEUE: reject: RCPT from mail-bn7nam10olkn2109.outbound.protection.outlook.com[40.92.40.109]: 521 5.7.1 <mail-bn7nam10olkn2109.outbound.protection.outlook.com[40.92.40.109]>: Client host rejected: 550 E-mail rejected: protection.outlook.com is classified as a spammer domain; from=<XXXXXX@msn.com> to=<framstag@flupp.org> proto=ESMTP helo=<NAM10-BN7-obe.outbound.protection.outlook.com>
2021-08-01 06:27:32  disconnect from mail-bn7nam10olkn2109.outbound.protection.outlook.com[40.92.40.109] ehlo=2 starttls=1 mail=1 rcpt=0/1 rset=1 commands=5/6
2021-08-01 06:37:34  connect from mail-mw2nam10olkn2075.outbound.protection.outlook.com[40.92.42.75]
2021-08-01 06:37:35  NOQUEUE: reject: RCPT from mail-mw2nam10olkn2075.outbound.protection.outlook.com[40.92.42.75]: 521 5.7.1 <mail-mw2nam10olkn2075.outbound.protection.outlook.com[40.92.42.75]>: Client host rejected: 550 E-mail rejected: protection.outlook.com is classified as a spammer domain; from=<XXXXXX@msn.com> to=<framstag@flupp.org> proto=ESMTP helo=<NAM10-MW2-obe.outbound.protection.outlook.com>
2021-08-01 06:37:35  disconnect from mail-mw2nam10olkn2075.outbound.protection.outlook.com[40.92.42.75] ehlo=2 starttls=1 mail=1 rcpt=0/1 commands=4/5
2021-08-01 06:47:37  connect from mail-dm6nam10olkn2068.outbound.protection.outlook.com[40.92.41.68]
2021-08-01 06:47:38  NOQUEUE: reject: RCPT from mail-dm6nam10olkn2068.outbound.protection.outlook.com[40.92.41.68]: 521 5.7.1 <mail-dm6nam10olkn2068.outbound.protection.outlook.com[40.92.41.68]>: Client host rejected: 550 E-mail rejected: protection.outlook.com is classified as a spammer domain; from=<XXXXXX@msn.com> to=<framstag@flupp.org> proto=ESMTP helo=<NAM10-DM6-obe.outbound.protection.outlook.com>
2021-08-01 06:47:38  disconnect from mail-dm6nam10olkn2068.outbound.protection.outlook.com[40.92.41.68] ehlo=2 starttls=1 mail=1 rcpt=0/1 commands=4/5


Leider ist mir genau DIESER Absender XXXXXX@msn.com wichtig, den moechte
ich gerne durchlassen.

http://www.postfix.org/access.5.html

Also hab ich noch ins access file geschrieben:

root@tandem:/etc/postfix# grep XXXXXX access
XXXXXX@msn.com             OK

Und danach auch "make access.db" aufgerufen:

root@tandem:/etc/postfix# ll access*
-rw-r--r-- root root  62,214 2021-08-02 09:44:45 access
-rw-r--r-- root root 151,552 2021-08-02 09:44:52 access.db
-rw-r--r-- root root      20 2015-05-05 17:29:28 access_ok
-rw-r--r-- root root  12,288 2015-05-05 17:33:04 access_ok.db

root@tandem:/etc/postfix# grep access main.cf
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access_ok
                            check_client_access hash:/etc/postfix/access
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/access

Leider funktioniert das nicht, XXXXXX@msn.com wird weiterhin
abgewiesen, egal ob die OK-Regel am Anfang oder Ende vom access file steht.

Ich hab dann noch die OK-Regel nach access_ok geschrieben:

root@tandem:/etc/postfix# cat access_ok
127.0.0.1               OK
XXXXXX@msn.com          OK

root@tandem:/etc/postfix# make
postmap hash:access
postmap hash:access_ok

Wird allerdings immer noch abgewiesen:

root@tandem:/etc/postfix# grep XXXXXX /var/log/mail.log|tail -2
2021-08-02 10:10:28  NOQUEUE: reject: RCPT from mail-mw2nam08olkn2041.outbound.protection.outlook.com[40.92.46.41]: 521 5.7.1 <mail-mw2nam08olkn2041.outbound.protection.outlook.com[40.92.46.41]>: Client host rejected: 550 E-mail rejected: protection.outlook.com is classified as a spammer domain; from=<XXXXXX@msn.com> to=<framstag@flupp.org> proto=ESMTP helo=<NAM04-MW2-obe.outbound.protection.outlook.com>
2021-08-02 10:12:17  NOQUEUE: reject: RCPT from mail-mw2nam08olkn2105.outbound.protection.outlook.com[40.92.46.105]: 521 5.7.1 <mail-mw2nam08olkn2105.outbound.protection.outlook.com[40.92.46.105]>: Client host rejected: 550 E-mail rejected: protection.outlook.com is classified as a spammer domain; from=<XXXXXX@msn.com> to=<framstag@tandem-fahren.de> proto=ESMTP helo=<NAM04-MW2-obe.outbound.protection.outlook.com>

Was hab ich uebersehen oder falsch gemacht?


-- 
+ Ulli Horlacher + framstag@tandem-fahren.de + http://tandem-fahren.de/ +

[toc] | [next] | [standalone]


#6468

FromThomas Hochstein <thh@thh.name>
Date2021-08-03 21:14 +0200
Message-ID<dcsm.20210803211407.2145@scatha.ancalagon.de>
In reply to#6467
Ulli Horlacher schrieb:

> Subject: postfix access

Disclaimer: Ich kenne mich mit Postfix praktisch nicht aus; ich habe
nur die Doku gelesen.

> Was hab ich uebersehen oder falsch gemacht?

| Delayed evaluation of SMTP access restriction lists 
[...]
|  Restriction lists are still evaluated in the proper order of (client,
|  helo, etrn) or (client, helo, sender, relay, recipient, data, or
|  end-of-data) restrictions. When a restriction list (example: client)
|  evaluates to REJECT or DEFER the restriction lists that follow
|  (example: helo, sender, etc.) are skipped. 
<http://www.postfix.org/SMTPD_ACCESS_README.html>

Wenn ich das richtig verstehe, wird zuerst smtpd_client_restrictions
ausgewertet. Das führt bei Dir zu einem REJECT wegen des Hostnamens
(Reverse-Lookups) der IP-Afresse; damit ist das Thema durch. Die
normalerweise später geprüften smtpd_sender_restrictions werden gar
nicht mehr ausgewertet; erst da ist aber das MAIL FROM überhaupt
bekannt. Man kann also bei einem Block auf IP-Ebene Ausnahmen für
bestimmte IP-Adressen vorsehen, aber nicht bestimmte Absenderadressen
ausnehmen, weil die zu diesem Zeitpunkt noch nicht bekannt sind und
die Entscheidung bei einem REJECT/DEFER endgültig fällt.

Ob und wie es mit Postfix möglich ist, Mails von bestimmten IPs (hier:
IPs mit bestimmtem Reverse-Lookup) nicht zu rejecten, sondern das nur
vorzumerken, so dass man dann später den MAIL FROM auswerten und
bestimmte Mails abweichend doch akzeptieren kann, kann ich nicht
sagen; auf Anhieb habe ich jedenfalls keine einfache Lösung in der
Doku gefunden. Vermutlich bräuchte man so etwas wie einen Milter?

-thh
-- 
Informationen rund um E-Mail und Mailserver:
<https://th-h.de/net/mail/>

[toc] | [prev] | [next] | [standalone]


#6469

FromMatthias Andree <matthias.andree@gmx.de>
Date2021-08-04 11:53 +0200
Message-ID<imv6bvFp4dsU1@mid.dfncis.de>
In reply to#6468
Am 03.08.21 um 21:14 schrieb Thomas Hochstein:
> Ulli Horlacher schrieb:
> 
>> Subject: postfix access
> 
> Disclaimer: Ich kenne mich mit Postfix praktisch nicht aus; ich habe
> nur die Doku gelesen.
> 
>> Was hab ich uebersehen oder falsch gemacht?
> 
> | Delayed evaluation of SMTP access restriction lists 
> [...]
> |  Restriction lists are still evaluated in the proper order of (client,
> |  helo, etrn) or (client, helo, sender, relay, recipient, data, or
> |  end-of-data) restrictions. When a restriction list (example: client)
> |  evaluates to REJECT or DEFER the restriction lists that follow
> |  (example: helo, sender, etc.) are skipped. 
> <http://www.postfix.org/SMTPD_ACCESS_README.html>
> 
> Wenn ich das richtig verstehe, wird zuerst smtpd_client_restrictions
> ausgewertet. Das führt bei Dir zu einem REJECT wegen des Hostnamens
> (Reverse-Lookups) der IP-Afresse; damit ist das Thema durch. Die
> normalerweise später geprüften smtpd_sender_restrictions werden gar
> nicht mehr ausgewertet; erst da ist aber das MAIL FROM überhaupt
> bekannt. Man kann also bei einem Block auf IP-Ebene Ausnahmen für
> bestimmte IP-Adressen vorsehen, aber nicht bestimmte Absenderadressen
> ausnehmen, weil die zu diesem Zeitpunkt noch nicht bekannt sind und
> die Entscheidung bei einem REJECT/DEFER endgültig fällt.
> 
> Ob und wie es mit Postfix möglich ist, Mails von bestimmten IPs (hier:
> IPs mit bestimmtem Reverse-Lookup) nicht zu rejecten, sondern das nur
> vorzumerken, so dass man dann später den MAIL FROM auswerten und
> bestimmte Mails abweichend doch akzeptieren kann, kann ich nicht
> sagen; auf Anhieb habe ich jedenfalls keine einfache Lösung in der
> Doku gefunden. Vermutlich bräuchte man so etwas wie einen Milter?

Thomas' Begründung passt - allerdings blockiert protection.outlook.com
auch legitime Firmenabsender... wenn Ulli das braucht?

Für die UND-Verknüpfung zweier Checks in so einfachen Fällen kann man
smtpd_restriction_classes [1] verwenden; wenn's aber viele Regeln gibt,
ist ein externer policy-daemons wie z. B. https://postfwd.org/ wohl
handhabbarer.
[1] http://www.postfix.org/RESTRICTION_CLASS_README.html

Entwurf für restriction classes:

1. In /etc/postfix/main.cf:

smtpd_restriction_classes = outlook_com
outlook_com = check_sender_access
		  hash:/etc/postfix/access_outlook_com_permitted
	      static:{554 5.7.1 E-mail rejected: protection.outlook.com
		  is classified as a spammer domain}
smtpd_sender_restrictions =
	...
	reject_unauth_destination
	check_client_access hash:/etc/postfix/access
	...

2. In /etc/postfix/access:
protection.outlook.com	outlook_com

3. In /etc/postfix/access_outlook_com_permitted:
XXXXXX@msn.com          OK

4. das übliche postmap/postfix reload.

Einschränkung: Das alles unterstellt, dass von Sendern mit Hostnamen
*outlook.com keine gefälschten @msn.com-Absender kommen können.

Hinweis: Das 521 550 in Ullis Originalkonfiguration ist Grütze. Weder
braucht's bei outlook.com 521 + drop, noch würde Postfix das 550
verwenden (siehe Logs - es antwortet ja mit 521 5.7.1 und übernimmt die
550 als Payload-Text).

[toc] | [prev] | [next] | [standalone]


#6470

FromThomas Hochstein <thh@thh.name>
Date2021-08-04 13:51 +0200
Message-ID<dcsm.20210804135104.2155@scatha.ancalagon.de>
In reply to#6469
Matthias Andree schrieb:

> Thomas' Begründung passt - allerdings blockiert protection.outlook.com
> auch legitime Firmenabsender... wenn Ulli das braucht?

Naja, Framstag ist lange genug im Netz, dass ich unterstelle, dass er
weiß, was er da tut (und dass natürlich viele Anbieter, Firmen, auch
Behörden im weiteren Sinne die Mailinfrastruktur von entweder Google
oder Microsofrt nutzen).

> Für die UND-Verknüpfung zweier Checks in so einfachen Fällen kann man
> smtpd_restriction_classes [1] verwenden; [...]

Wieder was gelernt, danke! :)

-thh
-- 
Informationen rund um E-Mail und Mailserver:
<https://th-h.de/net/mail/>

[toc] | [prev] | [standalone]


Back to top | Article view | de.comm.software.mailserver


csiph-web