In your config you need to add
username-as-common-name
auth-user-pass-verify /etc/openvpn/verify.php via-file
Then create the file and paste in it
#Now add this code into the file
#!/usr/bin/php
$userArray = file('/etc/openvpn/users'); $tmpFile = file($argv[1]); #userArray should be in the form of #username:password foreach ($userArray as $line) { $newArray = preg_split("/[:]+/", $line); if(trim($newArray[0]) == trim($tmpFile[0]) AND trim($newArray[1]) == trim($tmpFile[1])) exit(0); #Found a match } exit(1); #No match ?>
Don’t forget to add users 😉
echo „myfirstuser:password123“ > /etc/openvpn/users