wok-6.x annotate ppp/stuff/ppp.cgi @ rev 21526

updated ncurses, ncurses-common, ncurses-dev, ncurses-extra, ncurses-man, ncursesw, ncursesw-dev, and ncursesw-extra (5.9 -> 6.1)
author Hans-G?nter Theisgen
date Sat May 04 11:23:56 2019 +0100 (2019-05-04)
parents e0d366200e99
children c34ef09acb7c
rev   line source
pascal@18017 1 #!/bin/sh
pascal@18017 2 #
pascal@18017 3 # Network/PPP configuration CGI interface
pascal@18017 4 #
pascal@18017 5 # Copyright (C) 2015 SliTaz GNU/Linux - BSD License
pascal@18017 6 #
pascal@18017 7
pascal@18017 8 # Common functions from libtazpanel
pascal@18017 9 . lib/libtazpanel
pascal@18017 10 get_config
pascal@18017 11
pascal@18017 12
pascal@20411 13 set_secrets()
pascal@20411 14 {
pascal@20411 15 grep -qs "^$1 " /etc/ppp/pap-secrets ||
pascal@20411 16 echo "$1 * $2" >> /etc/ppp/pap-secrets
pascal@20411 17 grep -qs "^$1 " /etc/ppp/chap-secrets ||
pascal@20411 18 echo "$1 * $2" >> /etc/ppp/chap-secrets
pascal@20411 19 }
pascal@20411 20
pascal@20411 21
pascal@20411 22 create_gsm_conf()
pascal@20411 23 {
pascal@20411 24 local provider="${1:-myGSMprovider}"
pascal@20411 25 set_secrets "$provider" "$provider"
pascal@20411 26 [ -s /etc/ppp/scripts/gsm.chat ] ||
pascal@20411 27 cat > /etc/ppp/scripts/gsm.chat <<EOT
pascal@20411 28 ABORT 'BUSY'
pascal@20411 29 ABORT 'NO CARRIER'
pascal@20411 30 ABORT 'VOICE'
pascal@20411 31 ABORT 'NO DIALTONE'
pascal@20411 32 ABORT 'NO DIAL TONE'
pascal@20411 33 ABORT 'NO ANSWER'
pascal@20411 34 ABORT 'DELAYED'
pascal@20411 35 REPORT CONNECT
pascal@20411 36 TIMEOUT 6
pascal@20411 37 '' 'ATQ0'
pascal@20411 38 'OK-AT-OK' 'ATZ'
pascal@20411 39 TIMEOUT 3
pascal@20411 40 'OK' 'ATI'
pascal@20411 41 'OK' 'ATZ'
pascal@20411 42 'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
pascal@20411 43 'OK' 'AT+CGDCONT=1,"IP","$provider"'
pascal@20411 44 'OK' 'ATDT*99#'
pascal@20411 45 TIMEOUT 30
pascal@20411 46 CONNECT ''
pascal@20411 47 EOT
pascal@20411 48 [ -s /etc/ppp/options-gsm ] ||
pascal@20411 49 cat > /etc/ppp/options-gsm << EOT
pascal@20411 50 rfcomm0
pascal@20411 51 460800
pascal@20411 52 lock
pascal@20411 53 crtscts
pascal@20411 54 modem
pascal@20411 55 passive
pascal@20411 56 novj
pascal@20411 57 defaultroute
pascal@20411 58 noipdefault
pascal@20411 59 usepeerdns
pascal@20411 60 noauth
pascal@20411 61 hide-password
pascal@20411 62 persist
pascal@20411 63 holdoff 10
pascal@20411 64 maxfail 0
pascal@20411 65 debug
pascal@20411 66 EOT
pascal@20411 67 [ -s /etc/ppp/peers/gsm ] ||
pascal@20411 68 cat > /etc/ppp/peers/gsm << EOT
pascal@20411 69 file /etc/ppp/options-gsm
pascal@20411 70 user "$provider"
pascal@20411 71 password "$provider"
pascal@20411 72 connect "/usr/sbin/chat -v -t15 -f /etc/ppp/scripts/gsm.chat"
pascal@20411 73 EOT
pascal@20411 74 }
pascal@20411 75
pascal@20411 76
pascal@20411 77 phone_names()
pascal@20411 78 {
pascal@20411 79 rfcomm | awk '/connected/{print $2}' | while read mac; do
pascal@20411 80 grep -A2 $mac /etc/bluetooth/rfcomm.conf | \
pascal@20411 81 sed '/comment/!d;s/.* "\(.*\) modem";/ \1/'
pascal@20411 82 done
pascal@20411 83 }
pascal@20411 84
pascal@20411 85
pascal@18017 86 case "$1" in
pascal@18017 87 menu)
pascal@18017 88 TEXTDOMAIN_original=$TEXTDOMAIN
pascal@18017 89 export TEXTDOMAIN='ppp'
pascal@18017 90
pascal@20305 91 groups | grep -q dialout && dialout="" || dialout=" data-root"
pascal@18025 92 case "$2" in
pascal@18025 93 *VPN*)
pascal@18025 94 [ "$(which pptp 2>/dev/null)$(which pptpd 2>/dev/null)" ] && cat <<EOT
pascal@20305 95 <li><a data-icon="vpn" href="ppp.cgi#pptp"$dialout>$(_ 'PPTP')</a></li>
pascal@18025 96 EOT
pascal@18025 97 [ "$(which pppssh 2>/dev/null)" ] && cat <<EOT
pascal@20305 98 <li><a data-icon="vpn" href="ppp.cgi#pppssh"$dialout>$(_ 'PPP/SSH')</a></li>
pascal@18025 99 EOT
pascal@18025 100 ;;
pascal@20411 101 *)
pascal@18025 102 cat <<EOT
pascal@20305 103 <li><a data-icon="modem" href="ppp.cgi"$dialout>$(_ 'PPP Modem')</a></li>
pascal@18017 104 EOT
pascal@18025 105 esac
pascal@18017 106 export TEXTDOMAIN=$TEXTDOMAIN_original
pascal@18017 107 exit
pascal@18017 108 esac
pascal@18017 109
pascal@18017 110
pascal@18017 111 #
pascal@18017 112 # Commands
pascal@18017 113 #
pascal@18017 114
pascal@18017 115 case " $(GET) " in
pascal@20411 116 *\ start_pstn\ *)
pascal@20411 117 if [ "$(GET user)" ]; then
pascal@20411 118 set_secrets "$(GET user)" "$(GET pass)"
pascal@18017 119 sed -i 's/^name /d' /etc/ppp/options
pascal@18017 120 echo "name $(GET user)" >> /etc/ppp/options
pascal@18017 121 /etc/ppp/scripts/ppp-off
pascal@18017 122 /etc/ppp/scripts/ppp-on &
pascal@20411 123 fi ;;
pascal@20411 124 *\ start_gsm\ *)
pascal@20411 125 if [ "$(GET gsmprovider)" ]; then
pascal@20411 126 [ -n "$(pidof dbus-daemon)" ] || /etc/init.d/dbus start
pascal@20411 127 [ -n "$(pidof bluetoothd)" ] || bluetoothd
pascal@20411 128 grep -qs btusb /proc/modules || modprobe btusb
pascal@20411 129 hcitool scan | grep : | while read dev name; do
pascal@20411 130 set -- $dev "$name" $(sdptool browse $dev | awk '
pascal@20411 131 /Service Class ID List/ {n=0}
pascal@20411 132 /Dialup Networking/ {n=1}
pascal@20411 133 /RFCOMM/ {n++}
pascal@20411 134 /Channel/ {if (n==2) { print $2; exit } }')
pascal@20411 135 [ -n "$3" ] || continue
pascal@20411 136 grep -qs $1 /etc/bluetooth/rfcomm.conf ||
pascal@20411 137 cat >> /etc/bluetooth/rfcomm.conf <<EOT
pascal@20411 138 rfcomm0 {
pascal@20411 139 bind yes;
pascal@20411 140 device $1;
pascal@20411 141 channel $3;
pascal@20411 142 comment "$2 modem";
pascal@20411 143 }
pascal@20411 144 EOT
pascal@20411 145 rfcomm bind all || rfcomm bind 0 $1 $3
pascal@20411 146 break
pascal@20411 147 done
pascal@20411 148 create_gsm_conf "$(GET gsmprovider)"
pascal@20411 149 [ -n "$(GET gsmprovider)" ] &&
pascal@20411 150 sed -i "s|\"IP\",\".*\"|\"IP\",\"$(GET gsmprovider)\"|" \
pascal@20411 151 /etc/ppp/scripts/gsm.chat &&
pascal@20411 152 sed -i "s|myGSMprovider|$(GET gsmprovider)|g" \
pascal@20411 153 /etc/ppp/chap-secrets /etc/ppp/pap-secrets
pascal@20411 154 pppd call gsm
pascal@20411 155 host=$(hcitool dev | sed '/hci0/!d;s/.*hci0\t//')
pascal@20411 156 pin=$(GET gsmpin)
pascal@20411 157 hcitool scan | grep "$1" | while read adrs name ; do
pascal@20411 158 echo ${pin:-0000} | bluez-simple-agent $host $adrs
pascal@20411 159 done
pascal@20411 160 fi ;;
pascal@20411 161 *\ stop_pstn\ *|*\ stop_gsm\ *)
pascal@20411 162 /etc/ppp/scripts/ppp-off ;;
pascal@20411 163 *\ start_pppoe\ *)
pascal@20411 164 if [ "$(GET user)" ]; then
pascal@20411 165 set_secrets "$(GET user)" "$(GET pass)"
pascal@18017 166 grep -qs pppoe /etc/ppp/options || cat > /etc/ppp/options <<EOT
pascal@18017 167 plugin rp-pppoe.so
pascal@18017 168 noipdefault
pascal@18017 169 defaultroute
pascal@18017 170 mtu 1492
pascal@18017 171 mru 1492
pascal@18017 172 lock
pascal@18017 173 EOT
pascal@18017 174 sed -i 's/^name /d' /etc/ppp/options
pascal@18017 175 echo "name $(GET user)" >> /etc/ppp/options
pascal@18017 176 ( . /etc/network.conf ; pppd $INTERFACE & )
pascal@20411 177 fi ;;
pascal@20411 178 *\ stop_pppoe\ *)
pascal@20411 179 killall pppd ;;
pascal@18017 180 *\ setpppssh\ *)
pascal@18017 181 cat > /etc/ppp/pppssh <<EOT
pascal@18017 182 PEER="$(GET peer)"
pascal@18017 183 SSHARG="$(GET ssharg)"
pascal@18017 184 LOCALIP="$(GET localip)"
pascal@18017 185 REMOTEIP="$(GET remoteip)"
pascal@18017 186 LOCALPPP="$(GET localpppopt)"
pascal@18017 187 REMOTEPPP="$(GET remotepppopt)"
pascal@18017 188 ROUTES="$(GET routes)"
pascal@19355 189 UDP="$(GET udp)"
pascal@18017 190 EOT
pascal@18017 191 [ "$(GET pass)" ] && export DROPBEAR_PASSWORD="$(GET pass)"
pascal@18042 192 case " $(GET) " in
pascal@18042 193 *\ send_key\ *)
pascal@18017 194 ( dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key ;
pascal@18017 195 cat /etc/ssh/ssh_host_rsa_key.pub ) 2> /dev/null | \
pascal@18017 196 grep ^ssh | dbclient $(echo $(GET send_key) | sed \
pascal@18017 197 's/.*\([A-Za-z0-9_\.-]*\).*/\1/') "mkdir .ssh 2> /dev/null ; \
pascal@18017 198 while read key; do for i in authorized_keys authorized_keys2; do \
pascal@18017 199 grep -qs '\$key' .ssh/\$i || echo '\$key' >> .ssh/\$i ; done ; done ; \
pascal@18017 200 chmod 700 .ssh ; chmod 600 .ssh/authorized_keys*"
pascal@18042 201 ;;
pascal@18042 202 *\ stop_pppssh\ *)
pascal@18017 203 ppp="$(sed '/pppd/!d;s/.*="\([^"]*\).*/\1/' /usr/bin/pppssh)"
pascal@18042 204 kill $(busybox ps x | grep "$ppp" | awk '/pty/{next}/dbclient/{print $1}')
pascal@18042 205 ;;
pascal@18042 206 *\ start_pppssh\ *)
pascal@18042 207 EOT
pascal@18017 208 pppssh "$(GET ssharg) $(GET peer)" \
pascal@18017 209 "$(GET localip):$(GET remoteip) $(GET localpppopt)" \
pascal@19355 210 "$(GET remotepppopt)" "$(GET routes)" "$(GET udp)" &
pascal@18042 211 ;;
pascal@18042 212 esac
pascal@18017 213 ;;
pascal@18017 214 esac
pascal@18017 215
pascal@18017 216 USERNAME="$(sed '/^name/!d;s/^[^ ]* *//' /etc/ppp/options)"
pascal@18017 217 PASSWORD="$(awk -v key=$USERNAME "\$1==key{print \$3}" /etc/ppp/pap-secrets)"
pascal@18017 218 ACCOUNT="$(sed '/^ACCOUNT=/!d;s/^.*=\([^ \t]*\).*/\1/' /etc/ppp/scripts/ppp-on)"
pascal@18025 219 PASSPSTN="$(sed '/^PASSWORD=/!d;s/^.*=\([^ \t]*\).*/\1/' /etc/ppp/scripts/ppp-on)"
pascal@18017 220 PHONE="$(sed '/^TELEPHONE=/!d;s/^.*=\([^ \t]*\).*/\1/' /etc/ppp/scripts/ppp-on)"
pascal@18017 221 TITLE="$(_ 'TazPanel - Network') - $(_ 'PPP Connections')"
pascal@18017 222 header
pascal@18017 223 xhtml_header | sed 's/id="content"/id="content-sidebar"/'
pascal@18017 224 cat << EOT
pascal@18017 225 <div id="sidebar">
pascal@18017 226 <section>
pascal@18017 227 <header>
pascal@18017 228 $(_ 'Documentation')
pascal@18017 229 </header>
pascal@19457 230 <a data-icon="web" href="http://ppp.samba.org/" target="_blank" rel="noopener">$(_ 'PPP web page')</a><p>
pascal@19457 231 <a data-icon="help" href="index.cgi?exec=pppd%20--help" target="_blank" rel="noopener">$(_ 'PPP help')</a><p>
pascal@19457 232 <a data-icon="help" href="index.cgi?exec=man%20pppd" target="_blank" rel="noopener">$(_ 'PPP Manual')</a><p>
pascal@20418 233 <a data-icon="web" href="https://en.wikipedia.org/wiki/Hayes_command_set" target="_blank" rel="noopener">$(_ 'Hayes codes')</a><p>
pascal@18017 234 EOT
pascal@18017 235 [ "$(which pptp 2>/dev/null)" ] && cat <<EOT
pascal@19457 236 <a data-icon="web" href="http://pptpclient.sourceforge.net/" target="_blank" rel="noopener">$(_n 'PPTP web page')</a><p>
pascal@19457 237 <a data-icon="help" href="index.cgi?exec=pptp" target="_blank" rel="noopener">$(_ 'PPTP Help')</a><p>
pascal@18017 238 EOT
pascal@18017 239 [ "$(which pptpd 2>/dev/null)" ] && cat <<EOT
pascal@19457 240 <a data-icon="web" href="http://poptop.sourceforge.net/" target="_blank" rel="noopener">$(_n 'PPTPD web page')</a><p>
pascal@19457 241 <a data-icon="help" href="index.cgi?exec=pptpd%20--help" target="_blank" rel="noopener">$(_ 'PPTPD Help')</a><p>
pascal@18017 242 EOT
pascal@18017 243 [ "$(which pppssh 2>/dev/null)" ] && cat <<EOT
pascal@19457 244 <a data-icon="web" href="http://doc.slitaz.org/en:guides:vpn" target="_blank" rel="noopener">$(_n 'VPN Wiki')</a><p>
pascal@19457 245 <a data-icon="help" href="index.cgi?exec=dbclient" target="_blank" rel="noopener">$(_ 'SSH Help')</a><p>
pascal@18017 246 EOT
pascal@18017 247 cat << EOT
pascal@18017 248 <footer>
pascal@18017 249 </footer>
pascal@18017 250 </section>
pascal@18017 251 <section>
pascal@18017 252 <header>
pascal@18017 253 $(_ 'Configuration')
pascal@18017 254 </header>
pascal@20411 255 EOT
pascal@20411 256 [ "$(which sdptool 2>/dev/null)" ] && create_gsm_conf && cat <<EOT
pascal@20411 257 <a data-icon="conf" href="index.cgi?file=/etc/bluetooth/rfcomm.conf" target="_blank" rel="noopener">$(_ 'GSM device')</a><p>
pascal@20411 258 <a data-icon="conf" href="index.cgi?file=/etc/ppp/peers/gsm" target="_blank" rel="noopener">$(_ 'PPP GSM script')</a><p>
pascal@20411 259 <a data-icon="conf" href="index.cgi?file=/etc/ppp/scripts/gsm.chat" target="_blank" rel="noopener">$(_ 'PPP GSM chat')</a><p>
pascal@20411 260 <a data-icon="conf" href="index.cgi?file=/etc/ppp/options-gsm" target="_blank" rel="noopener">$(_ 'PPP GSM options')</a><p>
pascal@20411 261 EOT
pascal@20411 262 cat << EOT
pascal@19457 263 <a data-icon="conf" href="index.cgi?file=/etc/ppp/scripts/ppp-on" target="_blank" rel="noopener">$(_ 'PPP PSTN script')</a><p>
pascal@20411 264 <a data-icon="conf" href="index.cgi?file=/etc/ppp/scripts/ppp-on-dialer" target="_blank" rel="noopener">$(_ 'PPP PSTN chat')</a><p>
pascal@20411 265 <a data-icon="conf" href="index.cgi?file=/etc/ppp/options" target="_blank" rel="noopener">$(_ 'PPP PSTN options')</a><p>
pascal@19457 266 <a data-icon="conf" href="index.cgi?file=/etc/ppp/chap-secrets" target="_blank" rel="noopener">$(_ 'chap users')</a><p>
pascal@19457 267 <a data-icon="conf" href="index.cgi?file=/etc/ppp/pap-secrets" target="_blank" rel="noopener">$(_ 'pap users')</a><p>
pascal@18017 268 EOT
pascal@18017 269 for i in /etc/ppp/peers/* ; do
pascal@20411 270 [ -s "$i" ] && [ "$i" != "/etc/ppp/peers/gsm" ] && cat << EOT
pascal@19457 271 <a data-icon="conf" href="index.cgi?file=$i" target="_blank" rel="noopener">$(basename $i)</a><p>
pascal@18017 272 EOT
pascal@18017 273 done
pascal@18017 274 [ "$(which pptpd 2>/dev/null)" ] && cat <<EOT
pascal@19457 275 <a data-icon="conf" href="index.cgi?file=/etc/pptpd.conf" target="_blank" rel="noopener">$(_ 'pptpd.conf')</a><p>
pascal@18017 276 EOT
pascal@18017 277 if [ "$(busybox ps x | grep "pppd" | awk '/modem/{print $1}')" ]; then
pascal@18017 278 start_disabled='disabled'
pascal@18017 279 else
pascal@18017 280 stop_disabled='disabled'
pascal@18017 281 fi
pascal@18020 282 if [ "$(busybox ps x | grep "pppd" | awk '/eth/{print $1}')" ]; then
pascal@18020 283 startoe_disabled='disabled'
pascal@18020 284 else
pascal@18020 285 stopoe_disabled='disabled'
pascal@18020 286 fi
pascal@20411 287 if [ "$(busybox ps x | grep "pppd" | awk '/gsm/{print $1}')" ]; then
pascal@20411 288 startgsm_disabled='disabled'
pascal@20411 289 else
pascal@20411 290 stopgsm_disabled='disabled'
pascal@20411 291 fi
pascal@20411 292 head=" <footer>
pascal@20411 293 </footer>
pascal@20411 294 </section>
pascal@20411 295 <section>
pascal@20411 296 <header>
pascal@20411 297 $(_ 'Install extra')
pascal@20411 298 </header>"
pascal@20411 299 while read file pkg name ; do
pascal@20411 300 [ -z "$(which $file 2>/dev/null)" ] && echo $head && head="" &&
pascal@20411 301 echo " <a href='pkgs.cgi?do=Install&amp;pkg=$pkg'>$name</a>"
pascal@20411 302 done <<EOT
pascal@20411 303 sdptool bluez GSM / Bluetooth
pascal@20411 304 pppssh dropbear SSH / VPN
pascal@20411 305 EOT
pascal@20411 306 #pptp pptpclient PPTP client
pascal@20411 307 #pptpd poptop PPTP server
pascal@18017 308 cat << EOT
pascal@18017 309 <footer>
pascal@18017 310 </footer>
pascal@18017 311 </section>
pascal@18017 312 </div>
pascal@18017 313
pascal@20411 314 EOT
pascal@20411 315 if [ "$(which sdptool 2>/dev/null)" ]; then
pascal@20411 316 cat <<EOT
pascal@20411 317 <a name="pppgsm"></a>
pascal@20411 318 <section>
pascal@20411 319 <header>
pascal@20411 320 <span data-icon="modem">$(_ 'GSM modem') -
pascal@20411 321 $(_ 'Manage Bluetooth GSM Internet connections')</span>
pascal@20411 322 </header>
pascal@20411 323 <form method="get">
pascal@20411 324 <input type="hidden" name="setpppgsm" />
pascal@20411 325 <table>
pascal@20411 326 <tr>
pascal@20411 327 <td>$(_ 'GSM provider')</td>
pascal@20411 328 <td><input type="text" name="gsmprovider" size="40" value="$(sed \
pascal@20411 329 '/AT+CGDCONT/!d;s|.*IP","\(.*\)".|\1|' \
pascal@20411 330 /etc/ppp/scripts/gsm.chat 2> /dev/null)" /></td>
pascal@20411 331 </tr>
pascal@20411 332 <tr>
pascal@20411 333 <td>$(_ 'Bluetooth PIN')</td>
pascal@20411 334 <td><input type="text" name="gsmpin" size="40" value="0000" /></td>
pascal@20411 335 </tr>
pascal@20411 336 </table>
pascal@20411 337 <footer><!--
pascal@20411 338 --><button type="submit" name="start_gsm" data-icon="start" $startgsm_disabled>$(_ 'Start' )</button><!--
pascal@20411 339 --><button type="submit" name="stop_gsm" data-icon="stop" $stopgsm_disabled>$(_ 'Stop' )</button><!--
pascal@20411 340 -->$(phone_names)</footer>
pascal@20411 341 </form>
pascal@20411 342 </section>
pascal@20411 343 EOT
pascal@20411 344 fi
pascal@20411 345 cat << EOT
pascal@18025 346 <a name="ppppstn"></a>
pascal@18017 347 <section>
pascal@18017 348 <header>
pascal@18067 349 <span data-icon="modem">$(_ 'PSTN modem') -
pascal@18025 350 $(_ 'Manage PSTN Internet connections')</span>
pascal@18017 351 </header>
pascal@18017 352 <form action="index.cgi" id="indexform"></form>
pascal@18042 353 <form method="get">
pascal@18042 354 <input type="hidden" name="setppppstn" />
pascal@18017 355 <table>
pascal@18017 356 <tr>
pascal@18017 357 <td>$(_ 'Username')</td>
pascal@18017 358 <td><input type="text" name="user" size="40" value="$ACCOUNT" /></td>
pascal@18017 359 </tr>
pascal@18017 360 <tr>
pascal@18017 361 <td>$(_ 'Password')</td>
pascal@18025 362 <td><input type="text" name="pass" size="40" value="$PASSPSTN" /></td>
pascal@18017 363 </tr>
pascal@18017 364 <tr>
pascal@18017 365 <td>$(_ 'Phone number')</td>
pascal@18017 366 <td><input type="text" name="phone" size="40" value="$PHONE" /></td>
pascal@18017 367 </tr>
pascal@18017 368 </table>
pascal@18042 369 <footer><!--
pascal@18042 370 --><button type="submit" name="start_pstn" data-icon="start" $start_disabled>$(_ 'Start' )</button><!--
pascal@18042 371 --><button type="submit" name="stop_pstn" data-icon="stop" $stop_disabled >$(_ 'Stop' )</button><!--
pascal@18042 372 --></footer>
pascal@18017 373 </form>
pascal@18017 374 </section>
pascal@18017 375
pascal@18017 376 <a name="pppoe"></a>
pascal@18017 377 <section>
pascal@18017 378 <header>
pascal@18017 379 <span data-icon="eth">$(_ 'Cable Modem') -
pascal@18017 380 $(_ 'Manage PPPoE Internet connections')</span>
pascal@18017 381 </header>
pascal@18042 382 <form method="get">
pascal@18042 383 <input type="hidden" name="setpppoe" />
pascal@18017 384 <table>
pascal@18017 385 <tr>
pascal@18017 386 <td>$(_ 'Username')</td>
pascal@18017 387 <td><input type="text" name="user" size="40" value="$USERNAME" /></td>
pascal@18017 388 </tr>
pascal@18017 389 <tr>
pascal@18017 390 <td>$(_ 'Password')</td>
pascal@18017 391 <td><input type="text" name="pass" size="40" value="$PASSWORD" /></td>
pascal@18017 392 </tr>
pascal@18017 393 </table>
pascal@18042 394 <footer><!--
pascal@18042 395 --><button type="submit" name="start_pppoe" data-icon="start" $startoe_disabled>$(_ 'Start' )</button><!--
pascal@18042 396 --><button type="submit" name="stop_pppoe" data-icon="stop" $stopoe_disabled >$(_ 'Stop' )</button><!--
pascal@18042 397 --></footer>
pascal@18017 398 </form>
pascal@18017 399 </section>
pascal@18017 400 EOT
pascal@18017 401 if [ "$(which pppssh 2>/dev/null)" ]; then
pascal@18017 402 [ -s /etc/ppp/pppssh ] && . /etc/ppp/pppssh
pascal@18017 403 ppp="$(sed '/pppd/!d;s/.*="\([^"]*\).*/\1/' /usr/bin/pppssh)"
pascal@18017 404 if [ "$(busybox ps x | grep "$ppp" | awk '/dbclient/{print $1}')" ]; then
pascal@18042 405 startssh_disabled='disabled'
pascal@18017 406 else
pascal@18042 407 stopssh_disabled='disabled'
pascal@18017 408 fi
pascal@18017 409 cat <<EOT
pascal@18017 410 <a name="pppssh"></a>
pascal@18017 411 <section>
pascal@18017 412 <header>
pascal@18067 413 <span data-icon="vpn">$(_ 'Virtual Private Network') -
pascal@18017 414 $(_ 'Manage private TCP/IP connections')</span>
pascal@18017 415 </header>
pascal@18042 416 <form method="get">
pascal@18042 417 <input type="hidden" name="setpppssh" />
pascal@18017 418 <table>
pascal@18017 419 <tr>
pascal@18017 420 <td>$(_ 'Peer')</td>
pascal@18017 421 <td><input type="text" name="peer" size="50" value="${PEER:-user@elsewhere}" /></td>
pascal@18017 422 </tr>
pascal@18017 423 <tr>
pascal@18017 424 <td>$(_ 'SSH options')</td>
pascal@18017 425 <td><input type="text" name="ssharg" size="50" value="$SSHARG" /></td>
pascal@18017 426 </tr>
pascal@18017 427 <tr>
pascal@18017 428 <td>$(_ 'Password')</td>
paul@18037 429 <td><input type="password" name="pass" size="50" title="Should be empty to use the SSH key; useful to send the SSH key only" /></td>
pascal@18017 430 </tr>
pascal@18017 431 <tr>
pascal@18017 432 <td>$(_ 'Local IP address')</td>
pascal@18017 433 <td><input type="text" name="localip" size="50" value="${LOCALIP:-192.168.254.1}" /></td>
pascal@18017 434 </tr>
pascal@18017 435 <tr>
pascal@18017 436 <td>$(_ 'Remote IP address')</td>
pascal@18017 437 <td><input type="text" name="remoteip" size="50" value="${REMOTEIP:-192.168.254.2}" /></td>
pascal@18017 438 </tr>
pascal@18017 439 <tr>
pascal@18017 440 <td>$(_ 'Local PPP options')</td>
pascal@18017 441 <td><input type="text" name="localpppopt" size="50" value="$LOCALPPP" /></td>
pascal@18017 442 </tr>
pascal@18017 443 <tr>
pascal@18017 444 <td>$(_ 'Remote PPP options')</td>
pascal@18034 445 <td><input type="text" name="remotepppopt" size="50" value="${REMOTEPPP:-proxyarp}" title="$(_ "You may need 'proxyarp' to use the new routes")" /></td>
pascal@18017 446 </tr>
pascal@18017 447 <tr>
pascal@18017 448 <td>$(_ 'Peer routes')</td>
pascal@18041 449 <td><input type="text" name="routes" size="50" value="${ROUTES:-192.168.10.0/24 192.168.20.0/28}" title="$(_ "Routes on peer network to import or 'default' to redirect the default route")"/></td>
pascal@18017 450 </tr>
pascal@19355 451 <tr>
pascal@19355 452 <td>$(_ 'UDP port')</td>
pascal@19355 453 <td><input type="text" name="udp" size="50" value="$UDP" title="$(_ "Optional UDP port for a real-time but unencrypted link")"/></td>
pascal@19355 454 </tr>
pascal@18017 455 </table>
pascal@18042 456 <footer><!--
pascal@18042 457 --><button type="submit" name="start_pppssh" data-icon="start" $startssh_disabled>$(_ 'Start' )</button><!--
pascal@18042 458 --><button type="submit" name="stop_pppssh" data-icon="stop" $stopssh_disabled>$(_ 'Stop' )</button><!--
pascal@18042 459 --><button type="submit" name="send_key" data-icon="sync" >$(_ 'Send SSH key' )</button><!--
pascal@18042 460 --></footer>
pascal@18017 461 </form>
pascal@18017 462 </section>
pascal@18017 463 EOT
pascal@18017 464 fi
pascal@18017 465
pascal@18017 466 xhtml_footer
pascal@18017 467 exit 0