summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xduo_openvpn.pl20
1 files changed, 7 insertions, 13 deletions
diff --git a/duo_openvpn.pl b/duo_openvpn.pl
index 08a0524..aaf962f 100755
--- a/duo_openvpn.pl
+++ b/duo_openvpn.pl
@@ -16,12 +16,16 @@ my $API_RESULT_AUTH = qr/^auth$/;
my $API_RESULT_ALLOW = qr/^allow$/;
my $API_RESULT_DENY = qr/^deny$/;
my $API_RESULT_ENROLL = qr/^enroll$/;
-my $control = $ENV{'control'};
openlog 'duo_openvpn.pl', 'pid', 'LOG_AUTH';
-if (not $control) {
- logger('required control configuration');
+my $control = $ENV{'control'};
+my $username = $ENV{'username'};
+my $password = $ENV{'password'};
+my $ipaddr = $ENV{'ipaddr'} || '0.0.0.0';
+
+if (not $control or not $username or not $password) {
+ logger('required environmental variables not found');
exit 1;
}
@@ -32,16 +36,6 @@ my $host = $ENV{'host'};
if (not $ikey or not $skey or not $host) {
logger('required ikey/skey/host configuration');
failure();
- exit 1;
-}
-
-my $username = $ENV{'username'};
-my $password = $ENV{'password'};
-my $ipaddr = $ENV{'ipaddr'} || '0.0.0.0';
-
-if (not $control or not $username or not $host) {
- logger('required environmental variables not found');
- failure();
}
preauth();