imapext-2007
diff APOPtools/pop3-record @ 1:28a55bc1110c
[mq]: imapext
author | yuuji@gentei.org |
---|---|
date | Mon, 14 Sep 2009 19:23:11 +0900 |
parents | |
children | d741b3ecc917 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/APOPtools/pop3-record Mon Sep 14 19:23:11 2009 +0900 1.3 @@ -0,0 +1,62 @@ 1.4 +#!/bin/sh - 1.5 +# A sample "POP before SMTP"-enabler script for tcp_wrappers 1.6 +# This script should be installed in /usr/local/etc 1.7 +# If you are thinking of using this script on heavily loaded host, 1.8 +# you had better to choose tcpserver instead of tcp_wrappers. 1.9 +# 1.10 +ALLOWTMP="/var/log/ATMP" 1.11 +if [ -f /usr/local/etc/hosts.allow ]; then 1.12 + ALLOW="/usr/local/etc/hosts.allow" 1.13 +else 1.14 + ALLOW=/etc/hosts.allow 1.15 +fi 1.16 +ALLOWSRC=${ALLOW}.src 1.17 +ALLOWNEW=${ALLOW}.new 1.18 + 1.19 +# for debug 1.20 +# (env;echo "1=$1") | Mail -s pop3access yuuji 1.21 + 1.22 +case $0 in 1.23 + *record) 1.24 + echo "tcp-env : $RELAYCLIENT : setenv = RELAYCLIENT" >> $ALLOWTMP.1 1.25 + ;; 1.26 + *age) 1.27 + rm -f $ALLOWTMP.2 1.28 + [ -f $ALLOWTMP.1 ] && mv -f $ALLOWTMP.1 $ALLOWTMP.2 1.29 + ;; 1.30 + *) 1.31 + # else generate master hosts.allow file 1.32 + ;; 1.33 +esac 1.34 +touch $ALLOWTMP.1 $ALLOWTMP.2 1.35 +echo "# 1.36 +# DO NOT EDIT THIS FILE! 1.37 +# This file is generated from $ALLOWSRC file. 1.38 +# Edit it! 1.39 +#" > $ALLOWNEW 1.40 +(cat $ALLOWTMP.[12] | sort -u; cat $ALLOWSRC) >> $ALLOWNEW 1.41 +/bin/mv -f $ALLOWNEW $ALLOW 1.42 + 1.43 +# pop3-{age,update,record} for tcp_wrappers ends here 1.44 +# The following section is the sample routine for tcpserver(ucsp-tcp) 1.45 +# If you use tcpserver, replace the above section after "case $0...esac" 1.46 +# by the following section. 1.47 +# Sample code was contributed by pirozeau(pirozeau@banana-fish.com). 1.48 + 1.49 +#TCPREMOTEIP=${TCPREMOTEIP:-undefined} 1.50 +#RELAYCLIENT=${RELAYCLIENT:-$TCPREMOTEIP} 1.51 +#ALLOW=/usr/local/etc/smtprule 1.52 +#case $0 in 1.53 +# *record) 1.54 +# echo "$RELAYCLIENT:allow,RELAYCLIENT=\"\"" >> $ALLOWTMP.1 1.55 +# ;; 1.56 +# *age) 1.57 +# rm -f $ALLOWTMP.2 1.58 +# [ -f $ALLOWTMP.1 ] && mv -f $ALLOWTMP.1 $ALLOWTMP.2 1.59 +# ;; 1.60 +# *) 1.61 +# # else generate master tcprule file 1.62 +# ;; 1.63 +#esac 1.64 +#touch $ALLOWTMP.1 $ALLOWTMP.2 1.65 +#(cat $ALLOWTMP.[12] | sort -u; cat ${ALLOW}) | /usr/local/bin/tcprules ${ALLOW}.cdb ${ALLOW}.tmp