Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
> Speaking of diald, I'd like to hear how people have elected to handle > DNS and SMTP mail delivery/collection? I've been doing this kind of thing for several years so this represents several years of slow evolution, initially on Slackware and then moving to Red Hat. If I were starting with Red Hat today the approach may have been different. I don't use DNS in the house. There are 10 hosts in my hosts file which is maintained at a single node. The other UNIX-like machines get a copy of the hosts file. Windows machines get WINS service by way of SAMBA. I used the "nodns" version of sendmail.cf. My ISP has MX records for my machine such that if my machine is down, one of theirs will take delivery and work at its own pace to eventually forward the mail to me. I use pppd. I have a separate options file for each of several points-of-presence for my ISP. Each options file calls out the use of a separate chat script. Each options/chatscript pair live in their own subdirectory of /etc/ppp - so I have /etc/ppp/tiac-arlington, /etc/ppp/tiac-cambridge, etc. One of the options in my options file is "idle 1200" - turn off the link after 20 minutes of inactivity. There is no inactivity timer on my ISP's side. I have tweaked the mode on pppd to 4750, owner root, group uucp. All of the chat and options file are mode 750 or 640, owner root, group uucp. I can grant any of my users access to pppd by putting them in group uucp. If I were setting this up today, I might choose the pppusers group provided on recent RHL distributions. Anyone that wants to connect to any of my ISP's POPs can do it by typing /usr/sbin/pppd -d ttyS2 234000 file /etc/ppp/<POPNAME>/options. In practice I wrote a convenience script (/usr/local/bin/ppp) which takes a POP name as a parameter and attempts to connect to that POP and waits to see ppp0 come up before printing a success or failure message. For mail handling, I have a second script called "mailcheck". It runs out of cron several times a day. It attempts to connect to a preferred POP. If it succeeds it runs sendmail -q and leaves the line up to catch any mail inbound from my ISP. Yes this is passive and nondeterministic, but it works. If mailcheck fails to get a connection, it uses "at" to reschedule itself in another 5 minutes. So in practice, everything is smooth. Mailcheck runs at regular intervals to drain the mail from the ISP. If I create a mail message that's got to get out NOW!, I can run mailcheck manually. If one of us wants to get online we can type "ppp tiac" and my ppp script dials my default POP and exits only when it's sure that I have a connection. Get a close look at fetchmail before getting all wound up in this kind of hackery. Scripts attached. Hope this Helps, ccb -- [ /usr/local/bin/ppp ] -------- 8< -------------- #!/bin/bash -p # # /usr/sbin/ppp - dial a host # : -Main # Main() { case "$1" in -k) kill `cat $_PIDFILE` exit $? ;; "") 1>&2 echo "Usage: $0 [-k] system" exit 1 ;; esac SYSTEM=$1 $_PPPD -d ttyS2 230400 file /etc/ppp/$SYSTEM/options for K in 1 2 3 4 5 6 do for K in 1 2 3 4 5 do sleep 2 [ -f /etc/ppp/ppp0 ] && { echo "$SYSTEM is up" return 0 } done done echo Timed out waiting for $SYSTEM return 1 } typeset -r _PIDFILE=/var/run/ppp0.pid typeset -r _PPPDIR=/usr/local/lib/ppp typeset -r _PPPD=/usr/sbin/pppd typeset _X= case "$-" in *x*) # debug... _X=-px ;; esac [ "$CHECK_SYNTAX" ] || Main "$@" # -- NO CODE BELOW THIS LINE -- -- [ /usr/local/bin/mailcheck ] -------------- #!/bin/sh # IsOnLine() { [ -f $_LOCKFILE ] } Main() { case "$1" in on) echo "Mail checking enabled" echo "Mail checking enabled" | Mail -s "mailcheck notification" kukla-users [ -f $_NOMAIL ] || return 0 set -- $(wc -l $_NOMAIL) rm -f $_NOMAIL [ $1 -eq 0 ] && exit 0 S=s [ $1 -eq 1 ] && S= echo "$1 mail check$S missed, launching one immediately" ;; off) > $_NOMAIL echo "Mail checking disabled" echo "Mail checking disabled" | Mail -s "mailcheck notification" kukla-users IsOnLine && { echo "currently online, use ppp -k as root to kill" } exit 0 ;; -q) if IsOnLine then echo "Online, use ppp -k as root to kill" else echo "Offline" fi exit 0 ;; -f) FORCE=1 ;; esac [ -f $_NOMAIL -a ! "$FORCE" ] && { echo "Mail scan deferred" echo >> $_NOMAIL exit 0 } IsOnLine && { echo "Already online" exit 0 } /usr/local/bin/ppp tiac || { echo "connect to tiac failed" echo "scheduling retry for T+5 minutes" echo "/usr/local/bin/mailcheck" | at now + 5 minutes exit 1 } /usr/sbin/sendmail -q } _NOMAIL=/var/local/mailcheck/disable _LOCKFILE=/var/run/ppp0.pid [ "$CHECK_SYNTAX" ] || Main "$@" # -- NO CODE BELOW THIS LINE -- - Subcription/unsubscription/info requests: send e-mail with "subscribe", "unsubscribe", or "info" on the first line of the message body to discuss-request at blu.org (Subject line is ignored).
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |