multiple section_filters
Steve Meier
smeier at webster.edu
Fri Jan 15 03:06:52 CET 2016
Well I am pleased to report I have gotten it working as required for our
environment. After taking a closer look in config.py, and adding some
additional debugging lines to gain a better understanding of the processing
of the section filters, I adjusted my script to work the way automx needed.
Here is what I found happening-
2016-01-14 16:11:31,625 DEBUG: *** Going to process the filter list-
['o365', 'wumail']
2016-01-14 16:11:31,626 DEBUG: *** Going to run filter- o365
2016-01-14 16:11:31,626 DEBUG: *** Going to run filter-
/root/getMailConfig.py ['/root/getMailConfig.py', 'test2', '|', 'egrep',
'@websteru\\.onmicrosoft\\.com$']
2016-01-14 16:11:31,668 DEBUG: Email address from filter:
test2 at auden.webster.edu
2016-01-14 16:11:31,669 DEBUG: ***Current search domain is- webster.edu
2016-01-14 16:11:31,669 DEBUG: ***New search domain is- o365
The result of this filter was not correct because test2 at auden.webster.edu
<mailto:test2 at auden.webster.edu> should have never been returned from the
filter. In particular it is clear the pipe and shell commands are not being
parsed as such.. perhaps with proper quoting and/or escaping this could be
made to work, but in my case it is simple to modify my python script rather
than try to figure that out.
Here is the result after modifying my script to accept specific test cases-
2016-01-14 16:20:19,228 DEBUG: *** Going to process the filter list-
['o365', 'wumail', 'other']
2016-01-14 16:20:19,229 DEBUG: *** Going to run filter- o365
2016-01-14 16:20:19,229 DEBUG: *** Going to run filter-
/root/getMailConfig.py ['/root/getMailConfig.py', 'O365', 'test2']
2016-01-14 16:20:19,289 DEBUG: *** Going to run filter- wumail
2016-01-14 16:20:19,289 DEBUG: *** Going to run filter-
/root/getMailConfig.py ['/root/getMailConfig.py', 'WUMAIL', 'test2']
2016-01-14 16:20:19,332 DEBUG: Email address from filter:
test2 at auden.webster.edu
2016-01-14 16:20:19,332 DEBUG: ***Current search domain is- webster.edu
2016-01-14 16:20:19,332 DEBUG: ***New search domain is- wumail
As you can see I modified my script so that I can make a simple call from
automx without the need for any "shell-like" commands. Funny thing is,
originally I thought of doing this, but I chose to more closely follow the
example instead.
Here's what it ends up looking like for me in automx.conf:
[webster.edu]
backend = filter
section_filter = o365, wumail, other
wumail = /root/getMailConfig.py WUMAIL "%u"
o365 = /root/getMailConfig.py O365 "%u"
other = /root/getMailConfig.py OTHER "%u"
[wumail]
backend = script
script = /usr/bin/python /root/getMailConfig.py WUMAIL "%u"
result_attrs = wuserver
action = settings
smtp = yes
smtp_server = smtp.webster.edu
smtp_port = 587
smtp_encryption = ssl
smtp_auth = plaintext
smtp_refresh_ttl = 6
smtp_default = yes
imap = yes
imap_server = ${wuserver}
imap_port = 995
imap_encryption = ssl
imap_auth = plaintext
imap_refresh_ttl = 6
[o365]
backend = file
action = settings
autodiscover = /usr/share/automx/o365.xml
[other]
#TODO- gracefully not do things for "OTHER"
Works great! Now it can fully handle the three use-cases required for our
environment and we will be able to prepare to build for production
implementation.
Thanks for the help and support guys!
-SteveM
Steve Meier
Enterprise Architect - Middleware Services
Webster University
470 E. Lockwood Avenue
St. Louis, MO 63119
<mailto:smeier at webster.edu> smeier at webster.edu / +1-314-246-8604
From: Steve Meier
Sent: Wednesday, January 13, 2016 16:16
To: automx-users at sys4.de
Subject: multiple section_filters
Can someone tell me if this is correct? It seems like the first filter in
the section_filter list is being applied no matter what..
[webster.edu]
backend = filter
section_filter = o365, wumail
wumail = /root/getMailConfig.py "%u" | egrep "@\w+\.webster\.edu$"
o365 = /root/getMailConfig.py "%u" | egrep "@websteru\.onmicrosoft\.com$"
[wumail]
backend = script
script = /usr/bin/python /root/getMailConfig.py "%u"
result_attrs = wuserver
action = settings
sign_mobileconfig = yes
sign_cert = /etc/nginx/server.crt
sign_key = /etc/nginx/server.key
smtp = yes
smtp_server = smtp.webster.edu
smtp_port = 587
smtp_encryption = ssl
smtp_auth = plaintext
smtp_refresh_ttl = 6
smtp_default = yes
imap = yes
imap_server = ${wuserver}
imap_port = 995
imap_encryption = ssl
imap_auth = plaintext
imap_refresh_ttl = 6
pop = no
pop_server = ${wuserver}
pop_port = 993
pop_encryption = ssl
pop_auth = plaintext
pop_refresh_ttl = 6
[o365]
backend = file
action = settings
autodiscover = /usr/share/automx/o365.xml
I have checked my getMailConfig script and it is behaving properly..
[1149] root at testVM:/usr/share/automx# /root/getMailConfig.py "test4" | egrep
"@\w+\.webster\.edu$"
[1150] root at testVM:/usr/share/automx# /root/getMailConfig.py "test4" | egrep
"@websteru\.onmicrosoft\.com$"
test4 at websteru.onmicrosoft.com <mailto:test4 at websteru.onmicrosoft.com>
[1151] root at testVM:/usr/share/automx# /root/getMailConfig.py "test3" | egrep
"@\w+\.webster\.edu$"
test3 at bailey.webster.edu <mailto:test3 at bailey.webster.edu>
[1152] root at testVM:/usr/share/automx# /root/getMailConfig.py "test3" | egrep
"@websteru\.onmicrosoft\.com$"
When o365 is first in section_filter, it is applied for both test4 and
test3. When wumail is first, it is being applied for both.
I am trying to follow information supplied here:
https://github.com/sys4/automx/blob/master/doc/txt/automx.conf.5.txt
https://github.com/sys4/automx/blob/master/src/conf/automx.conf.example-comp
lex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.sys4.de/pipermail/automx-users/attachments/20160115/7e4de854/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 19271 bytes
Desc: not available
URL: <https://mail.sys4.de/pipermail/automx-users/attachments/20160115/7e4de854/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4827 bytes
Desc: not available
URL: <https://mail.sys4.de/pipermail/automx-users/attachments/20160115/7e4de854/attachment-0001.p7s>
More information about the automx-users
mailing list