mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:19:26 +08:00
优化
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# Secrets for authentication using CHAP
|
||||
# client server secret IP addresses
|
||||
teddysun l2tpd 123123 *
|
||||
+13
-16
@@ -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'
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user