I will assume that your postfix configuration directory is /etc/postfix and your postfix version is around 2.0.14
1. Edit /etc/postfix/virtual This is a plaintext file where you can specify the domains and users to accept mail for. Each virtual domain should begin with a single line containing the domain name. The subsequent lines define addresses at the domain that are deliverable. Mail will be delivered to local usernames on the right side, as demonstrated in the example below. The condition @domain allows you to deliver “all other” mail to the indicated user. You can list multiple domains in this file; just repeat the format demonstrated below.
example.com this-text-is-ignored postmaster@example.com postmaster address1@example.com destuser1 address2@example.com destuser2 @example.com destuser1
2. Edit /etc/postfix/main.cf
You have to tell postfix where to look for these virtual alias mappings; the appropriate configuration directive is in the main postfix configuration file. This tells postfix to use the db-format (hash) version of your virtual mappings. Note that your system must have db support for this to work; also, the actual db file is not created until you run ‘postmap’ in step 3.
virtual_alias_maps = hash:/etc/postfix/virtual
3. Refresh configuration and mappings
Since you’ve changed main.cf, you should restart the daemon. The second command below updates the virtual mappings; you must run this ‘postmap’ command when you change your /etc/postfix/virtual file. The ‘postmap’ command actually creates the hash db file that postfix looks for.
postfix reload postmap /etc/postfix/virtual
Now try delivering mail to virtual domain addresses. If you encounter problems, check your mailer daemon system log and make sure your server configuration has been refreshed with ‘postfix reload’ and the ‘postmap’ commands.
Tags: Postfix, SMTP, virtual domains
Posted by Hans-Henry Jakobsen
Postfix logs all failed and successful deliveries to a logfile. The file is usually called /var/log/maillog or /var/log/mail; the exact pathname is defined in the /etc/syslog.conf file.
Posted by Hans-Henry Jakobsen
Append one or more “-v” options to selected daemon definitions in /etc/postfix/master.cf and type “postfix reload“. This will cause a lot of activity to be logged to the syslog daemon. For example, to make the Postfix SMTP server process more verbose:
(more…)
Posted by Hans-Henry Jakobsen
Dovecot og Courier-imap klager til tider på at sertifikat ikke fungerer. Da kan man kjøre følgende kommando for å lage nytt sertifikat. Kommandoen kjøres fra /etc/ssl/dovecot/
openssl req -new -x509 -nodes -days 365 -out cert.crt -keyout cert.key cat cert.key cert.crt > cert.pem
Endre navnet på filene slik at de stemmer overns med configfilene til de respektive programmene.
Tags: Courier-imap, Dovecot, OpenSSL, SMTP, SSL
Posted by Hans-Henry Jakobsen
I’ve just migrated a couple of servers from Courier-IMAP to Dovecot, and am very happy with the latter so far. I thought I’d share the courier2dovecot shell script I whipped together (based on the instructions I found in the migration how-to), for converting Courier-IMAP maildirs to Dovecot format.
While the script is rather simple, it can save a fair bit of typing when migrating some hundreds of mail accounts, especially since Courier stores some of its own state files recursively in each folder of the maildir hierarchy, making it a real pain to otherwise manually rename or remove all of them.
Here’s a plain-English summary of what the script currently does, when given a Courier maildir path as an argument:
The script will also verbosely print out each action it performs, handy for redirecting the output to a log file for a large migration.
Hopefully people about to jump ship from Courier to Dovecot find this useful. If anyone comes up with improvements to the script, please send them my way.
#!/bin/sh # # courier2dovecot -- Converts a Courier maildir to Dovecot format. # Copyright (c) 2005 Arto Bendiken. Released under the GNU GPL. # Newest version available from http://bendiken.net/scripts/ # # 2005-10-21 initial version for Dovecot 1.0. # dir="$1" if [ -z "$dir" ] || [ "$dir" = "-?" ] || [ "$dir" = "-h" ] || [ "$dir" = "--help" ]; then echo "Usage: $0 maildirpath" exit 1 fi if [ ! -d "$dir" ] || [ ! -e "$dir/courierimapsubscribed" ]; then echo "$dir is not a path to a Courier maildir" exit 1 fi find $dir -name courierimapsubscribed -print0 | xargs -0r rename -v 's/courierimapsubscribed/subscriptions/' find $dir -name subscriptions -print0 | xargs -0r sed -i 's/INBOX\.//' find $dir -name courierimapuiddb -print0 | xargs -0r rename -v 's/courierimapuiddb/dovecot-uidlist/' find $dir -name courierimaphieracl -print0 | xargs -0r rm -vrf find $dir -name courierimapacl -print0 | xargs -0r rm -vf find $dir -name courierimapkeywords -print0 | xargs -0r rm -vrf
Comment to the script:
Hey Arto & everyone using this script:
Be careful when trying to run this on Red Hat Enterprise Linux or CentOS 4 systems. These operating systems ship with a different rename command than the Debian systems. You can also tell them apart based on the output when running ‘rename’ with no arguments.
This is the perl version which works:
Usage: rename [-v] [-n] [-f] perlexpr [filenames]
This is the RHEL/CentOS version that doesn’t:
call: rename.orig from to files…
Hope this helps someone out there, and thanks for the script Arto!
Source: http://bendiken.net/2005/11/03/courier-imap-to-dovecot-migration-script
Tags: CentOS, Courier-imap, Debian, Dovecot, Fedora, find, maildir, perl, RedHat, SMTP, xargs
Posted by Hans-Henry Jakobsen