Univention Bugzilla – Bug 53463
[UCS 5.0] listfilter.py does not respect use_sasl_username=yes/no
Last modified: 2022-03-16 14:05:00 CET
+++ This bug was initially created as a clone of Bug #46176 +++ listfilter.py does not respect use_sasl_username=yes/no. If the variable is set to yes, the check fails because attr["sender"] and attr["sasl_username"] are empty. This only affects the case, where --test is used. root@master41:~# ucr set mail/postfix/policy/listfilter/use_sasl_username=yes Setting mail/postfix/policy/listfilter/use_sasl_username Multifile: /etc/postfix/main.cf File: /etc/listfilter.secret Multifile: /etc/postfix/master.cf root@master41:~# /usr/share/univention-mail-postfix/listfilter.py -t -s user1mail@nstx.local -r grp1@nstx.local -b dc=nstx,dc=local listfilter: sender=None recipient='grp1@nstx.local' check_sasl_username=True listfilter: attrib={'recipient': 'grp1@nstx.local', 'sender': 'user1mail@nstx.local'} listfilter: allowed_user_dns=['uid=user1,cn=users,dc=nstx,dc=local'] allowed_group_dns=[] action=REJECT Access denied for not authenticated sender to restricted list grp1@nstx.local root@master41:~# ucr set mail/postfix/policy/listfilter/use_sasl_username=no Setting mail/postfix/policy/listfilter/use_sasl_username Multifile: /etc/postfix/main.cf File: /etc/listfilter.secret Multifile: /etc/postfix/master.cf root@master41:~# /usr/share/univention-mail-postfix/listfilter.py -t -s user1mail@nstx.local -r grp1@nstx.local -b dc=nstx,dc=local listfilter: sender='user1mail@nstx.local' recipient='grp1@nstx.local' check_sasl_username=False listfilter: attrib={'recipient': 'grp1@nstx.local', 'sender': 'user1mail@nstx.local'} listfilter: allowed_user_dns=['uid=user1,cn=users,dc=nstx,dc=local'] allowed_group_dns=[] listfilter: user_dn='uid=user1,cn=users,dc=nstx,dc=local' action=DUNNO allowed per user dn --- a/mail/univention-mail-postfix/share/listfilter.py +++ b/mail/univention-mail-postfix/share/listfilter.py @@ -191,6 +191,7 @@ if options.test: parser.print_help() sys.exit(1) attr["sender"] = options.sender + attr["sasl_username"] = options.sender attr["recipient"] = options.recipient action = listfilter(attr) print("action={}\n".format(action))
Applied same fix as in Bug #46176 on a new feature branch troehmey/bug53463_fix_listfilter_test_5.0 rebased from 5.0-0 with 4eb5188cd1 Bug #53463: fix listfilter test with use_sasl_username
Please don't forget to set the Target Milestone. I created a merge request for your branch, so it's easier to comment: https://git.knut.univention.de/univention/ucs/-/merge_requests/106
REOPEN: the changes are not python 3 compatible and break.
Thanks for the remarks! I commited a fix with [troehmey/bug53463_fix_listfilter_test_5.0] 7189b154eb Bug #53463: replace sys.stderr with print [troehmey/bug53463_fix_listfilter_test_5.0] 32aa8f2c2c Bug #53463: fix listfilter test with use_sasl_username
As requested merged & build [5.0-0] 6eb06b1914 Bug #53463: add fix to advisory [5.0-0] 79dc49a713 Bug #53463: remove docbook in advisory [5.0-0] db80bbf61d Bug #53463: changelog and advisory [5.0-0] aa7561bfae Bug #53463: replace sys.stderr with print [5.0-0] 4dd2eb2db5 Bug #53463: fix listfilter test with use_sasl_username Package: univention-mail-postfix Version: 14.0.1-2A~5.0.0.202106300946 Branch: ucs_5.0-0 Scope: errata5.0-0
OK: code review OK: package update OK: advisory
<https://errata.software-univention.de/#/?erratum=5.0x39>
No QA contact set at the bug. The bug introduced: mail/univention-mail-postfix/share/listfilter.py|214 col 37 error| undefined name 'att' [F821]