Last active
August 29, 2015 14:07
-
-
Save shivanshuag/a600cb1c0b2b142f27c8 to your computer and use it in GitHub Desktop.
OpenVpn Multi Factor Authentication Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
#OpenVpn Multi Factor Authentication Script | |
#Compares the password to "bar" | |
use POSIX; | |
# Get username/password from file | |
if ($ARG = shift @ARGV) { | |
if (!open (UPFILE, "<$ARG")) { | |
print "Could not open username/password file: $ARG\n"; | |
exit 1; | |
} | |
} else { | |
print "No username/password file specified on command line\n"; | |
exit 1; | |
} | |
$username = <UPFILE>; | |
$password = <UPFILE>; | |
$password_cmp = "bar"; | |
if (!$username || !$password) { | |
print "Username/password not found in file: $ARG\n"; | |
exit 1; | |
} | |
chomp $username; | |
chomp $password; | |
close (UPFILE); | |
exit !($password eq $password_cmp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment