If you setup mail
server using dynamic DNS and your IP address is listed in
DUL(Dialup User List) and rejected to deliver e-mail, please try
following setting.
Make
smtproutes file under /var/qmail/control and write : following
your ISP smtp server name. If you want perfect setting add one
more file defaulthost and write ISP's domain name in it. For me,
daily log mail goes to ISP and rejected because of no user there
so I do not set later yet.
01/02/2006
Install qmail.
First of all let's get
source file and patch.
ftp://ftp.jp.qmail.org/qmail/qmail-1.03.tar.gz ftp://ftp.nlc.net.au/pub/unix/mail/qmail/qmail-date-localtime.patch http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/qmail-1.03.errno.patch
qmail-date-localtime.patch
matches the date and time information which is written in header
to local time. qmail-1.03.errno.patch is a patch for
compile error when using latest glibc(after 2.3.1) on Redhat8.0
and Redhat9 because of the manipuration of 'errno'.
Extract
the downloaded file and patch it.
#
tar xvfz qmail-1.03.tar.gz # cd qmail-1.03/ # patch -p1 <
../qmail-date-localtime.patch #
patch -p1 < ../qmail-1.03.errno.patch
Before
compile make the destination of installation and users and group
which are needed to operate qmail.
#
mkdir /var/qmail # groupadd nofiles # useradd -g nofiles -d
/var/qmail/alias -s /bin/false alias # useradd -g nofiles -d
/var/qmail -s /bin/false qmaild # useradd -g nofiles -d
/var/qmail -s /bin/false qmaill # useradd -g nofiles -d
/var/qmail -s /bin/false qmailp # groupadd qmail # useradd
-g qmail -d /var/qmail -s /bin/false qmailq # useradd -g qmail
-d /var/qmail -s /bin/false qmailr # useradd -g qmail -d
/var/qmail -s /bin/false qmails
Now compile and
configure it.
# make
setup # make check # ./config-fast
c-24-98-186-238.atl.client2.attbi.com
At this
time 5 files have been made in /var/qmail/control. You can change
their contents for your requirement.
Then prepare for start
up. At first setting of deliver to important accounts such as
postmaster, MAILER-DAEMON and root.
#
cd /var/qmail/alias # touch .qmail-postmaster
.qmail-mailer-daemon .qmail-root # chmod 644 .qmail*
Now
the male to postmaster, MAILER-DAEMON and root is saved at
/var/qmail/alias
If sendmail is already running, you need
to stop sendmail. And also remove from rc3.d and rc5.d. You can do
it from service setting gui. If you don't know ask me.
Concerning
about the mail command or CGI script access /usr/lib/sendmail
directory, replace the sendmail command to sendmail wrapper.
#
cd /usr/sbin # mv sendmail sendmail.dist # chmod 0
sendmail.dist # ln -s /var/qmail/bin/sendmail
/usr/sbin/sendmail
Copy /var/qmail/boot/home to
/var/qmail as rc.
# cp
/var/qmail/boot/home /var/qmail/rc
Then modify the
contents of rc as follows.
qmail-start ./Mailbox splogger
qmail -> qmail-start ./Maildir/ splogger qmail
You need
to create Maildir directory by yourself.
#
/var/qmail/bin/maildirmake ~alias/Maildir # chown -R alias
/var/qmail/alias/Maildir
and using each user
account
$
/var/qmail/bin/maildirmake ~/Maildir
or root can
make it instead of user. When you make as root, change the Maildir
directory owner to each user using chown. For new user, put the
Maildir template to /etc/skel directory which automatically create
the Maildir directory when you create the new user using adduser
command. Actually do following.
#
/var/qmail/bin/maildirmake /etc/skel/Maildir
Install tcpserver Get the source file from
ftp://ftp.jp.qmail.org/qmail/ucspi-tcp-0.88.tar.gz
then
#
tar xvfz ../ucspi-tcp-0.88.tar.gz # cd ucspi-tcp-0.88/ #
make setup check
Now make the file which is base of
cdb. Here, make as tcp.smtp file in /etc directory.
#
vi
/etc/tcp.smtp
192.168.0.:allow,RELAYCLIENT="" 127.:allow,RELAYCLIENT=""
Then
create the cdb file. cdb file is made by following command.
#
/usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp <
/etc/tcp.smtp
pop server setup
pop3 daemon has been
installed at qmail installation, but this daemon dose not have
authentication so that we use the checkpassword. Download and
install it.
http://cr.yp.to/checkpwd/checkpassword-0.90.tar.gz
$
tar xvfz checkpassword-0.90.tar.gz $ cd checkpassword-0.90 $
make # make setup check
Installation of relay-ctrl At this time,
you can send a mail from inside of domain but you can not send it
from outside dialup etc. So, we introduce pop before smtp
scheme. Begin by download and install daemontools and a patch
which is used by relay-ctrl.
http://cr.yp.to/daemontools/install.html http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/daemontools-0.76.errno.patch
$
tar xvzf daemontools-0.76.tar.gz $?cd
admin/daemontools-0.76 $
patch -p1 < ../daemontools-0.76.errno.patch #
package/install
Now
the envdir command is installed in /usr/local/bin but this
installation only make the link to your original installation
place, so that please copy the command by manually. Then
download and install the relay-cntl
http://untroubled.org/relay-ctrl/
$
tar xvzf relay-ctrl-3.1.1.tar.gz $ cd relay-ctrl-3.1.1 $
make # mkdir /usr/local/man # ./installer
Then
make directory which save IP addresses of pop3 access.
#
mkdir /var/qmail/relay-ctrl # mkdir
/var/qmail/relay-ctrl/spool # chgrp -R qmail
/var/qmail/relay-ctrl # chmod 700 /var/qmail/relay-ctrl #
chmod 777 /var/qmail/relay-ctrl/spool
Next, make
environment directory of relay-ctrl.
#
mkdir /etc/relay-ctrl # echo "/var/qmail/relay-ctrl/spool"
> /etc/relay-ctrl/RELAY_CTRL_DIR
Then setup the
cron which deletes IP address in /var/qmail/relay-ctrl/spool after
15min.
# crontab -e
then
add following line, save and exit like vi.
* * * * *
/usr/local/bin/envdir /etc/relay-ctrl
/usr/local/bin/relay-ctrl-age
Start up script Finally we make qmail start
up script as follows. Change the italic type part to your
configuration.
#!/bin/sh # #
qmail:
/var/qmail PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin
[
-f /var/qmail/rc ] || exit 0
case "$1"
in start) # Start daemons. echo "Starting
qmail." csh -cf '/var/qmail/rc &' envdir
/etc/relay-ctrl relay-ctrl-chdir \ tcpserver -v -u [qmail
group ID] -g [nofiles group ID] -x /etc/tcp.smtp.cdb
\ 0 smtp relay-ctrl-check \ /var/qmail/bin/qmail-smtpd 2>&1
| /var/qmail/bin/splogger smtpd 3 & envdir /etc/relay-ctrl
relay-ctrl-chdir \ tcpserver -v 0 pop3
/var/qmail/bin/qmail-popup \ [server FQID]
/bin/checkpassword \ relay-ctrl-allow
/var/qmail/bin/qmail-pop3d Maildir 2>&1 \ |
/var/qmail/bin/splogger pop3d 3 & echo touch
/var/lock/qmail ;; stop) # Stop daemons. echo
"Shutting down qmail." PID=`/bin/ps -aefw | grep
qmail | awk '{print $2}'` if [ ! -z "$PID" ] ;
then /bin/kill ${PID} 1> /dev/null 2>&1 fi echo rm
-f /var/lock/qmail ;;
restart) $0 stop $0
start ;; *) echo "Usage: S83qmail
{start|stop|restart}" exit 1 esac
exit 0
Then
copy this qmail file to /etc/rc.d/init.d and make link.
#
ln -s /etc/rc.d/init.d/qmail /etc/rc.d/rc3.d/S83qmail # ln -s
/etc/rc.d/init.d/qmail /etc/rc.d/rc5.d/S83qmail
Now
we have finished all the settings. Start qmail and test it.
#
/etc/rc.d/init.d/qmail start
$ telenet localhost 110
and
if you get
Trying 127.0.0.1... Connected to
localhost.localdomain (127.0.0.1). Escape character is
'^]'. +OK <1498.1013146645@your servei?’
FQDN>
congratulations! pop3 is now running. Then
input
user
popusername
+OK
pass
yourpassword
+OK
then
input
quit
then
confirm there is the file named 127.0.0.1 in
/var/qmail/relay-ctrl/spool and it is removed after 15min. Next,
access pop server using your host name. If it takes long time to
connect server, you need set up DNS server.
That's all.
Back
|