blimp ~on the web |
This document outlines the steps that I have taken to set up dial up networking and qmail for a stand alone linux machine running stock redhat 5.2 with a dial up, dynamicaly asssigned ip address, ppp connection to the internet through an ISP. Note: I am not a unix expert or a mail expert. I cannot guarantee this will work for you, but it might help. Essentially none of the information presented here is original work, rather it is an attempt to organize what I have found useful in the docs, usenet posts, and mailing list archives. Credit goes to those authors entirely.
Since I expect the reader to go through FAQs and man pages for more detailed workings of these packages, I give here the bare minimum which has worked very well for me and should work for others too. So, for details please read the man pages and other docs that come with packages.
Packages I used for setting up dial-up networking on Linux machine and mail exchange with a pop/mail server.
Other packages for retreiving mails from POP servers can be found at UNC's Sunsite.
I also used fetchmail once which can also be found here.
Its best to get wvdial*i386.rpm from web.
# rpm -i wvdial*i386.rpmwvdial and wvdialconf are installed in /usr/local/bin.
# /usr/local/bin/wvdialconf /etc/wvdial.conf/etc/wvdial.conf is the file where the initialization and other parameters will be installed.
[Dialer myISP] Phone = 1234567 Username = myUsername@myISP.com Password = myPassword
# chmod 4755 /usr/local/bin/wvdial /usr/sbin/pppd
% /usr/local/bin/wvdial myISP
Its ok to get qmail's rpms from memphis.edu otherwise tarball (*tar.gz) is ok.
If you've rpm, then install the binaries with ...
# rpm -i qmail*.i386.rpm
Check where are all the files located. by default it should be /var/qmail but Qmail RPMs install files in lots of places instead eg /etc/qmail , /usr/bin etc.
Remove sendmail from the system first.
# rpm -e sendmail
If you've a tarball, its best in my opinion. You gunzip and untar the file using command tar zxvf filename.tar.gz. You can also gunzip first and then untar. ( # gunzip qmail*tar.gz; tar xvf qmail*tar )
The INSTALL file contains detailed installation instructions. I give them in short here.
qmail:*:2107 nofiles:*:2108
alias:*:7790:2108::/var/qmail/alias:/bin/true qmaild:*:7791:2108::/var/qmail:/bin/true qmaill:*:7792:2108::/var/qmail:/bin/true qmailp:*:7793:2108::/var/qmail:/bin/true qmailq:*:7794:2107::/var/qmail:/bin/true qmailr:*:7795:2107::/var/qmail:/bin/true qmails:*:7796:2107::/var/qmail:/bin/truealias,qmaild,qmaill,qmailp belong to nofiles group, rest 3 to qmail group.
# mkdir /var/qmail
# cd dir_where_qmail_src_files_are # make setup check
# ./config-fast localhost.localdomainor if you have a working DNS service for your network/machine
# ./config
# ln -s /var/qmail/bin/sendmail /usr/lib/sendmail # ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
smtp stream tcp nowait qmaild /var/qmail/bin/tcp-env tcp-env /var/qmail/bin/qmail-smtpdThe above thing should be in a single line in /etc/inetd.conf
# killall -HUP inetd
echo "Starting qmail ..." csh -cf '/var/qmail/boot/home &'
# csh -f '/var/qmail/boot/home &'
# telnet 127.0.0.1 25You should be able to see this line ...
220 localhost.localdomain ESMTPwhich means partially successful installation.
MAILHOST=isp.com MAILUSER=yourispusername MAILNAME="Your name" QMAILINJECT="fi" export MAILHOST MAILUSER QMAILINJECT
or if you use c-shell, then add the following lines to ~/.login
setenv MAILHOST "isp.com" setenv MAILUSER "yourispusername" setenv MAILNAME "Your name" setenv QMAILINJECT "fi"
As earlier for qmail, rpm's are ok but tarball is best.
usually they install in /usr/local and assume qmail lies in /var/qmail. installation for both is pretty easy and the following steps are common.
# make
# make setup check
Extract the files from tarball and go to the dir where getpop3's src files are present. The binary getpop3 will be installed in /usr/local/bin.
# ./configure
# make depend # make # make install
A typical ~/.getpop3rc looks like ...
[pop3host] [pop3account] [pop3passwd]
Note: The ~/.getpop3rc should not have any permissions to group and others. ie mode 600 only.
To add offline outbound mailing, we need qmail package, maildirsmtp (part of serialmail package) and tcpclient (part of ucspi-tcp package)
# /var/qmail/bin/maildirmake ~alias/pppdir # chown -R alias ~alias/pppdir
./pppdir/in ~alias/.qmail-ppp-default. Donot forget ./ or / .
:alias-pppIf you send a mail to non-local recepients, the mail will be saved/stored to ~alias/pppdir/new and will wait there till you connect.
Suppose electra and venus are local users and they have accounts on isp1.com as janus and isp2.com as psyche respectively. You may wish to redirect all mails sent to janus@isp1.com to local user electra. Then you need to masquerade electra as janus@isp1.com
janus@isp1.com:alias-isp1 psyche@isp2.com:alias-isp2
Also, put
&electrain ~alias/qmail-isp1-janus and
&venusin ~alias/qmail-isp2-psyche
# killall -HUP qmail-send
This will enable mails from local machine to janus@isp1.com to be treated as local and delivered locally. ie. mails to janus will be delivered to electra and mails to psyche@isp2.com will be delivered to venus.
To automate the mail exchange, create the file /etc/ppp/ip-up.local. ip-up is shell script which is executed by ppp when a connection is established. Make it executable (mode 755).
My ip-up looks like this ...
#!/bin/sh -f # export PATH="/bin:/usr/bin:/usr/local/bin" echo `date "+%a %b %d %H:%M:%S :"` CONNECT: $4 >> /var/log/ppplog # get mails from POP server getpop3 -q -A exit1=$? # send mails to MAIL server once mails have been fetched # $4 is the ip address we are assigned. maildirsmtp ~alias/pppdir alias-ppp- isp.com `hostname` exit2=$? if [ "$exit1" = "0" -a "$exit2" = "0" ] ; then wall "Mail exchange finished for this session." ; else wall "Could not exchange mail properly in this session."; fi
Replace isp.com with another mail relay or ISP mailhost.
Similar to ip-up there is a shell script which is executed when the connection goes down. Create /etc/ppp/ip-down.local and make it mode 755.
My ip-down.local looks like this ...
#!/bin/sh -f echo `date "+%a %b %d %H:%M:%S :"` DISCONNECT: >> /var/log/ppplogThis can be used to log up-time and connect time for costing.