From n.messerschmidt at buero.link-m.de Thu Sep 15 18:03:05 2016 From: n.messerschmidt at buero.link-m.de (Nicki Messerschmidt, Linksystem Muenchen GmbH) Date: Thu, 15 Sep 2016 18:03:05 +0200 Subject: Config example for multiple domains with different settings In-Reply-To: <593A46CC-B6ED-4A64-9193-41E5DE5298DD@roessner-network-solutions.com> References: <593A46CC-B6ED-4A64-9193-41E5DE5298DD@roessner-network-solutions.com> Message-ID: <5c7c0df4-39eb-b31a-ed45-9f8231f155f9@buero.link-m.de> Christian R??ner schrieb: >> Am 03.08.2016 um 12:17 schrieb Nicki Messerschmidt, Linksystem >> Muenchen GmbH : >> >> [DEFAULT] action = settings account_type = email > > You can use this section for default settings that are mapped to > _all_ other sections. So everything you specify here, will also > exist in any other section. Os this what you looked for? Not quite. I was looking for your secound example. :) > Another way is to specify follow statements: > > [my_wonderful_settings] backend = static_append foo = bar {...} Is there a way to have these settings dynamic? Like a sql query or a filter? I want to have several generic sections that are referenced to several domains. Most of the time I have not direct mapping of the username to the eMail adress. And I don't quite understand how the filter system works. I found the thread https://is.gd/xb8KlB , but it seems that there was no solution for the same problem. So right now I have the following working: ######### start config ######### [DEFAULT] action = settings account_type = email sign_mobileconfig = yes sign_cert = /etc/ssl/certs/cert.pem sign_key = /etc/ssl/private/key.pem #main server [global] backend = sql host = mysql://user:pass at host/db query = SELECT user,email_address from lm_email_address where email_address='%s'; result_attrs = user, email_address account_name = ${email_address} account_name_short = ${user} # all main server setting <...> [main-domain.tld] backend = global [second-domain.tld] backend = global [settings_second_server] backend = static_append #second server settings username = email adress <...> [third_domain.tld] follow = settings_second_server #### NOT WORKING - Start #### testing section with dynamic username from email adress [settings_third_server] backend = static_append #third server static settings no username <...> [dynamic-domain.tld] follow = settings_third_server backend = filter username = /usr/bin/automx/third_server_filter.sh %s #result: username #### NOT WORKING - End ######### end config ######### But the above does not work. How can this be achieved? Cheers Nicki -- Linksystem Muenchen GmbH We make the Net work Ludwig-Richter-Str. 29 Tel. 089 / 890 518-0 80687 Muenchen Fax 089 / 890 518-77 info at link-m.de http://www.link-m.de Handelsregister: Amtsgericht Muenchen, HRB 129182 Geschaeftsfuehrung: Christine Wittig, Mathias Zunterer PGP Keys: https://www.link-m.de/pgp/ From n.messerschmidt at buero.link-m.de Fri Sep 16 11:36:46 2016 From: n.messerschmidt at buero.link-m.de (Nicki Messerschmidt, Linksystem Muenchen GmbH) Date: Fri, 16 Sep 2016 11:36:46 +0200 Subject: Config example for multiple domains with different settings In-Reply-To: <6DEFE2DE-E90B-40B9-AD49-A3172B6C2971@roessner-network-solutions.com> References: <593A46CC-B6ED-4A64-9193-41E5DE5298DD@roessner-network-solutions.com> <5c7c0df4-39eb-b31a-ed45-9f8231f155f9@buero.link-m.de> <6DEFE2DE-E90B-40B9-AD49-A3172B6C2971@roessner-network-solutions.com> Message-ID: <3b9cb80e-f6ca-56b9-697f-4579abccdd3b@buero.link-m.de> Christian R??ner schrieb: > Unfortunately I am on vacation right now, so I will be back on 10th Oct. I wish you a nice vacation and thanks for answering my mail even on vacation time. :) > You can do a lot of dynamic stuff in automx. > > If I remember correctly, you can define variables for "follow = someprefix.${sectionname}" > > where sectionname is your domain. > > [someprefix.example.com] > backend = static_append > > "someprefix" is important here, as you do not want to have this section map a real domain! It is like a placeholder. The structure looks like this: > > [DEFAULT] > ... > > [global] > backend = sql > result_attrs = user, email_address, thedomain > ... > follow = foo.${thedomain} > > [foo.example1.com] > backend = static_append > ... > > [foo.example2.com] > backend = static_append > ... > > [foo.example3.com] > backend = static_append > ... But that means, that I still have only one datasource. I'd like to query multiple datasources depending on the domain. Some domains have their info in a sql database, others are in a xml file, some are static. I thought I could define a filter on a datasource per domain. Like [domain.tld] follow = generic_mail_settings_1 username = `grep $mailaddr data.csv|awk '{print $1}'` > Maybe something like this. You can combine this with DEFAULT. So put all common setting into DEFAULT. Define a "global" section with you SQL queries and use "follow" with dynamic-var to switch to special backends. Let me know if that worked for you. For me a backend is the datasource that holds the username, mailaddr mapping. The settings (hostname, ports, etc.) can be "followed". > I need to dive deeper into it, when I am back. Or someone else here on the list might be so kind and help you in the meantime :-) Thanks in advance. Cheers Nicki -- Linksystem Muenchen GmbH We make the Net work Ludwig-Richter-Str. 29 Tel. 089 / 890 518-0 80687 Muenchen Fax 089 / 890 518-77 info at link-m.de http://www.link-m.de Handelsregister: Amtsgericht Muenchen, HRB 129182 Geschaeftsfuehrung: Christine Wittig, Mathias Zunterer PGP Keys: https://www.link-m.de/pgp/