Difference between revisions of "Postfix mailer and Dovecot"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
(New page: <nowiki>Postfix mailer and Dovecot</nowiki> <nowiki>__ _</nowiki> <nowiki> -o)/ / (_)__ __ ____ __ Derek Winterstien</nowiki> <nowiki> /\\ /__/ / _ \/ // /\ \/ / r.o.a....)
 
m
Line 28: Line 28:
  
 
Install from RPM or latest from source.
 
Install from RPM or latest from source.
20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)20:15, 25 June 2007 (CDT)[[User:Admin|Admin]]
 
  
Compiling Dovecot From Sources:
+
=== Compiling Dovecot From Sources: ===
 
  ./configure
 
  ./configure
 
  make
 
  make
 
  sudo make install
 
  sudo make install
  
Redhat/Fedora
+
=== Redhat/Fedora ===
  
 
You will need to create a file under /etc/pam.d named dovecot with the  
 
You will need to create a file under /etc/pam.d named dovecot with the  
Line 123: Line 122:
 
  <nowiki></nowiki>
 
  <nowiki></nowiki>
 
  <nowiki></nowiki>
 
  <nowiki></nowiki>
 +
 +
=== SysV Init Runlevels ===
 +
 +
*redhat:  /etc/rc.d/init.d
 +
*trustix: /etc/init.d
 +
 +
Install the init script in the appropriate init.d directory for your distribution.  Now create the symlinks and so on with chkconfig.
 +
 +
  chkconfig --add dovecot
 +
 +
Verify that dovecot was added to the correct runlevels
 +
 +
/etc/init.d# chkconfig --list|grep dovecot
 +
 +
Right now everything is K's
 +
dovecot        0:off  1:off  2:off  3:off  4:off  5:off  6:off
 +
 +
  chkconfig --level 345 dovecot on
 +
 +
Now dovecot will startup with the system
 +
 +
=== Dovecot 'run as' User ===
 +
 +
create a separate dovecot user which doesn't have access to anything. It should also have it's own group where no-one else belongs to.  dovecot user isn't used for any kind of mail processing - don't store users' mails as dovecot, and don't put dovecot to mail group.
 +
 +
For Trustix and Redhat the following should be ok:
 +
 +
  groupadd -g 97 -r dovecot
 +
  useradd -d /no/dir -g dovecot -M -u 97 -r -s /bin/false dovecot
 +
 +
=== Misc Notes From Other Sources ===
 +
 +
dovecot. `/etc/rc.d/init.d/dovecot start` and `chkconfig dovecot add`. Worked
 +
with zero configuration although at first I could not see my folders on the
 +
server so I had a bit more configuration of imapd to do. I am not acutally
 +
sure how I got dovecot/Thunderbird to talk together completely. I had some
 +
strange group ownerhip bits in my mail files so fixing those might have
 +
helped. The changes I put into /etc/dovecot.conf included the following, to
 +
inform it that I have Mail subdirs in user home dirs to contain IMAP mail and
 +
about a couple other technical details:
 +
 +
protocols = imaps
 +
#dga imap_listen = [::]
 +
imap_listen = *
 +
#dga default_mail_env =
 +
default_mail_env = mbox:%h/Mail:INBOX=/var/spool/mail/%u
 +
#dga mailbox_check_interval = 0
 +
mailbox_check_interval = 60
 +
 +
[[Category:Computer_Technology]]
 +
[[Category:Linux]]

Revision as of 20:19, 25 June 2007

Postfix mailer and Dovecot

__   _
  -o)/ /  (_)__  __ ____  __      Derek Winterstien
  /\\ /__/ / _ \/ // /\ \/ /      r.o.a.c.h.@.r.o.b.o.t.z...c.o.m
 _\_v __/_/_//_/\_,_/ /_/\_\      Trustix Secure Linux / Redhat Linux
..............................................................................

(A). Postfix

Postfix should be configured to start up on boot

  chkconfig Postfix on 

Make some configuration changes in postfix

  vi /etc/postfix/main.cf

Add / Modify the following

inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain
myorigin = $mydomain


(B). Dovecot

Install from RPM or latest from source.

Compiling Dovecot From Sources:

./configure
make
sudo make install

Redhat/Fedora

You will need to create a file under /etc/pam.d named dovecot with the following info:

auth    required        pam_unix.so nullok
account required        pam_unix.so


SysV Init Script for dovecot:

#!/bin/bash
#
# Init file for Dovecot on Trustix Linux
# Dovecot was compiled from source.
# Written by Derek B. Winterstien
# http://linux.dbw.org/
# Star City Linux User Group

source /etc/init.d/functions

[ -x /usr/local/sbin/dovecot ] || exit 1
[ -r /usr/local/etc/dovecot.conf ] || exit 1

RETVAL=0
prog="dovecot"
desc="dovecot daemon"

start() {
        echo -n $"Starting $desc ($prog): "
        daemon $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}

stop() {
        echo -n $"Shutting down $desc ($prog): "
        killproc $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading $desc ($prog): "
        killproc $prog -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  condrestart)
        [ -e /var/lock/subsys/$prog ] && restart
        RETVAL=$?
        ;;
  status)
        status $prog
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
        RETVAL=1
esac

exit $RETVAL


SysV Init Runlevels

  • redhat: /etc/rc.d/init.d
  • trustix: /etc/init.d

Install the init script in the appropriate init.d directory for your distribution. Now create the symlinks and so on with chkconfig.

 chkconfig --add dovecot

Verify that dovecot was added to the correct runlevels

/etc/init.d# chkconfig --list|grep dovecot 

Right now everything is K's

dovecot         0:off   1:off   2:off   3:off   4:off   5:off   6:off
 chkconfig --level 345 dovecot on

Now dovecot will startup with the system

Dovecot 'run as' User

create a separate dovecot user which doesn't have access to anything. It should also have it's own group where no-one else belongs to. dovecot user isn't used for any kind of mail processing - don't store users' mails as dovecot, and don't put dovecot to mail group.

For Trustix and Redhat the following should be ok:

 groupadd -g 97 -r dovecot
 useradd -d /no/dir -g dovecot -M -u 97 -r -s /bin/false dovecot

Misc Notes From Other Sources

dovecot. `/etc/rc.d/init.d/dovecot start` and `chkconfig dovecot add`. Worked with zero configuration although at first I could not see my folders on the server so I had a bit more configuration of imapd to do. I am not acutally sure how I got dovecot/Thunderbird to talk together completely. I had some strange group ownerhip bits in my mail files so fixing those might have helped. The changes I put into /etc/dovecot.conf included the following, to inform it that I have Mail subdirs in user home dirs to contain IMAP mail and about a couple other technical details:

protocols = imaps
#dga imap_listen = [::]
imap_listen = *
#dga default_mail_env = 
default_mail_env = mbox:%h/Mail:INBOX=/var/spool/mail/%u
#dga mailbox_check_interval = 0
mailbox_check_interval = 60