From 1bc335d7158186c4fa094debea8a751f9b4df36d Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 1 Mar 2019 18:01:22 +0800 Subject: [PATCH] l2tp ok --- plugins/l2tp/index.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/plugins/l2tp/index.py b/plugins/l2tp/index.py index 0eaf1056b..011c98eb7 100755 --- a/plugins/l2tp/index.py +++ b/plugins/l2tp/index.py @@ -58,7 +58,25 @@ def status(): return 'start' +def initConf(): + l2tp_cs = getServerDir() + '/chap-secrets' + if not os.path.exists(l2tp_cs): + print 'cp -rf ' + getPluginDir() + '/tmp/chap-secrets' + ' ' + getServerDir() + public.execShell('cp -rf ' + getPluginDir() + + '/tmp/chap-secrets' + ' ' + getServerDir()) + + l2tp_is = getServerDir() + '/ipsec.secrets' + if not os.path.exists(l2tp_is): + public.execShell('cp -rf ' + getPluginDir() + + '/tmp/ipsec.secrets' + ' ' + getServerDir()) + + def start(): + initConf() + + if public.isAppleSystem(): + return "Apple Computer does not support" + data = public.execShell('service xl2tpd start') if data[0] == '': return 'ok' @@ -66,6 +84,9 @@ def start(): def stop(): + if public.isAppleSystem(): + return "Apple Computer does not support" + data = public.execShell('service xl2tpd stop') if data[0] == '': return 'ok' @@ -73,6 +94,9 @@ def stop(): def restart(): + if public.isAppleSystem(): + return "Apple Computer does not support" + data = public.execShell('service xl2tpd restart') if data[0] == '': return 'ok' @@ -127,6 +151,9 @@ def getUserList(): def addUser(): + if public.isAppleSystem(): + return public.returnJson(False, "Apple Computer does not support") + args = getArgs() data = checkArgs(args, ['username']) if not data[0]: @@ -138,6 +165,9 @@ def addUser(): def delUser(): + if public.isAppleSystem(): + return public.returnJson(False, "Apple Computer does not support") + args = getArgs() data = checkArgs(args, ['username']) if not data[0]: @@ -150,6 +180,7 @@ def delUser(): def modUser(): + args = getArgs() data = checkArgs(args, ['username', 'password']) if not data[0]: