wok-current annotate ppp/stuff/ppp.cgi @ rev 25435
Up libarchive (3.6.1)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 31 07:33:35 2022 +0000 (2022-08-31) |
parents | fa8eccc0015a |
children |
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@22850 | 128 grep -qs btusb /proc/modules || !modprobe btusb || sleep 1 |
pascal@22853 | 129 if [ -n "$(which bluetoothctl)" ]; then |
pascal@22853 | 130 bluetoothctl power on |
pascal@22853 | 131 bluetoothctl pairable on |
pascal@22853 | 132 bluetoothctl scan on |
pascal@22853 | 133 fi |
pascal@20411 | 134 hcitool scan | grep : | while read dev name; do |
pascal@20411 | 135 set -- $dev "$name" $(sdptool browse $dev | awk ' |
pascal@20411 | 136 /Service Class ID List/ {n=0} |
pascal@20411 | 137 /Dialup Networking/ {n=1} |
pascal@20411 | 138 /RFCOMM/ {n++} |
pascal@20411 | 139 /Channel/ {if (n==2) { print $2; exit } }') |
pascal@20411 | 140 [ -n "$3" ] || continue |
pascal@20411 | 141 grep -qs $1 /etc/bluetooth/rfcomm.conf || |
pascal@20411 | 142 cat >> /etc/bluetooth/rfcomm.conf <<EOT |
pascal@20411 | 143 rfcomm0 { |
pascal@20411 | 144 bind yes; |
pascal@20411 | 145 device $1; |
pascal@20411 | 146 channel $3; |
pascal@20411 | 147 comment "$2 modem"; |
pascal@20411 | 148 } |
pascal@20411 | 149 EOT |
pascal@20411 | 150 rfcomm bind all || rfcomm bind 0 $1 $3 |
pascal@20411 | 151 break |
pascal@20411 | 152 done |
pascal@20411 | 153 create_gsm_conf "$(GET gsmprovider)" |
pascal@20411 | 154 [ -n "$(GET gsmprovider)" ] && |
pascal@20411 | 155 sed -i "s|\"IP\",\".*\"|\"IP\",\"$(GET gsmprovider)\"|" \ |
pascal@20411 | 156 /etc/ppp/scripts/gsm.chat && |
pascal@20411 | 157 sed -i "s|myGSMprovider|$(GET gsmprovider)|g" \ |
pascal@20411 | 158 /etc/ppp/chap-secrets /etc/ppp/pap-secrets |
pascal@20411 | 159 pppd call gsm |
pascal@20411 | 160 host=$(hcitool dev | sed '/hci0/!d;s/.*hci0\t//') |
pascal@20411 | 161 pin=$(GET gsmpin) |
pascal@20411 | 162 hcitool scan | grep "$1" | while read adrs name ; do |
pascal@20411 | 163 echo ${pin:-0000} | bluez-simple-agent $host $adrs |
pascal@20411 | 164 done |
pascal@20411 | 165 fi ;; |
pascal@20411 | 166 *\ stop_pstn\ *|*\ stop_gsm\ *) |
pascal@20411 | 167 /etc/ppp/scripts/ppp-off ;; |
pascal@20411 | 168 *\ start_pppoe\ *) |
pascal@20411 | 169 if [ "$(GET user)" ]; then |
pascal@20411 | 170 set_secrets "$(GET user)" "$(GET pass)" |
pascal@18017 | 171 grep -qs pppoe /etc/ppp/options || cat > /etc/ppp/options <<EOT |
pascal@18017 | 172 plugin rp-pppoe.so |
pascal@18017 | 173 noipdefault |
pascal@18017 | 174 defaultroute |
pascal@18017 | 175 mtu 1492 |
pascal@18017 | 176 mru 1492 |
pascal@18017 | 177 lock |
pascal@18017 | 178 EOT |
pascal@18017 | 179 sed -i 's/^name /d' /etc/ppp/options |
pascal@18017 | 180 echo "name $(GET user)" >> /etc/ppp/options |
pascal@18017 | 181 ( . /etc/network.conf ; pppd $INTERFACE & ) |
pascal@20411 | 182 fi ;; |
pascal@20411 | 183 *\ stop_pppoe\ *) |
pascal@20411 | 184 killall pppd ;; |
pascal@18017 | 185 *\ setpppssh\ *) |
pascal@18017 | 186 cat > /etc/ppp/pppssh <<EOT |
pascal@18017 | 187 PEER="$(GET peer)" |
pascal@18017 | 188 SSHARG="$(GET ssharg)" |
pascal@18017 | 189 LOCALIP="$(GET localip)" |
pascal@18017 | 190 REMOTEIP="$(GET remoteip)" |
pascal@18017 | 191 LOCALPPP="$(GET localpppopt)" |
pascal@18017 | 192 REMOTEPPP="$(GET remotepppopt)" |
pascal@18017 | 193 ROUTES="$(GET routes)" |
pascal@19355 | 194 UDP="$(GET udp)" |
pascal@18017 | 195 EOT |
pascal@18017 | 196 [ "$(GET pass)" ] && export DROPBEAR_PASSWORD="$(GET pass)" |
pascal@18042 | 197 case " $(GET) " in |
pascal@18042 | 198 *\ send_key\ *) |
pascal@18017 | 199 ( dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key ; |
pascal@18017 | 200 cat /etc/ssh/ssh_host_rsa_key.pub ) 2> /dev/null | \ |
pascal@18017 | 201 grep ^ssh | dbclient $(echo $(GET send_key) | sed \ |
pascal@18017 | 202 's/.*\([A-Za-z0-9_\.-]*\).*/\1/') "mkdir .ssh 2> /dev/null ; \ |
pascal@18017 | 203 while read key; do for i in authorized_keys authorized_keys2; do \ |
pascal@18017 | 204 grep -qs '\$key' .ssh/\$i || echo '\$key' >> .ssh/\$i ; done ; done ; \ |
pascal@18017 | 205 chmod 700 .ssh ; chmod 600 .ssh/authorized_keys*" |
pascal@18042 | 206 ;; |
pascal@18042 | 207 *\ stop_pppssh\ *) |
pascal@18017 | 208 ppp="$(sed '/pppd/!d;s/.*="\([^"]*\).*/\1/' /usr/bin/pppssh)" |
pascal@18042 | 209 kill $(busybox ps x | grep "$ppp" | awk '/pty/{next}/dbclient/{print $1}') |
pascal@18042 | 210 ;; |
pascal@18042 | 211 *\ start_pppssh\ *) |
pascal@18017 | 212 pppssh "$(GET ssharg) $(GET peer)" \ |
pascal@18017 | 213 "$(GET localip):$(GET remoteip) $(GET localpppopt)" \ |
pascal@22849 | 214 "$(GET remotepppopt)" "$(GET routes)" \ |
pascal@22849 | 215 "$(GET udp)" > /dev/null & |
pascal@22849 | 216 sleep 1 |
pascal@18042 | 217 ;; |
pascal@18042 | 218 esac |
pascal@18017 | 219 ;; |
pascal@18017 | 220 esac |
pascal@18017 | 221 |
pascal@18017 | 222 USERNAME="$(sed '/^name/!d;s/^[^ ]* *//' /etc/ppp/options)" |
pascal@18017 | 223 PASSWORD="$(awk -v key=$USERNAME "\$1==key{print \$3}" /etc/ppp/pap-secrets)" |
pascal@18017 | 224 ACCOUNT="$(sed '/^ACCOUNT=/!d;s/^.*=\([^ \t]*\).*/\1/' /etc/ppp/scripts/ppp-on)" |
pascal@18025 | 225 PASSPSTN="$(sed '/^PASSWORD=/!d;s/^.*=\([^ \t]*\).*/\1/' /etc/ppp/scripts/ppp-on)" |
pascal@18017 | 226 PHONE="$(sed '/^TELEPHONE=/!d;s/^.*=\([^ \t]*\).*/\1/' /etc/ppp/scripts/ppp-on)" |
pascal@18017 | 227 TITLE="$(_ 'TazPanel - Network') - $(_ 'PPP Connections')" |
pascal@18017 | 228 header |
pascal@18017 | 229 xhtml_header | sed 's/id="content"/id="content-sidebar"/' |
pascal@18017 | 230 cat << EOT |
pascal@18017 | 231 <div id="sidebar"> |
pascal@18017 | 232 <section> |
pascal@18017 | 233 <header> |
pascal@18017 | 234 $(_ 'Documentation') |
pascal@18017 | 235 </header> |
pascal@19457 | 236 <a data-icon="web" href="http://ppp.samba.org/" target="_blank" rel="noopener">$(_ 'PPP web page')</a><p> |
pascal@19457 | 237 <a data-icon="help" href="index.cgi?exec=pppd%20--help" target="_blank" rel="noopener">$(_ 'PPP help')</a><p> |
pascal@19457 | 238 <a data-icon="help" href="index.cgi?exec=man%20pppd" target="_blank" rel="noopener">$(_ 'PPP Manual')</a><p> |
pascal@20418 | 239 <a data-icon="web" href="https://en.wikipedia.org/wiki/Hayes_command_set" target="_blank" rel="noopener">$(_ 'Hayes codes')</a><p> |
pascal@18017 | 240 EOT |
pascal@18017 | 241 [ "$(which pptp 2>/dev/null)" ] && cat <<EOT |
pascal@19457 | 242 <a data-icon="web" href="http://pptpclient.sourceforge.net/" target="_blank" rel="noopener">$(_n 'PPTP web page')</a><p> |
pascal@19457 | 243 <a data-icon="help" href="index.cgi?exec=pptp" target="_blank" rel="noopener">$(_ 'PPTP Help')</a><p> |
pascal@18017 | 244 EOT |
pascal@18017 | 245 [ "$(which pptpd 2>/dev/null)" ] && cat <<EOT |
pascal@19457 | 246 <a data-icon="web" href="http://poptop.sourceforge.net/" target="_blank" rel="noopener">$(_n 'PPTPD web page')</a><p> |
pascal@19457 | 247 <a data-icon="help" href="index.cgi?exec=pptpd%20--help" target="_blank" rel="noopener">$(_ 'PPTPD Help')</a><p> |
pascal@18017 | 248 EOT |
pascal@18017 | 249 [ "$(which pppssh 2>/dev/null)" ] && cat <<EOT |
pascal@19457 | 250 <a data-icon="web" href="http://doc.slitaz.org/en:guides:vpn" target="_blank" rel="noopener">$(_n 'VPN Wiki')</a><p> |
pascal@19457 | 251 <a data-icon="help" href="index.cgi?exec=dbclient" target="_blank" rel="noopener">$(_ 'SSH Help')</a><p> |
pascal@18017 | 252 EOT |
pascal@18017 | 253 cat << EOT |
pascal@18017 | 254 <footer> |
pascal@18017 | 255 </footer> |
pascal@18017 | 256 </section> |
pascal@18017 | 257 <section> |
pascal@18017 | 258 <header> |
pascal@18017 | 259 $(_ 'Configuration') |
pascal@18017 | 260 </header> |
pascal@20411 | 261 EOT |
pascal@20411 | 262 [ "$(which sdptool 2>/dev/null)" ] && create_gsm_conf && cat <<EOT |
pascal@20411 | 263 <a data-icon="conf" href="index.cgi?file=/etc/bluetooth/rfcomm.conf" target="_blank" rel="noopener">$(_ 'GSM device')</a><p> |
pascal@20411 | 264 <a data-icon="conf" href="index.cgi?file=/etc/ppp/peers/gsm" target="_blank" rel="noopener">$(_ 'PPP GSM script')</a><p> |
pascal@20411 | 265 <a data-icon="conf" href="index.cgi?file=/etc/ppp/scripts/gsm.chat" target="_blank" rel="noopener">$(_ 'PPP GSM chat')</a><p> |
pascal@20411 | 266 <a data-icon="conf" href="index.cgi?file=/etc/ppp/options-gsm" target="_blank" rel="noopener">$(_ 'PPP GSM options')</a><p> |
pascal@20411 | 267 EOT |
pascal@20411 | 268 cat << EOT |
pascal@19457 | 269 <a data-icon="conf" href="index.cgi?file=/etc/ppp/scripts/ppp-on" target="_blank" rel="noopener">$(_ 'PPP PSTN script')</a><p> |
pascal@20411 | 270 <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 | 271 <a data-icon="conf" href="index.cgi?file=/etc/ppp/options" target="_blank" rel="noopener">$(_ 'PPP PSTN options')</a><p> |
pascal@19457 | 272 <a data-icon="conf" href="index.cgi?file=/etc/ppp/chap-secrets" target="_blank" rel="noopener">$(_ 'chap users')</a><p> |
pascal@19457 | 273 <a data-icon="conf" href="index.cgi?file=/etc/ppp/pap-secrets" target="_blank" rel="noopener">$(_ 'pap users')</a><p> |
pascal@18017 | 274 EOT |
pascal@18017 | 275 for i in /etc/ppp/peers/* ; do |
pascal@20411 | 276 [ -s "$i" ] && [ "$i" != "/etc/ppp/peers/gsm" ] && cat << EOT |
pascal@19457 | 277 <a data-icon="conf" href="index.cgi?file=$i" target="_blank" rel="noopener">$(basename $i)</a><p> |
pascal@18017 | 278 EOT |
pascal@18017 | 279 done |
pascal@18017 | 280 [ "$(which pptpd 2>/dev/null)" ] && cat <<EOT |
pascal@19457 | 281 <a data-icon="conf" href="index.cgi?file=/etc/pptpd.conf" target="_blank" rel="noopener">$(_ 'pptpd.conf')</a><p> |
pascal@18017 | 282 EOT |
pascal@18017 | 283 if [ "$(busybox ps x | grep "pppd" | awk '/modem/{print $1}')" ]; then |
pascal@18017 | 284 start_disabled='disabled' |
pascal@18017 | 285 else |
pascal@18017 | 286 stop_disabled='disabled' |
pascal@18017 | 287 fi |
pascal@18020 | 288 if [ "$(busybox ps x | grep "pppd" | awk '/eth/{print $1}')" ]; then |
pascal@18020 | 289 startoe_disabled='disabled' |
pascal@18020 | 290 else |
pascal@18020 | 291 stopoe_disabled='disabled' |
pascal@18020 | 292 fi |
pascal@20411 | 293 if [ "$(busybox ps x | grep "pppd" | awk '/gsm/{print $1}')" ]; then |
pascal@20411 | 294 startgsm_disabled='disabled' |
pascal@20411 | 295 else |
pascal@20411 | 296 stopgsm_disabled='disabled' |
pascal@20411 | 297 fi |
pascal@20411 | 298 head=" <footer> |
pascal@20411 | 299 </footer> |
pascal@20411 | 300 </section> |
pascal@20411 | 301 <section> |
pascal@20411 | 302 <header> |
pascal@20411 | 303 $(_ 'Install extra') |
pascal@20411 | 304 </header>" |
pascal@20411 | 305 while read file pkg name ; do |
pascal@20411 | 306 [ -z "$(which $file 2>/dev/null)" ] && echo $head && head="" && |
pascal@20411 | 307 echo " <a href='pkgs.cgi?do=Install&pkg=$pkg'>$name</a>" |
pascal@20411 | 308 done <<EOT |
pascal@20411 | 309 sdptool bluez GSM / Bluetooth |
pascal@20411 | 310 pppssh dropbear SSH / VPN |
pascal@20411 | 311 EOT |
pascal@20411 | 312 #pptp pptpclient PPTP client |
pascal@20411 | 313 #pptpd poptop PPTP server |
pascal@18017 | 314 cat << EOT |
pascal@18017 | 315 <footer> |
pascal@18017 | 316 </footer> |
pascal@18017 | 317 </section> |
pascal@18017 | 318 </div> |
pascal@18017 | 319 |
pascal@20411 | 320 EOT |
pascal@20411 | 321 if [ "$(which sdptool 2>/dev/null)" ]; then |
pascal@20411 | 322 cat <<EOT |
pascal@20411 | 323 <a name="pppgsm"></a> |
pascal@20411 | 324 <section> |
pascal@20411 | 325 <header> |
pascal@20411 | 326 <span data-icon="modem">$(_ 'GSM modem') - |
pascal@20411 | 327 $(_ 'Manage Bluetooth GSM Internet connections')</span> |
pascal@20411 | 328 </header> |
pascal@20411 | 329 <form method="get"> |
pascal@20411 | 330 <input type="hidden" name="setpppgsm" /> |
pascal@20411 | 331 <table> |
pascal@20411 | 332 <tr> |
pascal@20411 | 333 <td>$(_ 'GSM provider')</td> |
pascal@20411 | 334 <td><input type="text" name="gsmprovider" size="40" value="$(sed \ |
pascal@20411 | 335 '/AT+CGDCONT/!d;s|.*IP","\(.*\)".|\1|' \ |
pascal@20411 | 336 /etc/ppp/scripts/gsm.chat 2> /dev/null)" /></td> |
pascal@20411 | 337 </tr> |
pascal@20411 | 338 <tr> |
pascal@20411 | 339 <td>$(_ 'Bluetooth PIN')</td> |
pascal@20411 | 340 <td><input type="text" name="gsmpin" size="40" value="0000" /></td> |
pascal@20411 | 341 </tr> |
pascal@20411 | 342 </table> |
pascal@20411 | 343 <footer><!-- |
pascal@20411 | 344 --><button type="submit" name="start_gsm" data-icon="start" $startgsm_disabled>$(_ 'Start' )</button><!-- |
pascal@20411 | 345 --><button type="submit" name="stop_gsm" data-icon="stop" $stopgsm_disabled>$(_ 'Stop' )</button><!-- |
pascal@20411 | 346 -->$(phone_names)</footer> |
pascal@20411 | 347 </form> |
pascal@20411 | 348 </section> |
pascal@20411 | 349 EOT |
pascal@20411 | 350 fi |
pascal@20411 | 351 cat << EOT |
pascal@18025 | 352 <a name="ppppstn"></a> |
pascal@18017 | 353 <section> |
pascal@18017 | 354 <header> |
pascal@18067 | 355 <span data-icon="modem">$(_ 'PSTN modem') - |
pascal@18025 | 356 $(_ 'Manage PSTN Internet connections')</span> |
pascal@18017 | 357 </header> |
pascal@18017 | 358 <form action="index.cgi" id="indexform"></form> |
pascal@18042 | 359 <form method="get"> |
pascal@18042 | 360 <input type="hidden" name="setppppstn" /> |
pascal@18017 | 361 <table> |
pascal@18017 | 362 <tr> |
pascal@18017 | 363 <td>$(_ 'Username')</td> |
pascal@18017 | 364 <td><input type="text" name="user" size="40" value="$ACCOUNT" /></td> |
pascal@18017 | 365 </tr> |
pascal@18017 | 366 <tr> |
pascal@18017 | 367 <td>$(_ 'Password')</td> |
pascal@18025 | 368 <td><input type="text" name="pass" size="40" value="$PASSPSTN" /></td> |
pascal@18017 | 369 </tr> |
pascal@18017 | 370 <tr> |
pascal@18017 | 371 <td>$(_ 'Phone number')</td> |
pascal@18017 | 372 <td><input type="text" name="phone" size="40" value="$PHONE" /></td> |
pascal@18017 | 373 </tr> |
pascal@18017 | 374 </table> |
pascal@18042 | 375 <footer><!-- |
pascal@18042 | 376 --><button type="submit" name="start_pstn" data-icon="start" $start_disabled>$(_ 'Start' )</button><!-- |
pascal@18042 | 377 --><button type="submit" name="stop_pstn" data-icon="stop" $stop_disabled >$(_ 'Stop' )</button><!-- |
pascal@18042 | 378 --></footer> |
pascal@18017 | 379 </form> |
pascal@18017 | 380 </section> |
pascal@18017 | 381 |
pascal@18017 | 382 <a name="pppoe"></a> |
pascal@18017 | 383 <section> |
pascal@18017 | 384 <header> |
pascal@18017 | 385 <span data-icon="eth">$(_ 'Cable Modem') - |
pascal@18017 | 386 $(_ 'Manage PPPoE Internet connections')</span> |
pascal@18017 | 387 </header> |
pascal@18042 | 388 <form method="get"> |
pascal@18042 | 389 <input type="hidden" name="setpppoe" /> |
pascal@18017 | 390 <table> |
pascal@18017 | 391 <tr> |
pascal@18017 | 392 <td>$(_ 'Username')</td> |
pascal@18017 | 393 <td><input type="text" name="user" size="40" value="$USERNAME" /></td> |
pascal@18017 | 394 </tr> |
pascal@18017 | 395 <tr> |
pascal@18017 | 396 <td>$(_ 'Password')</td> |
pascal@18017 | 397 <td><input type="text" name="pass" size="40" value="$PASSWORD" /></td> |
pascal@18017 | 398 </tr> |
pascal@18017 | 399 </table> |
pascal@18042 | 400 <footer><!-- |
pascal@18042 | 401 --><button type="submit" name="start_pppoe" data-icon="start" $startoe_disabled>$(_ 'Start' )</button><!-- |
pascal@18042 | 402 --><button type="submit" name="stop_pppoe" data-icon="stop" $stopoe_disabled >$(_ 'Stop' )</button><!-- |
pascal@18042 | 403 --></footer> |
pascal@18017 | 404 </form> |
pascal@18017 | 405 </section> |
pascal@18017 | 406 EOT |
pascal@18017 | 407 if [ "$(which pppssh 2>/dev/null)" ]; then |
pascal@18017 | 408 [ -s /etc/ppp/pppssh ] && . /etc/ppp/pppssh |
pascal@18017 | 409 ppp="$(sed '/pppd/!d;s/.*="\([^"]*\).*/\1/' /usr/bin/pppssh)" |
pascal@18017 | 410 if [ "$(busybox ps x | grep "$ppp" | awk '/dbclient/{print $1}')" ]; then |
pascal@18042 | 411 startssh_disabled='disabled' |
pascal@18017 | 412 else |
pascal@18042 | 413 stopssh_disabled='disabled' |
pascal@18017 | 414 fi |
pascal@18017 | 415 cat <<EOT |
pascal@18017 | 416 <a name="pppssh"></a> |
pascal@18017 | 417 <section> |
pascal@18017 | 418 <header> |
pascal@18067 | 419 <span data-icon="vpn">$(_ 'Virtual Private Network') - |
pascal@18017 | 420 $(_ 'Manage private TCP/IP connections')</span> |
pascal@18017 | 421 </header> |
pascal@18042 | 422 <form method="get"> |
pascal@18042 | 423 <input type="hidden" name="setpppssh" /> |
pascal@18017 | 424 <table> |
pascal@18017 | 425 <tr> |
pascal@18017 | 426 <td>$(_ 'Peer')</td> |
pascal@18017 | 427 <td><input type="text" name="peer" size="50" value="${PEER:-user@elsewhere}" /></td> |
pascal@18017 | 428 </tr> |
pascal@18017 | 429 <tr> |
pascal@18017 | 430 <td>$(_ 'SSH options')</td> |
pascal@18017 | 431 <td><input type="text" name="ssharg" size="50" value="$SSHARG" /></td> |
pascal@18017 | 432 </tr> |
pascal@18017 | 433 <tr> |
pascal@18017 | 434 <td>$(_ 'Password')</td> |
paul@18037 | 435 <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 | 436 </tr> |
pascal@18017 | 437 <tr> |
pascal@18017 | 438 <td>$(_ 'Local IP address')</td> |
pascal@18017 | 439 <td><input type="text" name="localip" size="50" value="${LOCALIP:-192.168.254.1}" /></td> |
pascal@18017 | 440 </tr> |
pascal@18017 | 441 <tr> |
pascal@18017 | 442 <td>$(_ 'Remote IP address')</td> |
pascal@18017 | 443 <td><input type="text" name="remoteip" size="50" value="${REMOTEIP:-192.168.254.2}" /></td> |
pascal@18017 | 444 </tr> |
pascal@18017 | 445 <tr> |
pascal@18017 | 446 <td>$(_ 'Local PPP options')</td> |
pascal@22849 | 447 <td><input type="text" name="localpppopt" size="50" value="${LOCALPPP:-usepeerdns}" /></td> |
pascal@18017 | 448 </tr> |
pascal@18017 | 449 <tr> |
pascal@18017 | 450 <td>$(_ 'Remote PPP options')</td> |
pascal@18034 | 451 <td><input type="text" name="remotepppopt" size="50" value="${REMOTEPPP:-proxyarp}" title="$(_ "You may need 'proxyarp' to use the new routes")" /></td> |
pascal@18017 | 452 </tr> |
pascal@18017 | 453 <tr> |
pascal@18017 | 454 <td>$(_ 'Peer routes')</td> |
pascal@18041 | 455 <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 | 456 </tr> |
pascal@19355 | 457 <tr> |
pascal@19355 | 458 <td>$(_ 'UDP port')</td> |
pascal@22849 | 459 <td><input type="text" name="udp" size="50" value="$UDP" title="$(_ "Optional UDP port for real-time (with a very reliable link only)")"/></td> |
pascal@19355 | 460 </tr> |
pascal@18017 | 461 </table> |
pascal@18042 | 462 <footer><!-- |
pascal@18042 | 463 --><button type="submit" name="start_pppssh" data-icon="start" $startssh_disabled>$(_ 'Start' )</button><!-- |
pascal@18042 | 464 --><button type="submit" name="stop_pppssh" data-icon="stop" $stopssh_disabled>$(_ 'Stop' )</button><!-- |
pascal@18042 | 465 --><button type="submit" name="send_key" data-icon="sync" >$(_ 'Send SSH key' )</button><!-- |
pascal@18042 | 466 --></footer> |
pascal@18017 | 467 </form> |
pascal@18017 | 468 </section> |
pascal@18017 | 469 EOT |
pascal@18017 | 470 fi |
pascal@18017 | 471 |
pascal@18017 | 472 xhtml_footer |
pascal@18017 | 473 exit 0 |