From a6fcb2838e439b8d598ce1d1ce8a38ee4a9774fa Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Thu, 28 Feb 2019 20:01:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/l2tp/chap-secrets | 3 +++ plugins/l2tp/index.py | 29 +++++++++++++---------------- plugins/l2tp/install.sh | 3 ++- plugins/l2tp/scripts/l2tp.sh | 26 +++++++++++++++++--------- 4 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 plugins/l2tp/chap-secrets diff --git a/plugins/l2tp/chap-secrets b/plugins/l2tp/chap-secrets new file mode 100644 index 000000000..70fddd818 --- /dev/null +++ b/plugins/l2tp/chap-secrets @@ -0,0 +1,3 @@ +# Secrets for authentication using CHAP +# client server secret IP addresses +teddysun l2tpd 123123 * diff --git a/plugins/l2tp/index.py b/plugins/l2tp/index.py index 6be3f4ff4..e250685d2 100755 --- a/plugins/l2tp/index.py +++ b/plugins/l2tp/index.py @@ -50,18 +50,13 @@ def getArgs(): def status(): - cmd = "ps -ef|grep pure-ftpd |grep -v grep | grep -v python | awk '{print $2}'" + cmd = "ps -ef|grep xl2tpd |grep -v grep | grep -v python | awk '{print $2}'" data = public.execShell(cmd) if data[0] == '': return 'stop' return 'start' -def initDreplace(): - - return file_bin - - def start(): file = initDreplace() data = public.execShell(file + ' start') @@ -79,21 +74,17 @@ def stop(): def restart(): - file = initDreplace() - data = public.execShell(file + ' restart') - if data[1] == '': - return 'ok' - return 'fail' + return 'ok' def reload(): - file = initDreplace() - data = public.execShell(file + ' reload') - if data[1] == '': - return 'ok' - return data[1] + return 'ok' +def getUserList(): + data = [] + return public.getJson(data) + if __name__ == "__main__": func = sys.argv[1] if func == 'status': @@ -106,5 +97,11 @@ if __name__ == "__main__": print restart() elif func == 'reload': print reload() + elif func == 'user_list': + print getUserList() + elif func == 'add_user': + print addUser() + elif func == 'delete_user': + print '' else: print 'error' diff --git a/plugins/l2tp/install.sh b/plugins/l2tp/install.sh index 9b011278e..1a6a795db 100755 --- a/plugins/l2tp/install.sh +++ b/plugins/l2tp/install.sh @@ -20,13 +20,14 @@ Install_l2tp() echo '1.0' > $serverPath/l2tp/version.pl cp -rf scripts/l2tp.sh $serverPath/l2tp + chmod +x $serverPath/l2tp/l2tp.sh if [ "Darwin" == "$SYSOS" ];then echo 'macosx unavailable' > $install_tmp exit 0 fi - #cp -rf $serverPath/l2tp + /bin/sh $serverPath/l2tp/l2tp.sh echo 'install complete' > $install_tmp } diff --git a/plugins/l2tp/scripts/l2tp.sh b/plugins/l2tp/scripts/l2tp.sh index 0fb341989..8cd0b23e0 100644 --- a/plugins/l2tp/scripts/l2tp.sh +++ b/plugins/l2tp/scripts/l2tp.sh @@ -223,21 +223,29 @@ preinstall_l2tp(){ fi echo echo "Please enter IP-Range:" - read -p "(Default Range: 192.168.18):" iprange - [ -z ${iprange} ] && iprange="192.168.18" + # read -p "(Default Range: 192.168.18):" iprange + # [ -z ${iprange} ] && iprange="192.168.18" + iprange="192.168.18" + echo ${iprange} echo "Please enter PSK:" - read -p "(Default PSK: teddysun.com):" mypsk - [ -z ${mypsk} ] && mypsk="teddysun.com" + # read -p "(Default PSK: teddysun.com):" mypsk + # [ -z ${mypsk} ] && mypsk="teddysun.com" + mypsk="midoks" + echo ${mypsk} echo "Please enter Username:" - read -p "(Default Username: teddysun):" username - [ -z ${username} ] && username="teddysun" + # read -p "(Default Username: teddysun):" username + # [ -z ${username} ] && username="teddysun" + username="midoks" + echo ${username} - password=`rand` + # password=`rand` echo "Please enter ${username}'s password:" - read -p "(Default Password: ${password}):" tmppassword - [ ! -z ${tmppassword} ] && password=${tmppassword} + # read -p "(Default Password: ${password}):" tmppassword + # [ ! -z ${tmppassword} ] && password=${tmppassword} + password=midoks + echo ${password} echo echo "ServerIP:${IP}"