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

Re: How to handle mail for multiple (10-15) domains w/o localpart conflicts?

On Sun, 6 Apr 2003, Ralf G. R. Bergs wrote:
> On Sun, 06 Apr 2003 20:34:30 +0200, Marcin Sochacki wrote:
> [...]
> >http://www.ex-parrot.com/~chris/vmail-sql/
> Upon first look this looks nice -- but there's no Debian package available
> (AFAIC gather), and it needs tpop3d which also isn't Debianized yet. :-(

I've just setup this exact same thing on my mail server. You don't need
any debian packages for everything. Heres my configs.

I have exim+vmail-sql+spamd+exiscan with tpop3 as pop server and UebiMiau
as a webmail (Which has an attachment bug! :-(). A few things you need to

apt-get install clamav exiscan spamassassin exim[1]

If you read the instructions on how to get vmail-sql setup from chris's
url, that'll get that side of things working. SpamAssassin's mysql stuff
is easily integrated into the php version that controls vmail-sql.

# Spam Assassin TRANSPORTS lines (search google for the rest)
    driver = pipe

    command = /usr/sbin/exim -oMr spam-scanned -bS
    transport_filter = /usr/bin/spamc -u "${lookup mysql{select unix_user from domain left join domain_alias on domain_alias.domain_name = domain.domain_name where domain.domain_name = '${quote_mysql:$domain}' or domain_alias.alias = '${quote_mysql:$domain}'}{$value}fail}"



    # do not use this director when verifying a local-part at SMTP-time

    # When to scan a message :
    #   -   it isn't already flagged as spam
    #   -   it isn't already scanned
    #   -   it didn't originate locally (as long as I don't harbor spammers :-))
    condition = "${if and { {!def:h_X-Spam-Flag:} {!eq {$received_protocol}{spam-scanned}} {!eq {$received_protocol}{local}} } {1}{0}}"
    driver = smartuser
    transport = spamcheck

And SMTP Auth from mysql [needed so people can relay mail through your
mail server].

   driver = plaintext
   public_name = PLAIN
   server_condition = "${if eq{${md5:$3}}{${substr_5:${lookup mysql{select password_hash from popbox where local_part='${local_part:$2}' and domain_name='${domain:$2}'}{$value}}}}{1}{0}}"
   server_set_id = $2

   driver = plaintext
   public_name = LOGIN
   server_prompts = "Username:: : Password::"
   server_condition = "${if eq{${md5:$2}}{${substr_5:${lookup mysql{select password_hash from popbox where local_part='${local_part:$1}' and domain_name='${domain:$1}'}{$value}}}}{1}{0}}"
   server_set_id = $1

This should get you started on the way, all up this complete setup from
start to finish took me about a day, and the only drawback I have found so
far is that delivery of mail takes around 8-10 seconds. If anybody knows
why I'd really like to know! Otherwise the entire system rocks. Now all I
need a nice php/mysql web hosting company billing system I can integrate
into this setup and finish the project!

One last thing, I've also hacked in quota support on the MTA side, but its
slightly flawed. IE: If user1's quota is 1MB, but somebody sends an email
thats 2MB the mail gets frozen. The mail trys to delivery until the
timeout is reached. How would I go about making it bounce permanently if
the email is larger than the users quota!

Hope this helped. If you need more help shoot me an email offlist.

[1] Debian's exim needs to be recompiled to use mysql (I can give you a
url to the one I created).

Reply to: