#!/usr/bin/perl
# wzk [A|T] wenzk [D|O|T] net
#
# POP3 Auth script for OpenVPN
# Usage:
# save this file to /etc/openvpn/ as popauth.pl
# run: chmod +x /etc/openvpn/popauth.pl
# add the next line to you OpenVPN config file
# auth-user-pass-verify /etc/openvpn/popauth.pl via-env
# restart your OpenVPN Server
use Net:: POP3;
# POP Server Address
$POPHOST = "localhost";
$USERNAME = $ENV{username};
$PASSWORD = $ENV{password};
# Constructors
$pop = Net:: POP3->new($POPHOST);
$pop = Net:: POP3->new($POPHOST, Timeout => 60);
if ( defined $pop->login($USERNAME, $PASSWORD) ) {
$result = 0;
} else {
$result = 1;
}
$pop->quit;
exit $result;
我没有接触perl,想大家帮我看看如果上面的代 *** 认证正确的话,能否返回0呢?(本机上面是pop3的服务的)
我需要用这个返回值,来确认vpn客户端是否是有效的用户。
上面的代 *** 是通过pop3来验证的,我在自己的机器上面始终不能返回正确的0,总是返回是1.自己又知道怎么调试
,请大家帮忙了
把localhost改成你的邮件服务器地址,然后
export username= *** @ *** .xx
export password= *** ***
./popauth.pl
echo $?
会员注册
会员登录
个人空间
发表评论