问了pptpd的作者,他说在pptpd里并没有提供这个功能,pppd里有方法可以做到。
pppd在完成用户认证以后会执行/etc/ppp/auth-up脚本,并且传一些参数给它,为了查看这些参数,我在这个脚本里写以下的代码:
一个用户拨入VPN服务以后,生成arg.txt文件,查看这个文件内容:
查看pppd的源代码:
在pppd/auth.c的 network_phase()函数里:
在auth.c文件的auth_script()函数里
这里可以看到传递给auth-up/auth-down脚本的参数。
所以,可以利用auth-up脚本来防止用户的重复登录。
根据作者提供的脚本样例,我写了auth-up这个脚本:
有了这个脚本以后,用户登录并建立VPN连接以后,再以同样的用户名在其他地方登录成功以后,前一次的连接会被服务端强制断开。
pppd在完成用户认证以后会执行/etc/ppp/auth-up脚本,并且传一些参数给它,为了查看这些参数,我在这个脚本里写以下的代码:
一个用户拨入VPN服务以后,生成arg.txt文件,查看这个文件内容:
查看pppd的源代码:
在pppd/auth.c的 network_phase()函数里:
在auth.c文件的auth_script()函数里
这里可以看到传递给auth-up/auth-down脚本的参数。
所以,可以利用auth-up脚本来防止用户的重复登录。
根据作者提供的脚本样例,我写了auth-up这个脚本:
有了这个脚本以后,用户登录并建立VPN连接以后,再以同样的用户名在其他地方登录成功以后,前一次的连接会被服务端强制断开。