Config example for multiple domains with different settings

Nicki Messerschmidt, Linksystem Muenchen GmbH n.messerschmidt at buero.link-m.de
Fri Mar 10 12:40:19 CET 2017


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I still don't get how I can achieve multiple filter/sql based domains
within one config file.

I have attached my current config file. All domains that use the
global and static settings work fine.
Now I want to add another domain that needs a filter (nosfo.de). But I
am not able to create a config that produces any sane settings.

The domain nosfo.de should follow the static settings of the section
settings.mail_ewh_de but should look up the username using a filter.

Can you help me out with this one?


Cheers
Nicki


Christian Rößner schrieb:
> Hi,
> 
> sorry for my delay.
> 
> Unfortunately I am on vacation right now, so I will be back on
> 10th Oct.
> 
> 
>> Am 15.09.2016 um 18:03 schrieb Nicki Messerschmidt, Linksystem 
>> Muenchen GmbH <n.messerschmidt at buero.link-m.de>:
>> 
>> Christian Rößner schrieb:
>>>> Am 03.08.2016 um 12:17 schrieb Nicki Messerschmidt, 
>>>> Linksystem Muenchen GmbH <n.messerschmidt at buero.link-m.de>:
>>>> 
>>>> [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@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?
> 
> 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 ...
> 
> 
> 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.
> 
> 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 :-)
> 
> Christian
> 


- -- 
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/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAljCkKIACgkQ6zWc+bXuIEPgGACgyRcUDO5j1U57qhWFWqpZzDpU
hDsAniiYt5uVVofHfShw6ar3Hi24INOZ
=v/hX
-----END PGP SIGNATURE-----
-------------- next part --------------
# file: /etc/automx.conf

[automx]
provider = lm.de
domains = *

debug = yes
logfile = /var/log/automx/automx.log

# Protect against DoS
memcache = 127.0.0.1:11211
memcache_ttl = 1
client_error_limit = 20
rate_limit_exception_networks = 127.0.0.0/8, ::1/128


[DEFAULT]
action = settings
account_type = email
# If you want to sign mobileconfig profiles, enable these options. Make sure
# that your webserver has proper privileges to read the key. The cert file
# must contain the server certificate and all intermediate certificates. You
# can simply concatenate these certificates.
sign_mobileconfig = yes
sign_cert = /etc/ssl/certs/cert.pem
sign_key = /etc/ssl/private/key.pem

[global]
backend = sql
host = mysql://username:password@mysql.host/database
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}

# The DEFAULT section is always merged into each other section. Each section
# can overwrite settings done here.

smtp = yes
smtp_server = mail.lm.de
smtp_port = 587
smtp_encryption = starttls
smtp_auth = plaintext
smtp_auth_identity = ${user}
smtp_refresh_ttl = 6
smtp_default = yes

imap = yes
imap_server = mail.lm.de
imap_port = 993
imap_encryption = ssl
imap_auth_identity = ${user}
imap_auth = plaintext
imap_refresh_ttl = 6

pop = yes
pop_server = mail.lm.de
pop_port = 995
pop_encryption = ssl
pop_auth_identity = ${user}
pop_auth = plaintext
pop_refresh_ttl = 6

[lm.de]
backend=global

[fv.de]
backend = static
account_name = %s
account_name_short = %u

smtp = yes
smtp_server = webmail.fv.de
smtp_port = 587
smtp_encryption = starttls
smtp_auth = plaintext
smtp_auth_identity = %u
smtp_refresh_ttl = 6
smtp_default = yes

imap = yes
imap_server = webmail.fv.de
imap_port = 993
imap_encryption = ssl
imap_auth_identity = %u
imap_auth = plaintext
imap_refresh_ttl = 6

pop = yes
pop_server = webmail.fv.de
pop_port = 995
pop_encryption = ssl
pop_auth_identity = %u
pop_auth = plaintext
pop_refresh_ttl = 6

[ispconfig_lm_de]
backend = static_append
account_name = %s
account_name_short = %u
smtp = yes
smtp_server = ispconfig.lm.de
smtp_port = 587
smtp_encryption = starttls
smtp_auth = plaintext
smtp_auth_identity = %s
smtp_refresh_ttl = 6
smtp_default = yes

imap = yes
imap_server = ispconfig.lm.de
imap_port = 993
imap_encryption = ssl
imap_auth_identity = %s
imap_auth = plaintext
imap_refresh_ttl = 6

pop = yes
pop_server = ispconfig.lm.de
pop_port = 995
pop_encryption = ssl
pop_auth_identity = %s
pop_auth = plaintext
pop_refresh_ttl = 6

[settings.mail_ewh_de]
backend = static
account_name = %s
account_name_short = %u
smtp = yes
smtp_server = mail.ewh.de
smtp_port = 587
smtp_encryption = starttls
smtp_auth = plaintext
smtp_auth_identity = %s
smtp_refresh_ttl = 6
smtp_default = yes

imap = yes
imap_server = mail.ewh.de
imap_port = 993
imap_encryption = ssl
imap_auth_identity = %s
imap_auth = plaintext
imap_refresh_ttl = 6

pop = yes
pop_server = mail.ewh.de
pop_port = 995
pop_encryption = ssl
pop_auth_identity = %s
pop_auth = plaintext
pop_refresh_ttl = 6

[kinderbuero-landsberg.de]
backend = static
follow = ispconfig_lm_de

[nosfo.de]
backend = filter
username = /usr/local/sbin/automx/postfix_virtual_grep %s
follow = settings.mail_ewh_de




More information about the automx-users mailing list