This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
password_authentication [2008/03/18 12:30] kyxap |
password_authentication [2013/12/15 17:02] (current) kyxap |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{tag>freebsd openvpn password auth ccd}}====== Парольная аутентификация в openvpn ====== | ||
+ | |||
===== Server Config ===== | ===== Server Config ===== | ||
<code> | <code> | ||
Line 24: | Line 26: | ||
verb 3 | verb 3 | ||
</code> | </code> | ||
+ | |||
===== Скрипт /usr/local/etc/openvpn/auth.pl ===== | ===== Скрипт /usr/local/etc/openvpn/auth.pl ===== | ||
<code perl> | <code perl> | ||
Line 44: | Line 47: | ||
chomp $password; | chomp $password; | ||
if ($username eq $thisUsername && $password eq $thisPassword) { | if ($username eq $thisUsername && $password eq $thisPassword) { | ||
- | $isValidUser = 1;} | + | $isValidUser = 1; |
+ | last; | ||
+ | } | ||
} | } | ||
close PASSWORDS; | close PASSWORDS; | ||
Line 50: | Line 55: | ||
if ($isValidUser == 1) { | if ($isValidUser == 1) { | ||
print "ERR\n"; | print "ERR\n"; | ||
- | exit 0; | + | exit 1; |
} else { | } else { | ||
print "OK\n"; | print "OK\n"; | ||
- | exit 1; | + | exit 0; |
} | } | ||
</code> | </code> |