slitaz-tools view tinyutils/netbox @ rev 218

netbox/ppp: add help
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jun 23 20:51:45 2008 +0000 (2008-06-23)
parents 40e8869e8ea6
children 8a61d6420e01
line source
1 #!/bin/sh
2 #
3 # Gtkdialog box to manage network connexion.
4 # - SliTaz GNU/Linux 2008.
5 #
6 VERSION=20080113
8 # Check if user is root.
9 check_root()
10 {
11 if test $(id -u) != 0 ; then
12 echo -e "
13 You must be root to run `basename $0`. Please type 'su' and
14 root password to become super-user.\n"
15 exit 0
16 fi
17 }
19 set_ipup()
20 {
21 [ -f /etc/ppp/ip-up ] && return
22 cat > /etc/ppp/ip-up <<EOT
23 #!/bin/sh
24 exec $0 call ipup \$@
25 EOT
26 chmod +x /etc/ppp/ip-up
27 }
29 if [ "$1" = "call" ]; then
30 ppp="pppd local lock notty"
31 pppup=""
32 sub=$2
33 shift 2
34 case "$sub" in
35 sendsshkey)
36 check_root
37 dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | \
38 grep ^ssh | ssh $1 "mkdir .ssh 2> /dev/null ; while read key; do for i in authorized_keys authorized_keys2; do grep -q \$key .ssh/\$i || echo \$key >> .ssh/\$i; done; done; chmod 700 .ssh ; chmod 600 .ssh/authorized_keys*"
39 exit 0;;
40 vpnssh) check_root
41 set_ipup
42 ps ww | grep -q "$ppp $2:$3" && exit 1
43 pipe="/tmp/ssh$$"
44 mkfifo $pipe
45 [ -n "$4" ] && pppup="ipparam 'addroutes,$(echo $4 | sed 's/ /,/g')'"
46 cat $pipe | dbclient -i /etc/dropbear/dropbear_rsa_host_key \
47 $1 "$ppp" | $ppp $2:$3 $pppup > $pipe
48 rm -f $pipe
49 exit 0;;
50 killvpnssh)
51 check_root
52 kill $(ps x | grep dbclient | grep "$ppp" | awk '{ print $1 }')
53 exit 0;;
54 ipup)
55 # Arg Name Example
56 # $1 Interface name ppp0
57 # $2 The tty ttyS1
58 # $3 The link speed 38400
59 # $4 Local IP number 12.34.56.78
60 # $5 Peer IP number 12.34.56.99
61 # $6 Optional ``ipparam'' value foo
62 iface=$1
63 # skip tty if present
64 case "$2" in [0-9]*);; *) shift; esac
65 peer=$4
66 IFS=","; set -- $(eval echo $5); unset IFS
67 set -- $1
68 if [ "$1" = "addroutes" ]; then
69 while [ -n "$2" ]; do
70 eval $(ipcalc -n $2)
71 eval $(ipcalc -m $2)
72 route add -net $NETWORK netmask $NETMASK \
73 gw $peer $iface
74 shift
75 done
76 fi
77 exit 0;;
78 esac
79 echo "call $sub unsupported."
80 exit 1
81 fi
83 # English/French help dialod.
84 export HELP='
85 <window title="Network status" icon-name="network-wire">
86 <vbox>
87 <text use-markup="true">
88 <label>"
89 <b>SliTaz - Netbox</b>"
90 </label>
91 </text>
92 <frame English>
93 <text wrap="true" width-chars="58">
94 <label>
95 "Netbox let you manage network connections getting dynamic IP by DHCP
96 or static IP, and setup servers. Netbox can start or stop networking,
97 configure network interfaces or directly edit files."
98 </label>
99 </text>
100 </frame>
101 <frame Francais>
102 <text wrap="true" width-chars="58">
103 <label>
104 "Netbox vous permet de gerer les connexions reseau avec une IP
105 statique ou en obtenant une IP dynamique par DHCP, et de parametrer
106 les serveurs. Netbox peut demarrer ou arreter le reseau, configurer
107 les interfaces reseau ou editer directement les fichiers."
108 </label>
109 </text>
110 </frame>
111 </vbox>
112 </window>
113 '
115 # Interafce status with ifconfig without arguments to show all
116 # active connections.
117 #
118 export IFCONFIG='
119 <window title="Network status" icon-name="network-wire">
120 <vbox>
121 <text wrap="false">
122 <input>date</input>
123 </text>
124 <notebook labels="Network interfaces'
125 [ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG|Wireless interfaces|Wireless networks"
126 tmp='|Routing|Servers">
127 <frame Ifconfig>
128 <text wrap="false" width-chars="58">
129 <input>ifconfig</input>
130 </text>
131 </frame>'
132 IFCONFIG="$IFCONFIG$tmp"
133 tmp='<frame Iwconfig>
134 <text wrap="false" width-chars="58">
135 <input>iwconfig</input>
136 </text>
137 </frame>
138 <frame Wireless networks>
139 <text wrap="false" width-chars="58">
140 <input>iwlist scan</input>
141 </text>
142 </frame>'
143 [ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG$tmp"
144 tmp='<frame Routing>
145 <frame Nameservers>
146 <text wrap="false" width-chars="58">
147 <input>cat /etc/resolv.conf</input>
148 </text>
149 </frame>
150 <frame Routing table>
151 <text wrap="false" width-chars="58">
152 <input>route</input>
153 </text>
154 </frame>
155 <frame Arp table>
156 <text wrap="false" width-chars="58">
157 <input>arp</input>
158 </text>
159 </frame>
160 </frame>
161 <frame Servers>
162 <text wrap="false" width-chars="58">
163 <input>for i in dropbear inetd udhcpd dnsd rsync lighttpd smbd nmbd x11vnc pppd; do ps ww | grep $i | grep -v grep | fold -s; done</input>
164 </text>
165 </frame>
166 </notebook>
167 <hbox>
168 <button>
169 <input file icon="gtk-close"></input>
170 <action type="closewindow">IFCONFIG</action>
171 </button>
172 </hbox>
173 </vbox>
174 </window>
175 '
176 IFCONFIG="$IFCONFIG$tmp"
178 # The main dialog with notebook, start/stop buttons and all options.
179 # Note than /etc/network.conf is seded wehwn an interafce is activate
180 #
181 NET_BOX='
182 <window title="SliTaz Netbox Manager" icon-name="network-wired">
183 <vbox>
185 <hbox>
186 <text use-markup="true">
187 <label>"<b>Network/Server Manager</b>"</label>
188 </text>
189 <pixmap>
190 <input file>/usr/share/pixmaps/netbox.png</input>
191 </pixmap>
192 </hbox>
194 <frame General>
195 <hbox>
196 <text use-markup="true">
197 <label>"<b>Interface :</b>"</label>
198 </text>
199 <entry>
200 <input>. /etc/network.conf; echo $INTERFACE</input>
201 <variable>INTERFACE</variable>
202 </entry>
203 </hbox>
204 </frame>
206 <notebook labels="DHCP|PPPoE|PPP|Static IP'
207 [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX|Wifi"
208 NET_BOX="$NET_BOX|System wide|VPN|Servers"
209 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX|Firewall"
210 tmp='|Etherwake">
212 <frame Udhcpc>
213 <hbox>
214 <text use-markup="true">
215 <label>"<b>Options :</b>"</label>
216 </text>
217 <entry>
218 <default>-b</default>
219 <variable>UDHCPC_OPTS</variable>
220 </entry>
221 <button>
222 <input file icon="help"></input>
223 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x27 -title "udhcpc help" -e "udhcpc --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
224 </button>
225 </hbox>
226 <hbox>
227 <button>
228 <label>Start</label>
229 <input file icon="forward"></input>
230 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
231 <action>sed -i s/DHCP=\"no\"/DHCP=\"yes\"/ /etc/network.conf</action>
232 <action>sed -i s/STATIC=\"yes\"/STATIC=\"no\"/ /etc/network.conf</action>
233 <action>udhcpc $UDHCPC_OPTS -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid</action>
234 </button>
235 <button>
236 <label>Stop</label>
237 <input file icon="stop"></input>
238 <action>echo -n "Stopping interface : $INTERFACE... "</action>
239 <action>ifconfig $INTERFACE down</action>
240 <action>killall -q udhcpc; echo "done"</action>
241 </button>
242 </hbox>
243 </frame>
245 <frame PPPoE>
246 <hbox>
247 <text use-markup="true">
248 <label>"<b>Name :</b>"</label>
249 </text>
250 <entry>
251 <input>NAME=$(grep -s ^name /etc/ppp/options); echo "${NAME#* }"</input>
252 <variable>NAME</variable>
253 </entry>
254 </hbox>
255 <hbox>
256 <text use-markup="true">
257 <label>"<b>Username :</b>"</label>
258 </text>
259 <entry>
260 <variable>USER</variable>
261 </entry>
262 </hbox>
263 <hbox>
264 <text use-markup="true">
265 <label>"<b>Password :</b>"</label>
266 </text>
267 <entry>
268 <variable>PASS</variable>
269 </entry>
270 </hbox>
271 <hbox>
272 <button>
273 <input file icon="help"></input>
274 <label>Help</label>
275 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "pppd help (q to quit)" -e "pppd --help 2>&1 | less"</action>
276 </button>
277 <button>
278 <input file icon="accessories-text-editor"></input>
279 <label>Tune</label>
280 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
281 <action type="lauch">leafpad /etc/ppp/options</action>
282 </button>
283 <button>
284 <label>Start</label>
285 <input file icon="forward"></input>
286 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
287 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
288 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
289 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
290 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
291 <action>killall udhcpc</action>
292 <action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
293 <action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
294 <action>pppd $INTERFACE &</action>
295 </button>
296 <button>
297 <label>Stop</label>
298 <input file icon="stop"></input>
299 <action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
300 <action>killall pppd</action>
301 </button>
302 </hbox>
303 </frame>
305 <frame PPP>
306 <hbox>
307 <text use-markup="true">
308 <label>"<b>Username :</b>"</label>
309 </text>
310 <entry>
311 <input>USER=$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "${USER#*=}"</input>
312 <variable>USER</variable>
313 </entry>
314 </hbox>
315 <hbox>
316 <text use-markup="true">
317 <label>"<b>Password :</b>"</label>
318 </text>
319 <entry>
320 <input>PASS=$(grep -s ^PASSWORD= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PASS#*=}"</input>
321 <variable>PASS</variable>
322 </entry>
323 </hbox>
324 <hbox>
325 <text use-markup="true">
326 <label>"<b>Telephone:</b>"</label>
327 </text>
328 <entry>
329 <input>PHONE=$(grep -s ^TELEPHONE= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PHONE#*=}"</input>
330 <variable>PHONE</variable>
331 </entry>
332 </hbox>
333 <hbox>
334 <button>
335 <input file icon="help"></input>
336 <label>Help</label>
337 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "pppd help (q to quit)" -e "pppd --help 2>&1 | less"</action>
338 </button>
339 <button>
340 <input file icon="accessories-text-editor"></input>
341 <label>Tune</label>
342 <action>[ -n "$NAME" ] && sed -i "s/^ACCOUNT=.*/ACCOUNT=$NAME/" /etc/ppp/scripts/ppp-on</action>
343 <action>[ -n "$PASS" ] && sed -i "s/^PASSWORD=.*/PASSWORD=$PASS/" /etc/ppp/scripts/ppp-on</action>
344 <action>[ -n "$PHONE" ] && sed -i "s/^TELEPHONE=.*/TELEPHONE=$PHONE/" /etc/ppp/scripts/ppp-on</action>
345 <action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
346 </button>
347 <button>
348 <label>Start</label>
349 <input file icon="forward"></input>
350 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
351 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
352 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
353 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
354 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
355 <action>/etc/ppp/scripts/ppp-off</action>
356 <action>/etc/ppp/scripts/ppp-on &</action>
357 </button>
358 <button>
359 <label>Stop</label>
360 <input file icon="stop"></input>
361 <action>/etc/ppp/scripts/ppp-off</action>
362 </button>
363 </hbox>
364 </frame>
366 <frame Configuration>
367 <hbox>
368 <text use-markup="true">
369 <label>"<b>IP :</b>"</label>
370 </text>
371 <entry>
372 <input>. /etc/network.conf; echo "$IP"</input>
373 <variable>IP</variable>
374 </entry>
375 </hbox>
376 <hbox>
377 <text use-markup="true">
378 <label>"<b>Netmask :</b>"</label>
379 </text>
380 <entry>
381 <input>. /etc/network.conf; echo "$NETMASK"</input>
382 <variable>NETMASK</variable>
383 </entry>
384 </hbox>
385 <hbox>
386 <text use-markup="true">
387 <label>"<b>Gateway :</b>"</label>
388 </text>
389 <entry>
390 <input>. /etc/network.conf; echo "$GATEWAY"</input>
391 <variable>GATEWAY</variable>
392 </entry>
393 </hbox>
394 <hbox>
395 <text use-markup="true">
396 <label>"<b>DNS server :</b>"</label>
397 </text>
398 <entry>
399 <input>. /etc/network.conf; echo "$DNS_SERVER"</input>
400 <variable>DNS_SERVER</variable>
401 </entry>
402 </hbox>
403 <hbox>
404 <button>
405 <label>Start</label>
406 <input file icon="forward"></input>
407 <action>ifconfig lo down</action>
408 <action>ifconfig $INTERFACE down</action>
409 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
410 <action>sed -i s/DHCP=\"yes\"/DHCP=\"no\"/ /etc/network.conf</action>
411 <action>sed -i s/STATIC=\"no\"/STATIC=\"yes\"/ /etc/network.conf</action>
412 <action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP=\"$IP\"/ /etc/network.conf</action>
413 <action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK=\"$NETMASK\"/ /etc/network.conf</action>
414 <action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY=\"$GATEWAY\"/ /etc/network.conf</action>
415 <action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER=\"$DNS_SERVER\"/ /etc/network.conf</action>
416 <action>/etc/init.d/network.sh</action>
417 </button>
418 <button>
419 <label>Stop</label>
420 <input file icon="stop"></input>
421 <action>echo -n "Stopping interface : $INTERFACE... "</action>
422 <action>ifconfig $INTERFACE down; echo "done"</action>
423 </button>
424 </hbox>
425 </frame>'
426 NET_BOX="$NET_BOX$tmp"
427 tmp='<frame Wireless>
428 <notebook labels="Interface|Extra parameters|WPA'
429 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp|Kernel Modules"
430 [ -x /usr/sbin/ndiswrapper ] && tmp="$tmp|Ndiswrapper"
431 tmp2='">
432 <vbox>
433 <hbox>
434 <text use-markup="true">
435 <label>"<b>Interface :</b>"</label>
436 </text>
437 <entry>
438 <input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input>
439 <variable>WIFI_INTERFACE</variable>
440 </entry>
441 </hbox>
442 <hbox>
443 <text use-markup="true">
444 <label>"<b>ESSID :</b>"</label>
445 </text>
446 <entry>
447 <input>. /etc/network.conf; echo "$WIFI_ESSID"</input>
448 <variable>WIFI_ESSID</variable>
449 </entry>
450 </hbox>
451 </vbox>
452 <vbox>
453 <hbox>
454 <text use-markup="true">
455 <label>"<b>Channel :</b>"</label>
456 </text>
457 <entry>
458 <input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input>
459 <variable>WIFI_CHANNEL</variable>
460 </entry>
461 <text use-markup="true">
462 <label>"<b>Mode :</b>"</label>
463 </text>
464 <combobox>
465 <variable>WIFI_MODE</variable>'
466 . /etc/network.conf
467 tmp2="$tmp2<item>$WIFI_MODE</item>"
468 for i in managed ad-hoc master repeater secondary monitor; do
469 [ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>"
470 done
471 tmp3='</combobox>
472 </hbox>
473 <hbox>
474 <text use-markup="true">
475 <label>"<b>Key :</b>"</label>
476 </text>
477 <entry>
478 <input>. /etc/network.conf; echo "$WIFI_KEY"</input>
479 <variable>WIFI_KEY</variable>
480 </entry>
481 </hbox>
482 </vbox>'
483 tmp="$tmp$tmp2$tmp3"
484 tmp2='<vbox>
485 <hbox>
486 <text use-markup="true">
487 <label>"<b>WPA_OPTIONS</b>"</label>
488 </text>
489 <entry editable="false">'
490 [ -n "$WPA_OPTIONS" ] && tmp2="$tmp2<default>$WPA_OPTIONS</default>"
491 tmp3='
492 <variable>WPA_OPTS</variable>
493 </entry>
494 <button>
495 <input file icon="help"></input>
496 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "wpa_supplicant help (q to quit)" -e "wpa_supplicant --help | less"</action>
497 </button>
498 <button>
499 <input file icon="accessories-text-editor"></input>
500 <action type="lauch">leafpad /etc/daemons.conf</action>
501 </button>
502 </hbox>
503 <hbox>
504 <text use-markup="true">
505 <label>"<b>Configuration:</b>"</label>
506 </text>
507 <entry editable="false">
508 <default>/etc/wpa_supplicant.conf</default>
509 <variable>WPA_CONF</variable>
510 </entry>
511 <button>
512 <input file icon="accessories-text-editor"></input>
513 <action type="lauch">leafpad $WPA_CONF</action>
514 </button>
515 </hbox>
516 <hbox>
517 <button>
518 <label>Start WPA</label>
519 <input file icon="forward"></input>
520 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)wpa_supplicant \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
521 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"wpa_supplicant \1\"/" /etc/rcS.conf</action>
522 <action>/etc/init.d/wpa_supplicant start</action>
523 </button>
524 <button>
525 <label>Stop WPA</label>
526 <input file icon="stop"></input>
527 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)wpa_supplicant \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
528 <action>/etc/init.d/wpa_supplicant stop</action>
529 </button>
530 </hbox>
531 </vbox>'
532 [ -x /usr/bin/wpa_supplicant ] && tmp="$tmp$tmp2$tmp3"
533 tmp2='<vbox>
534 <hbox>
535 <text wrap="true" width-chars="64" use-markup="true">
536 <label>
537 "<i>The package <b>wpa_supplicant</b> is not yet installed</i>"
538 </label>
539 </text>
540 <button>
541 <input file icon="go-jump"></input>
542 <label>Install</label>
543 <action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action>
544 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title "wpa_supplicant install" -e "tazpkg get-install wpa_supplicant ; echo -e "----\n\nENTER to continue..." && read close"</action>
545 <action type="exit">Exit</action>
546 </button>
547 </hbox>
548 </vbox>'
549 [ -x /usr/bin/wpa_supplicant ] || tmp="$tmp$tmp2"
550 tmp2='<vbox>
551 <hbox>
552 <button>
553 <label>Load</label>
554 <input file icon="forward"></input>
555 <action>modprobe $MODULE</action>
556 </button>
557 <button>
558 <label>Unload</label>
559 <input file icon="forward"></input>
560 <action>modprobe -r $MODULE</action>
561 </button>
562 <text use-markup="true">
563 <label>"<b>Wifi Module :</b>"</label>
564 </text>
565 <combobox>
566 <variable>MODULE</variable>'
567 tmp2="$tmp2$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f | sed 's,/.*/\(.*\).ko.gz,<item>\1</item>,')"
568 tmp3='</combobox>
569 <button>
570 <label>Lsmod</label>
571 <input file icon="computer"></input>
572 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action>
573 </button>
574 </hbox>
575 </vbox>'
576 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp$tmp2$tmp3"
577 tmp2='<vbox>
578 <hbox>
579 <text use-markup="true">
580 <label>"<b>Drivers :</b>"</label>
581 </text>
582 <entry>
583 <input>. /etc/network.conf; echo "$NDISWRAPPER_DRIVERS"</input>
584 <variable>NDISWRAPPER_DRIVERS</variable>
585 </entry>
586 <button>
587 <label>Restart</label>
588 <input file icon="reload"></input>
589 <action>rmmod ndiswrapper</action>
590 <action>for i in $NDISWRAPPER_DRIVERS; do ndiswrapper -i $i; done</action>
591 <action>modprobe ndiswrapper</action>
592 </button>
593 </hbox>
594 </vbox>'
595 [ -x /usr/sbin/ndiswrapper ] && tmp="$tmp$tmp2"
596 tmp2='</notebook>
597 <hbox>
598 <button>
599 <label>Start</label>
600 <input file icon="forward"></input>
601 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_INTERFACE=`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action>
602 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_ESSID=`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action>
603 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_KEY=`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action>
604 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_MODE=`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action>
605 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_CHANNEL=`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action>
606 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
607 <action>ifconfig $WIFI_INTERFACE down</action>
608 <action>/etc/init.d/network.sh</action>
609 </button>
610 <button>
611 <label>Stop</label>
612 <input file icon="stop"></input>
613 <action>ifconfig $WIFI_INTERFACE down</action>
614 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
615 </button>
616 </hbox>
617 </frame>'
618 [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX$tmp$tmp2"
619 tmp='<frame Configuration files>
620 <hbox>
621 <text use-markup="true">
622 <label>"<b>Hosts :</b>"</label>
623 </text>
624 <entry editable="false">
625 <default>/etc/hosts</default>
626 <variable>HOSTS</variable>
627 </entry>
628 <button>
629 <input file icon="accessories-text-editor"></input>
630 <action type="lauch">leafpad $HOSTS</action>
631 </button>
632 </hbox>
633 <hbox>
634 <text use-markup="true">
635 <label>"<b>Host name :</b>"</label>
636 </text>
637 <entry editable="false">
638 <default>/etc/hostname</default>
639 <variable>HOSTNAME</variable>
640 </entry>
641 <button>
642 <input file icon="accessories-text-editor"></input>
643 <action type="lauch">leafpad $HOSTNAME</action>
644 </button>
645 </hbox>
646 <hbox>
647 <text use-markup="true">
648 <label>"<b>Network :</b>"</label>
649 </text>
650 <entry editable="false">
651 <default>/etc/network.conf</default>
652 <variable>CONFIG_FILE</variable>
653 </entry>
654 <button>
655 <input file icon="accessories-text-editor"></input>
656 <action type="lauch">leafpad $CONFIG_FILE</action>
657 </button>
658 </hbox>
659 <hbox>
660 <button>
661 <label>Restart</label>
662 <input file icon="reload"></input>
663 <action>echo -n "Stopping interface : $INTERFACE... "</action>
664 <action>ifconfig lo down</action>
665 <action>ifconfig $INTERFACE down</action>
666 <action>killall -q udhcpc; echo "done"</action>
667 <action>/etc/init.d/network.sh</action>
668 </button>
669 </hbox>
670 </frame>
672 <frame Virtual Private Network with PPP/SSH>
673 <hbox>
674 <text use-markup="true">
675 <label>"<b>Peer :</b>"</label>
676 </text>
677 <entry>
678 <variable>DROPBEAR_PEERVPN</variable>
679 <default>user@elsewhere</default>
680 </entry>
681 </hbox>
682 <hbox>
683 <text use-markup="true">
684 <label>"<b>Local IP :</b>"</label>
685 </text>
686 <entry>
687 <variable>DROPBEAR_LOCAL</variable>
688 <default>192.168.254.1</default>
689 </entry>
690 </hbox>
691 <hbox>
692 <text use-markup="true">
693 <label>"<b>Remote IP :</b>"</label>
694 </text>
695 <entry>
696 <variable>DROPBEAR_REMOTE</variable>
697 <default>192.168.254.2</default>
698 </entry>
699 </hbox>
700 <hbox>
701 <text use-markup="true">
702 <label>"<b>Route(s) :</b>"</label>
703 </text>
704 <entry>
705 <variable>DROPBEAR_ROUTE</variable>
706 <default>192.168.10.0/24 192.168.20.0/28</default>
707 </entry>
708 </hbox>
709 <hbox>
710 <button>
711 <input file icon="forward"></input>
712 <label>Connect</label>
713 <action>netbox call vpnssh $DROPBEAR_PEERVPN $DROPBEAR_LOCAL $DROPBEAR_REMOTE "$DROPBEAR_ROUTE" &</action>
714 </button>
715 <button>
716 <input file icon="stop"></input>
717 <label>Disconnect</label>
718 <action>netbox call killvpnssh</action>
719 </button>
720 <button>
721 <input file icon="go-up"></input>
722 <label>Send key</label>
723 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x10 -title "dropbear help" -e "netbox call sendsshkey $DROPBEAR_PEERVPN; echo -e \"----\nENTER to continue...\" && read close"</action>
724 </button>
725 </hbox>
726 </frame>
727 <notebook labels="'
728 NET_BOX="$NET_BOX$tmp"
729 tmp=''
730 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}SSH" && tmp='|'
731 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}INETD" && tmp='|'
732 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}${tmp}ZEROCONF" && tmp='|'
733 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}${tmp}DHCP" && tmp='|'
734 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
735 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] \
736 && NET_BOX="${NET_BOX}${tmp}PXE" && tmp='|'
737 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}DNS" && tmp='|'
738 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}RSYNC" && tmp='|'
739 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}HTTP" && tmp='|'
740 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|'
741 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}VNC" && tmp='|'
742 . /etc/daemons.conf
743 set -- $DROPBEAR_OPTIONS
744 while [ -n "$2" ]; do
745 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
746 shift
747 done
748 NET_BOX="${NET_BOX}\">"
749 tmp='<frame Dropbear>
750 <hbox>
751 <text use-markup="true">
752 <label>"<b>DROPBEAR_OPTIONS</b>"</label>
753 </text>
754 <entry editable="false">'
755 [ -n "$DROPBEAR_OPTIONS" ] && tmp="$tmp<default>$DROPBEAR_OPTIONS</default>"
756 tmp2='
757 <variable>DROPBEAR_OPTS</variable>
758 </entry>
759 <button>
760 <input file icon="help"></input>
761 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "dropbear help" -e "dropbear --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
762 </button>
763 <button>
764 <input file icon="accessories-text-editor"></input>
765 <action type="lauch">leafpad /etc/daemons.conf</action>
766 </button>
767 </hbox>
768 <hbox>
769 <text use-markup="true">
770 <label>"<b>Banner :</b>"</label>
771 </text>
772 <entry editable="false">'
773 [ -n "$DROPBEAR_BANNER" ] && tmp="$tmp$tmp2<default>$DROPBEAR_BANNER</default>"
774 tmp2='
775 <variable>DROPBEAR_BANNER</variable>
776 </entry>
777 <button>
778 <input file icon="accessories-text-editor"></input>
779 <action type="lauch">leafpad $DROPBEAR_BANNER</action>
780 </button>
781 </hbox>
782 <hbox>
783 <text use-markup="true">
784 <label>"<b>Remote :</b>"</label>
785 </text>
786 <entry>
787 <variable>DROPBEAR_PEER</variable>
788 <default>user@elsewhere</default>
789 </entry>
790 <button>
791 <input file icon="utilities-terminal"></input>
792 <label>Connect</label>
793 <action>xterm -fa MiscFixed -fs 11 -bg black -fg white -geometry 80x25 -title "$DROPBEAR_PEER" -e "dbclient -i /etc/dropbear/dropbear_rsa_host_key $DROPBEAR_PEER ; echo -e \"----\nENTER to continue...\" && read close" &</action>
794 </button>
795 <button>
796 <input file icon="go-up"></input>
797 <label>Send key</label>
798 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x10 -title "dropbear help" -e "netbox call sendsshkey $DROPBEAR_PEER; echo -e \"----\nENTER to continue...\" && read close"</action>
799 </button>
800 </hbox>
801 <hbox>
802 <button>
803 <label>Start</label>
804 <input file icon="forward"></input>
805 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
806 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dropbear \1\"/" /etc/rcS.conf</action>
807 <action>/etc/init.d/dropbear start</action>
808 </button>
809 <button>
810 <label>Stop</label>
811 <input file icon="stop"></input>
812 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
813 <action>/etc/init.d/dropbear stop</action>
814 </button>
815 </hbox>
816 </frame>
817 '
818 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
819 tmp='<frame Inetd>
820 <hbox>
821 <text use-markup="true">
822 <label>"<b>INETD_OPTIONS</b>"</label>
823 </text>
824 <entry editable="false">'
825 [ -n "$INETD_OPTS" ] && tmp="$tmp<default>$INETD_OPTS</default>"
826 tmp2='
827 <variable>INETD_OPTS</variable>
828 </entry>
829 <button>
830 <input file icon="help"></input>
831 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 60x14 -title "inetd help" -e "inetd --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
832 </button>
833 <button>
834 <input file icon="accessories-text-editor"></input>
835 <action type="lauch">leafpad /etc/daemons.conf</action>
836 </button>
837 </hbox>
838 <hbox>
839 <text use-markup="true">
840 <label>"<b>Configuration :</b>"</label>
841 </text>
842 <entry editable="false">
843 <default>/etc/inetd.conf</default>
844 <variable>INETD_CONF</variable>
845 </entry>
846 <button>
847 <input file icon="accessories-text-editor"></input>
848 <action type="lauch">leafpad $INETD_CONF</action>
849 </button>
850 </hbox>
851 <hbox>
852 '
853 tmp="$tmp$tmp2"
854 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
855 i=$(basename $i)
856 tmp2="
857 <button>
858 <input file icon=\"help\"></input>
859 <label>$i</label>
860 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 60x19 -title \"$i help\" -e \"$i --help ; echo -e \\\"----\nENTER to continue...\\\" && read close\"</action>
861 </button>
862 "
863 tmp="$tmp$tmp2"
864 done
865 tmp2='
866 <button>
867 <label>Start</label>
868 <input file icon="forward"></input>
869 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
870 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"inetd \1\"/" /etc/rcS.conf</action>
871 <action>/etc/init.d/inetd start</action>
872 </button>
873 <button>
874 <label>Stop</label>
875 <input file icon="stop"></input>
876 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
877 <action>/etc/init.d/inetd stop</action>
878 </button>
879 </hbox>
880 </frame>
881 '
882 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
883 if [ -x /sbin/zcip -a -z "$ZCIP_OPTS" ]; then
884 ZCIP_OPTS="eth0 /etc/zcip.script"
885 cat >> /etc/daemons.conf <<EOT
886 # ZeroConf options
887 ZCIP_OPTS="$ZCIP_OPTS"
889 EOT
890 fi
891 tmp='<frame Zcip>
892 <hbox>
893 <text use-markup="true">
894 <label>"<b>ZCIP_OPTIONS</b>"</label>
895 </text>
896 <entry editable="false">'
897 [ -n "$ZCIP_OPTS" ] && tmp="$tmp<default>$ZCIP_OPTS</default>"
898 tmp2='
899 <variable>CZIP_OPTS</variable>
900 </entry>
901 <button>
902 <input file icon="help"></input>
903 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 60x14 -title "zcip help" -e "zcip --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
904 </button>
905 <button>
906 <input file icon="accessories-text-editor"></input>
907 <action type="lauch">leafpad /etc/daemons.conf</action>
908 </button>
909 </hbox>
910 <hbox>
911 <text use-markup="true">
912 <label>"<b>Script :</b>"</label>
913 </text>
914 <entry editable="false">
915 <default>/etc/zcip.script</default>
916 <variable>CZIP_SCRIPT</variable>
917 </entry>
918 <button>
919 <input file icon="accessories-text-editor"></input>
920 <action type="lauch">leafpad $CZIP_SCRIPT</action>
921 </button>
922 </hbox>
923 <hbox>
924 <button>
925 <label>Start</label>
926 <input file icon="forward"></input>
927 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
928 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"zcip \1\"/" /etc/rcS.conf</action>
929 <action>/etc/init.d/zcip start</action>
930 </button>
931 <button>
932 <label>Stop</label>
933 <input file icon="stop"></input>
934 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
935 <action>/etc/init.d/zcip stop</action>
936 </button>
937 </hbox>
938 </frame>
939 '
940 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}$tmp$tmp2"
941 tmp='<frame Dhcpd>
942 <hbox>
943 <text use-markup="true">
944 <label>"<b>UDHCPD_OPTIONS</b>"</label>
945 </text>
946 <entry editable="false">'
947 [ -n "$UDHCPD_OPTS" ] && tmp="$tmp<default>$UDHCPD_OPTS</default>"
948 tmp2='
949 <variable>UDHCPD_OPTS</variable>
950 </entry>
951 <button>
952 <input file icon="help"></input>
953 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 60x14 -title "udhcpd help" -e "udhcpd --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
954 </button>
955 <button>
956 <input file icon="accessories-text-editor"></input>
957 <action type="lauch">leafpad /etc/daemons.conf</action>
958 </button>
959 </hbox>
960 <hbox>
961 <text use-markup="true">
962 <label>"<b>Configuration :</b>"</label>
963 </text>
964 <entry editable="false">
965 <default>/etc/udhcpd.conf</default>
966 <variable>UDHCPD_CONF</variable>
967 </entry>
968 <button>
969 <input file icon="accessories-text-editor"></input>
970 <action type="lauch">leafpad $UDHCPD_CONF</action>
971 </button>
972 </hbox>
973 <hbox>
974 <text use-markup="true">
975 <label>"<b>Script :</b>"</label>
976 </text>
977 <entry editable="false">
978 <default>/usr/share/udhcpc/default.script</default>
979 <variable>UDHCPD_SCRIPT</variable>
980 </entry>
981 <button>
982 <input file icon="accessories-text-editor"></input>
983 <action type="lauch">leafpad $UDHCPD_SCRIPT</action>
984 </button>
985 </hbox>
986 <hbox>
987 <button>
988 <label>Start</label>
989 <input file icon="forward"></input>
990 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
991 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"udhcpd \1\"/" /etc/rcS.conf</action>
992 <action>/etc/init.d/udhcpd start</action>
993 </button>
994 <button>
995 <label>Stop</label>
996 <input file icon="stop"></input>
997 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
998 <action>/etc/init.d/udhcpd stop</action>
999 </button>
1000 </hbox>
1001 </frame>
1003 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}$tmp$tmp2"
1004 tmp='<frame Pxelinux>
1005 <hbox>
1006 <text wrap="true">
1007 <label>
1008 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
1009 </label>
1010 </text>
1011 </hbox>
1012 <hbox>
1013 <text use-markup="true">
1014 <label>"<b>Configuration :</b>"</label>
1015 </text>
1016 <entry editable="false">
1017 <default>'
1018 tmp="$tmp$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')"
1019 tmp2='/pxelinux.cfg/default</default>
1020 <variable>PXE_CONF</variable>
1021 </entry>
1022 <button>
1023 <input file icon="accessories-text-editor"></input>
1024 <action>dir=$(dirname $PXE_CONF); [ -d $dir ] || mkdir -p $dir</action>
1025 <action>lzma d /usr/share/boot/pxelinux.0.lzma $(dirname $PXE_CONF)/../pxelinux.0</action>
1026 <action>grep -q "^boot_file" $UDHCPD_CONF || echo "boot_file pxelinux.0" >> $UDHCPD_CONF</action>
1027 <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> $UDHCPD_CONF</action>
1028 <action>[ -f $PXE_CONF ] || echo -e "label linux\n\tkernel bzImage\n\tappend initrd=rootfs.gz rw root=/dev/null vga=normal" > $PXE_CONF</action>
1029 <action type="lauch">leafpad $PXE_CONF</action>
1030 </button>
1031 </hbox>
1032 <hbox>
1033 <button>
1034 <input file icon="system-file-manager"></input>
1035 <label>Network boot files</label>
1036 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 100x25 -title "Network boot files (q to quit)" -e "find $(dirname $(dirname $PXE_CONF)) -exec ls -ld {} \; | less"</action>
1037 </button>
1038 </hbox>
1039 </frame>
1041 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
1042 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] && NET_BOX="$NET_BOX$tmp$tmp2"
1043 tmp='<frame Dnsd>
1044 <hbox>
1045 <text use-markup="true">
1046 <label>"<b>DNSD_OPTIONS</b>"</label>
1047 </text>
1048 <entry editable="false">'
1049 [ -n "$DNSD_OPTIONS" ] && tmp="$tmp<default>$DNSD_OPTIONS</default>"
1050 tmp2='
1051 <variable>DNSD_OPTS</variable>
1052 </entry>
1053 <button>
1054 <input file icon="help"></input>
1055 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x15 -title "dnsd help" -e "dnsd --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
1056 </button>
1057 <button>
1058 <input file icon="accessories-text-editor"></input>
1059 <action type="lauch">leafpad /etc/daemons.conf</action>
1060 </button>
1061 </hbox>
1062 <hbox>
1063 <text use-markup="true">
1064 <label>"<b>Configuration :</b>"</label>
1065 </text>
1066 <entry editable="false">
1067 <default>/etc/dnsd.conf</default>
1068 <variable>DNSD_CONF</variable>
1069 </entry>
1070 <button>
1071 <input file icon="accessories-text-editor"></input>
1072 <action type="lauch">leafpad $DNSD_CONF</action>
1073 </button>
1074 </hbox>
1075 <hbox>
1076 <button>
1077 <label>Start</label>
1078 <input file icon="forward"></input>
1079 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1080 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dnsd \1\"/" /etc/rcS.conf</action>
1081 <action>/etc/init.d/dnsd start</action>
1082 </button>
1083 <button>
1084 <label>Stop</label>
1085 <input file icon="stop"></input>
1086 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1087 <action>/etc/init.d/dnsd stop</action>
1088 </button>
1089 </hbox>
1090 </frame>
1092 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1093 tmp='<frame Rsync>
1094 <hbox>
1095 <text use-markup="true">
1096 <label>"<b>RSYNCD_OPTIONS</b>"</label>
1097 </text>
1098 <entry editable="false">'
1099 [ -n "${RSYNCD_OPTIONS#* }" ] && tmp="$tmp<default>${RSYNCD_OPTIONS#* }</default>"
1100 tmp2='
1101 <variable>RSYNC_OPTS</variable>
1102 </entry>
1103 <button>
1104 <input file icon="help"></input>
1105 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x31 -title "rsync daemon help" -e "rsync --daemon --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
1106 </button>
1107 <button>
1108 <input file icon="accessories-text-editor"></input>
1109 <action type="lauch">leafpad /etc/daemons.conf</action>
1110 </button>
1111 </hbox>
1112 <hbox>
1113 <text use-markup="true">
1114 <label>"<b>Configuration :</b>"</label>
1115 </text>
1116 <entry editable="false">
1117 <default>/etc/rsyncd.conf</default>
1118 <variable>RSYNCD_CONF</variable>
1119 </entry>
1120 <button>
1121 <input file icon="accessories-text-editor"></input>
1122 <action type="lauch">leafpad $RSYNCD_CONF</action>
1123 </button>
1124 </hbox>
1125 <hbox>
1126 <text use-markup="true">
1127 <label>"<b>Secrets file :</b>"</label>
1128 </text>
1129 <entry editable="true">
1130 <default>/etc/rsyncd.secrets</default>
1131 <variable>RSYNCD_SECRETS</variable>
1132 </entry>
1133 <button>
1134 <input file icon="accessories-text-editor"></input>
1135 <action type="lauch">leafpad $RSYNCD_SECRETS</action>
1136 </button>
1137 </hbox>
1138 <hbox>
1139 <button>
1140 <label>Start</label>
1141 <input file icon="forward"></input>
1142 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1143 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"rsyncd \1\"/" /etc/rcS.conf</action>
1144 <action>/etc/init.d/rsyncd start</action>
1145 </button>
1146 <button>
1147 <label>Stop</label>
1148 <input file icon="stop"></input>
1149 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1150 <action>/etc/init.d/rsyncd stop</action>
1151 </button>
1152 </hbox>
1153 </frame>
1155 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1156 tmp='<frame Lighttpd>'
1157 tmp2='<frame PHP>
1158 <hbox>
1159 <text use-markup="true">
1160 <label>"<b>Configuration :</b>"</label>
1161 </text>
1162 <entry editable="false">
1163 <default>/etc/php.ini</default>
1164 <variable>PHP_CONF</variable>
1165 </entry>
1166 <button>
1167 <input file icon="accessories-text-editor"></input>
1168 <action type="lauch">leafpad $PHP_CONF</action>
1169 </button>
1170 </hbox>
1171 </frame>
1173 [ -f /etc/php.ini ] && tmp="${tmp}${tmp2}"
1174 tmp2='<hbox>
1175 <text use-markup="true">
1176 <label>"<b>Configuration :</b>"</label>
1177 </text>
1178 <entry editable="false">
1179 <default>/etc/lighttpd/lighttpd.conf</default>
1180 <variable>LIGHTTPD_CONF</variable>
1181 </entry>
1182 <button>
1183 <input file icon="accessories-text-editor"></input>
1184 <action type="lauch">leafpad $LIGHTTPD_CONF</action>
1185 </button>
1186 </hbox>
1187 <hbox>
1188 <button>
1189 <label>Start</label>
1190 <input file icon="forward"></input>
1191 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1192 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"lighttpd \1\"/" /etc/rcS.conf</action>
1193 <action>/etc/init.d/lighttpd start</action>
1194 </button>
1195 <button>
1196 <label>Stop</label>
1197 <input file icon="stop"></input>
1198 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1199 <action>/etc/init.d/lighttpd stop</action>
1200 </button>
1201 </hbox>
1202 </frame>
1204 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1205 tmp='<frame Samba: smbd & nmbd>
1206 <hbox>
1207 <text use-markup="true">
1208 <label>"<b>Configuration :</b>"</label>
1209 </text>
1210 <entry editable="false">
1211 <default>/etc/samba/smb.conf</default>
1212 <variable>SMBD_CONF</variable>
1213 </entry>
1214 <button>
1215 <input file icon="accessories-text-editor"></input>
1216 <action type="lauch">leafpad $SMBD_CONF</action>
1217 </button>
1218 </hbox>
1219 <hbox>
1220 <button>
1221 <label>Reload</label>
1222 <input file icon="reload"></input>
1223 <action>/etc/init.d/samba reload</action>
1224 </button>
1225 <button>
1226 <label>Start</label>
1227 <input file icon="forward"></input>
1228 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1229 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"samba \1\"/" /etc/rcS.conf</action>
1230 <action>/etc/init.d/samba start</action>
1231 </button>
1232 <button>
1233 <label>Stop</label>
1234 <input file icon="stop"></input>
1235 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1236 <action>/etc/init.d/samba stop</action>
1237 </button>
1238 </hbox>
1239 </frame>
1241 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}"
1242 tmp='<frame x11vnc>
1243 <hbox>
1244 <text use-markup="true">
1245 <label>"<b>X11VNC_OPTIONS</b>"</label>
1246 </text>
1247 <entry editable="false">'
1248 [ -n "$X11VNC_OPTIONS" ] && tmp="$tmp<default>$X11VNC_OPTIONS</default>"
1249 tmp2='
1250 <variable>X11VNC_OPTS</variable>
1251 </entry>
1252 <button>
1253 <input file icon="help"></input>
1254 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "x11vnc daemon help (q to quit)" -e "x11vnc --help | less"</action>
1255 </button>
1256 <button>
1257 <input file icon="accessories-text-editor"></input>
1258 <action type="lauch">leafpad /etc/daemons.conf</action>
1259 </button>
1260 </hbox>
1261 <hbox>
1262 <text use-markup="true">
1263 <label>"<b>New password</b>"</label>
1264 </text>
1265 <entry>
1266 <variable>X11VNC_PASSWD</variable>
1267 </entry>
1268 <button>
1269 <input file icon="reload"></input>
1270 <label>Update</label>
1271 <action>x11vnc -storepasswd $X11VNC_PASSWD /etc/vnc.secret</action>
1272 </button>
1273 </hbox>
1274 <hbox>
1275 <button>
1276 <label>Start</label>
1277 <input file icon="forward"></input>
1278 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1279 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"x11vnc \1\"/" /etc/rcS.conf</action>
1280 <action>/etc/init.d/x11vnc start</action>
1281 </button>
1282 <button>
1283 <label>Stop</label>
1284 <input file icon="stop"></input>
1285 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1286 <action>/etc/init.d/x11vnc stop</action>
1287 </button>
1288 </hbox>
1289 </frame>
1291 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1292 NET_BOX="${NET_BOX}
1293 </notebook>
1295 tmp='<frame Iptables>
1296 <hbox>
1297 <text use-markup="true">
1298 <label>"<b>Configuration :</b>"</label>
1299 </text>
1300 <entry editable="false">
1301 <default>/etc/iptables.conf</default>
1302 <variable>IPTABLES_CONF</variable>
1303 </entry>
1304 <button>
1305 <input file icon="accessories-text-editor"></input>
1306 <action type="lauch">leafpad $IPTABLES_CONF</action>
1307 </button>
1308 </hbox>
1309 <hbox>
1310 <button>
1311 <label>Load</label>
1312 <input file icon="reload"></input>
1313 <action>cat $IPTABLES_CONF | /sbin/iptables-restore</action>
1314 </button>
1315 <button>
1316 <label>Save</label>
1317 <input file icon="go-jump"></input>
1318 <action>/sbin/iptables-save > $IPTABLES_CONF</action>
1319 </button>
1320 </hbox>
1321 </frame>
1323 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX${tmp}"
1324 tmp='
1325 <frame Ether-wake>
1326 <hbox>
1327 <text use-markup="true">
1328 <label>"<b>Machines :</b>"</label>
1329 </text>
1330 <entry editable="false">
1331 <default>/etc/ethers</default>
1332 <variable>ETHERS</variable>
1333 </entry>
1334 <button>
1335 <input file icon="accessories-text-editor"></input>
1336 <action>[ -s $ETHERS ] || echo "#00:01:02:03:04:05 mystation" >$ETHERS</action>
1337 <action type="lauch">leafpad $ETHERS</action>
1338 </button>
1339 </hbox>
1340 <hbox>
1341 <text use-markup="true">
1342 <label>"<b>Options : </b>"</label>
1343 </text>
1344 <entry editable="false">
1345 <variable>ETHERWAKE_OPTS</variable>
1346 </entry>
1347 <button>
1348 <input file icon="help"></input>
1349 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x15 -title "dnsd help" -e "ether-wake --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
1350 </button>
1351 <button>
1352 <label>Start</label>
1353 <input file icon="forward"></input>
1354 <action>ether-wake $ETHERWAKE_OPTS</action>
1355 </button>
1356 </hbox>
1357 </frame>
1358 </notebook>
1360 <hbox>
1361 <button>
1362 <label>Status</label>
1363 <input file icon="dialog-information"></input>
1364 <action type="launch">IFCONFIG</action>
1365 </button>
1366 <button help>
1367 <label>Help</label>
1368 <action type="launch">HELP</action>
1369 </button>
1370 <button>
1371 <label>Quit</label>
1372 <input file icon="exit"></input>
1373 <action type="exit">Exit</action>
1374 </button>
1375 </hbox>
1377 </vbox>
1378 </window>
1380 NET_BOX="${NET_BOX}${tmp}"
1382 export NET_BOX
1384 # TODO: Modules(Network kernel modules) VPN(OpenVPN)
1386 # Only root can configure network.
1387 check_root
1388 # Configure and connect if button Connect was pressed.
1389 if ! grep -qs ^name /etc/ppp/options ; then
1390 # Generate /etc/ppp/options
1391 cat > /etc/ppp/options << _EOT_
1392 plugin rp-pppoe.so
1393 name provider-ID
1394 noipdefault
1395 defaultroute
1396 mtu 1492
1397 mru 1492
1398 lock
1399 _EOT_
1400 # Generate /etc/ppp/pap-secrets
1401 cat > /etc/ppp/pap-secrets << _EOT_
1402 # Secrets for authentication using PAP
1403 # client server secret IP addresses
1404 _EOT_
1405 # Generate /etc/ppp/chap-secrets
1406 cat > /etc/ppp/chap-secrets << _EOT_
1407 # Secrets for authentication using CHAP
1408 # client server secret IP addresses
1409 _EOT_
1410 fi
1411 gtkdialog --center --program=NET_BOX
1413 exit 0