User Tools

Site Tools


lee

Installing a Mail Server with OpenBSD

We installed OpenBSD 3.6, because 3.7 is not released yet, and there was a dependency problem with MySQL using the 3.7 pre-release packages.

Install OpenBSD

Booted to OpenBSD 3.6 boot floppy. Pulled down the tarballs and installed. Hard drive had already been partitioned.

Install Some Extras

# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/3.6/packages/i386

NOTE: The PKG_PATH export is required for all of the pkg_add calls below. It ensures that any package dependencies can be resolved automatically by downloading packages directly from the FTP site.

# pkg_add bash-3.0
# pkg_add nano-1.2.4
# pkg_add wget-1.8.2
# pkg_add curl-7.11.2p0
# pkg_add mc-4.6.1pre1p0
# pkg_add pine-4.6.1
# /usr/libexec/locate.updatedb
# adduser (craig)

Install MySQL

# pkg_add mysql-server-4.0.20
# /usr/local/bin/safe_mysqld  # Need to put in startup script.
# mysqladmin -u root
# mysqladmin -u root password 'new-password'
# mysqladmin -u root -h mail2.omnitec.net password 'new-password'

Install Webmin

Install some prerequisites.

# pkg_add p5-Net-SSLeay-1.23

Download latest source tarball from http://www.webmin.com/.

# tar xfz webmin-1.200.tar.gz
# cd webmin-1.200/
# ./setup.sh

Answer all the questions. (Lee put it on port 11111.) This will start up the program.

Send your browser to the Webmin login page, and login. Remove any modules that you're not going to use.

Install OpenLDAP

# pkg_add openldap-server-2.1.30
# adduser _slapd # (nologin)
# addgroup _slapd
# /usr/local/libexec/slapd -u _slapd -g _slapd  # Need to put this in startup scripts.

Install Cyrus and Courier

# pkg_add cyrus-sasl-2.1.19-db4
# pkg_add courier-imap-3.0.5
# pkg_add courier-ldap-3.0.5
# pkg_add courier-mysql-3.0.5
# pkg_add courier-pop3-3.0.5
# pkg_add courier-utils-3.0.5
# cp /usr/local/share/examples/courier-imap /etc/courier-imap

Edit /etc/courier-imap/imapd.cnf:

[ req_dn ]
C=US
ST=MO
L=St. Louis
O=Omnitec Corporation Mail Server
OU=Automatically-generated IMAP SSL key
CN=mail2.omnitec.net
emailAddress=admin@omnitec.net

When this is done, you can use the 'mkimapdcert' script to automatically generate a server certificate, which is installed into /etc/ssl/private/imapd.pem

To control the daemon use /usr/local/libexec/imapd.rc and /usr/local/libexec/imapd-ssl.rc, and to run the authdaemon, place the following in /etc/rc.local:

# mkdir -p /var/run/courier-imap
# /usr/local/libexec/authlib/authdaemond start
# /usr/local/libexec/imapd.rc start

To use POP3-SSL, be sure to read ssl(8) and run the mkpop3dcert script if you require a self-signed certificate

Install PHP

# pkg_add php4-core-4.3.8
# cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini
# /usr/local/sbin/phpxs -s

To enable parsing of PHP scripts, uncomment the following in /var/www/conf/httpd.conf:

AddType application/x-httpd-php .php

And add index.php to this line:

DirectoryIndex index.php index.html

Restart Apache:

# apachectl stop; apachectl start

(Needed for chroot'd Apache sytems)

Install PHP LDAP package:

# pkg_add php4-ldap-4.3.8
# /usr/local/sbin/phpxs -a ldap

Install Horde

# pkg_add libtool-1.5.8 (failed when trying to install automatically as a dependency)
# pkg_add horde-2.2.5
# /usr/local/sbin/phpxs -a domxml
# cd /var/www/horde/config/
# for foo in *.dist; do cp $foo `basename $foo .dist`; done
# sed -e 's:/horde::g' registry.php.dist > registry.php
# cd /var/www
# mv htdocs htdocs-dist
# mv horde htdocs
# ln -s htdocs horde

and proceed to complete the installation by reading: /var/www/horde/docs/INSTALL

You can ensure you have a working install by accessing: http:<localhost>/horde/test.php # pkg_add imp-3.2.5 # /usr/local/sbin/phpxs -a imap # cd /var/www/horde/imp/config/ # for foo in *.dist; do cp $foo `basename $foo .dist`; done Edit /var/www/horde/imp/config/servers.php to set the mail servers you'll be using. ===== TODO ===== - Configure Horde to authenticate to something we can change passwords on. - There are 8 choices, but no /etc/passwd, and no htpasswd. - Need to have incoming mail passed through SpamAssassin and ClamAV. - Probably requires getting SpamAssassin and ClamAV working too. - Need to have Sendmail pass incoming mail to delivery agent. - Not sure if Sendmail should do this, use procmail, or if Courier IMAP has a delivery agent. - Cyrus IMAP has a delivery agent. - Need to test to see if IMAP daemon is working. - Probably requires setting it up with an authentication method.

lee.txt · Last modified: 2005/05/06 23:50 by 206.197.251.3