Hi
I'm trying to write something like DMARC in Python to reject if the from and return-path for the selected domain are different

Because these similar solutions like vrfydmn (in Perl) are not very user-friendly

W dniu 28.11.2024 o 13:57, natan via Postfix-users pisze:
Hi
I have some problem with comunications postfix + python

in main.cf:
...
smtpd_restriction_classes=testowy
testowy=check_policy_service { unix:private/testowy, timeout=4s, default_action=DUNNO }

smtpd_recipient_restrictions =
        check_recipient_access inline:{{testdomain.ltd=testowy}},
#beacuse i i try run for only one domain "testdomain.ltd"

in master.cf:
testowy unix - n n - - spawn user=nobody argv=/usr/local/sbin/from_check.py

example script who doing nothing /usr/local/sbin/from_check.py:

#!/usr/bin/python3.9
import sys

def main():
    while True:
        input_line = sys.stdin.readline().strip()
        if not input_line:
            print()
            sys.stdout.flush()
            continue
        print("DUNNO")  # REJECT, PERMIT, DUNNO
        sys.stdout.flush()

if __name__ == "__main__":
    main()

in log I get:
Nov 28 13:54:15 mx postfix/smtpd[2953675]: warning: missing attribute action in input from private/testowy Nov 28 13:54:16 mx postfix/spawn[2953684]: warning: command /usr/local/sbin/from_check.py exit status 120 Nov 28 13:54:16 mx postfix/smtpd[2953675]: warning: missing attribute action in input from private/testowy Nov 28 13:54:16 mx postfix/smtpd[2953675]: warning: problem talking to server private/testowy: Success

I think the current script doesn't work because it doesn't read data from Postfix or respond in the expected format.
Does anyone have an example of what it should look like?

--

_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

--

_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to