natan via Postfix-users: > 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
from_check.py should receive requests and send responses as described in https://www.postfix.org/SMTPD_POLICY_README.html#protocol: 1 - Receive lines formatted as name=value, followed by an empty line. 2 - Reply with ONE LINE containing action=name-of-action, followed by an empty line. 3) It should not terminate, but wait for another request, and terminate after it receives EOF. > 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() This program does not do [1]: reply after an empty input line. Instead, it replies after every input line. This program does not do [2]: reply with action=value. This program does not do [3]: terminate after EOF on input. Instead, it goes into an infinite loop, printing empty lines. You should test your program without Postfix first. Wietse _______________________________________________ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org