[Exim] Fwd: Exim with postgres-lookups

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Robert Gomulka
Date:  
À: exim-users
Sujet: [Exim] Fwd: Exim with postgres-lookups
Hello!
I'd like to put whole structure of my users into postgres database. I've
searched in archives and sample configuration, but found very little
information, how to do it. Well, actually I wanted to find sample
configuration which could be used with virtual domains and database
lookups.
But found no one.
So I would like to know if things, which I want to implement in my config,
will work. If those are enough or should I put anything else.
Robert
[...]
hide pgsql_servers="server/database/user/password"
# ^^^ values are good :)
[...]
local_domains ="/etc/exim/aliases/domains:pgsql;SELECT domain FROM domains"
# WHAT'S UP ??? After putting ':pgsql; SELECT ...' I could't sent mail to 
this group (server said: unknown local part exim-users in domain exim.org). 
???
# SELECT domain FROM domains gives list of existing (hosted) domains
[...]
# transport
virtual_localdelivery:
  driver = appendfile
  file =
/var/spool/mail/${substr_0_1:$local_part}/${substr_1_1:$local_part}/${local_p
art} user = $local_part
  group = mail
  mode = 0600
  create_directory = false
[...]
# directors
[...]
# the two below are for standard lookup (text files)
virtual_localuser:
    driver = aliasfile
    transport = virtual_localdelivery
    domains = lsearch;/etc/exim/aliases/domains
    file=/etc/exim/aliases/${domain}/user
    require_files = /etc/exim/aliases/${domain}/user
    search_type = lsearch


virtual_alias:
    driver = aliasfile
    domains = "lsearch;/etc/exim/aliases/domains"
    file=/etc/exim/aliases/${domain}/aliases
    search_type = "lsearch*@"
    qualify_preserve_domain


#two above are for database lookup
virtual_user_db:
    driver = aliasfile
    transport = virtual_localdelivery
    domains = "pgsql;SELECT domain FROM domains WHERE domain='$key'"
    search_type = pgsql
    query = "SELECT name FROM aliasmail \
    WHERE domain='$domain'"


virtual_alias_db:
    driver = aliasfile
    domains = "pgsql;SELECT domain FROM domains WHERE domain='$key'"
    search_type = "pgsql"
    qualify_preserve_domain
    query = "SELECT name FROM aliasmail \
    WHERE domain='$domain' AND alias='$local_part'"
# aliasmail is a view
# which looks like: user | alias | domain
[...]
That's all changes applied to working configuration with standard file
lookup. And if you ask, yes, at the moment i have to mix database lookups
with file lookups


Robert

-------------------------------------------------------