pull/109/head
Mr Chen 6 years ago
parent 993d07beac
commit a6fcb2838e
  1. 3
      plugins/l2tp/chap-secrets
  2. 29
      plugins/l2tp/index.py
  3. 3
      plugins/l2tp/install.sh
  4. 26
      plugins/l2tp/scripts/l2tp.sh

@ -0,0 +1,3 @@
# Secrets for authentication using CHAP
# client server secret IP addresses
teddysun l2tpd 123123 *

@ -50,18 +50,13 @@ def getArgs():
def status(): 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) data = public.execShell(cmd)
if data[0] == '': if data[0] == '':
return 'stop' return 'stop'
return 'start' return 'start'
def initDreplace():
return file_bin
def start(): def start():
file = initDreplace() file = initDreplace()
data = public.execShell(file + ' start') data = public.execShell(file + ' start')
@ -79,20 +74,16 @@ def stop():
def restart(): def restart():
file = initDreplace() return 'ok'
data = public.execShell(file + ' restart')
if data[1] == '':
return 'ok'
return 'fail'
def reload(): def reload():
file = initDreplace() return 'ok'
data = public.execShell(file + ' reload')
if data[1] == '':
return 'ok'
return data[1]
def getUserList():
data = []
return public.getJson(data)
if __name__ == "__main__": if __name__ == "__main__":
func = sys.argv[1] func = sys.argv[1]
@ -106,5 +97,11 @@ if __name__ == "__main__":
print restart() print restart()
elif func == 'reload': elif func == 'reload':
print reload() print reload()
elif func == 'user_list':
print getUserList()
elif func == 'add_user':
print addUser()
elif func == 'delete_user':
print ''
else: else:
print 'error' print 'error'

@ -20,13 +20,14 @@ Install_l2tp()
echo '1.0' > $serverPath/l2tp/version.pl echo '1.0' > $serverPath/l2tp/version.pl
cp -rf scripts/l2tp.sh $serverPath/l2tp cp -rf scripts/l2tp.sh $serverPath/l2tp
chmod +x $serverPath/l2tp/l2tp.sh
if [ "Darwin" == "$SYSOS" ];then if [ "Darwin" == "$SYSOS" ];then
echo 'macosx unavailable' > $install_tmp echo 'macosx unavailable' > $install_tmp
exit 0 exit 0
fi fi
#cp -rf $serverPath/l2tp /bin/sh $serverPath/l2tp/l2tp.sh
echo 'install complete' > $install_tmp echo 'install complete' > $install_tmp
} }

@ -223,21 +223,29 @@ preinstall_l2tp(){
fi fi
echo echo
echo "Please enter IP-Range:" echo "Please enter IP-Range:"
read -p "(Default Range: 192.168.18):" iprange # read -p "(Default Range: 192.168.18):" iprange
[ -z ${iprange} ] && iprange="192.168.18" # [ -z ${iprange} ] && iprange="192.168.18"
iprange="192.168.18"
echo ${iprange}
echo "Please enter PSK:" echo "Please enter PSK:"
read -p "(Default PSK: teddysun.com):" mypsk # read -p "(Default PSK: teddysun.com):" mypsk
[ -z ${mypsk} ] && mypsk="teddysun.com" # [ -z ${mypsk} ] && mypsk="teddysun.com"
mypsk="midoks"
echo ${mypsk}
echo "Please enter Username:" echo "Please enter Username:"
read -p "(Default Username: teddysun):" username # read -p "(Default Username: teddysun):" username
[ -z ${username} ] && username="teddysun" # [ -z ${username} ] && username="teddysun"
username="midoks"
echo ${username}
password=`rand` # password=`rand`
echo "Please enter ${username}'s password:" echo "Please enter ${username}'s password:"
read -p "(Default Password: ${password}):" tmppassword # read -p "(Default Password: ${password}):" tmppassword
[ ! -z ${tmppassword} ] && password=${tmppassword} # [ ! -z ${tmppassword} ] && password=${tmppassword}
password=midoks
echo ${password}
echo echo
echo "ServerIP:${IP}" echo "ServerIP:${IP}"

Loading…
Cancel
Save