Change username

How to customize and extend your OpenVPN installation.
Post Reply
liyanzu
OpenVpn Newbie
Posts: 1
Joined: Tue Nov 24, 2020 7:00 am

Change username

Post by liyanzu » Tue Nov 24, 2020 7:10 am

I use the account name “10086”,When logging in, I changed this name to something to achieve login.
how to do,i changed the environmental variables but no effect
server.conf

Code: Select all

auth-user-pass-verify /etc/openvpn/checkpsw.py via-env 

checkpsw.py

Code: Select all

#! /usr/bin/python3
# -*- coding: UTF-8 -*-
import sys
import os
if __name__ == '__main__':
    user_name = os.environ['username']
    if user_name == '10086':
        os.environ['username'] = 'user1'
        #os.environ.setdefault('username', 'user1')
    print(os.environ)
    sys.exit(0)
Console:
environ({' 'password': '1', 'username': '[b][i]user1[/i][/b]'}
Tue Nov 24 14:19:49 2020 180.103.198.4:58031 TLS: Username/Password authentication succeeded for username '[i][b]10086[/b][/i]' [CN SET]

i want:

Code: Select all

Tue Nov 24 14:19:49 2020 180.103.198.4:58031 TLS: Username/Password authentication succeeded for username '[i][b]user1[/b][/i]' [CN SET]
Last edited by Pippin on Tue Nov 24, 2020 11:25 am, edited 1 time in total.
Reason: Formatting

Post Reply