slitaz-tools view tinyutils/netbox @ rev 208

calendar: no more hardcoded date
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue May 27 15:32:37 2008 +0000 (2008-05-27)
parents d95c13d35c0a
children bfbb1b457dc4
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 /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}${tmp}DHCP" && tmp='|'
591 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
592 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] \
593 && NET_BOX="${NET_BOX}${tmp}PXE" && tmp='|'
594 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}DNS" && tmp='|'
595 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}RSYNC" && tmp='|'
596 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}HTTP" && tmp='|'
597 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|'
598 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}VNC" && tmp='|'
599 . /etc/daemons.conf
600 set -- $DROPBEAR_OPTIONS
601 while [ -n "$2" ]; do
602 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
603 shift
604 done
605 NET_BOX="${NET_BOX}\">"
606 tmp='<frame Dropbear>
607 <hbox>
608 <text use-markup="true">
609 <label>"<b>DROPBEAR_OPTIONS</b>"</label>
610 </text>
611 <entry editable="false">'
612 [ -n "$DROPBEAR_OPTIONS" ] && tmp="$tmp<default>$DROPBEAR_OPTIONS</default>"
613 tmp2='
614 <variable>DROPBEAR_OPTS</variable>
615 </entry>
616 <button>
617 <input file icon="help"></input>
618 <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>
619 </button>
620 <button>
621 <input file icon="accessories-text-editor"></input>
622 <action type="lauch">leafpad /etc/daemons.conf</action>
623 </button>
624 </hbox>
625 <hbox>
626 <text use-markup="true">
627 <label>"<b>Banner :</b>"</label>
628 </text>
629 <entry editable="false">'
630 [ -n "$DROPBEAR_BANNER" ] && tmp="$tmp$tmp2<default>$DROPBEAR_BANNER</default>"
631 tmp2='
632 <variable>DROPBEAR_BANNER</variable>
633 </entry>
634 <button>
635 <input file icon="accessories-text-editor"></input>
636 <action type="lauch">leafpad $DROPBEAR_BANNER</action>
637 </button>
638 </hbox>
639 <hbox>
640 <text use-markup="true">
641 <label>"<b>Remote :</b>"</label>
642 </text>
643 <entry>
644 <variable>DROPBEAR_PEER</variable>
645 <default>user@elsewhere</default>
646 </entry>
647 <button>
648 <input file icon="utilities-terminal"></input>
649 <label>Connect</label>
650 <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>
651 </button>
652 <button>
653 <input file icon="go-up"></input>
654 <label>Send key</label>
655 <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>
656 </button>
657 </hbox>
658 <hbox>
659 <button>
660 <label>Start</label>
661 <input file icon="forward"></input>
662 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
663 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dropbear \1\"/" /etc/rcS.conf</action>
664 <action>/etc/init.d/dropbear start</action>
665 </button>
666 <button>
667 <label>Stop</label>
668 <input file icon="stop"></input>
669 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
670 <action>/etc/init.d/dropbear stop</action>
671 </button>
672 </hbox>
673 </frame>
674 '
675 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
676 tmp='<frame Inetd>
677 <hbox>
678 <text use-markup="true">
679 <label>"<b>INETD_OPTIONS</b>"</label>
680 </text>
681 <entry editable="false">'
682 [ -n "$INETD_OPTS" ] && tmp="$tmp<default>$INETD_OPTS</default>"
683 tmp2='
684 <variable>INETD_OPTS</variable>
685 </entry>
686 <button>
687 <input file icon="help"></input>
688 <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>
689 </button>
690 <button>
691 <input file icon="accessories-text-editor"></input>
692 <action type="lauch">leafpad /etc/daemons.conf</action>
693 </button>
694 </hbox>
695 <hbox>
696 <text use-markup="true">
697 <label>"<b>Configuration :</b>"</label>
698 </text>
699 <entry editable="false">
700 <default>/etc/inetd.conf</default>
701 <variable>INETD_CONF</variable>
702 </entry>
703 <button>
704 <input file icon="accessories-text-editor"></input>
705 <action type="lauch">leafpad $INETD_CONF</action>
706 </button>
707 </hbox>
708 <hbox>
709 '
710 tmp="$tmp$tmp2"
711 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
712 i=$(basename $i)
713 tmp2="
714 <button>
715 <input file icon=\"help\"></input>
716 <label>$i</label>
717 <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>
718 </button>
719 "
720 tmp="$tmp$tmp2"
721 done
722 tmp2='
723 <button>
724 <label>Start</label>
725 <input file icon="forward"></input>
726 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
727 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"inetd \1\"/" /etc/rcS.conf</action>
728 <action>/etc/init.d/inetd start</action>
729 </button>
730 <button>
731 <label>Stop</label>
732 <input file icon="stop"></input>
733 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
734 <action>/etc/init.d/inetd stop</action>
735 </button>
736 </hbox>
737 </frame>
738 '
739 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
740 tmp='<frame Dhcpd>
741 <hbox>
742 <text use-markup="true">
743 <label>"<b>UDHCPD_OPTIONS</b>"</label>
744 </text>
745 <entry editable="false">'
746 [ -n "$UDHCPD_OPTS" ] && tmp="$tmp<default>$UDHCPD_OPTS</default>"
747 tmp2='
748 <variable>UDHCPD_OPTS</variable>
749 </entry>
750 <button>
751 <input file icon="help"></input>
752 <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>
753 </button>
754 <button>
755 <input file icon="accessories-text-editor"></input>
756 <action type="lauch">leafpad /etc/daemons.conf</action>
757 </button>
758 </hbox>
759 <hbox>
760 <text use-markup="true">
761 <label>"<b>Configuration :</b>"</label>
762 </text>
763 <entry editable="false">
764 <default>/etc/udhcpd.conf</default>
765 <variable>UDHCPD_CONF</variable>
766 </entry>
767 <button>
768 <input file icon="accessories-text-editor"></input>
769 <action type="lauch">leafpad $UDHCPD_CONF</action>
770 </button>
771 </hbox>
772 <hbox>
773 <button>
774 <label>Start</label>
775 <input file icon="forward"></input>
776 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
777 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"udhcpd \1\"/" /etc/rcS.conf</action>
778 <action>/etc/init.d/udhcpd start</action>
779 </button>
780 <button>
781 <label>Stop</label>
782 <input file icon="stop"></input>
783 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
784 <action>/etc/init.d/udhcpd stop</action>
785 </button>
786 </hbox>
787 </frame>
788 '
789 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}$tmp$tmp2"
790 tmp='<frame Pxelinux>
791 <hbox>
792 <text wrap="true">
793 <label>
794 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
795 </label>
796 </text>
797 </hbox>
798 <hbox>
799 <text use-markup="true">
800 <label>"<b>Configuration :</b>"</label>
801 </text>
802 <entry editable="false">
803 <default>'
804 tmp="$tmp$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')"
805 tmp2='/pxelinux.cfg/default</default>
806 <variable>PXE_CONF</variable>
807 </entry>
808 <button>
809 <input file icon="accessories-text-editor"></input>
810 <action>dir=$(dirname $PXE_CONF); [ -d $dir ] || mkdir -p $dir</action>
811 <action>lzma d /usr/share/boot/pxelinux.0.lzma $(dirname $PXE_CONF)/../pxelinux.0</action>
812 <action>grep -q "^boot_file" $UDHCPD_CONF || echo "boot_file pxelinux.0" >> $UDHCPD_CONF</action>
813 <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> $UDHCPD_CONF</action>
814 <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>
815 <action type="lauch">leafpad $PXE_CONF</action>
816 </button>
817 </hbox>
818 <hbox>
819 <button>
820 <input file icon="system-file-manager"></input>
821 <label>Network boot files</label>
822 <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>
823 </button>
824 </hbox>
825 </frame>
826 '
827 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
828 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] && NET_BOX="$NET_BOX$tmp$tmp2"
829 tmp='<frame Dnsd>
830 <hbox>
831 <text use-markup="true">
832 <label>"<b>DNSD_OPTIONS</b>"</label>
833 </text>
834 <entry editable="false">'
835 [ -n "$DNSD_OPTIONS" ] && tmp="$tmp<default>$DNSD_OPTIONS</default>"
836 tmp2='
837 <variable>DNSD_OPTS</variable>
838 </entry>
839 <button>
840 <input file icon="help"></input>
841 <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>
842 </button>
843 <button>
844 <input file icon="accessories-text-editor"></input>
845 <action type="lauch">leafpad /etc/daemons.conf</action>
846 </button>
847 </hbox>
848 <hbox>
849 <text use-markup="true">
850 <label>"<b>Configuration :</b>"</label>
851 </text>
852 <entry editable="false">
853 <default>/etc/dnsd.conf</default>
854 <variable>DNSD_CONF</variable>
855 </entry>
856 <button>
857 <input file icon="accessories-text-editor"></input>
858 <action type="lauch">leafpad $DNSD_CONF</action>
859 </button>
860 </hbox>
861 <hbox>
862 <button>
863 <label>Start</label>
864 <input file icon="forward"></input>
865 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
866 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dnsd \1\"/" /etc/rcS.conf</action>
867 <action>/etc/init.d/dnsd start</action>
868 </button>
869 <button>
870 <label>Stop</label>
871 <input file icon="stop"></input>
872 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
873 <action>/etc/init.d/dnsd stop</action>
874 </button>
875 </hbox>
876 </frame>
877 '
878 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
879 tmp='<frame Rsync>
880 <hbox>
881 <text use-markup="true">
882 <label>"<b>RSYNCD_OPTIONS</b>"</label>
883 </text>
884 <entry editable="false">'
885 [ -n "${RSYNCD_OPTIONS#* }" ] && tmp="$tmp<default>${RSYNCD_OPTIONS#* }</default>"
886 tmp2='
887 <variable>RSYNC_OPTS</variable>
888 </entry>
889 <button>
890 <input file icon="help"></input>
891 <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>
892 </button>
893 <button>
894 <input file icon="accessories-text-editor"></input>
895 <action type="lauch">leafpad /etc/daemons.conf</action>
896 </button>
897 </hbox>
898 <hbox>
899 <text use-markup="true">
900 <label>"<b>Configuration :</b>"</label>
901 </text>
902 <entry editable="false">
903 <default>/etc/rsyncd.conf</default>
904 <variable>RSYNCD_CONF</variable>
905 </entry>
906 <button>
907 <input file icon="accessories-text-editor"></input>
908 <action type="lauch">leafpad $RSYNCD_CONF</action>
909 </button>
910 </hbox>
911 <hbox>
912 <text use-markup="true">
913 <label>"<b>Secrets file :</b>"</label>
914 </text>
915 <entry editable="true">
916 <default>/etc/rsyncd.secrets</default>
917 <variable>RSYNCD_SECRETS</variable>
918 </entry>
919 <button>
920 <input file icon="accessories-text-editor"></input>
921 <action type="lauch">leafpad $RSYNCD_SECRETS</action>
922 </button>
923 </hbox>
924 <hbox>
925 <button>
926 <label>Start</label>
927 <input file icon="forward"></input>
928 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
929 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"rsyncd \1\"/" /etc/rcS.conf</action>
930 <action>/etc/init.d/rsyncd start</action>
931 </button>
932 <button>
933 <label>Stop</label>
934 <input file icon="stop"></input>
935 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
936 <action>/etc/init.d/rsyncd stop</action>
937 </button>
938 </hbox>
939 </frame>
940 '
941 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
942 tmp='<frame Lighttpd>'
943 tmp2='<frame PHP>
944 <hbox>
945 <text use-markup="true">
946 <label>"<b>Configuration :</b>"</label>
947 </text>
948 <entry editable="false">
949 <default>/etc/php.ini</default>
950 <variable>PHP_CONF</variable>
951 </entry>
952 <button>
953 <input file icon="accessories-text-editor"></input>
954 <action type="lauch">leafpad $PHP_CONF</action>
955 </button>
956 </hbox>
957 </frame>
958 '
959 [ -f /etc/php.ini ] && tmp="${tmp}${tmp2}"
960 tmp2='<hbox>
961 <text use-markup="true">
962 <label>"<b>Configuration :</b>"</label>
963 </text>
964 <entry editable="false">
965 <default>/etc/lighttpd/lighttpd.conf</default>
966 <variable>LIGHTTPD_CONF</variable>
967 </entry>
968 <button>
969 <input file icon="accessories-text-editor"></input>
970 <action type="lauch">leafpad $LIGHTTPD_CONF</action>
971 </button>
972 </hbox>
973 <hbox>
974 <button>
975 <label>Start</label>
976 <input file icon="forward"></input>
977 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
978 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"lighttpd \1\"/" /etc/rcS.conf</action>
979 <action>/etc/init.d/lighttpd start</action>
980 </button>
981 <button>
982 <label>Stop</label>
983 <input file icon="stop"></input>
984 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
985 <action>/etc/init.d/lighttpd stop</action>
986 </button>
987 </hbox>
988 </frame>
989 '
990 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
991 tmp='<frame Samba: smbd & nmbd>
992 <hbox>
993 <text use-markup="true">
994 <label>"<b>Configuration :</b>"</label>
995 </text>
996 <entry editable="false">
997 <default>/etc/samba/smb.conf</default>
998 <variable>SMBD_CONF</variable>
999 </entry>
1000 <button>
1001 <input file icon="accessories-text-editor"></input>
1002 <action type="lauch">leafpad $SMBD_CONF</action>
1003 </button>
1004 </hbox>
1005 <hbox>
1006 <button>
1007 <label>Reload</label>
1008 <input file icon="reload"></input>
1009 <action>/etc/init.d/samba reload</action>
1010 </button>
1011 <button>
1012 <label>Start</label>
1013 <input file icon="forward"></input>
1014 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1015 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"samba \1\"/" /etc/rcS.conf</action>
1016 <action>/etc/init.d/samba start</action>
1017 </button>
1018 <button>
1019 <label>Stop</label>
1020 <input file icon="stop"></input>
1021 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1022 <action>/etc/init.d/samba stop</action>
1023 </button>
1024 </hbox>
1025 </frame>
1027 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}"
1028 tmp='<frame x11vnc>
1029 <hbox>
1030 <text use-markup="true">
1031 <label>"<b>X11VNC_OPTIONS</b>"</label>
1032 </text>
1033 <entry editable="false">'
1034 [ -n "$X11VNC_OPTIONS" ] && tmp="$tmp<default>$X11VNC_OPTIONS</default>"
1035 tmp2='
1036 <variable>X11VNC_OPTS</variable>
1037 </entry>
1038 <button>
1039 <input file icon="help"></input>
1040 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "x11vnc daemon help (q to quit)" -e "x11vnc --help | less"</action>
1041 </button>
1042 <button>
1043 <input file icon="accessories-text-editor"></input>
1044 <action type="lauch">leafpad /etc/daemons.conf</action>
1045 </button>
1046 </hbox>
1047 <hbox>
1048 <text use-markup="true">
1049 <label>"<b>New password</b>"</label>
1050 </text>
1051 <entry>
1052 <variable>X11VNC_PASSWD</variable>
1053 </entry>
1054 <button>
1055 <input file icon="reload"></input>
1056 <label>Update</label>
1057 <action>x11vnc -storepasswd $X11VNC_PASSWD /etc/vnc.secret</action>
1058 </button>
1059 </hbox>
1060 <hbox>
1061 <button>
1062 <label>Start</label>
1063 <input file icon="forward"></input>
1064 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1065 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"x11vnc \1\"/" /etc/rcS.conf</action>
1066 <action>/etc/init.d/x11vnc start</action>
1067 </button>
1068 <button>
1069 <label>Stop</label>
1070 <input file icon="stop"></input>
1071 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1072 <action>/etc/init.d/x11vnc stop</action>
1073 </button>
1074 </hbox>
1075 </frame>
1077 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1078 NET_BOX="${NET_BOX}
1079 </notebook>
1081 tmp='<frame Iptables>
1082 <hbox>
1083 <text use-markup="true">
1084 <label>"<b>Configuration :</b>"</label>
1085 </text>
1086 <entry editable="false">
1087 <default>/etc/iptables.conf</default>
1088 <variable>IPTABLES_CONF</variable>
1089 </entry>
1090 <button>
1091 <input file icon="accessories-text-editor"></input>
1092 <action type="lauch">leafpad $IPTABLES_CONF</action>
1093 </button>
1094 </hbox>
1095 <hbox>
1096 <button>
1097 <label>Load</label>
1098 <input file icon="reload"></input>
1099 <action>cat $IPTABLES_CONF | /sbin/iptables-restore</action>
1100 </button>
1101 <button>
1102 <label>Save</label>
1103 <input file icon="go-jump"></input>
1104 <action>/sbin/iptables-save > $IPTABLES_CONF</action>
1105 </button>
1106 </hbox>
1107 </frame>
1109 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX${tmp}"
1110 tmp='
1111 <frame Ether-wake>
1112 <hbox>
1113 <text use-markup="true">
1114 <label>"<b>Machines :</b>"</label>
1115 </text>
1116 <entry editable="false">
1117 <default>/etc/ethers</default>
1118 <variable>ETHERS</variable>
1119 </entry>
1120 <button>
1121 <input file icon="accessories-text-editor"></input>
1122 <action>[ -s $ETHERS ] || echo "#00:01:02:03:04:05 mystation" >$ETHERS</action>
1123 <action type="lauch">leafpad $ETHERS</action>
1124 </button>
1125 </hbox>
1126 <hbox>
1127 <text use-markup="true">
1128 <label>"<b>Options : </b>"</label>
1129 </text>
1130 <entry editable="false">
1131 <variable>ETHERWAKE_OPTS</variable>
1132 </entry>
1133 <button>
1134 <input file icon="help"></input>
1135 <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>
1136 </button>
1137 <button>
1138 <label>Start</label>
1139 <input file icon="forward"></input>
1140 <action>ether-wake $ETHERWAKE_OPTS</action>
1141 </button>
1142 </hbox>
1143 </frame>
1144 </notebook>
1146 <hbox>
1147 <button>
1148 <label>Status</label>
1149 <input file icon="dialog-information"></input>
1150 <action type="launch">IFCONFIG</action>
1151 </button>
1152 <button help>
1153 <label>Help</label>
1154 <action type="launch">HELP</action>
1155 </button>
1156 <button>
1157 <label>Quit</label>
1158 <input file icon="exit"></input>
1159 <action type="exit">Exit</action>
1160 </button>
1161 </hbox>
1163 </vbox>
1164 </window>
1166 NET_BOX="${NET_BOX}${tmp}"
1168 export NET_BOX
1170 # TODO: Modules(Network kernel modules) VPN(OpenVPN)
1172 # Only root can configure network.
1173 check_root
1174 # Configure and connect if button Connect was pressed.
1175 if ! grep -qs ^name /etc/ppp/options ; then
1176 # Generate /etc/ppp/options
1177 cat > /etc/ppp/options << _EOT_
1178 plugin rp-pppoe.so
1179 name provider-ID
1180 noipdefault
1181 defaultroute
1182 mtu 1492
1183 mru 1492
1184 lock
1185 _EOT_
1186 # Generate /etc/ppp/pap-secrets
1187 cat > /etc/ppp/pap-secrets << _EOT_
1188 # Secrets for authentication using PAP
1189 # client server secret IP addresses
1190 _EOT_
1191 # Generate /etc/ppp/chap-secrets
1192 cat > /etc/ppp/chap-secrets << _EOT_
1193 # Secrets for authentication using CHAP
1194 # client server secret IP addresses
1195 _EOT_
1196 fi
1197 gtkdialog --center --program=NET_BOX
1199 exit 0