|
![]() |
EinführungDieses Crash Tutorial zeigt Dir wie man ein Virtuele Mailboxen mit Sendmail, Courer-IMAP und Maildrop OpenBSD einrichtet. Getestet wurde dieses Tutorial mit OpenBSD 3.6 und einem Pentium2
Falls Du fragen oder anregungen hast kannst Du mir jederzeit ein Mail schreiben (tutorial@thetube.ch).
# pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/3.6/packages/i386/courier-imap-3.0.5.tgz
# cp -R /usr/local/share/examples/courier-imap/ /etc/
##VERSION: $Id: imapd.dist.in,v 1.29 2004/04/18 15:54:39 mrsam Exp $ ADDRESS=0 PORT=143 MAXDAEMONS=40 MAXPERIP=4 PIDFILE=/var/run/imapd.pid TCPDOPTS="-nodnslookup -noidentlookup" AUTHMODULES="authdaemon" AUTHMODULES_ORIG="authdaemon" DEBUG_LOGIN=0 IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=PLAIN IDLE" IMAP_KEYWORDS=1 IMAP_CAPABILITY_ORIG="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 IDLE" IMAP_IDLE_TIMEOUT=60 IMAP_CAPABILITY_TLS="$IMAP_CAPABILITY AUTH=PLAIN" IMAP_CAPABILITY_TLS_ORIG="$IMAP_CAPABILITY_ORIG AUTH=PLAIN" IMAP_DISABLETHREADSORT=0 IMAP_CHECK_ALL_FOLDERS=0 IMAP_OBSOLETE_CLIENT=0 IMAP_ULIMITD=65536 IMAP_USELOCKS=1 IMAP_SHAREDINDEXFILE=/etc/courier-imap/shared/index IMAP_ENHANCEDIDLE=0 IMAP_TRASHFOLDERNAME=Trash IMAP_EMPTYTRASH=Trash:7 IMAP_MOVE_EXPUNGE_TO_TRASH=0 SENDMAIL=/usr/sbin/sendmail HEADERFROM=X-IMAP-Sender IMAPDSTART=NO MAILDIRPATH=Maildir
##VERSION: $Id: authdaemonrc.in,v 1.8 2001/10/07 02:16:22 mrsam Exp $ authmodulelist="authcram authuserdb" authmodulelistorig="authcustom authcram authuserdb authldap authpgsql authmysql authpwd" daemons=5 version="" authdaemonvar=/var/run/courier-imap
# useradd -d /var/vmail -g =uid -s /sbin/nologin vmail # mkdir /var/vmail # chown vmail.vmail /var/vmail
# id vmail uid=1001(vmail) gid=1001(vmail) groups=1001(vmail)
vmail uid=1001|gid=1001|home=/var/vmail 1001= vmail
# chmod 600 /etc/userdb
#!/bin/sh MAILDIRMAKE=/usr/local/bin/maildirmake MAKEUSERDB=/usr/local/bin/makeuserdb USERDBPW=/usr/local/bin/userdbpw USERDB=/usr/local/bin/userdb VUSER=vmail VUSER_UID=`id -u $VUSER` VUSER_GID=`id -g $VUSER` VUSER_HOME=~vmail NEW_USER=$1 if [ -z "$NEW_USER" ] then echo "Usage:" `basename $0` "<username>" echo "Ex: `basename $0` bob" exit 1 fi # Make sure the user does not already exist. if [ -d $VUSER_HOME/Maildir-$NEW_USER ] then echo "Error: Account" $NEW_USER "already exists." exit 1 fi # Create the user's home and mail directory. echo "Creating a Maildir for" $NEW_USER $MAILDIRMAKE $VUSER_HOME/Maildir-$NEW_USER if [ $? != 0 ]; then echo "Error creating Maildir..." exit fi chown -R $VUSER.$VUSER $VUSER_HOME/Maildir-$NEW_USER # Add the user to the proper userdb and set the user's password. echo "Adding" $NEW_USER "to" /etc/userdb echo "Enter the password for" $NEW_USER $USERDBPW | $USERDB -f /etc/userdb $NEW_USER set uid=$VUSER_UID gid=$VUSER_GID home=$VUSER_HOME mail=$VUSER_HOME/Maildir-$NEW_USER $USERDBPW -md5 | $USERDB -f /etc/userdb $NEW_USER set systempw # Make sure the new user is noticed. $MAKEUSERDB # Finalize for user. echo echo " Done!!! $NEW_USER has been added to Courier-IMAP." echo exit 0
# pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/3.6/packages/i386/maildrop-1.5.3.tgz
# cd /usr/share/sendmail/cf # cp openbsd-localhost.mc openbsd-example.mc
divert(-1) # # Copyright (c) 1998 Sendmail, Inc. All rights reserved. # Copyright (c) 1983 Eric P. Allman. All rights reserved. # Copyright (c) 1988, 1993 # The Regents of the University of California. All rights reserved. # # By using this file, you agree to the terms and conditions set # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # # # # This configuration only runs sendmail on the localhost interface. # This allows mail on the local host to work without accepting # connections from the net at large. # divert(0)dnl VERSIONID(`@(#)openbsd-localhost.mc $Revision: 1.4 $') OSTYPE(openbsd)dnl FEATURE(`virtusertable', `hash /etc/mail/virtusertable') FEATURE(use_cw_file) FEATURE(`local_procmail',`/usr/local/bin/maildrop',`maildrop -d $u') FEATURE(nouucp, `reject')dnl FEATURE(`accept_unresolvable_domains')dnl FEATURE(`no_default_msa')dnl MAILER(local)dnl MAILER(smtp)dnl DAEMON_OPTIONS(`Family=inet, address=0.0.0.0, Name=MTA')dnl DAEMON_OPTIONS(`Family=inet6, address=::, Name=MTA6, M=O')dnl DAEMON_OPTIONS(`Family=inet, address=0.0.0.0, Port=587, Name=MSA, M=E')dnl DAEMON_OPTIONS(`Family=inet6, address=::, Port=587, Name=MSA6, M=O, M=E')dnl CLIENT_OPTIONS(`Family=inet6, Address=::')dnl CLIENT_OPTIONS(`Family=inet, Address=0.0.0.0')dnl dnl dnl Some broken nameservers will return SERVFAIL (a temporary failure) dnl on T_AAAA (IPv6) lookups. define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl LOCAL_RULESETS HMEssage-Id: $>CheckMessageId SCheckMessageId R< $+ @ $+ > $@ OK R$* $#error $: 553 Header Error
# m4 ../m4/cf.m4 openbsd-example.mc > openbsd-example.cf
# cp openbsd-example.cf /etc/mail/
cd /etc/mail vi openbsd-example.cf
(Mlocal, P=/usr/local/bin/maildrop, F=lsDFMA5:)
# kill -15 `head -1 /var/run/sendmail.pid` # sendmail -L sm-mta -C /etc/mail/openbsd-example.cf -bd -q30m
/usr/local/sbin/cour_userdb_mkuser benny
# $OpenBSD: virtusertable,v 1.2 2004/01/13 15:43:40 millert Exp $ # # sendmail(8) virtual user table. Rebuild by running as root: # makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable # # This file contains the mapping of virtual to local addresses. # Each line denotes a transform of: # virtual_address local_address # # E.g. # info@foo.com foo-info # info@bar.com bar-info # @baz.org jane@example.net # # It is also possible to map all users from one domain to another, e.g. # @foo.org %1@example.com # # See the "virtusertable" section of /usr/share/sendmail/README for # more information. # benny@example.ch benny
# makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable
# /usr/local/libexec/imapd.rc start
# telnet localhost 143 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=PLAIN IDLE ACL ACL2=UNION] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information.
courierimap_flags=""
if [ X"${courierimap_flags}" != X"NO" ]; then
mkdir -p /var/run/courier-imap
echo -n ' courier-imap'; /usr/local/libexec/imapd.rc start ${courierimap_flags}
fi