Hello, I have a problem setting up a vpn for my homeoffice, I would be very grateful if anyone could help. I couldn't understand what is happening. The problem is that even if I enter the wrong username and password in the client, I can log into the VPN. See the codes below:
#################### CLIENT Config ###############################
client
dev tun
proto udp
remote 178.200.125.32 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client01.crt
key client01.key
auth-user-pass
comp-lzo
verb 3
###################### SERVER Config #############################
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
script-security 3
auth-user-pass-verify 'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -File "C:\\Program Files\\OpenVPN\\config\\auth.ps1"' via-file
username-as-common-name
tmp-dir "C:\\Windows\\temp"
server 10.20.30.0 255.255.255.0
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
########################## The SCRIPT auth.ps1 ####################################
param([string]$authfile)
#read openvpn authentication
$creds = gc $authfile
$username = $creds[0]
$password = $creds[1]
if (Test-Path "C:\Program Files\OpenVPN\config\$username.txt"){
$EXPECTED_PASSWORD=(Get-Content "C:\Program Files\OpenVPN\config\$username.txt" | Select-Object -Last 1)
if ($password -eq $EXPECTED_PASSWORD) {
Write-Host "OK"
exit 0
}else{
Write-Host "Authentication failed"
exit 1
}
}else{
Write-Host "Authentication failed"
exit 1
}
Open VPN authentication script error
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
-
- OpenVpn Newbie
- Posts: 2
- Joined: Mon Mar 27, 2023 2:37 am
-
- OpenVpn Newbie
- Posts: 2
- Joined: Mon Mar 27, 2023 2:37 am
Re: Open VPN authentication script error
i figured out the error, it was just the quotes or space in the script location. The exact correct form is in this other topic: viewtopic.php?t=26264#p102600