Files
linux-cloud-router/debian-package/src/usr/lib/vpn-router/openvpn-same-user
T
2026-10-23 21:55:03 +02:00

13 lines
447 B
Python
Executable File

#!/usr/bin/python3
"""Accept an OpenVPN login only when the user name is the common name of the client certificate.
Run by the OpenVPN server as auth-user-pass-verify with via-env, next to the LDAP plugin that
checks the password, so a user's certificate cannot be used with another user's password.
"""
import os
import sys
username = os.environ.get('username', '')
sys.exit(0 if username and username == os.environ.get('common_name') else 1)