#!/bin/sh # # service-dovecot-xxx-run # John Simpson 2008-05-13 # # can be used as the "run" script for a Dovecot IMAP or POP3 service # ############################################################################### # # Copyright (C) 2008 John Simpson. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 3, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ############################################################################### # IP and port to listen on IP=127.0.0.1 PORT=143 # how many concurrent connections to allow. #MAX=40 # .cdb filename, if using a tcp/sslserver access control file #ACCESS_CDB= ######################################## # location of imap-login or pop3-login, whichever is used by this service # this is normally /usr/local/libexec/dovecot/xxxx-login SVC_LOGIN=/usr/local/libexec/dovecot/imap-login # if >0, set up secure connection IS_SSL=0 # for SSL connections, specify the .pem file containing the server key #CERTFILE=/var/qmail/control/servercert.pem ############################################################################### ############################################################################### ############################################################################### # # build command line if [ ${IS_SSL:-0} -gt 0 ] then if [ -n "${CERTFILE:-}" ] then CMD="sslserver -evRH -l0" export CERTFILE export KEYFILE="" export DHFILE="" else echo "ERROR: no CERTFILE specified for SSL service" sleep 5 exit 1 fi else CMD="tcpserver -vRH -l0" fi if [ -n "${MAX:-}" ] then CMD="$CMD -c \"$MAX\"" fi if [ -n "${ACCESS_CDB:-}" ] then CMD="$CMD -x \"$ACCESS_CDB\"" fi CMD="$CMD $IP $PORT $SVC_LOGIN" if [ ${IS_SSL:-0} -gt 0 ] then CMD="$CMD --ssl" fi ############################################################################### # # do the deed echo "command line: $CMD" exec $CMD 2>&1 echo "exec failed" sleep 5