« apache 服务器的 CA 证书 |
Main
| [IPCN] 俺家代理的一个人性化改动 +补充说明 »
February 11, 2004
passchsquid.sh -- Password Change For Squid Auth
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。
https://windtear.net/archives/2004/02/11/000434.html
#!/bin/bash # # passchsquid.sh for squid # Password Change For Squid Auth # By Zhang Xiuling (windtear@ipcn.org) #
#HTPASSWD="/usr/local/apache/bin/htpasswd -b -d /etc/squid/passwd" HTPASSWD="/usr/bin/htpasswd -b -d /etc/squid/passwd" MKPASSWD="/usr/bin/mkpasswd -l 8 -d 0 -c 8 -C 0 -s 0" DEFAULTUSER=windtear PLAINPASSDIR=/etc/squid/_user HTMLFILE=/var/www/ipcn.org/proxy/index.html PASSFILE=/var/www/ipcn.org/proxy/password.txt PERL=/usr/bin/perl
FILENAME=`basename $0`
usage() { echo echo "usage: $FILENAME [USERNAME]" echo echo "Example:" echo " $FILENAME windtear" echo exit }
[[ $1 = "-h" || $1 = "--help" || $1 = "-v" || $1 = "--version" ]] && usage SQUIDUSER=${1:-$DEFAULTUSER} SQUIDPASS=$($MKPASSWD) SQUIDPASS=${2:-$SQUIDPASS} [[ -f $PLAINPASSDIR/$SQUIDUSER ]] && ORIGPASS=$(cat $PLAINPASSDIR/$SQUIDUSER) echo $ORIGPASS echo $SQUIDPASS echo $SQUIDPASS > $PLAINPASSDIR/$SQUIDUSER $HTPASSWD $SQUIDUSER $SQUIDPASS $PERL -pi -e "s#密码:$ORIGPASS#密码:$SQUIDPASS#" $HTMLFILE echo "帐号:windtear" > $PASSFILE echo "密码:$SQUIDPASS" >> $PASSFILE
|
|
Posted by windtear at February 11, 2004 9:37 AM