mirror of
https://github.com/QSCTech/zjunet.git
synced 2026-01-22 19:54:48 +08:00
Merge branch 'dev' of https://github.com/QSCTech/zjunet into dev
This commit is contained in:
commit
4cfe165573
@ -53,7 +53,8 @@ if [ "${devs_count}" -eq "0" ]; then
|
||||
ip route replace default via $gateway dev $dev
|
||||
|
||||
ip route
|
||||
return
|
||||
exit 0
|
||||
#return
|
||||
fi
|
||||
|
||||
ip route replace 10.5.1.0/24 via $gateway # for LNS
|
||||
|
||||
@ -35,7 +35,7 @@ edituser() {
|
||||
password=$2
|
||||
echo $password > "$users_enabled/${username}"
|
||||
echo "[INFO] Disconnect VPN"
|
||||
"${BASEDIR}/sudo.sh" "${BASEDIR}/vpn.sh" disconnect
|
||||
"${BASEDIR}/vpn.sh" disconnect
|
||||
echo "[INFO] Write to xl2tpd.conf"
|
||||
"${BASEDIR}/sudo.sh" "${BASEDIR}/xl2tpd.sh" adduser ${username} $password
|
||||
echo "[INFO] Restart xl2tpd"
|
||||
|
||||
18
lib/vpn.sh
18
lib/vpn.sh
@ -25,19 +25,19 @@ BASEDIR=$(dirname $0)
|
||||
|
||||
flush() {
|
||||
# see also: https://github.com/QSCTech/zjunet/issues/39
|
||||
ip route flush 10.5.1.5
|
||||
ip route flush 10.5.1.7
|
||||
ip route flush 10.5.1.9
|
||||
ip route flush 10.5.6.2
|
||||
"${BASEDIR}/sudo.sh" ip route flush 10.5.1.5
|
||||
"${BASEDIR}/sudo.sh" ip route flush 10.5.1.7
|
||||
"${BASEDIR}/sudo.sh" ip route flush 10.5.1.9
|
||||
"${BASEDIR}/sudo.sh" ip route flush 10.5.6.2
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
users=$("${BASEDIR}/user.sh" getall)
|
||||
for username in $users; do
|
||||
echo "[INFO] Logout: ${username}"
|
||||
"${BASEDIR}/xl2tpd.sh" disconnect $username
|
||||
"${BASEDIR}/sudo.sh" "${BASEDIR}/xl2tpd.sh" disconnect $username
|
||||
done
|
||||
"${BASEDIR}/route.sh"
|
||||
"${BASEDIR}/sudo.sh" "${BASEDIR}/route.sh"
|
||||
}
|
||||
|
||||
connect() {
|
||||
@ -47,11 +47,13 @@ connect() {
|
||||
for username in $users; do
|
||||
password=$("${BASEDIR}/user.sh" getpwd $username)
|
||||
echo "[INFO] Login using ${username}"
|
||||
"${BASEDIR}/xl2tpd.sh" connect $username $password
|
||||
"${BASEDIR}/sudo.sh" "${BASEDIR}/xl2tpd.sh" connect $username $password
|
||||
echo ------ flush
|
||||
flush
|
||||
echo ------ febd
|
||||
done
|
||||
|
||||
"${BASEDIR}/route.sh"
|
||||
"${BASEDIR}/sudo.sh" "${BASEDIR}/route.sh"
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# RUN AS ROOT! >..< ~~ / by xero ~~~ ararararar ~~~~
|
||||
|
||||
LNS="10.5.1.9"
|
||||
L2TPD_CFG_FILE=/etc/xl2tpd/xl2tpd.conf
|
||||
@ -78,7 +80,7 @@ xl2tpd_restart() {
|
||||
}
|
||||
|
||||
xl2tpd_create_lac() {
|
||||
touch $PPP_LOG_FILE
|
||||
#touch $PPP_LOG_FILE
|
||||
|
||||
cat > $PPP_OPT_FILE <<EOF
|
||||
noauth
|
||||
@ -122,10 +124,11 @@ connect() {
|
||||
echo -n > $PPP_LOG_FILE
|
||||
|
||||
prev_count=$(ip addr show | grep 'inet.*ppp' | grep ' 10.5.' | wc -l)
|
||||
echo $LOG_FILE
|
||||
|
||||
for i in $(seq 0 10000); do
|
||||
|
||||
tail $PPP_LOG_FILE
|
||||
tail $PPP_LOG_FILE >> /home/xero/tmp/ttttt
|
||||
tail $PPP_LOG_FILE >> $LOG_FILE
|
||||
if [ $(tail $PPP_LOG_FILE | grep 'Connection terminated' | wc -l) -ne 0 ]
|
||||
then
|
||||
|
||||
@ -29,13 +29,13 @@ case "$1" in
|
||||
;;
|
||||
all)
|
||||
"${BASEDIR}/wlan.sh" $2
|
||||
"${BASEDIR}/sudo.sh" "${BASEDIR}/vpn.sh" $2
|
||||
"${BASEDIR}/vpn.sh" $2
|
||||
;;
|
||||
wlan)
|
||||
"${BASEDIR}/wlan.sh" $2
|
||||
;;
|
||||
vpn)
|
||||
"${BASEDIR}/sudo.sh" "${BASEDIR}/vpn.sh" $2
|
||||
"${BASEDIR}/vpn.sh" $2
|
||||
;;
|
||||
dns)
|
||||
"${BASEDIR}/dns.sh"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user