slitaz-tools view tinyutils/netbox @ rev 215

netbox: add zcip
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jun 23 15:16:13 2008 +0000 (2008-06-23)
parents 30a71ce39bda
children 939d1e5cfa3d
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 </vbox>
102 </window>
103 '
105 # Interafce status with ifconfig without arguments to show all
106 # active connections.
107 #
108 export IFCONFIG='
109 <window title="Network status" icon-name="network-wire">
110 <vbox>
111 <text wrap="false">
112 <input>date</input>
113 </text>
114 <notebook labels="Network interfaces'
115 [ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG|Wireless interfaces|Wireless networks"
116 tmp='|Routing|Servers">
117 <frame Ifconfig>
118 <text wrap="false" width-chars="58">
119 <input>ifconfig</input>
120 </text>
121 </frame>'
122 IFCONFIG="$IFCONFIG$tmp"
123 tmp='<frame Iwconfig>
124 <text wrap="false" width-chars="58">
125 <input>iwconfig</input>
126 </text>
127 </frame>
128 <frame Wireless networks>
129 <text wrap="false" width-chars="58">
130 <input>iwlist scan</input>
131 </text>
132 </frame>'
133 [ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG$tmp"
134 tmp='<frame Routing>
135 <frame Nameservers>
136 <text wrap="false" width-chars="58">
137 <input>cat /etc/resolv.conf</input>
138 </text>
139 </frame>
140 <frame Routing table>
141 <text wrap="false" width-chars="58">
142 <input>route</input>
143 </text>
144 </frame>
145 <frame Arp table>
146 <text wrap="false" width-chars="58">
147 <input>arp</input>
148 </text>
149 </frame>
150 </frame>
151 <frame Servers>
152 <text wrap="false" width-chars="58">
153 <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>
154 </text>
155 </frame>
156 </notebook>
157 <hbox>
158 <button>
159 <input file icon="gtk-close"></input>
160 <action type="closewindow">IFCONFIG</action>
161 </button>
162 </hbox>
163 </vbox>
164 </window>
165 '
166 IFCONFIG="$IFCONFIG$tmp"
168 # The main dialog with notebook, start/stop buttons and all options.
169 # Note than /etc/network.conf is seded wehwn an interafce is activate
170 #
171 NET_BOX='
172 <window title="SliTaz Netbox Manager" icon-name="network-wired">
173 <vbox>
175 <hbox>
176 <text use-markup="true">
177 <label>"<b>Network/Server Manager</b>"</label>
178 </text>
179 <pixmap>
180 <input file>/usr/share/pixmaps/netbox.png</input>
181 </pixmap>
182 </hbox>
184 <frame General>
185 <hbox>
186 <text use-markup="true">
187 <label>"<b>Interface :</b>"</label>
188 </text>
189 <entry>
190 <input>. /etc/network.conf; echo $INTERFACE</input>
191 <variable>INTERFACE</variable>
192 </entry>
193 </hbox>
194 </frame>
196 <notebook labels="DHCP|PPPoE|Static IP'
197 [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX|Wifi"
198 NET_BOX="$NET_BOX|System wide|VPN|Servers"
199 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX|Firewall"
200 tmp='|Etherwake">
202 <frame Udhcpc>
203 <hbox>
204 <text use-markup="true">
205 <label>"<b>Options :</b>"</label>
206 </text>
207 <entry>
208 <default>-b</default>
209 <variable>UDHCPC_OPTS</variable>
210 </entry>
211 <button>
212 <input file icon="help"></input>
213 <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>
214 </button>
215 </hbox>
216 <hbox>
217 <button>
218 <label>Start</label>
219 <input file icon="forward"></input>
220 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
221 <action>sed -i s/DHCP=\"no\"/DHCP=\"yes\"/ /etc/network.conf</action>
222 <action>sed -i s/STATIC=\"yes\"/STATIC=\"no\"/ /etc/network.conf</action>
223 <action>udhcpc $UDHCPC_OPTS -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid</action>
224 </button>
225 <button>
226 <label>Stop</label>
227 <input file icon="stop"></input>
228 <action>echo -n "Stopping interface : $INTERFACE... "</action>
229 <action>ifconfig $INTERFACE down</action>
230 <action>killall -q udhcpc; echo "done"</action>
231 </button>
232 </hbox>
233 </frame>
235 <frame PPPoE>
236 <hbox>
237 <text use-markup="true">
238 <label>"<b>Name :</b>"</label>
239 </text>
240 <entry>
241 <input>NAME=$(grep -s ^name /etc/ppp/options); echo "${NAME#* }"</input>
242 <variable>NAME</variable>
243 </entry>
244 </hbox>
245 <hbox>
246 <text use-markup="true">
247 <label>"<b>Username :</b>"</label>
248 </text>
249 <entry>
250 <variable>USER</variable>
251 </entry>
252 </hbox>
253 <hbox>
254 <text use-markup="true">
255 <label>"<b>Password :</b>"</label>
256 </text>
257 <entry>
258 <variable>USER</variable>
259 </entry>
260 </hbox>
261 <hbox>
262 <button>
263 <input file icon="accessories-text-editor"></input>
264 <label>Tune</label>
265 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
266 <action type="lauch">leafpad /etc/ppp/options</action>
267 </button>
268 <button>
269 <label>Start</label>
270 <input file icon="forward"></input>
271 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
272 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
273 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
274 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
275 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
276 <action>killall udhcpc</action>
277 <action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
278 <action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
279 <action>pppd $INTERFACE &</action>
280 </button>
281 <button>
282 <label>Stop</label>
283 <input file icon="stop"></input>
284 <action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
285 <action>killall pppd</action>
286 </button>
287 </hbox>
288 </frame>
290 <frame Configuration>
291 <hbox>
292 <text use-markup="true">
293 <label>"<b>IP :</b>"</label>
294 </text>
295 <entry>
296 <input>. /etc/network.conf; echo "$IP"</input>
297 <variable>IP</variable>
298 </entry>
299 </hbox>
300 <hbox>
301 <text use-markup="true">
302 <label>"<b>Netmask :</b>"</label>
303 </text>
304 <entry>
305 <input>. /etc/network.conf; echo "$NETMASK"</input>
306 <variable>NETMASK</variable>
307 </entry>
308 </hbox>
309 <hbox>
310 <text use-markup="true">
311 <label>"<b>Gateway :</b>"</label>
312 </text>
313 <entry>
314 <input>. /etc/network.conf; echo "$GATEWAY"</input>
315 <variable>GATEWAY</variable>
316 </entry>
317 </hbox>
318 <hbox>
319 <text use-markup="true">
320 <label>"<b>DNS server :</b>"</label>
321 </text>
322 <entry>
323 <input>. /etc/network.conf; echo "$DNS_SERVER"</input>
324 <variable>DNS_SERVER</variable>
325 </entry>
326 </hbox>
327 <hbox>
328 <button>
329 <label>Start</label>
330 <input file icon="forward"></input>
331 <action>ifconfig lo down</action>
332 <action>ifconfig $INTERFACE down</action>
333 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
334 <action>sed -i s/DHCP=\"yes\"/DHCP=\"no\"/ /etc/network.conf</action>
335 <action>sed -i s/STATIC=\"no\"/STATIC=\"yes\"/ /etc/network.conf</action>
336 <action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP=\"$IP\"/ /etc/network.conf</action>
337 <action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK=\"$NETMASK\"/ /etc/network.conf</action>
338 <action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY=\"$GATEWAY\"/ /etc/network.conf</action>
339 <action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER=\"$DNS_SERVER\"/ /etc/network.conf</action>
340 <action>/etc/init.d/network.sh</action>
341 </button>
342 <button>
343 <label>Stop</label>
344 <input file icon="stop"></input>
345 <action>echo -n "Stopping interface : $INTERFACE... "</action>
346 <action>ifconfig $INTERFACE down; echo "done"</action>
347 </button>
348 </hbox>
349 </frame>'
350 NET_BOX="$NET_BOX$tmp"
351 tmp='<frame Wireless>
352 <notebook labels="Interface|Extra parameters'
353 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp|Kernel Modules"
354 [ -x /usr/sbin/ndiswrapper ] && tmp="$tmp|Ndiswrapper"
355 tmp2='">
356 <vbox>
357 <hbox>
358 <text use-markup="true">
359 <label>"<b>Interface :</b>"</label>
360 </text>
361 <entry>
362 <input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input>
363 <variable>WIFI_INTERFACE</variable>
364 </entry>
365 </hbox>
366 <hbox>
367 <text use-markup="true">
368 <label>"<b>ESSID :</b>"</label>
369 </text>
370 <entry>
371 <input>. /etc/network.conf; echo "$WIFI_ESSID"</input>
372 <variable>WIFI_ESSID</variable>
373 </entry>
374 </hbox>
375 </vbox>
376 <vbox>
377 <hbox>
378 <text use-markup="true">
379 <label>"<b>Channel :</b>"</label>
380 </text>
381 <entry>
382 <input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input>
383 <variable>WIFI_CHANNEL</variable>
384 </entry>
385 <text use-markup="true">
386 <label>"<b>Mode :</b>"</label>
387 </text>
388 <combobox>
389 <variable>WIFI_MODE</variable>'
390 . /etc/network.conf
391 tmp2="$tmp2<item>$WIFI_MODE</item>"
392 for i in managed ad-hoc master repeater secondary monitor; do
393 [ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>"
394 done
395 tmp3='</combobox>
396 </hbox>
397 <hbox>
398 <text use-markup="true">
399 <label>"<b>Key :</b>"</label>
400 </text>
401 <entry>
402 <input>. /etc/network.conf; echo "$WIFI_KEY"</input>
403 <variable>WIFI_KEY</variable>
404 </entry>
405 </hbox>
406 </vbox>'
407 tmp="$tmp$tmp2$tmp3"
408 tmp2='<vbox>
409 <hbox>
410 <button>
411 <label>Load</label>
412 <input file icon="forward"></input>
413 <action>modprobe $MODULE</action>
414 </button>
415 <button>
416 <label>Unload</label>
417 <input file icon="forward"></input>
418 <action>modprobe -r $MODULE</action>
419 </button>
420 <text use-markup="true">
421 <label>"<b>Wifi Module :</b>"</label>
422 </text>
423 <combobox>
424 <variable>MODULE</variable>'
425 tmp2="$tmp2$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f | sed 's,/.*/\(.*\).ko.gz,<item>\1</item>,')"
426 tmp3='</combobox>
427 <button>
428 <label>Lsmod</label>
429 <input file icon="computer"></input>
430 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action>
431 </button>
432 </hbox>
433 </vbox>'
434 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp$tmp2$tmp3"
435 tmp2='<vbox>
436 <hbox>
437 <text use-markup="true">
438 <label>"<b>Drivers :</b>"</label>
439 </text>
440 <entry>
441 <input>. /etc/network.conf; echo "$NDISWRAPPER_DRIVERS"</input>
442 <variable>NDISWRAPPER_DRIVERS</variable>
443 </entry>
444 <button>
445 <label>Restart</label>
446 <input file icon="reload"></input>
447 <action>rmmod ndiswrapper</action>
448 <action>for i in $NDISWRAPPER_DRIVERS; do ndiswrapper -i $i; done</action>
449 <action>modprobe ndiswrapper</action>
450 </button>
451 </hbox>
452 </vbox>'
453 [ -x /usr/sbin/ndiswrapper ] && tmp="$tmp$tmp2"
454 tmp2='</notebook>
455 <hbox>
456 <button>
457 <label>Start</label>
458 <input file icon="forward"></input>
459 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_INTERFACE=`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action>
460 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_ESSID=`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action>
461 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_KEY=`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action>
462 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_MODE=`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action>
463 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_CHANNEL=`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action>
464 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
465 <action>ifconfig $WIFI_INTERFACE down</action>
466 <action>/etc/init.d/network.sh</action>
467 </button>
468 <button>
469 <label>Stop</label>
470 <input file icon="stop"></input>
471 <action>ifconfig $WIFI_INTERFACE down</action>
472 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
473 </button>
474 </hbox>
475 </frame>'
476 [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX$tmp$tmp2"
477 tmp='<frame Configuration files>
478 <hbox>
479 <text use-markup="true">
480 <label>"<b>Hosts :</b>"</label>
481 </text>
482 <entry editable="false">
483 <default>/etc/hosts</default>
484 <variable>HOSTS</variable>
485 </entry>
486 <button>
487 <input file icon="accessories-text-editor"></input>
488 <action type="lauch">leafpad $HOSTS</action>
489 </button>
490 </hbox>
491 <hbox>
492 <text use-markup="true">
493 <label>"<b>Host name :</b>"</label>
494 </text>
495 <entry editable="false">
496 <default>/etc/hostname</default>
497 <variable>HOSTNAME</variable>
498 </entry>
499 <button>
500 <input file icon="accessories-text-editor"></input>
501 <action type="lauch">leafpad $HOSTNAME</action>
502 </button>
503 </hbox>
504 <hbox>
505 <text use-markup="true">
506 <label>"<b>Network :</b>"</label>
507 </text>
508 <entry editable="false">
509 <default>/etc/network.conf</default>
510 <variable>CONFIG_FILE</variable>
511 </entry>
512 <button>
513 <input file icon="accessories-text-editor"></input>
514 <action type="lauch">leafpad $CONFIG_FILE</action>
515 </button>
516 </hbox>
517 <hbox>
518 <button>
519 <label>Restart</label>
520 <input file icon="reload"></input>
521 <action>echo -n "Stopping interface : $INTERFACE... "</action>
522 <action>ifconfig lo down</action>
523 <action>ifconfig $INTERFACE down</action>
524 <action>killall -q udhcpc; echo "done"</action>
525 <action>/etc/init.d/network.sh</action>
526 </button>
527 </hbox>
528 </frame>
530 <frame Virtual Private Network with PPP/SSH>
531 <hbox>
532 <text use-markup="true">
533 <label>"<b>Peer :</b>"</label>
534 </text>
535 <entry>
536 <variable>DROPBEAR_PEERVPN</variable>
537 <default>user@elsewhere</default>
538 </entry>
539 </hbox>
540 <hbox>
541 <text use-markup="true">
542 <label>"<b>Local IP :</b>"</label>
543 </text>
544 <entry>
545 <variable>DROPBEAR_LOCAL</variable>
546 <default>192.168.254.1</default>
547 </entry>
548 </hbox>
549 <hbox>
550 <text use-markup="true">
551 <label>"<b>Remote IP :</b>"</label>
552 </text>
553 <entry>
554 <variable>DROPBEAR_REMOTE</variable>
555 <default>192.168.254.2</default>
556 </entry>
557 </hbox>
558 <hbox>
559 <text use-markup="true">
560 <label>"<b>Route(s) :</b>"</label>
561 </text>
562 <entry>
563 <variable>DROPBEAR_ROUTE</variable>
564 <default>192.168.10.0/24 192.168.20.0/28</default>
565 </entry>
566 </hbox>
567 <hbox>
568 <button>
569 <input file icon="forward"></input>
570 <label>Connect</label>
571 <action>netbox call vpnssh $DROPBEAR_PEERVPN $DROPBEAR_LOCAL $DROPBEAR_REMOTE "$DROPBEAR_ROUTE" &</action>
572 </button>
573 <button>
574 <input file icon="stop"></input>
575 <label>Disconnect</label>
576 <action>netbox call killvpnssh</action>
577 </button>
578 <button>
579 <input file icon="go-up"></input>
580 <label>Send key</label>
581 <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>
582 </button>
583 </hbox>
584 </frame>
585 <notebook labels="'
586 NET_BOX="$NET_BOX$tmp"
587 tmp=''
588 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}SSH" && tmp='|'
589 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}INETD" && tmp='|'
590 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}${tmp}ZEROCONF" && tmp='|'
591 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}${tmp}DHCP" && tmp='|'
592 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
593 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] \
594 && NET_BOX="${NET_BOX}${tmp}PXE" && tmp='|'
595 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}DNS" && tmp='|'
596 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}RSYNC" && tmp='|'
597 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}HTTP" && tmp='|'
598 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|'
599 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}VNC" && tmp='|'
600 . /etc/daemons.conf
601 set -- $DROPBEAR_OPTIONS
602 while [ -n "$2" ]; do
603 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
604 shift
605 done
606 NET_BOX="${NET_BOX}\">"
607 tmp='<frame Dropbear>
608 <hbox>
609 <text use-markup="true">
610 <label>"<b>DROPBEAR_OPTIONS</b>"</label>
611 </text>
612 <entry editable="false">'
613 [ -n "$DROPBEAR_OPTIONS" ] && tmp="$tmp<default>$DROPBEAR_OPTIONS</default>"
614 tmp2='
615 <variable>DROPBEAR_OPTS</variable>
616 </entry>
617 <button>
618 <input file icon="help"></input>
619 <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>
620 </button>
621 <button>
622 <input file icon="accessories-text-editor"></input>
623 <action type="lauch">leafpad /etc/daemons.conf</action>
624 </button>
625 </hbox>
626 <hbox>
627 <text use-markup="true">
628 <label>"<b>Banner :</b>"</label>
629 </text>
630 <entry editable="false">'
631 [ -n "$DROPBEAR_BANNER" ] && tmp="$tmp$tmp2<default>$DROPBEAR_BANNER</default>"
632 tmp2='
633 <variable>DROPBEAR_BANNER</variable>
634 </entry>
635 <button>
636 <input file icon="accessories-text-editor"></input>
637 <action type="lauch">leafpad $DROPBEAR_BANNER</action>
638 </button>
639 </hbox>
640 <hbox>
641 <text use-markup="true">
642 <label>"<b>Remote :</b>"</label>
643 </text>
644 <entry>
645 <variable>DROPBEAR_PEER</variable>
646 <default>user@elsewhere</default>
647 </entry>
648 <button>
649 <input file icon="utilities-terminal"></input>
650 <label>Connect</label>
651 <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>
652 </button>
653 <button>
654 <input file icon="go-up"></input>
655 <label>Send key</label>
656 <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>
657 </button>
658 </hbox>
659 <hbox>
660 <button>
661 <label>Start</label>
662 <input file icon="forward"></input>
663 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
664 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dropbear \1\"/" /etc/rcS.conf</action>
665 <action>/etc/init.d/dropbear start</action>
666 </button>
667 <button>
668 <label>Stop</label>
669 <input file icon="stop"></input>
670 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
671 <action>/etc/init.d/dropbear stop</action>
672 </button>
673 </hbox>
674 </frame>
675 '
676 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
677 tmp='<frame Inetd>
678 <hbox>
679 <text use-markup="true">
680 <label>"<b>INETD_OPTIONS</b>"</label>
681 </text>
682 <entry editable="false">'
683 [ -n "$INETD_OPTS" ] && tmp="$tmp<default>$INETD_OPTS</default>"
684 tmp2='
685 <variable>INETD_OPTS</variable>
686 </entry>
687 <button>
688 <input file icon="help"></input>
689 <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>
690 </button>
691 <button>
692 <input file icon="accessories-text-editor"></input>
693 <action type="lauch">leafpad /etc/daemons.conf</action>
694 </button>
695 </hbox>
696 <hbox>
697 <text use-markup="true">
698 <label>"<b>Configuration :</b>"</label>
699 </text>
700 <entry editable="false">
701 <default>/etc/inetd.conf</default>
702 <variable>INETD_CONF</variable>
703 </entry>
704 <button>
705 <input file icon="accessories-text-editor"></input>
706 <action type="lauch">leafpad $INETD_CONF</action>
707 </button>
708 </hbox>
709 <hbox>
710 '
711 tmp="$tmp$tmp2"
712 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
713 i=$(basename $i)
714 tmp2="
715 <button>
716 <input file icon=\"help\"></input>
717 <label>$i</label>
718 <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>
719 </button>
720 "
721 tmp="$tmp$tmp2"
722 done
723 tmp2='
724 <button>
725 <label>Start</label>
726 <input file icon="forward"></input>
727 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
728 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"inetd \1\"/" /etc/rcS.conf</action>
729 <action>/etc/init.d/inetd start</action>
730 </button>
731 <button>
732 <label>Stop</label>
733 <input file icon="stop"></input>
734 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
735 <action>/etc/init.d/inetd stop</action>
736 </button>
737 </hbox>
738 </frame>
739 '
740 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
741 if [ -x /sbin/zcip -a -z "$ZCIP_OPTS" ]; then
742 ZCIP_OPTS="eth0 /etc/zcip.script"
743 cat >> /etc/daemons.conf <<EOT
744 # ZeroConf options
745 ZCIP_OPTS="$ZCIP_OPTS"
747 EOT
748 fi
749 tmp='<frame Zcip>
750 <hbox>
751 <text use-markup="true">
752 <label>"<b>ZCIP_OPTIONS</b>"</label>
753 </text>
754 <entry editable="false">'
755 [ -n "$ZCIP_OPTS" ] && tmp="$tmp<default>$ZCIP_OPTS</default>"
756 tmp2='
757 <variable>CZIP_OPTS</variable>
758 </entry>
759 <button>
760 <input file icon="help"></input>
761 <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>
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>Script :</b>"</label>
771 </text>
772 <entry editable="false">
773 <default>/etc/zcip.script</default>
774 <variable>CZIP_SCRIPT</variable>
775 </entry>
776 <button>
777 <input file icon="accessories-text-editor"></input>
778 <action type="lauch">leafpad $CZIP_SCRIPT</action>
779 </button>
780 </hbox>
781 <hbox>
782 <button>
783 <label>Start</label>
784 <input file icon="forward"></input>
785 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
786 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"zcip \1\"/" /etc/rcS.conf</action>
787 <action>/etc/init.d/zcip start</action>
788 </button>
789 <button>
790 <label>Stop</label>
791 <input file icon="stop"></input>
792 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
793 <action>/etc/init.d/zcip stop</action>
794 </button>
795 </hbox>
796 </frame>
797 '
798 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}$tmp$tmp2"
799 tmp='<frame Dhcpd>
800 <hbox>
801 <text use-markup="true">
802 <label>"<b>UDHCPD_OPTIONS</b>"</label>
803 </text>
804 <entry editable="false">'
805 [ -n "$UDHCPD_OPTS" ] && tmp="$tmp<default>$UDHCPD_OPTS</default>"
806 tmp2='
807 <variable>UDHCPD_OPTS</variable>
808 </entry>
809 <button>
810 <input file icon="help"></input>
811 <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>
812 </button>
813 <button>
814 <input file icon="accessories-text-editor"></input>
815 <action type="lauch">leafpad /etc/daemons.conf</action>
816 </button>
817 </hbox>
818 <hbox>
819 <text use-markup="true">
820 <label>"<b>Configuration :</b>"</label>
821 </text>
822 <entry editable="false">
823 <default>/etc/udhcpd.conf</default>
824 <variable>UDHCPD_CONF</variable>
825 </entry>
826 <button>
827 <input file icon="accessories-text-editor"></input>
828 <action type="lauch">leafpad $UDHCPD_CONF</action>
829 </button>
830 </hbox>
831 <hbox>
832 <text use-markup="true">
833 <label>"<b>Script :</b>"</label>
834 </text>
835 <entry editable="false">
836 <default>/usr/share/udhcpc/default.script</default>
837 <variable>UDHCPD_SCRIPT</variable>
838 </entry>
839 <button>
840 <input file icon="accessories-text-editor"></input>
841 <action type="lauch">leafpad $UDHCPD_SCRIPT</action>
842 </button>
843 </hbox>
844 <hbox>
845 <button>
846 <label>Start</label>
847 <input file icon="forward"></input>
848 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
849 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"udhcpd \1\"/" /etc/rcS.conf</action>
850 <action>/etc/init.d/udhcpd start</action>
851 </button>
852 <button>
853 <label>Stop</label>
854 <input file icon="stop"></input>
855 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
856 <action>/etc/init.d/udhcpd stop</action>
857 </button>
858 </hbox>
859 </frame>
860 '
861 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}$tmp$tmp2"
862 tmp='<frame Pxelinux>
863 <hbox>
864 <text wrap="true">
865 <label>
866 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
867 </label>
868 </text>
869 </hbox>
870 <hbox>
871 <text use-markup="true">
872 <label>"<b>Configuration :</b>"</label>
873 </text>
874 <entry editable="false">
875 <default>'
876 tmp="$tmp$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')"
877 tmp2='/pxelinux.cfg/default</default>
878 <variable>PXE_CONF</variable>
879 </entry>
880 <button>
881 <input file icon="accessories-text-editor"></input>
882 <action>dir=$(dirname $PXE_CONF); [ -d $dir ] || mkdir -p $dir</action>
883 <action>lzma d /usr/share/boot/pxelinux.0.lzma $(dirname $PXE_CONF)/../pxelinux.0</action>
884 <action>grep -q "^boot_file" $UDHCPD_CONF || echo "boot_file pxelinux.0" >> $UDHCPD_CONF</action>
885 <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> $UDHCPD_CONF</action>
886 <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>
887 <action type="lauch">leafpad $PXE_CONF</action>
888 </button>
889 </hbox>
890 <hbox>
891 <button>
892 <input file icon="system-file-manager"></input>
893 <label>Network boot files</label>
894 <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>
895 </button>
896 </hbox>
897 </frame>
898 '
899 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
900 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] && NET_BOX="$NET_BOX$tmp$tmp2"
901 tmp='<frame Dnsd>
902 <hbox>
903 <text use-markup="true">
904 <label>"<b>DNSD_OPTIONS</b>"</label>
905 </text>
906 <entry editable="false">'
907 [ -n "$DNSD_OPTIONS" ] && tmp="$tmp<default>$DNSD_OPTIONS</default>"
908 tmp2='
909 <variable>DNSD_OPTS</variable>
910 </entry>
911 <button>
912 <input file icon="help"></input>
913 <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>
914 </button>
915 <button>
916 <input file icon="accessories-text-editor"></input>
917 <action type="lauch">leafpad /etc/daemons.conf</action>
918 </button>
919 </hbox>
920 <hbox>
921 <text use-markup="true">
922 <label>"<b>Configuration :</b>"</label>
923 </text>
924 <entry editable="false">
925 <default>/etc/dnsd.conf</default>
926 <variable>DNSD_CONF</variable>
927 </entry>
928 <button>
929 <input file icon="accessories-text-editor"></input>
930 <action type="lauch">leafpad $DNSD_CONF</action>
931 </button>
932 </hbox>
933 <hbox>
934 <button>
935 <label>Start</label>
936 <input file icon="forward"></input>
937 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
938 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dnsd \1\"/" /etc/rcS.conf</action>
939 <action>/etc/init.d/dnsd start</action>
940 </button>
941 <button>
942 <label>Stop</label>
943 <input file icon="stop"></input>
944 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
945 <action>/etc/init.d/dnsd stop</action>
946 </button>
947 </hbox>
948 </frame>
949 '
950 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
951 tmp='<frame Rsync>
952 <hbox>
953 <text use-markup="true">
954 <label>"<b>RSYNCD_OPTIONS</b>"</label>
955 </text>
956 <entry editable="false">'
957 [ -n "${RSYNCD_OPTIONS#* }" ] && tmp="$tmp<default>${RSYNCD_OPTIONS#* }</default>"
958 tmp2='
959 <variable>RSYNC_OPTS</variable>
960 </entry>
961 <button>
962 <input file icon="help"></input>
963 <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>
964 </button>
965 <button>
966 <input file icon="accessories-text-editor"></input>
967 <action type="lauch">leafpad /etc/daemons.conf</action>
968 </button>
969 </hbox>
970 <hbox>
971 <text use-markup="true">
972 <label>"<b>Configuration :</b>"</label>
973 </text>
974 <entry editable="false">
975 <default>/etc/rsyncd.conf</default>
976 <variable>RSYNCD_CONF</variable>
977 </entry>
978 <button>
979 <input file icon="accessories-text-editor"></input>
980 <action type="lauch">leafpad $RSYNCD_CONF</action>
981 </button>
982 </hbox>
983 <hbox>
984 <text use-markup="true">
985 <label>"<b>Secrets file :</b>"</label>
986 </text>
987 <entry editable="true">
988 <default>/etc/rsyncd.secrets</default>
989 <variable>RSYNCD_SECRETS</variable>
990 </entry>
991 <button>
992 <input file icon="accessories-text-editor"></input>
993 <action type="lauch">leafpad $RSYNCD_SECRETS</action>
994 </button>
995 </hbox>
996 <hbox>
997 <button>
998 <label>Start</label>
999 <input file icon="forward"></input>
1000 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1001 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"rsyncd \1\"/" /etc/rcS.conf</action>
1002 <action>/etc/init.d/rsyncd start</action>
1003 </button>
1004 <button>
1005 <label>Stop</label>
1006 <input file icon="stop"></input>
1007 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1008 <action>/etc/init.d/rsyncd stop</action>
1009 </button>
1010 </hbox>
1011 </frame>
1013 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1014 tmp='<frame Lighttpd>'
1015 tmp2='<frame PHP>
1016 <hbox>
1017 <text use-markup="true">
1018 <label>"<b>Configuration :</b>"</label>
1019 </text>
1020 <entry editable="false">
1021 <default>/etc/php.ini</default>
1022 <variable>PHP_CONF</variable>
1023 </entry>
1024 <button>
1025 <input file icon="accessories-text-editor"></input>
1026 <action type="lauch">leafpad $PHP_CONF</action>
1027 </button>
1028 </hbox>
1029 </frame>
1031 [ -f /etc/php.ini ] && tmp="${tmp}${tmp2}"
1032 tmp2='<hbox>
1033 <text use-markup="true">
1034 <label>"<b>Configuration :</b>"</label>
1035 </text>
1036 <entry editable="false">
1037 <default>/etc/lighttpd/lighttpd.conf</default>
1038 <variable>LIGHTTPD_CONF</variable>
1039 </entry>
1040 <button>
1041 <input file icon="accessories-text-editor"></input>
1042 <action type="lauch">leafpad $LIGHTTPD_CONF</action>
1043 </button>
1044 </hbox>
1045 <hbox>
1046 <button>
1047 <label>Start</label>
1048 <input file icon="forward"></input>
1049 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1050 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"lighttpd \1\"/" /etc/rcS.conf</action>
1051 <action>/etc/init.d/lighttpd start</action>
1052 </button>
1053 <button>
1054 <label>Stop</label>
1055 <input file icon="stop"></input>
1056 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1057 <action>/etc/init.d/lighttpd stop</action>
1058 </button>
1059 </hbox>
1060 </frame>
1062 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1063 tmp='<frame Samba: smbd & nmbd>
1064 <hbox>
1065 <text use-markup="true">
1066 <label>"<b>Configuration :</b>"</label>
1067 </text>
1068 <entry editable="false">
1069 <default>/etc/samba/smb.conf</default>
1070 <variable>SMBD_CONF</variable>
1071 </entry>
1072 <button>
1073 <input file icon="accessories-text-editor"></input>
1074 <action type="lauch">leafpad $SMBD_CONF</action>
1075 </button>
1076 </hbox>
1077 <hbox>
1078 <button>
1079 <label>Reload</label>
1080 <input file icon="reload"></input>
1081 <action>/etc/init.d/samba reload</action>
1082 </button>
1083 <button>
1084 <label>Start</label>
1085 <input file icon="forward"></input>
1086 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1087 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"samba \1\"/" /etc/rcS.conf</action>
1088 <action>/etc/init.d/samba start</action>
1089 </button>
1090 <button>
1091 <label>Stop</label>
1092 <input file icon="stop"></input>
1093 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1094 <action>/etc/init.d/samba stop</action>
1095 </button>
1096 </hbox>
1097 </frame>
1099 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}"
1100 tmp='<frame x11vnc>
1101 <hbox>
1102 <text use-markup="true">
1103 <label>"<b>X11VNC_OPTIONS</b>"</label>
1104 </text>
1105 <entry editable="false">'
1106 [ -n "$X11VNC_OPTIONS" ] && tmp="$tmp<default>$X11VNC_OPTIONS</default>"
1107 tmp2='
1108 <variable>X11VNC_OPTS</variable>
1109 </entry>
1110 <button>
1111 <input file icon="help"></input>
1112 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "x11vnc daemon help (q to quit)" -e "x11vnc --help | less"</action>
1113 </button>
1114 <button>
1115 <input file icon="accessories-text-editor"></input>
1116 <action type="lauch">leafpad /etc/daemons.conf</action>
1117 </button>
1118 </hbox>
1119 <hbox>
1120 <text use-markup="true">
1121 <label>"<b>New password</b>"</label>
1122 </text>
1123 <entry>
1124 <variable>X11VNC_PASSWD</variable>
1125 </entry>
1126 <button>
1127 <input file icon="reload"></input>
1128 <label>Update</label>
1129 <action>x11vnc -storepasswd $X11VNC_PASSWD /etc/vnc.secret</action>
1130 </button>
1131 </hbox>
1132 <hbox>
1133 <button>
1134 <label>Start</label>
1135 <input file icon="forward"></input>
1136 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1137 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"x11vnc \1\"/" /etc/rcS.conf</action>
1138 <action>/etc/init.d/x11vnc start</action>
1139 </button>
1140 <button>
1141 <label>Stop</label>
1142 <input file icon="stop"></input>
1143 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1144 <action>/etc/init.d/x11vnc stop</action>
1145 </button>
1146 </hbox>
1147 </frame>
1149 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1150 NET_BOX="${NET_BOX}
1151 </notebook>
1153 tmp='<frame Iptables>
1154 <hbox>
1155 <text use-markup="true">
1156 <label>"<b>Configuration :</b>"</label>
1157 </text>
1158 <entry editable="false">
1159 <default>/etc/iptables.conf</default>
1160 <variable>IPTABLES_CONF</variable>
1161 </entry>
1162 <button>
1163 <input file icon="accessories-text-editor"></input>
1164 <action type="lauch">leafpad $IPTABLES_CONF</action>
1165 </button>
1166 </hbox>
1167 <hbox>
1168 <button>
1169 <label>Load</label>
1170 <input file icon="reload"></input>
1171 <action>cat $IPTABLES_CONF | /sbin/iptables-restore</action>
1172 </button>
1173 <button>
1174 <label>Save</label>
1175 <input file icon="go-jump"></input>
1176 <action>/sbin/iptables-save > $IPTABLES_CONF</action>
1177 </button>
1178 </hbox>
1179 </frame>
1181 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX${tmp}"
1182 tmp='
1183 <frame Ether-wake>
1184 <hbox>
1185 <text use-markup="true">
1186 <label>"<b>Machines :</b>"</label>
1187 </text>
1188 <entry editable="false">
1189 <default>/etc/ethers</default>
1190 <variable>ETHERS</variable>
1191 </entry>
1192 <button>
1193 <input file icon="accessories-text-editor"></input>
1194 <action>[ -s $ETHERS ] || echo "#00:01:02:03:04:05 mystation" >$ETHERS</action>
1195 <action type="lauch">leafpad $ETHERS</action>
1196 </button>
1197 </hbox>
1198 <hbox>
1199 <text use-markup="true">
1200 <label>"<b>Options : </b>"</label>
1201 </text>
1202 <entry editable="false">
1203 <variable>ETHERWAKE_OPTS</variable>
1204 </entry>
1205 <button>
1206 <input file icon="help"></input>
1207 <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>
1208 </button>
1209 <button>
1210 <label>Start</label>
1211 <input file icon="forward"></input>
1212 <action>ether-wake $ETHERWAKE_OPTS</action>
1213 </button>
1214 </hbox>
1215 </frame>
1216 </notebook>
1218 <hbox>
1219 <button>
1220 <label>Status</label>
1221 <input file icon="dialog-information"></input>
1222 <action type="launch">IFCONFIG</action>
1223 </button>
1224 <button help>
1225 <label>Help</label>
1226 <action type="launch">HELP</action>
1227 </button>
1228 <button>
1229 <label>Quit</label>
1230 <input file icon="exit"></input>
1231 <action type="exit">Exit</action>
1232 </button>
1233 </hbox>
1235 </vbox>
1236 </window>
1238 NET_BOX="${NET_BOX}${tmp}"
1240 export NET_BOX
1242 # TODO: Modules(Network kernel modules) VPN(OpenVPN)
1244 # Only root can configure network.
1245 check_root
1246 # Configure and connect if button Connect was pressed.
1247 if ! grep -qs ^name /etc/ppp/options ; then
1248 # Generate /etc/ppp/options
1249 cat > /etc/ppp/options << _EOT_
1250 plugin rp-pppoe.so
1251 name provider-ID
1252 noipdefault
1253 defaultroute
1254 mtu 1492
1255 mru 1492
1256 lock
1257 _EOT_
1258 # Generate /etc/ppp/pap-secrets
1259 cat > /etc/ppp/pap-secrets << _EOT_
1260 # Secrets for authentication using PAP
1261 # client server secret IP addresses
1262 _EOT_
1263 # Generate /etc/ppp/chap-secrets
1264 cat > /etc/ppp/chap-secrets << _EOT_
1265 # Secrets for authentication using CHAP
1266 # client server secret IP addresses
1267 _EOT_
1268 fi
1269 gtkdialog --center --program=NET_BOX
1271 exit 0