Use phpmailer to implement simple openvpn user authentication. Now everyone has countless accounts and passwords, which cannot be remembered. The principle is to complete authentication through the mail server pop service, or use SMTP and add SSL to improve security; password setting is not required. now everyone has countless accounts and passwords, which is hard to remember. The principle is that authentication is completed through the pop service of the mail server. you can also use SMTP and add SSL to improve security; this eliminates the trouble of setting User/Password. it is suitable for scenarios where you have your own email server and require PHPMailer. google
PHP code
The code is as follows:
Require_once ('class. phpmailer. php ');
Require_once ('class. pop3.php ');
$ Username = getenv ('Username ');
$ Password = getenv ('password ');
$ Pop = new POP3 ();
$ Auth = $ pop-> Authorise ('your .mailserver.com ', 110, 30, "$ username", "$ password", 1 );
If ($ auth ){
# Echo OK;
Exit (0 );
} Else {
# Echo "FAIL ";
Exit (255 );
}
?>
Save as auth_user.php and set it to executable
Server. conf directly
Auth-user-pass-verify auth_user.php via-env
Authentication, it is hard to remember; the principle is to complete authentication through the mail server pop service, you can also use SMTP, and add SSL to improve security; do not set user/password...