Neil Briscoe
2006-Dec-06 16:01 UTC
[Pkg-exim4-users] Obtaining Local Domains from a mysql database.
Currently, the way Debian-Exim4 works is that it uses the dc_other_hosts entry from update-exim4.conf.conf file to determine which domains it will accept mail for. I have a customer who wants me to configure things so that the domains it will accept mail for are contained in a table of a mysql database. I have, therefore, installed exim4-daemon-heavy so that I have those facilities. Whilst I think I can work out the code necessary for the routers (they only need a modified local_delivery and a modified aliases), I''m not certain how to get Exim4 to obtain its view of accepted local domains from a mysql table. Yes Marc, I have read chapter 9. ;-)) Regards Neil ------------------------------------------------------------------------------------ Scanned for viruses, spam and offensive content by CensorNet MailSafe Professional Web & E-mail Filtering from www.censornet.com
Marc Haber
2006-Dec-06 16:54 UTC
[Pkg-exim4-users] Obtaining Local Domains from a mysql database.
On Wed, Dec 06, 2006 at 02:53:00PM +0000, Neil Briscoe wrote:> Yes Marc, I have read chapter 9. ;-))In that case, I''ll have to refer you to the other people on this list ;) Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don''t trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
Alex King
2006-Dec-07 05:54 UTC
[Pkg-exim4-users] Obtaining Local Domains from a mysql database.
In exim3 there was a built in distinction between local domains and non-local domains. Local domains were handled by directors, while non-local domains were handled by routers. In exim 4 this distinction was removed, there is no longer a fundamental difference between local and non-local domains. Both are all handled by routers and directors were removed. However, it is still often a useful distinction, and the standard configuration files that ship with Debian create a domainlist (local_domains) which specify which domains are local. If you simply want to add additional domains to local_domains, you can re-define that domain list by setting the MAIN_LOCAL_DOMAINS macro to include a mysql lookup. The local_domains macro is used in two main roles. It is used to determine which routers to run (ie, to run the equivalent of exim3 directors for local addresses), and it is also used in ACL statements. ACL statements are mainly used at SMTP time to accept or reject messages and to prevent unauthorised use of your server (ie, so exim doesn''t act as an open relay). If you already have your routers sotred out, it is ACLs you need to work on now, particularly the acl_check_rcpt acl. Instead of modifying the local_domains macro, you could instead put a hook into this acl using the CHECK_RCPT_LOCAL_ACL_FILE macro. Check it out in /etc/exim4/conf.d/acl/30_exim4-config_check_rcpt, and then put an actual macro somewhere in /etc/exim4/conf.d/main (if you are using the split config, which you should do if you are doing this type of change). You also need to read the chapter on ACLs and actually write the ACL fragment that will accept mail for domains based on your mysql lookup. In setups such as yours, the local_domains macro and the concept behind it may not make much sense. I sometimes create another domainlist called virtual_domains in such cases to handle domains defined in your mysql (or ldap or other) database. I also sometimes find it difficult to shoehorn such setups into the Debian config system. It is sometimes better to copy your current config to /etc/exim4/exim4.conf and strip it down and re-structure it to better fit what you want. Cheers, Alex Neil Briscoe wrote:> Currently, the way Debian-Exim4 works is that it uses the dc_other_hosts > entry from update-exim4.conf.conf file to determine which domains it > will accept mail for. > > I have a customer who wants me to configure things so that the domains > it will accept mail for are contained in a table of a mysql database. > > I have, therefore, installed exim4-daemon-heavy so that I have those > facilities. > > Whilst I think I can work out the code necessary for the routers (they > only need a modified local_delivery and a modified aliases), I''m not > certain how to get Exim4 to obtain its view of accepted local domains > from a mysql table. > > Yes Marc, I have read chapter 9. ;-)) > > Regards > Neil > > ------------------------------------------------------------------------------------ > Scanned for viruses, spam and offensive content by CensorNet MailSafe > > Professional Web & E-mail Filtering from www.censornet.com > > _______________________________________________ > Pkg-exim4-users mailing list > Pkg-exim4-users@lists.alioth.debian.org > http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users >
Neil Briscoe
2006-Dec-12 21:06 UTC
[Pkg-exim4-users] Obtaining Local Domains from a mysql database.
Thanks Alex
Your explanation helped out a lot. Whilst my definiton of local domains
came from the normal place, the two routers and one transport I wrote
worked beautifully.
My last stumbling block is trying to get my definition of local domains
sorted. The current line I have is
MAIN_LOCAL_DOMAINS = ${sg ${quote_mysql:${lookup mysql{select domain
from transport}}}{\\n}{:}}
Which is supposed to select all the domains from the transport table,
and substitute all the new line characters that quote_mysql is supposed
to give me into colons.
I''ve tried several variations on this but needless to say I suffer an
expansion failure when trying an exim4 -bt user@some.tld
I don''t suppose either you, or anyone else would care to assist would
you?
Regards
Neil
------------------------------------------------------------------------------------
Scanned for viruses, spam and offensive content by CensorNet MailSafe
Professional Web & E-mail Filtering from www.censornet.com
Neil Briscoe
2006-Dec-13 10:20 UTC
[Pkg-exim4-users] Obtaining Local Domains from a mysql database.
Ah, there''s nothing like a good sleep.
This worked, at the first attempt.
MAIN_LOCAL_DOMAINS = ${sg {${lookup mysql{select domain from
transport}{$value}fail}}{\\n}{:}}
Once again, thanks for your assistance.
Regards
Neil
------------------------------------------------------------------------------------
Scanned for viruses, spam and offensive content by CensorNet MailSafe
Professional Web & E-mail Filtering from www.censornet.com