This "howto" describes the installation steps needed to get a dbmail system up and running as quick as possible. Only the bare minimum actions are taken.
Expected setup time is only 2 hours. By creating this manual, I learned useful stuff. Please consider that I am a newbie in the world of unix. So be mild with criticism:-) The result is a working dbmail system with 2 users created and a distributionlist. Ideal for home use. The following main software packages are used: Freebsd 4.9 Mysql 4.0.18 Postfix 2.0.19 Dbmail 1.2.7a After installation of the os, the following users and groups are created: usertype User/group username Password os User Mysql n/a Os Group Mysql n/a Os User Postfix n/a Os Group Postfix n/a Os Group maildrop n/a Os User Dbmail Envelop os group Dbmail n/a Mysql (mysql database) User Root root Mysql (mysql database) User Dbmail Dbmail Mysql (dbmail database) User Bert Bert Mysql (dbmail database) user ernie ernie Of course you should not use the same passwords as usernames. Install freebsd 4.9 and configure Not really any explanation necessary. The following will work: Do a standard installation. Select "Developer" (Full sources, binaries and doc but no games) In this howto, I named the host "mailer" and the domain "p". The ipddress is 192.168.1.10 Reboot Add the following lines to the following file: /etc/ssh/sshd_config PermitRootLogin yes ChallengeResponseAuthentication no Download packages and install them in the following order bash-2.05b.007.tgz mysql-client-4.0.18_1.tgz mysql-server-4.0.18_1.tgz (ignore for now what is being told) pcre-4.5.tgz postfix-2.0.19,1.tgz (do what is being told) These packages can be downloaded from http://www.freebsd.org/ports/index.html start mysql and set the password for root mailer# /usr/local/bin/mysqld_safe & [1] 266 mailer# Starting mysqld daemon with databases from /var/db/mysql mailer# /usr/local/bin/mysqladmin -u root password 'root' download "dbmail-1.2.7a.tgz.tar" and unpack it create dbmail database and corresponding database user mailer# mysql -u root -p < sql/mysql/create_tables.mysql Enter password: mailer# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 to server version: 4.0.18 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases; +----------+ | Database | +----------+ | dbmail | | mysql | | test | +----------+ 3 rows in set (0.00 sec) mysql> grant all on dbmail.* to [EMAIL PROTECTED] identified by 'dbmail'; Query OK, 0 rows affected (0.00 sec) Configure dbmail.conf Copy dbmail.conf to /etc edit the following parameter: pass=dbmail Run build.sh Create the osuser dbmail with dbmail group. Use the following password "envelop". Now change the following section of build.sh: ./install-dbmail.sh $bindir if [ $? -ne 0 ]; then echo install script failed. You can rerun this manually by runnin g install-dbmail.sh exit 1 Now run build.sh. Here is a my output: mailer# ./build.sh This is the dbmail build script I will have to ask you some questions about your system What database do you wish to use? Choices are (m)ysql and (p)ostgresql > m You have selected MySQL as database The library directory for MySQL is now [/usr/local/lib/mysql/]. Enter new directory or press RETURN to keep this setting: The include directory for MySQL is now [/usr/include/mysql/]. Enter new directory or press RETURN to keep this setting: /usr/local/include/mysql The libraries are currently set to [-lmysqlclient -lcrypto -lz]. Enter new libraries (preceed each by -l) or press RETURN to keep this setting: Creating makefile.. Done. You can now make dbmail by running 'make clean all'. Do you want this to be executed right now? y rm -f *.o core mysql/*.o cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c list.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c debug.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c pipe.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c mime.c cc -o mysql/dbmysql.o -c mysql/dbmysql.c -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c dbmd5.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c md5.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c bounce.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c forward.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c memblock.c cc -o mysql/dbauthmysql.o -c mysql/dbauthmysql.c -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c config.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c misc.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE main.c -o dbmail-smtp list.o debug.o pipe.o mime.o mysql/dbmysql.o dbmd5.o md5.o bounce.o forward.o memblock.o mysql/dbauthmysql.o config.o misc.o -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. -lmysqlclient -lcrypto -lz cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c pop3.c pop3.c: In function `pop3_handle_connection': pop3.c:64: warning: unused variable `timestamp' cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c serverchild.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c server.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c proctitleutils.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE pop3d.c -o dbmail-pop3d pop3.o list.o debug.o mysql/dbmysql.o serverchild.o server.o dbmd5.o md5.o mime.o misc.o memblock.o mysql/dbauthmysql.o config.o proctitleutils.o -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. -lmysqlclient -lcrypto -lz cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE maintenance.c -o dbmail-maintenance debug.o list.o dbmd5.o md5.o mysql/dbmysql.o mime.o memblock.o mysql/dbauthmysql.o config.o misc.o -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. -lmysqlclient -lcrypto -lz cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c imap4.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c imaputil.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c imapcommands.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c rfcmsg.c cc -o mysql/dbmsgbufmysql.o -c mysql/dbmsgbufmysql.c -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. cc -o mysql/dbsearchmysql.o -c mysql/dbsearchmysql.c -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE -c quota.c cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE imapd.c -o dbmail-imapd imap4.o debug.o mysql/dbmysql.o serverchild.o server.o config.o list.o dbmd5.o md5.o imaputil.o imapcommands.o mime.o misc.o memblock.o rfcmsg.o mysql/dbmsgbufmysql.o mysql/dbsearchmysql.o mysql/dbauthmysql.o quota.o proctitleutils.o -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. -lmysqlclient -lcrypto -lz cc -Wall -O2 -D_BSD_SOURCE -D_SVID_SOURCE user.c -o dbmail-adduser debug.o list.o dbmd5.o md5.o mysql/dbmysql.o mime.o memblock.o mysql/dbauthmysql.o config.o misc.o -L/usr/local/lib/mysql/ -I/usr/local/include/mysql -I. -lmysqlclient -lcrypto -lz Make succesfull. Do you want to install the binaries and man pages? y Target binary directory is now /usr/local/sbin. Enter new directory or press RETURN to keep this setting: This script will install dbmail on your system. Before executing this script be sure to have read the INSTALL file. Although dbmail is very easy to install you'll need to know a few little things before you can start using it. If you have any problems, man files will also be installed so you can always check the manpage of a program. Next i'll be asking you as what user and group you want to be running DBMAIL. Best thing is to create a user called dbmail with a dbmail group. Don't forget to edit these users in the dbmail.conf file. The pop3 daemon and the imapd daemon have capabilities to drop their privileges! Use that capability! As what user are the dbmail daemons going to run? [default: dbmail] As what group are the dbmail daemons going to run? [default: dbmail] Ok installing dbmail executables as dbmail:dbmail.. Ok installing manfiles in /usr/local/man/man1/.. Done Create users in the dbmail system dbmail-adduser a ernie ernie 0 0 [EMAIL PROTECTED] dbmail-adduser a bert bert 0 0 [EMAIL PROTECTED] Configure Postfix Add the following entry to /usr/local/etc/posfix/master.cf dbmail unix - n n - - pipe flags= user=dbmail:dbmail argv=/usr/local/sbin/dbmail-smtp -d ${recipient} Add the following entry to /usr/local/etc/postfix/transport whatever.com dbmail: Run the following command: Postmap /usr/local/etc/postfix/transport Add the following entries to /usr/local/etc/postfix/main.cf local_recipient_maps = transport_maps = hash:/usr/local/etc/postfix/transport myhostname = mail.whatever.com mydestination = whatever.com, mail.whatever.com, localhost.$mydomain, mailer, mailer.p mynetworks = $config_directory/mynetworks Create a file named /usr/local/etc/postfix/mynetworks with the following content: 127.0.0.0/8 192.168.1.0/24 This means that clients within the same network as the server can send/receive mail. If you want to send/receive mail from a remote location, add the corresponding ip address here. Restart machine By restarting the machine you can check the following: Postfix starts Mysql starts Touchdown!! Finishing touch When doing a tail -20f /var/log/maillog you can monitor the mailsystem. You will notice the following annoying error: Apr 29 17:08:52 mailer postfix/local[220]: fatal: open database /etc/aliases.db: No such file or directory Get rid of this error by doing the following: Postalias /etc/aliases. This creates a file "/etc/aliases.db" which is expected by postfix. The aliases however need to be inserted in mysql because the aliases.db file is bypassed and can be ignored. The next step is to create a distributionlist "[EMAIL PROTECTED]": mailer# dbmail-adduser c ernie +a [EMAIL PROTECTED]; mailer# dbmail-adduser c bert +a [EMAIL PROTECTED];
