1

I have a problem setting up something that I think would be cool.

I have a server (Debian Wheezy) and I would like to let my users send email from their smarthosts. From what I have read, exim allow the definition of mulitple smarthost and select the one to use based on the from header of the email and checking the system configuration file. That means that every users share the same smarthost/login/password file.

It doesn't seem right to me. As far as I could look, I found this Debian Bug report logs - #541473 - exim4: Per-user smarthost settings that seems to correspond to want I would like but it doesn't seem to be taken care of. So, is there something I'm missing or is there another MTA (like postfix) that would allow to do what I want ?

Thank you very much !

5
  • Exim is extremely flexible. I would be surprised if there wasn't a way to do this. But it will almost certainly require some major hacking of the transport/router sections of your config to point exim at per-user database of smarthosts/users/creds.
    – Zoredache
    Aug 6, 2014 at 18:19
  • @Zoredache I would like to believe it but I think the problem is by design. If I'm right, a MTA is a daemon and its system configuration file is read at start. If it had user configuration file, the daemon should not need restarting to update its configuration (which is also something I would like very much). And I think that's the main problem. That's why I don't believe in "hacking". But I think there should be something or maybe a trick to do what I want.
    – ncenerar
    Aug 7, 2014 at 7:52
  • 1
    Why the downvote? I am new here and I am probably doing things wrong but why? How am I suppoed to improve if I have no idea of my mistake?
    – ncenerar
    Aug 7, 2014 at 7:58
  • 1
    Exim can be configured to consult external sources for certain config. As a simple example, look at what you can do with a .forward file, look at how it operates in exim. This is a per-user config that changes how messages are delivered. The .forward files are not special, you can use the same lookup methods for other things. What you are asking for in this question is basically just a reverse .forward, that controls outgoing instead of incoming delivery settings. It should be possible.
    – Zoredache
    Aug 7, 2014 at 16:44
  • I agree with you. That's what I want and I hope it is possible...
    – ncenerar
    Aug 8, 2014 at 9:18

1 Answer 1

0

You have to do something like this:

begin routers
per_user:
  driver     = manualroute
  condition  = ${lookup{$sender_address}lsearch{/some/file}{yes}}
  route_data = ${lookup{$sender_address}lsearch{/some/file}}

/some/file should be the next format:

#   sender         smarthost
[email protected]    smtp.tld
[email protected]       mx.tld

condition line check whether the sender is listed in the /some/file. If no - message is passed to the next router. If yes, route_data extract smarthost field from /some/file and route the message there.

2
  • Very interesting but is it possible that /some/file be resolved according to the user home directory (something like ~/.exim.smarthosts or ${HOME}/.exim.smarthosts) so that each user on my system could edit its own smarthosts? If not, maybe I could set up one manualroute per user and hard code the location to the file according to the users (/some/file would be /home/userX/.exim.smarthosts) but then, how could I set up permissions so that user2 doesn't use user1 smarthost file?
    – ncenerar
    Aug 8, 2014 at 9:13
  • exim have powerful and flexible string-expansion mechanisms (Exim Spec ch.11) so you can do literally anything you want. First what I've think of is to replace direct path to the file by another lookup to the list file with sender-path pairs. But I'm not sure that this level of user interaction with MTA is the wise choice. The only meaningful reason to do this is to direct spam messages to the open relays.
    – Kondybas
    Aug 8, 2014 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .