Vyprvpn 自动重连及升级后 tomato 路由器无法使用的解决办法

Tomato 路由器版的 Vyprvpn 升级后 installer.sh 和安装文件的下载链接都变成了 https, 导致无法下载和安装。

解决办法是:

直接下载 Vyprvpn 的安装文件。

可以在 install.sh 中找到安装文件的下载链接:

echo -n "Installing VyprVPN Router App...";

nvram set script_init="eval \`nvram get vypr_bootstrap\`";

nvram set vypr_bootstrap="
/bin/touch /tmp/vyprvpn_lock.\$\$;
/bin/mv -n /tmp/vyprvpn_lock.\$\$ /tmp/vyprvpn_lock;
if [ -f /tmp/vyprvpn_lock.\$\$ ];
then
 rm /tmp/vyprvpn_lock.\$\$;
else

 status=\"downloading\";
 /bin/kill -SIGTERM \"\$(pidof watchdog.sh)\" 2>/dev/null;
 echo \"{\\\"res\\\":\\\"OK\\\",\\\"data\\\":{\\\"status\\\":\\\"\$status\\\"}}\" > /www/user/vyprvpn_app_status.html;

 cd /tmp/var;
 /bin/rm -f vyprvpn.tar.gz;
 while [ ! -f vyprvpn.tar.gz ];
 do
 wget -O vyprvpn.tar.gz http://router-app.goldenfrog.netdna-cdn.com/tomato/mipsel/vyprvpn.tar.gz;
 sleep 5;
 done;

 /bin/kill -SIGTERM \"\$(pidof vyprvpn)\" 2>/dev/null;
 seconds=0;
 while [ \"\$(pidof vyprvpn)\" ];
 do
 sleep 1;
 seconds=\$((seconds+1));
 if [ \$seconds = 10 ];
 then
 /bin/kill -9 \"\$(pidof vyprvpn)\" 2>/dev/null;
 fi;
 if [ \$seconds = 15 ];
 then
 break;
 fi;
 done;

 /bin/kill -SIGTERM \"\$(pidof openvpn)\" 2>/dev/null;
 /bin/kill -SIGTERM \"\$(pidof pppd)\" 2>/dev/null;

 /bin/rm -rf /tmp/var/vyprvpn;
 /bin/tar -zxvf vyprvpn.tar.gz;
 /bin/rm -f vyprvpn.tar.gz;

 vyprvpn/scripts/run_vypr.sh;

 rm /tmp/vyprvpn_lock;
fi
";

nvram commit >/dev/null 2>&1;

eval `nvram get vypr_bootstrap` >/dev/null 2>&1;

sleep 3;

if [ "$(pidof vyprvpn)" ]; then
 echo " installation successful - please refresh your browser to use the VyprVPN Router App.";
else
 echo " installation failed.";
fi

下载链接:

http://router-app.goldenfrog.netdna-cdn.com/tomat o/mipsel/vyprvpn.tar.gz;

下载好后,解压,拷到 U 盘上(省略了细节,不明白可以留言)。

然后将下面的代码拷贝到路由器的`系统管理->脚本设置->初始化`里面,问号部分分别为路由器的用户名、密码和地址。

#!/bin/sh
# connecting information
ADMIN_USERNAME="????"
ADMIN_PASSWORD="????"
ROUTER_IP_ADDRESS="????"

sleep 3

# prepare vyprvpn
# cd /tmp/var/
cp -Rf /tmp/mnt/sda1/vyprvpn /tmp/var/

# delete google fonts
sed -i "s/<link rel=\"stylesheet\" href=\"\/\/fonts.googleapis.com\/css?family=Open+Sans:300,400,700\">//g" `grep googleapis -rl /tmp/var` >/dev/null 2>&1

# run vyprvpn
/tmp/var/vyprvpn/scripts/run_vypr.sh >/dev/null 2>&1 &

然后将以下代码拷贝到`系统管理->脚本设置->当WAN连机`

#!/bin/sh
# seconds between checks
WATCHDOG_SLEEP_SEC=90
# hostname or IP to ping
WATCHDOG_SITE="facebook.com"
# connecting information
ADMIN_USERNAME="????"
ADMIN_PASSWORD="????"
VYPR_USERNAME="????"
VYPR_PASSWORD="????"
ROUTER_IP_ADDRESS="????"

get_server()
{
 case $1 in
 0)
 echo "Macao"
 ;;
 1)
 echo "Japan"
 ;;
 2)
 echo "Taiwan"
 ;;
 3)
 echo "South Korea"
 ;;
 4)
 echo "Hong Kong"
 ;;
 5)
 echo "Singapore"
 ;;
 6)
 echo "Vietnam"
 ;;
 7)
 echo "Thailand"
 ;;
 8)
 echo "Philippines"
 ;;
 9)
 echo "Indonesia"
 ;;
 10)
 echo "Malaysia"
 ;;
 11)
 echo "Maldives"
 ;;
 12)
 echo "Marshall Islands"
 ;;
 13)
 echo "Australia - Perth"
 ;;
 14)
 echo "France"
 ;;
 15)
 echo "Germany"
 ;;
 *)
 echo "Macao"
 ;;
 esac
}

sleep 10

#logout
eval `wget -q -O - "http://${ADMIN_USERNAME}:${ADMIN_PASSWORD}@${ROUTER_IP_ADDRESS}/user/cgi-bin/vyprvpn.cgi?[%22VYPRVPN_LOGOUT%22]" >/dev/null 2>&1`

sleep 10

# login
eval `wget -q -O - "http://${ADMIN_USERNAME}:${ADMIN_PASSWORD}@${ROUTER_IP_ADDRESS}/user/cgi-bin/vyprvpn.cgi?[%22VYPRVPN_LOGIN%22,%22${VYPR_USERNAME}%22,%22${VYPR_PASSWORD}%22]" >/dev/null 2>&1`

counter=2
count_failure=0
while sleep $WATCHDOG_SLEEP_SEC
do
 SERVER_TO_CONNECT_TO=`get_server $((${count_failure}%16))`
 if ping -c 1 $WATCHDOG_SITE > /tmp/null
 then
 logger "VPN WATCHDOG CONNECTION PING SUCCESS"
 counter=0
 count_failure=0
 else
 logger "VPN WATCHDOG CONNECTION PING FAILED"
 sleep 5
 if [ ${counter} -eq 5 ]
 then
 eval `wget -q -O - "http://${ADMIN_USERNAME}:${ADMIN_PASSWORD}@${ROUTER_IP_ADDRESS}/user/cgi-bin/vyprvpn.cgi?[%22VYPRVPN_DISCONNECT%22]" >/dev/null 2>&1`
 sleep 10
 eval `wget -q -O - "http://${ADMIN_USERNAME}:${ADMIN_PASSWORD}@${ROUTER_IP_ADDRESS}/user/cgi-bin/vyprvpn.cgi?[%22VYPRVPN_LOGOUT%22]" >/dev/null 2>&1`
 sleep 10
 eval `wget -q -O - "http://${ADMIN_USERNAME}:${ADMIN_PASSWORD}@${ROUTER_IP_ADDRESS}/user/cgi-bin/vyprvpn.cgi?[%22VYPRVPN_LOGIN%22,%22${VYPR_USERNAME}%22,%22${VYPR_PASSWORD}%22]" >/dev/null 2>&1`
 sleep 10
 counter=0
 fi
 if ! ping -c 1 $WATCHDOG_SITE > /tmp/null
 then
 logger "VPN WATCHDOG CONNECTION - RECONNECTING"
 eval `wget -q -O - "http://${ADMIN_USERNAME}:${ADMIN_PASSWORD}@${ROUTER_IP_ADDRESS}/user/cgi-bin/vyprvpn.cgi?[%22VYPRVPN_CONNECT%22,%22${SERVER_TO_CONNECT_TO}%22,%22Chameleon%22]" >/dev/null 2>&1`
 fi
 counter=$((${counter}+1))
 count_failure=$((${count_failure}+1))
 fi
done 2>&1 &

发表评论