Comments on Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Ubuntu 8.10)

This document describes how to install a mail server based on Postfix that is based on virtual users and domains, i.e. users and domains that are in a MySQL database. I'll also demonstrate the installation and configuration of Courier (Courier-POP3, Courier-IMAP), so that Courier can authenticate against the same MySQL database Postfix uses. The resulting Postfix server is capable of SMTP-AUTH and TLS and quota (quota is not built into Postfix by default, I'll show how to patch your Postfix appropriately). Passwords are stored in encrypted form in the database (most documents I found were dealing with plain text passwords which is a security risk). In addition to that, this tutorial covers the installation of Amavisd, SpamAssassin and ClamAV so that emails will be scanned for spam and viruses. I will also show how to install SquirrelMail as a webmail interface so that users can read and send emails and change their passwords.

5 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Dale Hutchinson

Falko,

 Thank you for these guides. Not only do these get a great server up and running with little effort your are teaching me Linux! 

 

Thanks!

 

By: Johnny

Excellent guide, thanks. You got any advice on integrating domain keys into the setup?

By:

Thanks for this one.

By: Michel

hi my problem is not recive email send is ok

log:

Mar  7 01:38:39 mail postfix/smtpd[23978]: connect from localhost[127.0.0.1]
Mar  7 01:38:39 mail postfix/smtpd[23978]: 2A94618127: client=localhost[127.0.0.1]
Mar  7 01:38:39 mail postfix/cleanup[23974]: 2A94618127: message-id=<01d701c99ebd$055b0af0$101120d0$@[email protected]>
Mar  7 01:38:39 mail postfix/qmgr[23768]: 2A94618127: from=<[email protected]>, size=3640, nrcpt=1 (queue active)
Mar  7 01:38:39 mail postfix/smtpd[23978]: disconnect from localhost[127.0.0.1]
Mar  7 01:38:39 mail amavis[23161]: (23161-07) Passed CLEAN, [212.90.203.27] [62.48.100.149] <[email protected]> -> <[email protected]>, Message-ID: <01d701c99ebd$055b0af0$101120d0$@[email protected]>, mail_id: $
Mar  7 01:38:39 mail postfix/smtp[23975]: 00A8918126: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.2, delays=0.22/0.01/0.01/1, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=23161-07, from MTA($
Mar  7 01:38:39 mail postfix/qmgr[23768]: 00A8918126: removed
Mar  7 01:38:39 mail pop3d-ssl: Connection, ip=[::ffff:62.48.100.149]
Mar  7 01:38:39 mail postfix/smtpd[23971]: warning: 62.48.100.157: hostname 62-48-100-157.adsl.ticino.com verification failed: Name or service not known
Mar  7 01:38:39 mail postfix/smtpd[23971]: connect from unknown[62.48.100.157]
Mar  7 01:38:39 mail postfix/smtp[23979]: warning: host mail.dmbox.ch[62.48.100.157]:25 greeted me with my own hostname mail.dmbox.ch
Mar  7 01:38:39 mail postfix/smtp[23979]: warning: host mail.dmbox.ch[62.48.100.157]:25 replied to HELO/EHLO with my own hostname mail.dmbox.ch
Mar  7 01:38:39 mail postfix/smtp[23979]: 2A94618127: to=<[email protected]>, relay=mail.dmbox.ch[62.48.100.157]:25, delay=0.25, delays=0.01/0.02/0.22/0, dsn=5.4.6, status=bounced (mail for mail.dmbox.ch loop$
Mar  7 01:38:39 mail postfix/smtpd[23971]: disconnect from unknown[62.48.100.157]
Mar  7 01:38:39 mail postfix/cleanup[23974]: 6995018128: message-id=<[email protected]>
Mar  7 01:38:39 mail postfix/qmgr[23768]: 6995018128: from=<>, size=5436, nrcpt=1 (queue active)
Mar  7 01:38:39 mail postfix/bounce[23982]: 2A94618127: sender non-delivery notification: 6995018128
Mar  7 01:38:39 mail postfix/qmgr[23768]: 2A94618127: removed
Mar  7 01:38:39 mail pop3d-ssl: LOGIN, [email protected], ip=[::ffff:62.48.100.149], port=[62236]
Mar  7 01:38:39 mail pop3d-ssl: LOGOUT, [email protected], ip=[::ffff:62.48.100.149], port=[62236], top=0, retr=0, rcvd=12, sent=39, time=0
Mar  7 01:38:40 mail postfix/smtp[23979]: 6995018128: to=<[email protected]>, relay=mail.netcore.ch[213.200.248.134]:25, delay=1.4, delays=0.01/0/0.77/0.65, dsn=2.0.0, status=sent (250 Requested mail ac$
Mar  7 01:38:40 mail postfix/qmgr[23768]: 6995018128: removed
Mar  7 01:38:41 mail pop3d-ssl: Connection, ip=[::ffff:62.48.100.149]
Mar  7 01:38:41 mail pop3d-ssl: LOGIN, [email protected], ip=[::ffff:62.48.100.149], port=[62248]
Mar  7 01:38:41 mail pop3d-ssl: LOGOUT, [email protected], ip=[::ffff:62.48.100.149], port=[62248], top=0, retr=0, rcvd=12, sent=39, time=0

my main.cf

myhostname = mail.dmbox.ch
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.dmbox.ch, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
message_size_limit = 30720000
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
#virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sende$
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings

help my please

By:

What a great guide!

I found a small typo in the configuration of postfix.

The line:

postconf -e 'virtual_mailbox_extended = yes'

should be:

postconf -e 'virtual_maildir_extended = yes'

If not, quota does not work

Best regards,

Hans Audun