slitaz-tools view tinyutils/netbox @ rev 312

tazctrlbox: improved date and time setting + users management
author Christophe Lincoln <pankso@slitaz.org>
date Tue Mar 03 23:17:19 2009 +0100 (2009-03-03)
parents 20f08a94af98
children af65458ca488
line source
1 #!/bin/sh
2 #
3 # Gtkdialog box to manage network connection and server.
4 # Please use tab to indent.
5 #
6 # (c) - SliTaz GNU/Linux 2009.
7 #
8 VERSION=20090222
10 # Check if user is root.
11 check_root()
12 {
13 if test $(id -u) != 0 ; then
14 echo -e "
15 You must be root to run `basename $0`. Please type 'su' and
16 root password to become super-user.\n"
17 exit 0
18 fi
19 }
21 # Functions called by the connection tab to list interfaces.
22 interface_status()
23 {
24 if ifconfig | grep -A 1 $i | grep -q inet; then
25 ip=`ifconfig | grep -A 1 $i | grep inet | awk '{ print $2 }' | cut -d ":" -f 2`
26 echo "connected ($ip)"
27 else
28 echo "-"
29 fi
30 }
31 # First column is for icon name.
32 detect_interfaces()
33 {
34 for i in `ls /sys/class/net`
35 do
36 case $i in
37 eth*)
38 echo "network-wired | $i | Ethernet | `interface_status`" ;;
39 wlan*|ath*|ra*)
40 echo "network-wireless | $i | Wireless | `interface_status`" ;;
41 lo)
42 echo "gtk-network | $i | Loopback | `interface_status`" ;;
43 *)
44 continue ;;
45 esac
47 done
48 }
50 # When users double click on a connection.
51 interfaces_List_actions()
52 {
53 echo "$INTERFACE_LIST"
54 }
56 # Netbox can be call with args.
57 case "$1" in
58 detect_interfaces|interfaces_List_actions)
59 $1
60 exit 0 ;;
61 *)
62 continue ;;
63 esac
65 # GUI functions
66 helpbutton()
67 {
68 local label;
69 label="<label>$3</label>"
70 [ -n "$3" ] || label=""
71 cat << EOT
72 <button>
73 <input file icon="help"></input>$label
74 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry $2 -title "$1 help" -e "$(which $1) --help ; echo -e \\"----\\nENTER to continue...\\" && read close"</action>
75 </button>
76 EOT
77 }
79 editbutton()
80 {
81 cat << EOT
82 <button>
83 <input file icon="accessories-text-editor"></input>
84 <action type="lauch">leafpad $1</action>
85 </button>
86 EOT
87 }
89 manbutton()
90 {
91 cat << EOT
92 <button>
93 <input file icon="browser"></input>
94 <label>man</label>
95 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "$2 man (q to quit)" -e ". /etc/profile; man $1 $2"</action>
96 </button>
97 EOT
98 }
100 helpdaemon()
101 {
102 cat << EOT
103 <hbox>
104 <text use-markup="true">
105 <label>"<b>$3</b>"</label>
106 </text>
107 <entry editable="false">
108 EOT
109 eval tmp=\$$3
110 [ -n "$tmp" ] && cat << EOT
111 <default>$tmp</default>
112 EOT
113 cat << EOT
114 <variable>$4</variable>
115 </entry>
116 EOT
117 [ -n "$6" ] || cat << EOT
118 $(helpbutton $1 $2)
119 EOT
120 [ -n "$5" ] && cat << EOT
121 $(manbutton $5 $1)
122 EOT
123 cat << EOT
124 $(editbutton /etc/daemons.conf)
125 </hbox>
126 EOT
127 }
129 datafile()
130 {
131 cat << EOT
132 <hbox>
133 <text use-markup="true">
134 <label>"<b>$3</b>"</label>
135 </text>
136 <entry editable="false">
137 EOT
138 [ -n "$1" ] && cat << EOT
139 <default>$1</default>
140 EOT
141 cat << EOT
142 <variable>$2</variable>
143 </entry>
144 EOT
145 [ -n "$4" ] && cat << EOT
146 $(manbutton $4)
147 EOT
148 cat << EOT
149 $(editbutton \$$2)
150 </hbox>
151 EOT
152 }
154 configfile()
155 {
156 datafile "$1" $2 'Configuration:' "$3"
157 }
159 webbutton()
160 {
161 [ -f "/var/lib/tazpkg/installed/$1/receipt" ] && cat << EOT
162 <button>
163 <input file icon="browser"></input>
164 <label>web</label>
165 <action>. /var/lib/tazpkg/installed/$1/receipt ; firefox \$WEB_SITE &</action>
166 </button>
167 EOT
168 }
170 startstopdaemon()
171 {
172 local pkg
173 pkg=$1
174 [ -n "$2" ] && pkg=$2
175 webbutton $pkg
176 cat << EOT
177 <button>
178 <label>Start</label>
179 <input file icon="forward"></input>
180 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
181 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"$1 \1\\"/" /etc/rcS.conf</action>
182 <action>/etc/init.d/$1 start</action>
183 </button>
184 <button>
185 <label>Stop</label>
186 <input file icon="stop"></input>
187 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
188 <action>/etc/init.d/$1 stop</action>
189 </button>
190 EOT
191 }
193 installbox()
194 {
195 cat << EOT
196 <hbox>
197 <text wrap="true" use-markup="true">
198 <label>"<i>The package <b>$1</b> is not yet installed</i>"</label>
199 </text>
200 <button>
201 <input file icon="go-jump"></input>
202 <label>Install</label>
203 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title "$1 install" -e "yes y | tazpkg get-install $1 ; echo -e \"----\n\nENTER to continue...\" && read close"</action>
204 <action type="exit">restart</action>
205 </button>
206 </hbox>
207 EOT
208 }
210 set_ipup()
211 {
212 [ -f /etc/ppp/ip-up ] && return
213 cat > /etc/ppp/ip-up <<EOT
214 #!/bin/sh
215 exec $0 call ipup \$@
216 EOT
217 chmod +x /etc/ppp/ip-up
218 }
220 while true; do
222 # Detect WIFI_INTERFACE and update /etc/network.conf
223 . /etc/network.conf
224 if [ ! -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
225 WIFI_INTERFACE=$(for i in /sys/class/net/*/wireless; do \
226 [ -d $i ] && echo $(basename $(dirname $i)) || echo wlan0; \
227 break; done)
228 [ -n "$WIFI_INTERFACE" ] && sed -i "s/^WIFI_INTERFACE=.*/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/" /etc/network.conf
229 fi
231 if [ "$1" = "call" ]; then
232 ppp="pppd local lock notty"
233 pppup=""
234 sub=$2
235 shift 2
236 case "$sub" in
237 sendsshkey)
238 check_root
239 (dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key ;
240 cat /etc/ssh/ssh_host_rsa_key.pub ) 2> /dev/null | \
241 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*"
242 exit 0;;
243 # OpenSSH VPN:
244 # PermitTunnel=point-to-point (or yes, ethernet, no)
245 # Tunnel="4" => tun4
246 # Local Client:
247 # # ssh -f -w 0:1 $REMOTE true => local tun0 [, remote tun1]
248 # # ifconfig $TUN $IP1 $IP2 netmask 255.255.255.252
249 # # route add $REMOTE_NETWORK $IP2
250 # Remote Server:
251 # # ifconfig $TUN $IP2 $IP1 netmask 255.255.255.252
252 # # route add $LOCAL_NETWORK $IP1
253 vpnssh) check_root
254 set_ipup
255 ps ww | grep -q "$ppp $2:$3" && exit 1
256 pipe="/tmp/ssh$$"
257 mkfifo $pipe
258 [ -n "$4" ] && pppup="ipparam 'addroutes,$(echo $4 | sed 's/ /,/g')'"
259 cat $pipe | dbclient -i /etc/dropbear/dropbear_rsa_host_key \
260 $1 "$ppp" | $ppp $2:$3 $pppup > $pipe
261 rm -f $pipe
262 exit 0;;
263 killvpnssh)
264 check_root
265 kill $(ps x | grep dbclient | grep "$ppp" | awk '{ print $1 }')
266 exit 0;;
267 ipup)
268 # Arg Name Example
269 # $1 Interface name ppp0
270 # $2 The tty ttyS1
271 # $3 The link speed 38400
272 # $4 Local IP number 12.34.56.78
273 # $5 Peer IP number 12.34.56.99
274 # $6 Optional ``ipparam'' value foo
275 iface=$1
276 # skip tty if present
277 case "$2" in [0-9]*);; *) shift; esac
278 peer=$4
279 IFS=","; set -- $(eval echo $5); unset IFS
280 set -- $1
281 if [ "$1" = "addroutes" ]; then
282 while [ -n "$2" ]; do
283 eval $(ipcalc -n $2)
284 eval $(ipcalc -m $2)
285 route add -net $NETWORK netmask $NETMASK \
286 gw $peer $iface
287 shift
288 done
289 fi
290 exit 0;;
291 esac
292 echo "call $sub unsupported."
293 exit 1
294 fi
296 # English/French help dialog.
297 export HELP='
298 <window title="Network status" icon-name="network-wire">
299 <vbox>
300 <text use-markup="true">
301 <label>
302 "
303 <b>SliTaz - Netbox</b>"
304 </label>
305 </text>
306 <frame English>
307 <text wrap="true" width-chars="58">
308 <label>
309 "Netbox lets you manage network connections by getting a dynamic IP by
310 DHCP or a static IP and setup servers. Netbox can start or stop
311 networking, configure network interfaces or directly edit files."
312 </label>
313 </text>
314 </frame>
315 <frame Francais>
316 <text wrap="true" width-chars="58">
317 <label>
318 "Netbox vous permet de gerer les connexions reseau avec une IP
319 statique ou en obtenant une IP dynamique par DHCP, et de parametrer
320 les serveurs. Netbox peut demarrer ou arreter le reseau, configurer
321 les interfaces reseau ou editer directement les fichiers."
322 </label>
323 </text>
324 </frame>
325 </vbox>
326 </window>
327 '
329 # Interafce status with ifconfig without arguments to show all
330 # active connections.
331 #
332 export IFCONFIG='
333 <window title="Network status" icon-name="network-wire">
334 <vbox>
335 <notebook labels="Network interfaces'
336 [ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG|Wireless interfaces|Wireless networks"
337 tmp='|Routing|Servers">
338 <frame Ifconfig>
339 <text wrap="false" width-chars="58">
340 <input>ifconfig</input>
341 </text>
342 </frame>'
343 IFCONFIG="$IFCONFIG$tmp"
344 tmp='
345 <frame Iwconfig>
346 <text wrap="false" width-chars="58">
347 <input>iwconfig</input>
348 </text>
349 </frame>
350 <frame Wireless networks>
351 <text wrap="false" width-chars="58">
352 <input>iwlist scan</input>
353 </text>
354 </frame>'
355 [ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG$tmp"
356 tmp='
357 <frame Routing>
358 <frame Nameservers>
359 <text wrap="false" width-chars="58">
360 <input>cat /etc/resolv.conf</input>
361 </text>
362 </frame>
363 <frame Routing table>
364 <text wrap="false" width-chars="58">
365 <input>route</input>
366 </text>
367 </frame>
368 <frame Arp table>
369 <text wrap="false" width-chars="58">
370 <input>arp</input>
371 </text>
372 </frame>
373 </frame>
374 <frame Servers>
375 <text wrap="false" width-chars="58">
376 <input>for i in dropbear sshd inetd dhcpd dnsd named rsync httpd smbd nmbd x11vnc pppd knock; do ps ww | grep $i | grep -v grep | fold -s; done</input>
377 </text>
378 </frame>
379 </notebook>
380 <hbox>
381 <button>
382 <input file icon="gtk-close"></input>
383 <action type="closewindow">IFCONFIG</action>
384 </button>
385 </hbox>
386 </vbox>
387 </window>'
388 IFCONFIG="$IFCONFIG$tmp"
390 # The main dialog with notebook, start/stop buttons and all options.
391 # Note that /etc/network.conf is seded when an interface is activated.
392 #
393 NET_BOX='
394 <window title="SliTaz Netbox Manager" icon-name="network-wired">
395 <vbox>
397 <hbox>
398 <text use-markup="true">
399 <label>"<b>Network/Server Manager</b>"</label>
400 </text>
401 <pixmap>
402 <input file>/usr/share/pixmaps/netbox.png</input>
403 </pixmap>
404 </hbox>'
406 # Notebook tabs.
407 tmp='<notebook labels="Connections|DHCP|Static IP|PPPoE|PPP|System wide|VPN|Servers'
408 NET_BOX="$NET_BOX$tmp"
409 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX|Firewall"
410 [ -x /usr/bin/knock ] && NET_BOX="$NET_BOX|Knock"
411 tmp='|Etherwake">'
413 # Interfaces list from detect_interfaces()
414 tmp=${tmp}"
415 <vbox>
416 <tree>
417 <width>520</width><height>120</height>
418 <variable>INTERFACE_LIST</variable>
419 <label>Interface|Type|Status</label>
420 <input icon_column=\"0\">$0 detect_interfaces</input>
421 <action>refresh:INTERFACE_LIST</action>
422 </tree>
423 </vbox>"
425 # DHCP
426 tmp=${tmp}'
427 <frame Udhcpc (busybox)>
428 <text width-chars="58">
429 <label>
430 "Ethernet (cable) default connection.
431 "
432 </label>
433 </text>
434 <hbox>
435 <text use-markup="true">
436 <label>"<b>Interface:</b>"</label>
437 </text>
438 <entry>
439 <input>. /etc/network.conf; echo "$INTERFACE"</input>
440 <variable>INTERFACE</variable>
441 </entry>
442 </hbox>
443 <hbox>
444 <text use-markup="true">
445 <label>"<b>Options: </b>"</label>
446 </text>
447 <entry>
448 <default>-b</default>
449 <variable>UDHCPC_OPTS</variable>
450 </entry>
451 <button>
452 <input file icon="help"></input>
453 <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>
454 </button>
455 </hbox>
456 <hbox>
457 <text use-markup="true">
458 <label>"<b>Script: </b>"</label>
459 </text>
460 <entry editable="false">
461 <default>/usr/share/udhcpc/default.script</default>
462 <variable>UDHCPC_SCRIPT</variable>
463 </entry>
464 <button>
465 <input file icon="accessories-text-editor"></input>
466 <action type="lauch">leafpad $UDHCPC_SCRIPT</action>
467 </button>
468 </hbox>
469 <hbox>
470 <button>
471 <label>Start</label>
472 <input file icon="forward"></input>
473 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
474 <action>sed -i s/DHCP=\"no\"/DHCP=\"yes\"/ /etc/network.conf</action>
475 <action>sed -i s/STATIC=\"yes\"/STATIC=\"no\"/ /etc/network.conf</action>
476 <action>udhcpc $UDHCPC_OPTS -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid</action>
477 <action>refresh:INTERFACE_LIST</action>
478 </button>
479 <button>
480 <label>Stop</label>
481 <input file icon="stop"></input>
482 <action>echo -n "Stopping interface : $INTERFACE... "</action>
483 <action>ifconfig $INTERFACE down</action>
484 <action>killall -q udhcpc; echo "done"</action>
485 <action>refresh:INTERFACE_LIST</action>
486 </button>
487 </hbox>
488 </frame>'
490 # Static/fixed IP settings.
491 tmp=${tmp}'
492 <frame Ethernet fixed IP>
493 <hbox>
494 <text use-markup="true">
495 <label>"<b>Interface: </b>"</label>
496 </text>
497 <entry>
498 <input>. /etc/network.conf; echo "$INTERFACE"</input>
499 <variable>INTERFACE</variable>
500 </entry>
501 </hbox>
502 <hbox>
503 <text use-markup="true">
504 <label>"<b>IP: </b>"</label>
505 </text>
506 <entry>
507 <input>. /etc/network.conf; echo "$IP"</input>
508 <variable>IP</variable>
509 </entry>
510 </hbox>
511 <hbox>
512 <text use-markup="true">
513 <label>"<b>Netmask: </b>"</label>
514 </text>
515 <entry>
516 <input>. /etc/network.conf; echo "$NETMASK"</input>
517 <variable>NETMASK</variable>
518 </entry>
519 </hbox>
520 <hbox>
521 <text use-markup="true">
522 <label>"<b>Gateway: </b>"</label>
523 </text>
524 <entry>
525 <input>. /etc/network.conf; echo "$GATEWAY"</input>
526 <variable>GATEWAY</variable>
527 </entry>
528 </hbox>
529 <hbox>
530 <text use-markup="true">
531 <label>"<b>DNS server: </b>"</label>
532 </text>
533 <entry>
534 <input>. /etc/network.conf; echo "$DNS_SERVER"</input>
535 <variable>DNS_SERVER</variable>
536 </entry>
537 </hbox>'
539 # Static/fixed IP actions (should go in a function).
540 tmp=${tmp}'
541 <hbox>
542 <button>
543 <label>Start</label>
544 <input file icon="forward"></input>
545 <action>ifconfig lo down</action>
546 <action>ifconfig $INTERFACE down</action>
547 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
548 <action>sed -i s/DHCP=\"yes\"/DHCP=\"no\"/ /etc/network.conf</action>
549 <action>sed -i s/WIFI=\"yes\"/WIFI=\"no\"/ /etc/network.conf</action>
550 <action>sed -i s/STATIC=\"no\"/STATIC=\"yes\"/ /etc/network.conf</action>
551 <action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP=\"$IP\"/ /etc/network.conf</action>
552 <action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK=\"$NETMASK\"/ /etc/network.conf</action>
553 <action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY=\"$GATEWAY\"/ /etc/network.conf</action>
554 <action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER=\"$DNS_SERVER\"/ /etc/network.conf</action>
555 <action>/etc/init.d/network.sh</action>
556 <action>refresh:INTERFACE_LIST</action>
557 </button>
558 <button>
559 <label>Stop</label>
560 <input file icon="stop"></input>
561 <action>ifconfig $INTERFACE down</action>
562 <action>refresh:INTERFACE_LIST</action>
563 </button>
564 </hbox>
565 </frame>'
567 # PPPoe settings.
568 tmp=${tmp}'
569 <frame PPPoE>
570 <hbox>
571 <text use-markup="true">
572 <label>"<b>Name: </b>"</label>
573 </text>
574 <entry>
575 <input>NAME=$(grep -s ^name /etc/ppp/options); echo "${NAME#* }"</input>
576 <variable>NAME</variable>
577 </entry>
578 </hbox>
579 <hbox>
580 <text use-markup="true">
581 <label>"<b>Username:</b>"</label>
582 </text>
583 <entry>
584 <variable>USER</variable>
585 </entry>
586 </hbox>
587 <hbox>
588 <text use-markup="true">
589 <label>"<b>Password:</b>"</label>
590 </text>
591 <entry>
592 <variable>PASS</variable>
593 </entry>
594 </hbox>
595 <hbox>
596 <button>
597 <input file icon="help"></input>
598 <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>
599 </button>
600 <button>
601 <input file icon="browser"></input>
602 <label>man</label>
603 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "pppd man (q to quit)" -e ". /etc/profile; man 8 pppd"</action>
604 </button>
605 <button>
606 <input file icon="accessories-text-editor"></input>
607 <label>Tune</label>
608 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
609 <action type="lauch">leafpad /etc/ppp/options</action>
610 </button>
611 <button>
612 <label>Start</label>
613 <input file icon="forward"></input>
614 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
615 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
616 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
617 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
618 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
619 <action>killall udhcpc</action>
620 <action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
621 <action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
622 <action>pppd $INTERFACE &</action>
623 </button>
624 <button>
625 <label>Stop</label>
626 <input file icon="stop"></input>
627 <action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
628 <action>killall pppd</action>
629 </button>
630 </hbox>
631 </frame>'
633 # PPP settings.
634 tmp=${tmp}'
635 <frame PPP>
636 <hbox>
637 <text use-markup="true">
638 <label>"<b>Username: </b>"</label>
639 </text>
640 <entry>
641 <input>USER=$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "${USER#*=}"</input>
642 <variable>USER</variable>
643 </entry>
644 </hbox>
645 <hbox>
646 <text use-markup="true">
647 <label>"<b>Password: </b>"</label>
648 </text>
649 <entry>
650 <input>PASS=$(grep -s ^PASSWORD= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PASS#*=}"</input>
651 <variable>PASS</variable>
652 </entry>
653 </hbox>
654 <hbox>
655 <text use-markup="true">
656 <label>"<b>Telephone:</b>"</label>
657 </text>
658 <entry>
659 <input>PHONE=$(grep -s ^TELEPHONE= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PHONE#*=}"</input>
660 <variable>PHONE</variable>
661 </entry>
662 </hbox>
663 <hbox>
664 <button>
665 <input file icon="help"></input>
666 <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>
667 </button>
668 <button>
669 <input file icon="browser"></input>
670 <label>man</label>
671 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "pppd man (q to quit)" -e ". /etc/profile; man 8 pppd"</action>
672 </button>
673 <button>
674 <input file icon="accessories-text-editor"></input>
675 <label>Tune</label>
676 <action>[ -n "$NAME" ] && sed -i "s/^ACCOUNT=.*/ACCOUNT=$NAME/" /etc/ppp/scripts/ppp-on</action>
677 <action>[ -n "$PASS" ] && sed -i "s/^PASSWORD=.*/PASSWORD=$PASS/" /etc/ppp/scripts/ppp-on</action>
678 <action>[ -n "$PHONE" ] && sed -i "s/^TELEPHONE=.*/TELEPHONE=$PHONE/" /etc/ppp/scripts/ppp-on</action>
679 <action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
680 </button>
681 <button>
682 <label>Start</label>
683 <input file icon="forward"></input>
684 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
685 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
686 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
687 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
688 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
689 <action>/etc/ppp/scripts/ppp-off</action>
690 <action>/etc/ppp/scripts/ppp-on &</action>
691 </button>
692 <button>
693 <label>Stop</label>
694 <input file icon="stop"></input>
695 <action>/etc/ppp/scripts/ppp-off</action>
696 </button>
697 </hbox>
698 </frame>'
700 #
701 # TODO: Indent with tabs from there
702 #
704 # System Wide configuration.
705 NET_BOX="$NET_BOX$tmp"
706 tmp='<frame Configuration files>
707 <hbox>
708 <text use-markup="true">
709 <label>"<b>Hosts :</b>"</label>
710 </text>
711 <entry editable="false">
712 <default>/etc/hosts</default>
713 <variable>HOSTS</variable>
714 </entry>
715 <button>
716 <input file icon="accessories-text-editor"></input>
717 <action type="lauch">leafpad $HOSTS</action>
718 </button>
719 </hbox>
720 <hbox>
721 <text use-markup="true">
722 <label>"<b>Host name :</b>"</label>
723 </text>
724 <entry editable="false">
725 <default>/etc/hostname</default>
726 <variable>HOSTNAME</variable>
727 </entry>
728 <button>
729 <input file icon="accessories-text-editor"></input>
730 <action type="lauch">leafpad $HOSTNAME</action>
731 </button>
732 </hbox>
733 <hbox>
734 <text use-markup="true">
735 <label>"<b>Network :</b>"</label>
736 </text>
737 <entry editable="false">
738 <default>/etc/network.conf</default>
739 <variable>CONFIG_FILE</variable>
740 </entry>
741 <button>
742 <input file icon="accessories-text-editor"></input>
743 <action type="lauch">leafpad $CONFIG_FILE</action>
744 </button>
745 </hbox>
746 <hbox>
747 <button>
748 <label>Restart</label>
749 <input file icon="reload"></input>
750 <action>echo -n "Stopping interface : $INTERFACE... "</action>
751 <action>ifconfig $INTERFACE down</action>
752 <action>killall -q udhcpc; echo "done"</action>
753 <action>/etc/init.d/network.sh restart</action>
754 </button>
755 </hbox>
756 </frame>
758 <frame Virtual Private Network with PPP/SSH>
759 <hbox>
760 <text use-markup="true">
761 <label>"<b>Peer :</b>"</label>
762 </text>
763 <entry>
764 <variable>DROPBEAR_PEERVPN</variable>
765 <default>user@elsewhere</default>
766 </entry>
767 </hbox>
768 <hbox>
769 <text use-markup="true">
770 <label>"<b>Local IP :</b>"</label>
771 </text>
772 <entry>
773 <variable>DROPBEAR_LOCAL</variable>
774 <default>192.168.254.1</default>
775 </entry>
776 </hbox>
777 <hbox>
778 <text use-markup="true">
779 <label>"<b>Remote IP :</b>"</label>
780 </text>
781 <entry>
782 <variable>DROPBEAR_REMOTE</variable>
783 <default>192.168.254.2</default>
784 </entry>
785 </hbox>
786 <hbox>
787 <text use-markup="true">
788 <label>"<b>Route(s) :</b>"</label>
789 </text>
790 <entry>
791 <variable>DROPBEAR_ROUTE</variable>
792 <default>192.168.10.0/24 192.168.20.0/28</default>
793 </entry>
794 </hbox>
795 <hbox>
796 <button>
797 <input file icon="browser"></input>
798 <label>Wiki</label>
799 <action>firefox http://wiki.slitaz.org/doku.php?id=quickstart:vpn &</action>
800 </button>
801 <button>
802 <input file icon="forward"></input>
803 <label>Connect</label>
804 <action>netbox call vpnssh $DROPBEAR_PEERVPN $DROPBEAR_LOCAL $DROPBEAR_REMOTE "$DROPBEAR_ROUTE" &</action>
805 </button>
806 <button>
807 <input file icon="stop"></input>
808 <label>Disconnect</label>
809 <action>netbox call killvpnssh</action>
810 </button>
811 <button>
812 <input file icon="go-up"></input>
813 <label>Send key</label>
814 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x10 -title "Send key" -e "netbox call sendsshkey $DROPBEAR_PEERVPN; echo -e \"----\nENTER to continue...\" && read close"</action>
815 </button>
816 </hbox>
817 </frame>
818 <notebook labels="'
819 NET_BOX="$NET_BOX$tmp"
820 tmp=''
821 [ -x /usr/sbin/dropbear -o \
822 -x /usr/sbin/sshd ] && NET_BOX="${NET_BOX}${tmp}SSH" && tmp='|'
823 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}Inetd" && tmp='|'
824 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}${tmp}ZeroConf" && tmp='|'
825 [ -x /usr/sbin/udhcpd -o \
826 -x /usr/sbin/dhcpd ] && NET_BOX="${NET_BOX}${tmp}DHCP" && tmp='|'
827 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
828 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] \
829 && NET_BOX="${NET_BOX}${tmp}PXE" && tmp='|'
830 [ -x /usr/sbin/dnsd -o \
831 -x /usr/sbin/named ] && NET_BOX="${NET_BOX}${tmp}DNS" && tmp='|'
832 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}Rsync" && tmp='|'
833 [ -x /usr/sbin/lighttpd -o \
834 -x /usr/bin/httpd ] && NET_BOX="${NET_BOX}${tmp}HTTP" && tmp='|'
835 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|'
836 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}VNC" && tmp='|'
837 [ -x /usr/sbin/knockd ] && NET_BOX="${NET_BOX}${tmp}Knock" && tmp='|'
838 . /etc/daemons.conf
839 set -- $DROPBEAR_OPTIONS
840 while [ -n "$2" ]; do
841 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
842 shift
843 done
844 NET_BOX="${NET_BOX}\">"
845 [ -x /usr/sbin/sshd -a -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}
846 <notebook labels=\"Dropbear|OpenSSH\">
847 "
849 sshremote()
850 {
851 cat << EOT
852 <hbox>
853 <text use-markup="true">
854 <label>"<b>Remote :</b>"</label>
855 </text>
856 <entry>
857 <variable>$2</variable>
858 <default>user@elsewhere</default>
859 </entry>
860 <button>
861 <input file icon="utilities-terminal"></input>
862 <label>Connect</label>
863 <action>xterm -fa MiscFixed -fs 11 -bg black -fg white -geometry 80x25 -title "$1" -e "$1 \$$2 ; echo -e \"----\nENTER to continue...\" && read close" &</action>
864 </button>
865 <button>
866 <input file icon="go-up"></input>
867 <label>Send key</label>
868 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x10 -title "send ssh key" -e "netbox call sendsshkey \$$2; echo -e \"----\nENTER to continue...\" && read close"</action>
869 </button>
870 </hbox>
871 EOT
872 }
874 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}
875 <frame Dropbear>
876 $(helpdaemon dropbear 80x30 DROPBEAR_OPTIONS DROPBEAR_OPTS)
877 $(datafile /etc/dropbear/banner DROPBEAR_BANNER 'Banner :')
878 $(sshremote DROPBEAR_PEER 'dbclient -i /etc/dropbear/dropbear_rsa_host_key')
879 <hbox>
880 $(startstopdaemon dropbear)
881 </hbox>
882 </frame>
883 "
884 [ -x /usr/sbin/sshd ] && NET_BOX="${NET_BOX}
885 <frame OpenSSH>
886 $(helpdaemon sshd 80x30 OPENSSH_OPTIONS OPENSSH_OPTS 8 nohelp)
887 $(configfile /etc/ssh/sshd_config OPENSSH_CONF '5 sshd_config')
888 $(sshremote OPENSSH_PEER 'ssh -i /etc/ssh/ssh_host_rsa_key')
889 <hbox>
890 $(startstopdaemon openssh)
891 </hbox>
892 </frame>
893 "
894 [ -x /usr/sbin/sshd -a -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}
895 </notebook>
896 "
897 tmp="<frame Inetd (busybox)>
898 $(helpdaemon inetd 60x14 INETD_OPTIONS INETD_OPTS)
899 $(configfile /etc/inetd.conf INETD_CONF)
900 <hbox>
901 "
902 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
903 i=$(basename $i)
904 tmp="$tmp$(helpbutton $i 60x19 $i)"
905 done
906 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}
907 $(startstopdaemon inetd)
908 </hbox>
909 </frame>
910 "
911 if [ -x /sbin/zcip -a -z "$ZCIP_OPTIONS" ]; then
912 ZCIP_OPTIONS="eth0 /etc/zcip.script"
913 cat >> /etc/daemons.conf <<EOT
914 # ZeroConf options
915 ZCIP_OPTIONS="$ZCIP_OPTIONS"
917 EOT
918 fi
919 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}
920 <frame Zcip (busybox)>
921 $(helpdaemon zcip 60x14 ZCIP_OPTIONS ZCIP_OPTS)
922 $(datafile /etc/zcip.script CZIP_SCRIPT 'Script :')
923 <hbox>
924 $(startstopdaemon zcip)
925 </hbox>
926 </frame>
927 "
928 [ -x /usr/sbin/dhcpd -a -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}
929 <notebook labels=\"Dhcpd|Udhcpd\">
930 "
931 [ -x /usr/sbin/dhcpd ] && NET_BOX="${NET_BOX}
932 <frame Dhcpd (ISC)>
933 $(helpdaemon dhcpd 60x14 DHCPD_OPTIONS DHCPD_OPTS)
934 $(configfile /etc/dhcpd.conf DHCPD_CONF)
935 <hbox>
936 $(startstopdaemon dhcpd dhcp)
937 </hbox>
938 </frame>
939 "
940 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}
941 <frame Udhcpd (busybox)>
942 $(helpdaemon udhcpd 60x14 UDHCPD_OPTIONS UDHCPD_OPTS)
943 $(configfile /etc/udhcpd.conf UDHCPD_CONF)
944 <hbox>
945 $(startstopdaemon udhcpd)
946 </hbox>
947 </frame>
948 "
949 [ -x /usr/sbin/dhcpd -a -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}
950 </notebook>
951 "
952 tmp='<frame Pxelinux>
953 <hbox>
954 <text wrap="true">
955 <label>
956 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
957 </label>
958 </text>
959 </hbox>
960 <hbox>
961 <text use-markup="true">
962 <label>"<b>Configuration :</b>"</label>
963 </text>
964 <entry editable="false">
965 <default>'
966 tmp="$tmp$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')"
967 tmp2='/pxelinux.cfg/default</default>
968 <variable>PXE_CONF</variable>
969 </entry>
970 <button>
971 <input file icon="accessories-text-editor"></input>
972 <action>dir=$(dirname $PXE_CONF); [ -d $dir ] || mkdir -p $dir</action>
973 <action>lzma d /usr/share/boot/pxelinux.0.lzma $(dirname $PXE_CONF)/../pxelinux.0</action>
974 <action>grep -q "^boot_file" $UDHCPD_CONF || echo "boot_file pxelinux.0" >> $UDHCPD_CONF</action>
975 <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> $UDHCPD_CONF</action>
976 <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>
977 <action type="lauch">leafpad $PXE_CONF</action>
978 </button>
979 </hbox>
980 <hbox>
981 <button>
982 <input file icon="browser"></input>
983 <label>Wiki</label>
984 <action>firefox http://wiki.slitaz.org/doku.php?id=quickstart:pxe &</action>
985 </button>
986 <button>
987 <input file icon="system-file-manager"></input>
988 <label>Network boot files</label>
989 <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>
990 </button>
991 </hbox>
992 </frame>
993 '
994 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
995 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] && NET_BOX="$NET_BOX$tmp$tmp2"
996 [ -x /usr/sbin/dnsd -a -x /usr/sbin/named ] && NET_BOX="${NET_BOX}
997 <notebook labels=\"Named|Dnsd\">
998 "
999 [ -x /usr/sbin/named ] && NET_BOX="${NET_BOX}
1000 <frame Named (ISC bind)>
1001 $(helpdaemon named 80x10 NAMED_OPTIONS NAMED_OPTS)
1002 $(configfile /etc/bind/named.conf.local NAMED_CONF)
1003 <hbox>
1004 $(startstopdaemon named bind)
1005 </hbox>
1006 </frame>
1008 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}
1009 <frame Dnsd (busybox)>
1010 $(helpdaemon dnsd 80x15 DNSD_OPTIONS DNSD_OPTS)
1011 $(configfile /etc/dnsd.conf DNSD_CONF)
1012 <hbox>
1013 $(startstopdaemon dnsd)
1014 </hbox>
1015 </frame>
1017 [ -x /usr/sbin/dnsd -a -x /usr/sbin/named ] && NET_BOX="${NET_BOX}
1018 </notebook>
1020 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}
1021 <frame Rsync>
1022 $(helpdaemon rsync 80x30 RSYNCD_OPTIONS RSYNCD_OPTS 1)
1023 $(configfile /etc/rsyncd.conf RSYNCD_CONF)
1024 $(datafile /etc/rsyncd.secrets RSYNCD_SECRETS 'Secrets file :')
1025 <hbox>
1026 $(startstopdaemon rsyncd rsync)
1027 </hbox>
1028 </frame>
1030 [ -x /usr/sbin/lighttpd -a -x /usr/bin/httpd ] && NET_BOX="${NET_BOX}
1031 <notebook labels=\"Apache|Lighttpd\">
1033 tmp="<frame PHP>
1034 $(configfile /etc/php.ini PHP_CONF)
1035 </frame>
1037 [ -f /etc/php.ini ] || tmp=""
1038 [ -x /usr/bin/httpd ] && NET_BOX="${NET_BOX}<frame Apache>${tmp}
1039 $(configfile /etc/apache/httpd.conf HTTPD_CONF)
1040 <hbox>
1041 $(startstopdaemon apache)
1042 </hbox>
1043 </frame>
1045 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}<frame Lighttpd>${tmp}
1046 $(configfile /etc/lighttpd/lighttpd.conf LIGHTTPD_CONF)
1047 <hbox>
1048 $(startstopdaemon lighttpd)
1049 </hbox>
1050 </frame>
1052 [ -x /usr/sbin/lighttpd -a -x /usr/bin/httpd ] && NET_BOX="${NET_BOX}
1053 </notebook>
1055 tmp="<frame Samba: smbd & nmbd>
1056 $(configfile /etc/samba/smb.conf SMBD_CONF)
1057 <hbox>
1058 <button>
1059 <label>Reload</label>
1060 <input file icon=\"reload\"></input>
1061 <action>/etc/init.d/samba reload</action>
1062 </button>"
1063 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}
1064 $(startstopdaemon samba)
1065 </hbox>
1066 </frame>
1068 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}
1069 <frame x11vnc>
1070 $(helpdaemon x11vnc 80x30 X11VNC_OPTIONS X11VNC_OPTS)
1071 <hbox>
1072 <text use-markup=\"true\">
1073 <label>\"<b>New password</b>\"</label>
1074 </text>
1075 <entry>
1076 <variable>X11VNC_PASSWD</variable>
1077 </entry>
1078 <button>
1079 <input file icon=\"reload\"></input>
1080 <label>Update</label>
1081 <action>x11vnc -storepasswd \$X11VNC_PASSWD /etc/vnc.secret</action>
1082 </button>
1083 </hbox>
1084 <hbox>
1085 $(startstopdaemon x11vnc)
1086 </hbox>
1087 </frame>
1089 [ -x /usr/sbin/knockd ] && NET_BOX="${NET_BOX}
1090 <frame Knockd: trigger backdoors>
1091 $(helpdaemon knockd 80x15 KNOCK_OPTIONS KNOCK_OPTS)
1092 $(configfile /etc/knockd.conf KNOCKD_CONF)
1093 <hbox>
1094 $(startstopdaemon knockd knock)
1095 </hbox>
1096 </frame>
1098 NET_BOX="${NET_BOX}
1099 </notebook>
1101 tmp="<frame Iptables>
1102 $(configfile /etc/iptables.conf IPTABLES_CONF)
1103 <hbox>
1104 <button>
1105 <input file icon=\"browser\"></input>
1106 <label>man</label>
1107 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title \"iptables man (q to quit)\" -e \". /etc/profile; man 8 iptables\"</action>
1108 </button>
1109 <button>
1110 <label>Load</label>
1111 <input file icon=\"reload\"></input>
1112 <action>cat \$IPTABLES_CONF | /sbin/iptables-restore</action>
1113 </button>
1114 <button>
1115 <label>Save</label>
1116 <input file icon=\"go-jump\"></input>
1117 <action>/sbin/iptables-save > \$IPTABLES_CONF</action>
1118 </button>
1119 </hbox>
1120 </frame>
1122 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX${tmp}"
1123 tmp='<frame Knock>
1124 <hbox>
1125 <text use-markup="true">
1126 <label>"<b>Options : </b>"</label>
1127 </text>
1128 <entry editable="true">
1129 <variable>KNOCK_OPTS</variable>
1130 <default>myserver.example.com 123:tcp 456:udp 789:tcp</default>
1131 </entry>
1132 </hbox>
1133 <hbox>'
1134 [ -x /usr/bin/knock ] && NET_BOX="$NET_BOX${tmp}
1135 $(helpbutton knock 80x12)
1136 <button>
1137 <label>Start</label>
1138 <input file icon=\"forward\"></input>
1139 <action>knock \$KNOCK_OPTS</action>
1140 </button>
1141 </hbox>
1142 </frame>
1144 tmp='
1145 <frame Ether-wake (busybox)>
1146 <hbox>
1147 <text use-markup="true">
1148 <label>"<b>Machines :</b>"</label>
1149 </text>
1150 <entry editable="false">
1151 <default>/etc/ethers</default>
1152 <variable>ETHERS</variable>
1153 </entry>
1154 <button>
1155 <input file icon="accessories-text-editor"></input>
1156 <action>[ -s $ETHERS ] || echo "#00:01:02:03:04:05 mystation" >$ETHERS</action>
1157 <action type="lauch">leafpad $ETHERS</action>
1158 </button>
1159 </hbox>
1160 <hbox>
1161 <text use-markup="true">
1162 <label>"<b>Options : </b>"</label>
1163 </text>
1164 <entry editable="true">
1165 <variable>ETHERWAKE_OPTS</variable>
1166 </entry>'
1167 NET_BOX="${NET_BOX}${tmp}$(helpbutton ether-wake 80x15)"
1168 tmp='
1169 <button>
1170 <label>Start</label>
1171 <input file icon="forward"></input>
1172 <action>ether-wake $ETHERWAKE_OPTS</action>
1173 </button>
1174 </hbox>
1175 </frame>
1176 </notebook>
1178 <hbox>
1179 <button>
1180 <label>Wireless manager</label>
1181 <input file icon="network-wireless"></input>
1182 <action>wifibox &</action>
1183 </button>
1184 <button>
1185 <label>Refresh list</label>
1186 <input file icon="reload"></input>
1187 <action>refresh:INTERFACE_LIST</action>
1188 </button>
1189 <button>
1190 <label>Full status</label>
1191 <input file icon="dialog-information"></input>
1192 <action type="launch">IFCONFIG</action>
1193 </button>
1194 <button help>
1195 <label>Help</label>
1196 <action type="launch">HELP</action>
1197 </button>
1198 <button>
1199 <label>Quit</label>
1200 <input file icon="exit"></input>
1201 <action type="exit">Exit</action>
1202 </button>
1203 </hbox>
1205 </vbox>
1206 </window>
1208 NET_BOX="${NET_BOX}${tmp}"
1210 export NET_BOX
1212 # TODO: Modules(Network kernel modules) VPN(OpenVPN)
1214 # Only root can configure network.
1215 check_root
1217 # Configure and connect if button Connect was pressed.
1218 if ! grep -qs ^name /etc/ppp/options ; then
1219 # Generate /etc/ppp/options
1220 cat > /etc/ppp/options << _EOT_
1221 plugin rp-pppoe.so
1222 name provider-ID
1223 noipdefault
1224 defaultroute
1225 mtu 1492
1226 mru 1492
1227 lock
1228 _EOT_
1229 # Generate /etc/ppp/pap-secrets
1230 cat > /etc/ppp/pap-secrets << _EOT_
1231 # Secrets for authentication using PAP
1232 # client server secret IP addresses
1233 _EOT_
1234 # Generate /etc/ppp/chap-secrets
1235 cat > /etc/ppp/chap-secrets << _EOT_
1236 # Secrets for authentication using CHAP
1237 # client server secret IP addresses
1238 _EOT_
1239 fi
1240 gtkdialog --center --program=NET_BOX | grep -a 'EXIT="restart"' && continue
1241 exit 0
1242 done