[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Automatically creating user accounts from exim



On Wed, Jun 17, 2009 at 3:53 PM, Douglas A. Tutty<dtutty@vianet.ca> wrote:
> Since this mail is coming from a trusted server, why not have a script
> on that server first check (via ssh) if the user exists?  Or, have it
> send the mail blindly.  If the user doesn't exist, exim bounces it back.
> the sending script then uses ssh to create the user on the target
> system.

These would be other ways of adding accounts, yes.

My main assumption is that exim gives a simple way to hook arbitrary
scripts into it's logic at various points. Something like:

/etc/exim4/incoming_mail.d/

And then I could drop a shell script in that directory, which would be
called as the mail is received, to create the new accounts as needed,
and then after calling the script, exim would see the user account it
needs (so that it doesn't bounce the mail, and stores it instead).

Or, if not the above, then something similar, where I could hook
arbitrary logic into various points of the mail receiving logic. From
your reply, I take it that there is no simple mechanism like that?
We're exim newbies, so we don't really know the usual methods of tying
external logic into exim.

>
> Are you sure that email is the best route at all for this traffic?  Mail
> to non-existant user so that a script on a remote box can read the mail?
> Why not just rsync (or scp) over ssh a file containing the information?
> Or, have programmes at each end running with a socket between them?  Or
> use have the target script put the output to stdout, pipe it through
> ssh to the receiving script taking it from stdin via a pipe from ssh?

The overall system, is basically a messaging system (that doesn't only
use email, so it's also a kind of gateway), where users send each
other messages, and exim and the mail protocols provides a lot of
logic that we'd otherwise need to re-implement, either ourselves from
scratch, or by rigging various existing tools together (like, queuing
messages when servers are temporarily offline, relaying, etc). The
messaging system isn't a duck, but it walks and quacks a lot like one
>_>.

On Wed, Jun 17, 2009 at 3:53 PM, Eduardo M
KALINOWSKI<eduardo@kalinowski.com.br> wrote:
> Exim doesn't really make a distinction between real users and local users.
> It can check /etc/passwd (or some other database) for users, but it can also
> check a text file, a database, check for the existence of a file...

Thanks for that info. I think the main idea with automatically adding
users, is so that a standard exim config (which we don't really
understand), will be able to deliver the mails instead of bouncing
them. There isn't really a need for user accounts beyond that afaict.
I'll see if I can get your example config to work.

A few more questions:

1. Is there a way for external programs to determine immediately when
a mail was just delivered into the mail files?

2. How can external programs manipulate the mail files (read the
messages, delete, etc), and avoid race conditions with the exim
process which also uses those files?

This info is needed, because our software needs to hook into the exim
mail life cycle at various points. Mainly for things like converting
between email and non-email messaging systems. Basically, the idea is
to use exim as the core engine which drives the rest of the logic,
based on email received/forwarded/etc events.

Thanks,

David.


Reply to: