#!/bin/sh - # A sample "POP before SMTP"-enabler script for tcp_wrappers # This script should be installed in /usr/local/etc # If you are thinking of using this script on heavily loaded host, # you had better to choose tcpserver instead of tcp_wrappers. # # for debug # (env;echo "1=$1") | Mail -s pop3access yuuji # pop3-{age,update,record} for tcp_wrappers ends here # The following section is the sample routine for tcpserver(ucsp-tcp) # If you use tcpserver, replace the above section after "case $0...esac" # by the following section. # Sample code was contributed by pirozeau(pirozeau@banana-fish.com). #TCPREMOTEIP=${TCPREMOTEIP:-undefined} TCPREMOTEIP=${REMOTE_HOST} RELAYCLIENT=${RELAYCLIENT:-$TCPREMOTEIP} ALLOW=/usr/local/etc/smtprule ALLOWTMP=/usr/local/etc/atmp case $0 in *record) echo "$RELAYCLIENT:allow,RELAYCLIENT=\"\"" >> $ALLOWTMP.1 ;; *age) rm -f $ALLOWTMP.2 [ -f $ALLOWTMP.1 ] && mv -f $ALLOWTMP.1 $ALLOWTMP.2 ;; *) # else generate master tcprule file ;; esac touch $ALLOWTMP.1 $ALLOWTMP.2 (cat $ALLOWTMP.[12] | sort -u; cat ${ALLOW}) | /usr/local/bin/tcprules ${ALLOW}.cdb ${ALLOW}.tmp