slitaz-tools view tinyutils/netbox @ rev 217

netbox: add ppp
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jun 23 20:29:13 2008 +0000 (2008-06-23)
parents 939d1e5cfa3d
children 8d3e82b76796
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="accessories-text-editor"></input>
274 <label>Tune</label>
275 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
276 <action type="lauch">leafpad /etc/ppp/options</action>
277 </button>
278 <button>
279 <label>Start</label>
280 <input file icon="forward"></input>
281 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
282 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
283 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
284 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
285 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
286 <action>killall udhcpc</action>
287 <action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
288 <action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
289 <action>pppd $INTERFACE &</action>
290 </button>
291 <button>
292 <label>Stop</label>
293 <input file icon="stop"></input>
294 <action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
295 <action>killall pppd</action>
296 </button>
297 </hbox>
298 </frame>
300 <frame PPP>
301 <hbox>
302 <text use-markup="true">
303 <label>"<b>Username :</b>"</label>
304 </text>
305 <entry>
306 <input>USER=$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "${USER#*=}"</input>
307 <variable>USER</variable>
308 </entry>
309 </hbox>
310 <hbox>
311 <text use-markup="true">
312 <label>"<b>Password :</b>"</label>
313 </text>
314 <entry>
315 <input>PASS=$(grep -s ^PASSWORD= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PASS#*=}"</input>
316 <variable>PASS</variable>
317 </entry>
318 </hbox>
319 <hbox>
320 <text use-markup="true">
321 <label>"<b>Telephone:</b>"</label>
322 </text>
323 <entry>
324 <input>PHONE=$(grep -s ^TELEPHONE= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PHONE#*=}"</input>
325 <variable>PHONE</variable>
326 </entry>
327 </hbox>
328 <hbox>
329 <button>
330 <input file icon="accessories-text-editor"></input>
331 <label>Tune</label>
332 <action>[ -n "$NAME" ] && sed -i "s/^ACCOUNT=.* /ACCOUNT=$NAME /" /etc/ppp/scripts/ppp-on</action>
333 <action>[ -n "$PASS" ] && sed -i "s/^PASSWORD=.* /PASSWORD=$PASS /" /etc/ppp/scripts/ppp-on</action>
334 <action>[ -n "$PHONE" ] && sed -i "s/^TELEPHONE=.* /TELEPHONE=$PHONE /" /etc/ppp/scripts/ppp-on</action>
335 <action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
336 </button>
337 <button>
338 <label>Start</label>
339 <input file icon="forward"></input>
340 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
341 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
342 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
343 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
344 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
345 <action>/etc/ppp/scripts/ppp-off</action>
346 <action>/etc/ppp/scripts/ppp-on &</action>
347 </button>
348 <button>
349 <label>Stop</label>
350 <input file icon="stop"></input>
351 <action>/etc/ppp/scripts/ppp-off</action>
352 </button>
353 </hbox>
354 </frame>
356 <frame Configuration>
357 <hbox>
358 <text use-markup="true">
359 <label>"<b>IP :</b>"</label>
360 </text>
361 <entry>
362 <input>. /etc/network.conf; echo "$IP"</input>
363 <variable>IP</variable>
364 </entry>
365 </hbox>
366 <hbox>
367 <text use-markup="true">
368 <label>"<b>Netmask :</b>"</label>
369 </text>
370 <entry>
371 <input>. /etc/network.conf; echo "$NETMASK"</input>
372 <variable>NETMASK</variable>
373 </entry>
374 </hbox>
375 <hbox>
376 <text use-markup="true">
377 <label>"<b>Gateway :</b>"</label>
378 </text>
379 <entry>
380 <input>. /etc/network.conf; echo "$GATEWAY"</input>
381 <variable>GATEWAY</variable>
382 </entry>
383 </hbox>
384 <hbox>
385 <text use-markup="true">
386 <label>"<b>DNS server :</b>"</label>
387 </text>
388 <entry>
389 <input>. /etc/network.conf; echo "$DNS_SERVER"</input>
390 <variable>DNS_SERVER</variable>
391 </entry>
392 </hbox>
393 <hbox>
394 <button>
395 <label>Start</label>
396 <input file icon="forward"></input>
397 <action>ifconfig lo down</action>
398 <action>ifconfig $INTERFACE down</action>
399 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
400 <action>sed -i s/DHCP=\"yes\"/DHCP=\"no\"/ /etc/network.conf</action>
401 <action>sed -i s/STATIC=\"no\"/STATIC=\"yes\"/ /etc/network.conf</action>
402 <action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP=\"$IP\"/ /etc/network.conf</action>
403 <action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK=\"$NETMASK\"/ /etc/network.conf</action>
404 <action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY=\"$GATEWAY\"/ /etc/network.conf</action>
405 <action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER=\"$DNS_SERVER\"/ /etc/network.conf</action>
406 <action>/etc/init.d/network.sh</action>
407 </button>
408 <button>
409 <label>Stop</label>
410 <input file icon="stop"></input>
411 <action>echo -n "Stopping interface : $INTERFACE... "</action>
412 <action>ifconfig $INTERFACE down; echo "done"</action>
413 </button>
414 </hbox>
415 </frame>'
416 NET_BOX="$NET_BOX$tmp"
417 tmp='<frame Wireless>
418 <notebook labels="Interface|Extra parameters|WPA'
419 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp|Kernel Modules"
420 [ -x /usr/sbin/ndiswrapper ] && tmp="$tmp|Ndiswrapper"
421 tmp2='">
422 <vbox>
423 <hbox>
424 <text use-markup="true">
425 <label>"<b>Interface :</b>"</label>
426 </text>
427 <entry>
428 <input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input>
429 <variable>WIFI_INTERFACE</variable>
430 </entry>
431 </hbox>
432 <hbox>
433 <text use-markup="true">
434 <label>"<b>ESSID :</b>"</label>
435 </text>
436 <entry>
437 <input>. /etc/network.conf; echo "$WIFI_ESSID"</input>
438 <variable>WIFI_ESSID</variable>
439 </entry>
440 </hbox>
441 </vbox>
442 <vbox>
443 <hbox>
444 <text use-markup="true">
445 <label>"<b>Channel :</b>"</label>
446 </text>
447 <entry>
448 <input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input>
449 <variable>WIFI_CHANNEL</variable>
450 </entry>
451 <text use-markup="true">
452 <label>"<b>Mode :</b>"</label>
453 </text>
454 <combobox>
455 <variable>WIFI_MODE</variable>'
456 . /etc/network.conf
457 tmp2="$tmp2<item>$WIFI_MODE</item>"
458 for i in managed ad-hoc master repeater secondary monitor; do
459 [ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>"
460 done
461 tmp3='</combobox>
462 </hbox>
463 <hbox>
464 <text use-markup="true">
465 <label>"<b>Key :</b>"</label>
466 </text>
467 <entry>
468 <input>. /etc/network.conf; echo "$WIFI_KEY"</input>
469 <variable>WIFI_KEY</variable>
470 </entry>
471 </hbox>
472 </vbox>'
473 tmp="$tmp$tmp2$tmp3"
474 tmp2='<vbox>
475 <hbox>
476 <text use-markup="true">
477 <label>"<b>WPA_OPTIONS</b>"</label>
478 </text>
479 <entry editable="false">'
480 [ -n "$WPA_OPTIONS" ] && tmp2="$tmp2<default>$WPA_OPTIONS</default>"
481 tmp3='
482 <variable>WPA_OPTS</variable>
483 </entry>
484 <button>
485 <input file icon="help"></input>
486 <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>
487 </button>
488 <button>
489 <input file icon="accessories-text-editor"></input>
490 <action type="lauch">leafpad /etc/daemons.conf</action>
491 </button>
492 </hbox>
493 <hbox>
494 <text use-markup="true">
495 <label>"<b>Configuration:</b>"</label>
496 </text>
497 <entry editable="false">
498 <default>/etc/wpa_supplicant.conf</default>
499 <variable>WPA_CONF</variable>
500 </entry>
501 <button>
502 <input file icon="accessories-text-editor"></input>
503 <action type="lauch">leafpad $WPA_CONF</action>
504 </button>
505 </hbox>
506 <hbox>
507 <button>
508 <label>Start WPA</label>
509 <input file icon="forward"></input>
510 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)wpa_supplicant \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
511 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"wpa_supplicant \1\"/" /etc/rcS.conf</action>
512 <action>/etc/init.d/wpa_supplicant start</action>
513 </button>
514 <button>
515 <label>Stop WPA</label>
516 <input file icon="stop"></input>
517 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)wpa_supplicant \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
518 <action>/etc/init.d/wpa_supplicant stop</action>
519 </button>
520 </hbox>
521 </vbox>'
522 [ -x /usr/bin/wpa_supplicant ] && tmp="$tmp$tmp2$tmp3"
523 tmp2='<vbox>
524 <hbox>
525 <text wrap="true" width-chars="64" use-markup="true">
526 <label>
527 "<i>The package <b>wpa_supplicant</b> is not yet installed</i>"
528 </label>
529 </text>
530 <button>
531 <input file icon="go-jump"></input>
532 <label>Install</label>
533 <action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action>
534 <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>
535 <action type="exit">Exit</action>
536 </button>
537 </hbox>
538 </vbox>'
539 [ -x /usr/bin/wpa_supplicant ] || tmp="$tmp$tmp2"
540 tmp2='<vbox>
541 <hbox>
542 <button>
543 <label>Load</label>
544 <input file icon="forward"></input>
545 <action>modprobe $MODULE</action>
546 </button>
547 <button>
548 <label>Unload</label>
549 <input file icon="forward"></input>
550 <action>modprobe -r $MODULE</action>
551 </button>
552 <text use-markup="true">
553 <label>"<b>Wifi Module :</b>"</label>
554 </text>
555 <combobox>
556 <variable>MODULE</variable>'
557 tmp2="$tmp2$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f | sed 's,/.*/\(.*\).ko.gz,<item>\1</item>,')"
558 tmp3='</combobox>
559 <button>
560 <label>Lsmod</label>
561 <input file icon="computer"></input>
562 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action>
563 </button>
564 </hbox>
565 </vbox>'
566 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp$tmp2$tmp3"
567 tmp2='<vbox>
568 <hbox>
569 <text use-markup="true">
570 <label>"<b>Drivers :</b>"</label>
571 </text>
572 <entry>
573 <input>. /etc/network.conf; echo "$NDISWRAPPER_DRIVERS"</input>
574 <variable>NDISWRAPPER_DRIVERS</variable>
575 </entry>
576 <button>
577 <label>Restart</label>
578 <input file icon="reload"></input>
579 <action>rmmod ndiswrapper</action>
580 <action>for i in $NDISWRAPPER_DRIVERS; do ndiswrapper -i $i; done</action>
581 <action>modprobe ndiswrapper</action>
582 </button>
583 </hbox>
584 </vbox>'
585 [ -x /usr/sbin/ndiswrapper ] && tmp="$tmp$tmp2"
586 tmp2='</notebook>
587 <hbox>
588 <button>
589 <label>Start</label>
590 <input file icon="forward"></input>
591 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_INTERFACE=`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action>
592 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_ESSID=`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action>
593 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_KEY=`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action>
594 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_MODE=`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action>
595 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_CHANNEL=`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action>
596 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
597 <action>ifconfig $WIFI_INTERFACE down</action>
598 <action>/etc/init.d/network.sh</action>
599 </button>
600 <button>
601 <label>Stop</label>
602 <input file icon="stop"></input>
603 <action>ifconfig $WIFI_INTERFACE down</action>
604 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
605 </button>
606 </hbox>
607 </frame>'
608 [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX$tmp$tmp2"
609 tmp='<frame Configuration files>
610 <hbox>
611 <text use-markup="true">
612 <label>"<b>Hosts :</b>"</label>
613 </text>
614 <entry editable="false">
615 <default>/etc/hosts</default>
616 <variable>HOSTS</variable>
617 </entry>
618 <button>
619 <input file icon="accessories-text-editor"></input>
620 <action type="lauch">leafpad $HOSTS</action>
621 </button>
622 </hbox>
623 <hbox>
624 <text use-markup="true">
625 <label>"<b>Host name :</b>"</label>
626 </text>
627 <entry editable="false">
628 <default>/etc/hostname</default>
629 <variable>HOSTNAME</variable>
630 </entry>
631 <button>
632 <input file icon="accessories-text-editor"></input>
633 <action type="lauch">leafpad $HOSTNAME</action>
634 </button>
635 </hbox>
636 <hbox>
637 <text use-markup="true">
638 <label>"<b>Network :</b>"</label>
639 </text>
640 <entry editable="false">
641 <default>/etc/network.conf</default>
642 <variable>CONFIG_FILE</variable>
643 </entry>
644 <button>
645 <input file icon="accessories-text-editor"></input>
646 <action type="lauch">leafpad $CONFIG_FILE</action>
647 </button>
648 </hbox>
649 <hbox>
650 <button>
651 <label>Restart</label>
652 <input file icon="reload"></input>
653 <action>echo -n "Stopping interface : $INTERFACE... "</action>
654 <action>ifconfig lo down</action>
655 <action>ifconfig $INTERFACE down</action>
656 <action>killall -q udhcpc; echo "done"</action>
657 <action>/etc/init.d/network.sh</action>
658 </button>
659 </hbox>
660 </frame>
662 <frame Virtual Private Network with PPP/SSH>
663 <hbox>
664 <text use-markup="true">
665 <label>"<b>Peer :</b>"</label>
666 </text>
667 <entry>
668 <variable>DROPBEAR_PEERVPN</variable>
669 <default>user@elsewhere</default>
670 </entry>
671 </hbox>
672 <hbox>
673 <text use-markup="true">
674 <label>"<b>Local IP :</b>"</label>
675 </text>
676 <entry>
677 <variable>DROPBEAR_LOCAL</variable>
678 <default>192.168.254.1</default>
679 </entry>
680 </hbox>
681 <hbox>
682 <text use-markup="true">
683 <label>"<b>Remote IP :</b>"</label>
684 </text>
685 <entry>
686 <variable>DROPBEAR_REMOTE</variable>
687 <default>192.168.254.2</default>
688 </entry>
689 </hbox>
690 <hbox>
691 <text use-markup="true">
692 <label>"<b>Route(s) :</b>"</label>
693 </text>
694 <entry>
695 <variable>DROPBEAR_ROUTE</variable>
696 <default>192.168.10.0/24 192.168.20.0/28</default>
697 </entry>
698 </hbox>
699 <hbox>
700 <button>
701 <input file icon="forward"></input>
702 <label>Connect</label>
703 <action>netbox call vpnssh $DROPBEAR_PEERVPN $DROPBEAR_LOCAL $DROPBEAR_REMOTE "$DROPBEAR_ROUTE" &</action>
704 </button>
705 <button>
706 <input file icon="stop"></input>
707 <label>Disconnect</label>
708 <action>netbox call killvpnssh</action>
709 </button>
710 <button>
711 <input file icon="go-up"></input>
712 <label>Send key</label>
713 <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>
714 </button>
715 </hbox>
716 </frame>
717 <notebook labels="'
718 NET_BOX="$NET_BOX$tmp"
719 tmp=''
720 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}SSH" && tmp='|'
721 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}INETD" && tmp='|'
722 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}${tmp}ZEROCONF" && tmp='|'
723 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}${tmp}DHCP" && tmp='|'
724 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
725 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] \
726 && NET_BOX="${NET_BOX}${tmp}PXE" && tmp='|'
727 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}DNS" && tmp='|'
728 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}RSYNC" && tmp='|'
729 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}HTTP" && tmp='|'
730 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|'
731 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}VNC" && tmp='|'
732 . /etc/daemons.conf
733 set -- $DROPBEAR_OPTIONS
734 while [ -n "$2" ]; do
735 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
736 shift
737 done
738 NET_BOX="${NET_BOX}\">"
739 tmp='<frame Dropbear>
740 <hbox>
741 <text use-markup="true">
742 <label>"<b>DROPBEAR_OPTIONS</b>"</label>
743 </text>
744 <entry editable="false">'
745 [ -n "$DROPBEAR_OPTIONS" ] && tmp="$tmp<default>$DROPBEAR_OPTIONS</default>"
746 tmp2='
747 <variable>DROPBEAR_OPTS</variable>
748 </entry>
749 <button>
750 <input file icon="help"></input>
751 <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>
752 </button>
753 <button>
754 <input file icon="accessories-text-editor"></input>
755 <action type="lauch">leafpad /etc/daemons.conf</action>
756 </button>
757 </hbox>
758 <hbox>
759 <text use-markup="true">
760 <label>"<b>Banner :</b>"</label>
761 </text>
762 <entry editable="false">'
763 [ -n "$DROPBEAR_BANNER" ] && tmp="$tmp$tmp2<default>$DROPBEAR_BANNER</default>"
764 tmp2='
765 <variable>DROPBEAR_BANNER</variable>
766 </entry>
767 <button>
768 <input file icon="accessories-text-editor"></input>
769 <action type="lauch">leafpad $DROPBEAR_BANNER</action>
770 </button>
771 </hbox>
772 <hbox>
773 <text use-markup="true">
774 <label>"<b>Remote :</b>"</label>
775 </text>
776 <entry>
777 <variable>DROPBEAR_PEER</variable>
778 <default>user@elsewhere</default>
779 </entry>
780 <button>
781 <input file icon="utilities-terminal"></input>
782 <label>Connect</label>
783 <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>
784 </button>
785 <button>
786 <input file icon="go-up"></input>
787 <label>Send key</label>
788 <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>
789 </button>
790 </hbox>
791 <hbox>
792 <button>
793 <label>Start</label>
794 <input file icon="forward"></input>
795 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
796 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dropbear \1\"/" /etc/rcS.conf</action>
797 <action>/etc/init.d/dropbear start</action>
798 </button>
799 <button>
800 <label>Stop</label>
801 <input file icon="stop"></input>
802 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
803 <action>/etc/init.d/dropbear stop</action>
804 </button>
805 </hbox>
806 </frame>
807 '
808 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
809 tmp='<frame Inetd>
810 <hbox>
811 <text use-markup="true">
812 <label>"<b>INETD_OPTIONS</b>"</label>
813 </text>
814 <entry editable="false">'
815 [ -n "$INETD_OPTS" ] && tmp="$tmp<default>$INETD_OPTS</default>"
816 tmp2='
817 <variable>INETD_OPTS</variable>
818 </entry>
819 <button>
820 <input file icon="help"></input>
821 <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>
822 </button>
823 <button>
824 <input file icon="accessories-text-editor"></input>
825 <action type="lauch">leafpad /etc/daemons.conf</action>
826 </button>
827 </hbox>
828 <hbox>
829 <text use-markup="true">
830 <label>"<b>Configuration :</b>"</label>
831 </text>
832 <entry editable="false">
833 <default>/etc/inetd.conf</default>
834 <variable>INETD_CONF</variable>
835 </entry>
836 <button>
837 <input file icon="accessories-text-editor"></input>
838 <action type="lauch">leafpad $INETD_CONF</action>
839 </button>
840 </hbox>
841 <hbox>
842 '
843 tmp="$tmp$tmp2"
844 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
845 i=$(basename $i)
846 tmp2="
847 <button>
848 <input file icon=\"help\"></input>
849 <label>$i</label>
850 <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>
851 </button>
852 "
853 tmp="$tmp$tmp2"
854 done
855 tmp2='
856 <button>
857 <label>Start</label>
858 <input file icon="forward"></input>
859 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
860 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"inetd \1\"/" /etc/rcS.conf</action>
861 <action>/etc/init.d/inetd start</action>
862 </button>
863 <button>
864 <label>Stop</label>
865 <input file icon="stop"></input>
866 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
867 <action>/etc/init.d/inetd stop</action>
868 </button>
869 </hbox>
870 </frame>
871 '
872 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
873 if [ -x /sbin/zcip -a -z "$ZCIP_OPTS" ]; then
874 ZCIP_OPTS="eth0 /etc/zcip.script"
875 cat >> /etc/daemons.conf <<EOT
876 # ZeroConf options
877 ZCIP_OPTS="$ZCIP_OPTS"
879 EOT
880 fi
881 tmp='<frame Zcip>
882 <hbox>
883 <text use-markup="true">
884 <label>"<b>ZCIP_OPTIONS</b>"</label>
885 </text>
886 <entry editable="false">'
887 [ -n "$ZCIP_OPTS" ] && tmp="$tmp<default>$ZCIP_OPTS</default>"
888 tmp2='
889 <variable>CZIP_OPTS</variable>
890 </entry>
891 <button>
892 <input file icon="help"></input>
893 <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>
894 </button>
895 <button>
896 <input file icon="accessories-text-editor"></input>
897 <action type="lauch">leafpad /etc/daemons.conf</action>
898 </button>
899 </hbox>
900 <hbox>
901 <text use-markup="true">
902 <label>"<b>Script :</b>"</label>
903 </text>
904 <entry editable="false">
905 <default>/etc/zcip.script</default>
906 <variable>CZIP_SCRIPT</variable>
907 </entry>
908 <button>
909 <input file icon="accessories-text-editor"></input>
910 <action type="lauch">leafpad $CZIP_SCRIPT</action>
911 </button>
912 </hbox>
913 <hbox>
914 <button>
915 <label>Start</label>
916 <input file icon="forward"></input>
917 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
918 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"zcip \1\"/" /etc/rcS.conf</action>
919 <action>/etc/init.d/zcip start</action>
920 </button>
921 <button>
922 <label>Stop</label>
923 <input file icon="stop"></input>
924 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
925 <action>/etc/init.d/zcip stop</action>
926 </button>
927 </hbox>
928 </frame>
929 '
930 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}$tmp$tmp2"
931 tmp='<frame Dhcpd>
932 <hbox>
933 <text use-markup="true">
934 <label>"<b>UDHCPD_OPTIONS</b>"</label>
935 </text>
936 <entry editable="false">'
937 [ -n "$UDHCPD_OPTS" ] && tmp="$tmp<default>$UDHCPD_OPTS</default>"
938 tmp2='
939 <variable>UDHCPD_OPTS</variable>
940 </entry>
941 <button>
942 <input file icon="help"></input>
943 <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>
944 </button>
945 <button>
946 <input file icon="accessories-text-editor"></input>
947 <action type="lauch">leafpad /etc/daemons.conf</action>
948 </button>
949 </hbox>
950 <hbox>
951 <text use-markup="true">
952 <label>"<b>Configuration :</b>"</label>
953 </text>
954 <entry editable="false">
955 <default>/etc/udhcpd.conf</default>
956 <variable>UDHCPD_CONF</variable>
957 </entry>
958 <button>
959 <input file icon="accessories-text-editor"></input>
960 <action type="lauch">leafpad $UDHCPD_CONF</action>
961 </button>
962 </hbox>
963 <hbox>
964 <text use-markup="true">
965 <label>"<b>Script :</b>"</label>
966 </text>
967 <entry editable="false">
968 <default>/usr/share/udhcpc/default.script</default>
969 <variable>UDHCPD_SCRIPT</variable>
970 </entry>
971 <button>
972 <input file icon="accessories-text-editor"></input>
973 <action type="lauch">leafpad $UDHCPD_SCRIPT</action>
974 </button>
975 </hbox>
976 <hbox>
977 <button>
978 <label>Start</label>
979 <input file icon="forward"></input>
980 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
981 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"udhcpd \1\"/" /etc/rcS.conf</action>
982 <action>/etc/init.d/udhcpd start</action>
983 </button>
984 <button>
985 <label>Stop</label>
986 <input file icon="stop"></input>
987 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
988 <action>/etc/init.d/udhcpd stop</action>
989 </button>
990 </hbox>
991 </frame>
992 '
993 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}$tmp$tmp2"
994 tmp='<frame Pxelinux>
995 <hbox>
996 <text wrap="true">
997 <label>
998 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
999 </label>
1000 </text>
1001 </hbox>
1002 <hbox>
1003 <text use-markup="true">
1004 <label>"<b>Configuration :</b>"</label>
1005 </text>
1006 <entry editable="false">
1007 <default>'
1008 tmp="$tmp$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')"
1009 tmp2='/pxelinux.cfg/default</default>
1010 <variable>PXE_CONF</variable>
1011 </entry>
1012 <button>
1013 <input file icon="accessories-text-editor"></input>
1014 <action>dir=$(dirname $PXE_CONF); [ -d $dir ] || mkdir -p $dir</action>
1015 <action>lzma d /usr/share/boot/pxelinux.0.lzma $(dirname $PXE_CONF)/../pxelinux.0</action>
1016 <action>grep -q "^boot_file" $UDHCPD_CONF || echo "boot_file pxelinux.0" >> $UDHCPD_CONF</action>
1017 <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> $UDHCPD_CONF</action>
1018 <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>
1019 <action type="lauch">leafpad $PXE_CONF</action>
1020 </button>
1021 </hbox>
1022 <hbox>
1023 <button>
1024 <input file icon="system-file-manager"></input>
1025 <label>Network boot files</label>
1026 <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>
1027 </button>
1028 </hbox>
1029 </frame>
1031 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
1032 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] && NET_BOX="$NET_BOX$tmp$tmp2"
1033 tmp='<frame Dnsd>
1034 <hbox>
1035 <text use-markup="true">
1036 <label>"<b>DNSD_OPTIONS</b>"</label>
1037 </text>
1038 <entry editable="false">'
1039 [ -n "$DNSD_OPTIONS" ] && tmp="$tmp<default>$DNSD_OPTIONS</default>"
1040 tmp2='
1041 <variable>DNSD_OPTS</variable>
1042 </entry>
1043 <button>
1044 <input file icon="help"></input>
1045 <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>
1046 </button>
1047 <button>
1048 <input file icon="accessories-text-editor"></input>
1049 <action type="lauch">leafpad /etc/daemons.conf</action>
1050 </button>
1051 </hbox>
1052 <hbox>
1053 <text use-markup="true">
1054 <label>"<b>Configuration :</b>"</label>
1055 </text>
1056 <entry editable="false">
1057 <default>/etc/dnsd.conf</default>
1058 <variable>DNSD_CONF</variable>
1059 </entry>
1060 <button>
1061 <input file icon="accessories-text-editor"></input>
1062 <action type="lauch">leafpad $DNSD_CONF</action>
1063 </button>
1064 </hbox>
1065 <hbox>
1066 <button>
1067 <label>Start</label>
1068 <input file icon="forward"></input>
1069 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1070 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dnsd \1\"/" /etc/rcS.conf</action>
1071 <action>/etc/init.d/dnsd start</action>
1072 </button>
1073 <button>
1074 <label>Stop</label>
1075 <input file icon="stop"></input>
1076 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1077 <action>/etc/init.d/dnsd stop</action>
1078 </button>
1079 </hbox>
1080 </frame>
1082 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1083 tmp='<frame Rsync>
1084 <hbox>
1085 <text use-markup="true">
1086 <label>"<b>RSYNCD_OPTIONS</b>"</label>
1087 </text>
1088 <entry editable="false">'
1089 [ -n "${RSYNCD_OPTIONS#* }" ] && tmp="$tmp<default>${RSYNCD_OPTIONS#* }</default>"
1090 tmp2='
1091 <variable>RSYNC_OPTS</variable>
1092 </entry>
1093 <button>
1094 <input file icon="help"></input>
1095 <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>
1096 </button>
1097 <button>
1098 <input file icon="accessories-text-editor"></input>
1099 <action type="lauch">leafpad /etc/daemons.conf</action>
1100 </button>
1101 </hbox>
1102 <hbox>
1103 <text use-markup="true">
1104 <label>"<b>Configuration :</b>"</label>
1105 </text>
1106 <entry editable="false">
1107 <default>/etc/rsyncd.conf</default>
1108 <variable>RSYNCD_CONF</variable>
1109 </entry>
1110 <button>
1111 <input file icon="accessories-text-editor"></input>
1112 <action type="lauch">leafpad $RSYNCD_CONF</action>
1113 </button>
1114 </hbox>
1115 <hbox>
1116 <text use-markup="true">
1117 <label>"<b>Secrets file :</b>"</label>
1118 </text>
1119 <entry editable="true">
1120 <default>/etc/rsyncd.secrets</default>
1121 <variable>RSYNCD_SECRETS</variable>
1122 </entry>
1123 <button>
1124 <input file icon="accessories-text-editor"></input>
1125 <action type="lauch">leafpad $RSYNCD_SECRETS</action>
1126 </button>
1127 </hbox>
1128 <hbox>
1129 <button>
1130 <label>Start</label>
1131 <input file icon="forward"></input>
1132 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1133 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"rsyncd \1\"/" /etc/rcS.conf</action>
1134 <action>/etc/init.d/rsyncd start</action>
1135 </button>
1136 <button>
1137 <label>Stop</label>
1138 <input file icon="stop"></input>
1139 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1140 <action>/etc/init.d/rsyncd stop</action>
1141 </button>
1142 </hbox>
1143 </frame>
1145 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1146 tmp='<frame Lighttpd>'
1147 tmp2='<frame PHP>
1148 <hbox>
1149 <text use-markup="true">
1150 <label>"<b>Configuration :</b>"</label>
1151 </text>
1152 <entry editable="false">
1153 <default>/etc/php.ini</default>
1154 <variable>PHP_CONF</variable>
1155 </entry>
1156 <button>
1157 <input file icon="accessories-text-editor"></input>
1158 <action type="lauch">leafpad $PHP_CONF</action>
1159 </button>
1160 </hbox>
1161 </frame>
1163 [ -f /etc/php.ini ] && tmp="${tmp}${tmp2}"
1164 tmp2='<hbox>
1165 <text use-markup="true">
1166 <label>"<b>Configuration :</b>"</label>
1167 </text>
1168 <entry editable="false">
1169 <default>/etc/lighttpd/lighttpd.conf</default>
1170 <variable>LIGHTTPD_CONF</variable>
1171 </entry>
1172 <button>
1173 <input file icon="accessories-text-editor"></input>
1174 <action type="lauch">leafpad $LIGHTTPD_CONF</action>
1175 </button>
1176 </hbox>
1177 <hbox>
1178 <button>
1179 <label>Start</label>
1180 <input file icon="forward"></input>
1181 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1182 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"lighttpd \1\"/" /etc/rcS.conf</action>
1183 <action>/etc/init.d/lighttpd start</action>
1184 </button>
1185 <button>
1186 <label>Stop</label>
1187 <input file icon="stop"></input>
1188 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1189 <action>/etc/init.d/lighttpd stop</action>
1190 </button>
1191 </hbox>
1192 </frame>
1194 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1195 tmp='<frame Samba: smbd & nmbd>
1196 <hbox>
1197 <text use-markup="true">
1198 <label>"<b>Configuration :</b>"</label>
1199 </text>
1200 <entry editable="false">
1201 <default>/etc/samba/smb.conf</default>
1202 <variable>SMBD_CONF</variable>
1203 </entry>
1204 <button>
1205 <input file icon="accessories-text-editor"></input>
1206 <action type="lauch">leafpad $SMBD_CONF</action>
1207 </button>
1208 </hbox>
1209 <hbox>
1210 <button>
1211 <label>Reload</label>
1212 <input file icon="reload"></input>
1213 <action>/etc/init.d/samba reload</action>
1214 </button>
1215 <button>
1216 <label>Start</label>
1217 <input file icon="forward"></input>
1218 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1219 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"samba \1\"/" /etc/rcS.conf</action>
1220 <action>/etc/init.d/samba start</action>
1221 </button>
1222 <button>
1223 <label>Stop</label>
1224 <input file icon="stop"></input>
1225 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1226 <action>/etc/init.d/samba stop</action>
1227 </button>
1228 </hbox>
1229 </frame>
1231 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}"
1232 tmp='<frame x11vnc>
1233 <hbox>
1234 <text use-markup="true">
1235 <label>"<b>X11VNC_OPTIONS</b>"</label>
1236 </text>
1237 <entry editable="false">'
1238 [ -n "$X11VNC_OPTIONS" ] && tmp="$tmp<default>$X11VNC_OPTIONS</default>"
1239 tmp2='
1240 <variable>X11VNC_OPTS</variable>
1241 </entry>
1242 <button>
1243 <input file icon="help"></input>
1244 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "x11vnc daemon help (q to quit)" -e "x11vnc --help | less"</action>
1245 </button>
1246 <button>
1247 <input file icon="accessories-text-editor"></input>
1248 <action type="lauch">leafpad /etc/daemons.conf</action>
1249 </button>
1250 </hbox>
1251 <hbox>
1252 <text use-markup="true">
1253 <label>"<b>New password</b>"</label>
1254 </text>
1255 <entry>
1256 <variable>X11VNC_PASSWD</variable>
1257 </entry>
1258 <button>
1259 <input file icon="reload"></input>
1260 <label>Update</label>
1261 <action>x11vnc -storepasswd $X11VNC_PASSWD /etc/vnc.secret</action>
1262 </button>
1263 </hbox>
1264 <hbox>
1265 <button>
1266 <label>Start</label>
1267 <input file icon="forward"></input>
1268 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1269 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"x11vnc \1\"/" /etc/rcS.conf</action>
1270 <action>/etc/init.d/x11vnc start</action>
1271 </button>
1272 <button>
1273 <label>Stop</label>
1274 <input file icon="stop"></input>
1275 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1276 <action>/etc/init.d/x11vnc stop</action>
1277 </button>
1278 </hbox>
1279 </frame>
1281 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1282 NET_BOX="${NET_BOX}
1283 </notebook>
1285 tmp='<frame Iptables>
1286 <hbox>
1287 <text use-markup="true">
1288 <label>"<b>Configuration :</b>"</label>
1289 </text>
1290 <entry editable="false">
1291 <default>/etc/iptables.conf</default>
1292 <variable>IPTABLES_CONF</variable>
1293 </entry>
1294 <button>
1295 <input file icon="accessories-text-editor"></input>
1296 <action type="lauch">leafpad $IPTABLES_CONF</action>
1297 </button>
1298 </hbox>
1299 <hbox>
1300 <button>
1301 <label>Load</label>
1302 <input file icon="reload"></input>
1303 <action>cat $IPTABLES_CONF | /sbin/iptables-restore</action>
1304 </button>
1305 <button>
1306 <label>Save</label>
1307 <input file icon="go-jump"></input>
1308 <action>/sbin/iptables-save > $IPTABLES_CONF</action>
1309 </button>
1310 </hbox>
1311 </frame>
1313 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX${tmp}"
1314 tmp='
1315 <frame Ether-wake>
1316 <hbox>
1317 <text use-markup="true">
1318 <label>"<b>Machines :</b>"</label>
1319 </text>
1320 <entry editable="false">
1321 <default>/etc/ethers</default>
1322 <variable>ETHERS</variable>
1323 </entry>
1324 <button>
1325 <input file icon="accessories-text-editor"></input>
1326 <action>[ -s $ETHERS ] || echo "#00:01:02:03:04:05 mystation" >$ETHERS</action>
1327 <action type="lauch">leafpad $ETHERS</action>
1328 </button>
1329 </hbox>
1330 <hbox>
1331 <text use-markup="true">
1332 <label>"<b>Options : </b>"</label>
1333 </text>
1334 <entry editable="false">
1335 <variable>ETHERWAKE_OPTS</variable>
1336 </entry>
1337 <button>
1338 <input file icon="help"></input>
1339 <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>
1340 </button>
1341 <button>
1342 <label>Start</label>
1343 <input file icon="forward"></input>
1344 <action>ether-wake $ETHERWAKE_OPTS</action>
1345 </button>
1346 </hbox>
1347 </frame>
1348 </notebook>
1350 <hbox>
1351 <button>
1352 <label>Status</label>
1353 <input file icon="dialog-information"></input>
1354 <action type="launch">IFCONFIG</action>
1355 </button>
1356 <button help>
1357 <label>Help</label>
1358 <action type="launch">HELP</action>
1359 </button>
1360 <button>
1361 <label>Quit</label>
1362 <input file icon="exit"></input>
1363 <action type="exit">Exit</action>
1364 </button>
1365 </hbox>
1367 </vbox>
1368 </window>
1370 NET_BOX="${NET_BOX}${tmp}"
1372 export NET_BOX
1374 # TODO: Modules(Network kernel modules) VPN(OpenVPN)
1376 # Only root can configure network.
1377 check_root
1378 # Configure and connect if button Connect was pressed.
1379 if ! grep -qs ^name /etc/ppp/options ; then
1380 # Generate /etc/ppp/options
1381 cat > /etc/ppp/options << _EOT_
1382 plugin rp-pppoe.so
1383 name provider-ID
1384 noipdefault
1385 defaultroute
1386 mtu 1492
1387 mru 1492
1388 lock
1389 _EOT_
1390 # Generate /etc/ppp/pap-secrets
1391 cat > /etc/ppp/pap-secrets << _EOT_
1392 # Secrets for authentication using PAP
1393 # client server secret IP addresses
1394 _EOT_
1395 # Generate /etc/ppp/chap-secrets
1396 cat > /etc/ppp/chap-secrets << _EOT_
1397 # Secrets for authentication using CHAP
1398 # client server secret IP addresses
1399 _EOT_
1400 fi
1401 gtkdialog --center --program=NET_BOX
1403 exit 0