# Gentoo Mailserver

## -leliel-

Hi,

I want to build a Postfix + Ldap + Courier IMAP + Anti Spam Mailserver on Gentoo. Is anybody experienced in this?

If all works fine, I'll try to write a howto for the tips and tricks section, too.

so long

----------

## carl

My mail server is Postfix + Courier-IMAP + Procmail + SpamAssassin + Squirrelmail.  I'd wanted to use LDAP for virtual mail (or MySQL for the same), but never did get it working.

There's a How-To for virtual mail that can easily be modified for single-host mail, in the Docs section on the main Web site.

----------

## -leliel-

Thanks for the hint. I also found a howto for postfix + lpap, but maybe this could be made easier with some use flags etc.

Could you shortly explain what virtual mails are and what problems you had with ldap?

thanks

----------

## rajl

virtual domains and virtual mail serving is where you host more than one domain from the same box using the same server.  For example, if I was a web-hosting company, I might have one computer handling all the email for companya.com, non_profitb.org, and hobby_siteC.net on the same computer using the same server.  That's pretty much all there is to it.

----------

## Torg

I've got 2 production gentoo anti-spam mailservers running currently.

I'm using the following packages to accomplish it:

Fetchmail

Courier-Imapd (And pop3d)

Maildrop

Mail-SpamAssassin

Squirrelmail (and apache of course)

I haven't messed with LDAP yet... and I'm not even sure where to start on that... but I can help with any of the above packages as far as my config goes.

I've also got a set of bash scripts I wrote that provide stats on the spamfilter, and generate hourly updates to a stats file on my webroot.  I'd be happy to share the sources from that with you as well.

-Torg

----------

## -leliel-

so, I'm workin' on an LDAP at the moment ... I found a HowTo named 'LDAP for Postfix with Courier IMAP' with useful information about ldap and ldap directories. As soon as I got the ldap running I'll begin to write the HowTo and set up postfix a.s.o..

so long

----------

## dma

I'm just using postfix at the moment:

main.cf:

http://www.dmatech.org:8000/~dma/pf/config.txt

access:

http://www.dmatech.org:8000/~dma/pf/access.txt

(I removed a few entries).

It seems to kill spam quite nicely without spamassassin.

May 19 01:46:35 [postfix/smtpd] 57EB1C30F8: reject: RCPT from unknown[67.64.180.25]: 450 <none>: Helo command rejected: Host not found; from=<rlg@estockquest.com> to=<rlg@estockquest.com> proto=SMTP helo=<none>

May 10 01:08:37 [postfix/smtpd] warning: Illegal address syntax from unknown[162.33.251.47] in MAIL command: amy21@yahoo.com

May  9 18:05:29 [postfix/smtpd] 2702E409E3: reject_warning: RCPT from unknown[208.2.159.146]: 450 Client host rejected: cannot find your hostname, [208.2.159.146]; from=<HFoor@executive.com> to=<test@dmatech.net> proto=SMTP helo=<[208.2.159.146]>

May  9 18:05:32 [postfix/smtpd] 2702E409E3: reject: RCPT from unknown[208.2.159.146]: 554 <test@dmatech.net>: Relay access denied; from=<HFoor@executive.com> to=<test@dmatech.net> proto=SMTP helo=<[208.2.159.146]>

May  9 17:53:44 [postfix/smtpd] 7D156409E3: reject_warning: RCPT from unknown[66.250.107.250]: 450 Client host rejected: cannot find your hostname, [66.250.107.250]; from=<zhen@forums.gentoo.org> to=<dma@dmatech.org> proto=ESMTP helo=<forums.gentoo.org>

(whoops!  actually it should be .251, not .250!)

May 13 09:26:09 [postfix/smtpd] F24F0157865: reject: RCPT from 218-162-28-48.HINET-IP.hinet.net[218.162.28.48]: 450 <none>: Helo command rejected: Host not found; from=<26490723@mail.apol.com.tw> to=<smile.ivan@msa.hinet.net> proto=SMTP helo=<none>

May 15 17:15:05 [postfix/smtpd] E774315A2C: reject: RCPT from customerscan.sec.rr.com[24.30.199.231]: 504 <openrelaytest@localhost>: Sender address rejected: need fully-qualified address; from=<openrelaytest@localhost> to=<relaytest@security.rr.com> proto=SMTP helo=<security.rr.com>

May 15 17:16:05 [postfix/smtpd] lost connection after RCPT from customerscan.sec.rr.com[24.30.199.231]

(my ISP is probing me it seems...)Last edited by dma on Sat Sep 13, 2003 2:59 am; edited 1 time in total

----------

## -leliel-

Hi,

thanks for the info ...

my only problem at the moment is as follows:

there's a mailserver at my isp. this mailserver collects all mail from different domains and I could recieve it.

Now, I want to install my own mailserver, get all this mails from the remote mailserver and process them to the local users (accessible via imap). What do I need for this configuration? virtual boxes?

----------

## Naan Yaar

I have an essentially similar configuration and use the following set-up:

fetchmail runs from a crontab entry as a non-privileged user to retrieve e-mail messages for all users from pop and imap servers

procmail is invoked by fetchmail as the local mail delivery agent (mda)

procmail filters stuff through spamassassin first and then forwards email messages to local users through postfix' local delivery agent

courier-pop3d is set up to be the pop-server for local users

A few config files to fiddle with, but not very hard overall.

 *-leliel- wrote:*   

> Hi,
> 
> thanks for the info ...
> 
> my only problem at the moment is as follows:
> ...

 

----------

## -leliel-

ok, thanks.  :Smile: 

----------

## Satpal

 *Torg wrote:*   

> I've got 2 production gentoo anti-spam mailservers running currently.
> 
> I'm using the following packages to accomplish it:
> 
> Fetchmail
> ...

 

Hi,

It seems your configuration matches mine...

I have setup Postfix+LDAP+Courier-IMAP+Squirrelmail successfully, i am able to send mails to all my virtual users now i want add mail quota for all virtual users so while working on maildrop i have got an error 

"relay=maildrop, delay=0, status=bounced (user unknown. Command output: Invalid user specified. )"

I can also add that the error is "Invalid user specified." if I run 

maildrop -d userdomain.com

May be maildrop is not interacting with LDAP properly

Maildrop is compiled from the source to support LDAP and Maildir format

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

My current setup is as follows :

PCQLinux 2004 (Fedora core 1)

Postfix installed from source code - postfix-2.0.19.tar.gz

Courier-IMAP - courier-imap-3.0.2-1.1

Squirrelmail - squirrelmail-1.4.2-1 rpm installation

OpenLDAP - openldap-2.1.22-8

Jamm - jamm-0.9.6

procmail-3.22-11 ( I am useing maildrop instead )

I have compiled and installed maildrop (maildrop-1.6.3

) with following options

"./configure --prefix=/usr/local/maildrop --exec-prefix=/usr/local/maildrop

 --enable-maildirquota --enable-maildrop-uid=root --enable-maildrop-gid=mail

 --enable-restricted-trusted=0 --enable-trusted-users='mail' --enable-maildropldap

 --with-ldapconfig=/etc/maildrop/maildropldap.config --with-etcdir=/etc/maildrop"

and this is my "postconf -n"

"alias_database = hash:/etc/aliases

alias_maps = ldap:aliases

command_directory = /usr/sbin

config_directory = /etc/postfix

daemon_directory = /usr/libexec/postfix

debug_peer_level = 2

default_destination_concurrency_limit = 20

home_mailbox = Maildir/

inet_interfaces = all

local_destination_concurrency_limit = 1

local_recipient_maps = ldap:accounts ldap:aliases

mail_owner = postfix

mail_spool_directory = /var/spool/mail

mailbox_command = /usr/local/maildrop/bin/maildrop

mailq_path = /usr/bin/mailq

manpage_directory = /usr/local/man

mydestination = $myhostname, localhost.$mydomain, $mydomain, $transport_maps

mydomain = domain.tld

myhostname = subdomain.domain.tld

mynetworks = 192.168.0.0/24, 127.0.0.0/8

mynetworks_style = subnet

myorigin = $mydomain

newaliases_path = /usr/bin/newaliases

queue_directory = /var/spool/postfix

readme_directory = no

sample_directory = /etc/postfix

sendmail_path = /usr/sbin/sendmail

setgid_group = postdrop

transport_maps = ldap:transport

unknown_local_recipient_reject_code = 450

virtual_alias_maps = ldap:accountsmap, ldap:aliases, ldap:domains, ldap:accounts,

 ldap:transport

virtual_gid_maps = static:103

virtual_mailbox_base = /home/vmail

virtual_mailbox_domains = ldap:domains

virtual_mailbox_maps = ldap:accounts

virtual_minimum_uid = 101

virtual_transport = maildrop

virtual_uid_maps = static:101"

I am having virtual users, all virtual users all under /home/vmail/domains folder with this path /home/vmail/domains/domain.com/username

I want to enable mail quota per user basis for all virtual accounts by 

using maildrop

After compiling and installing maildrop from source it is suppose to create /etc/maildrop/ folder as per documentation but it didnt, and documentation says i need configure /etc/maildrop/maildropldap.config file inorder to maildrop working properly.

If it is possible i also like to see your log files.

I highly appriciate if you can focus on this.

Regards,

Satpal

----------

## mastabog

Well, i know i might be a lil late on this but a very close config. to what you want to achieve is posted on the main doc page at postfix.org. Lemme fetch the link:

Postfix+MySQL+Courier-IMAP+Maildrop+SpamAssassin howto by Serge Stepanov: http://www.gfxcafe.com/Mail%20Howto.htm

A very good place to start with nice and well written howtos is the doc/howto page from postfix.org (look under the POP/IMAP section, the link above is from there):

http://www.postfix.org/docs.html

Cheers, i hope this helped a bit,

Bogdan

----------

