Centos7上openVP-用户密码登录

open**用户密码认证登陆

一、基于上一篇文章的密钥认证登陆,现在实现用户密码登陆(在上一篇的基础上修改即可)。

1、首先修改vi /etc/open**/server.conf配置文件,在这里注释五行密钥认证文件,添加以下四行用户密码认证文件:

1)auth-user-pass-verify /etc/open**/auth_pass.sh via-file 允许运行密码认证脚本
2)client-cert-not-required 不需要客户端证书认证
3)username-as-common-name 使用用户名密码登录认证
4)script-security 3 脚本安全性3
Centos7上openVP-用户密码登录

2、新建用户密码认证脚本 vi /etc/open**/auth_pass.sh

#!/bin/bash
#the username+password is stored in a temporary file
#pointed to by $1
username=head -1 $1
password=tail -1 $1
if grep "$username:$password" pass_file > /dev/null 2>&1
then
exit 0
else
if grep "$username" pass_file > /dev/null 2>&1
then
echo "auth-user-pass-verify: Wrong password entered for user '$username'"
else
echo "auth-user-pass-verify: Unknown user '$username'"
fi
exit 1
fi

Centos7上openVP-用户密码登录

3、创建用户名密码文件 vi /etc/open**/pass_file

wangfeiyu:123(前边用户名,后边密码)
ming:123
Centos7上openVP-用户密码登录
Centos7上openVP-用户密码登录

4、增加auth_pass.sh和pass_file文件权限

chmod 777 /etc/open/auth_pass.sh
chmod 777 /etc/open
/pass_file

5、重启open服务 systemctl restart open@server.service

6、修改客户端配置文件打 C:\ProgramFiles\Open\config\client.o

添加一行:auth-user-pass
注释五行:
1)#cert client.crt 2)#key client.key 3);user nobody
4);group nobody 5)#cipher AES-256-CBC
Centos7上openVP-用户密码登录
Centos7上openVP-用户密码登录
Centos7上openVP-用户密码登录
Centos7上openVP-用户密码登录

7、重新连接(输入用户名密码点击ok就可以了)

Centos7上openVP-用户密码登录
注:如果没有问题的话右下角的图标会变绿,鼠标放在上边能看见tun地址。

转载于:https://blog.51cto.com/13043516/2091986

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值