slitaz-tools view tinyutils/serverbox @ rev 546

serverbox: add mail servers
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Feb 07 12:08:47 2011 +0100 (2011-02-07)
parents 47800c6fea80
children eb7469a8467f
line source
1 #!/bin/sh
2 #
3 # Gtkdialog box to manage servers.
4 # Please use tab to indent.
6 VERSION=20100315
8 . /usr/lib/slitaz/gui_functions
10 # Check if user is root.
11 check_root()
12 {
13 if test $(id -u) != 0 ; then
14 echo -e "
15 You must be root to run `basename $0`. Please type 'su' and
16 root password to become super-user.\n"
17 exit 0
18 fi
19 }
20 #
21 # Status servers
22 #
23 tab_status_servers()
24 {
25 local servers
26 servers="dropbear sshd inetd dhcpd dnsd named rsync httpd mbd vnc pppd knock postfix fetchmail cyrus perdition slapd sql squid"
27 cat <<EOT
28 <frame Servers>
29 <text use-markup="true">
30 <label>"<b>Running servers :</b>"</label>
31 </text>
32 <text wrap="false" width-chars="58">
33 <input>for i in $servers; do ps ww | grep \$i | grep -v grep | fold -s; done</input>
34 </text>
35 </frame>
36 EOT
37 }
39 data_status()
40 {
41 cat <<EOT
42 ps Servers tab_status_servers
43 EOT
44 }
46 #
47 # Status
48 #
49 tab_status()
50 {
51 use_tab data_status
52 }
54 sshremote()
55 {
56 cat << EOT
57 <hbox>
58 <text use-markup="true">
59 <label>"<b>Remote :</b>"</label>
60 </text>
61 <entry>
62 <variable>$2</variable>
63 <default>user@elsewhere</default>
64 </entry>
65 <button>
66 <input file icon="utilities-terminal"></input>
67 <label>Connect</label>
68 <action>xterm -fa MiscFixed -fs 11 -bg black -fg white -geometry 80x25 -title "$1" -e "$1 \$$2 ; echo -e \"----\nENTER to continue...\" && read close" &</action>
69 </button>
70 <button>
71 <input file icon="go-up"></input>
72 <label>Send key</label>
73 <action>$xterm -geometry 80x10 -title "send ssh key" -e "$0 call sendsshkey \$$2; echo -e \"----\nENTER to continue...\" && read close"</action>
74 </button>
75 </hbox>
76 EOT
77 }
78 #
79 # Dropbear client & server
80 #
81 tab_dropbear()
82 {
83 . /etc/daemons.conf
84 set -- $DROPBEAR_OPTIONS
85 while [ -n "$2" ]; do
86 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
87 shift
88 done
90 cat <<EOT
91 <frame Dropbear>
92 $(helpdaemon dropbear 80x30 DROPBEAR_OPTIONS DROPBEAR_OPTS)
93 $(datafile /etc/dropbear/banner DROPBEAR_BANNER 'Banner :')
94 $(sshremote DROPBEAR_PEER 'dbclient -i /etc/dropbear/dropbear_rsa_host_key')
95 <hbox>
96 $(startstopdaemon dropbear)
97 </hbox>
98 </frame>
99 EOT
100 }
102 #
103 # OpenSSH client & server
104 #
105 tab_openssh()
106 {
107 cat <<EOT
108 <frame OpenSSH>
109 $(helpdaemon sshd 80x30 OPENSSH_OPTIONS OPENSSH_OPTS 8 nohelp)
110 $(configfile /etc/ssh/sshd_config OPENSSH_CONF '5 sshd_config')
111 $(sshremote OPENSSH_PEER 'ssh -i /etc/ssh/ssh_host_rsa_key')
112 <hbox>
113 $(startstopdaemon openssh)
114 </hbox>
115 </frame>
116 EOT
117 }
119 data_sshd()
120 {
121 cat <<EOT
122 dropbear Dropbear tab_dropbear
123 sshd OpenSSH tab_openssh
124 EOT
125 }
127 #
128 # SSH tab
129 #
130 tab_sshd()
131 {
132 use_tab data_sshd
133 }
135 #
136 # Busybox Inetd
137 #
138 tab_inetd()
139 {
140 cat <<EOT
141 <frame Inetd (busybox)>
142 $(helpdaemon inetd 60x14 INETD_OPTIONS INETD_OPTS)
143 $(configfile /etc/inetd.conf INETD_CONF)
144 <hbox>
145 EOT
146 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
147 i=$(basename $i)
148 helpbutton $i 60x19 $i
149 done
150 cat <<EOT
151 $(startstopdaemon inetd)
152 </hbox>
153 </frame>
154 EOT
155 }
157 #
158 # ZeroConf
159 #
160 tab_zcip()
161 {
163 . /etc/daemons.conf
164 if [ -x /sbin/zcip -a -z "$ZCIP_OPTIONS" ]; then
165 ZCIP_OPTIONS="eth0 /etc/zcip.script"
166 cat >> /etc/daemons.conf <<EOT
167 # ZeroConf options
168 ZCIP_OPTIONS="$ZCIP_OPTIONS"
170 EOT
171 fi
172 cat <<EOT
173 <frame Zcip (busybox)>
174 $(helpdaemon zcip 60x14 ZCIP_OPTIONS ZCIP_OPTS)
175 $(datafile /etc/zcip.script CZIP_SCRIPT 'Script :')
176 <hbox>
177 $(startstopdaemon zcip)
178 </hbox>
179 </frame>
180 EOT
181 }
183 #
184 # Dhcpd ISC
185 #
186 tab_isc_dhcpd()
187 {
188 cat <<EOT
189 <frame Dhcpd (ISC)>
190 $(helpdaemon dhcpd 60x14 DHCPD_OPTIONS DHCPD_OPTS)
191 $(configfile /etc/dhcpd.conf DHCPD_CONF)
192 <hbox>
193 $(startstopdaemon dhcpd dhcp)
194 </hbox>
195 </frame>
196 EOT
197 }
199 #
200 # Dhcpd Busybox
201 #
202 tab_udhcpd()
203 {
204 cat <<EOT
205 <frame Udhcpd (busybox)>
206 $(helpdaemon udhcpd 60x14 UDHCPD_OPTIONS UDHCPD_OPTS)
207 $(configfile /etc/udhcpd.conf UDHCPD_CONF)
208 <hbox>
209 $(startstopdaemon udhcpd busybox)
210 </hbox>
211 </frame>
212 EOT
213 }
215 data_dhcpd()
216 {
217 cat <<EOT
218 udhcpd Udhcpd tab_udhcpd
219 dhcpd Dhcpd tab_isc_dhcpd
220 dnsmasq DNSmasq tab_dnsmasq
221 EOT
222 }
224 #
225 # dhcpd tab
226 #
227 tab_dhcpd()
228 {
229 use_tab data_dhcpd
230 }
232 #
233 # PXE forwarder
234 #
235 tab_gpxe()
236 {
237 cat <<EOT
238 <frame PXE forwarder>
239 <hbox>
240 <text use-markup="true">
241 <label>"<b>WEB boot URL(s) :</b>"</label>
242 </text>
243 </hbox>
244 <hbox>
245 <entry editable="true">
246 <default>
247 "$(dd bs=1 skip=5 count=255 if=/usr/share/boot/gpxe.pxe 2> /dev/null | strings)"
248 </default>
249 <variable>WEB_PXE</variable>
250 </entry>
251 </hbox>
252 <hbox>
253 $(wikibutton http://doc.slitaz.org/en:guides:pxe)
254 <button>
255 <input file icon="go-jump"></input>
256 <label>Install</label>
257 <action>
258 echo -n "\$WEB_PXE" | cat - /dev/zero | \
259 dd conv=notrunc bs=1 seek=5 count=255 of=/usr/share/boot/gpxe.pxe
260 </action>
261 <action>
262 sed -i "s|tftpd -r .*\$|tftpd -r /usr/share/boot|" /etc/inetd.conf
263 </action>
264 <action> sed -i "/^boot_file/d" \$UDHCPD_CONF </action>
265 <action> echo "boot_file gpxe.pxe" >> \$UDHCPD_CONF </action>
266 <action> /etc/init.d/inetd restart </action>
267 <action> /etc/init.d/udhcpd restart </action>
268 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)inetd \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
269 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)udhcpd \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
270 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"udhcpd inetd \1\\"/" /etc/rcS.conf</action>
271 </button>
272 </hbox>
273 </frame>
274 EOT
275 }
277 #
278 # PXE server
279 #
280 tab_pxelinux()
281 {
282 cat <<EOT
283 <frame PXElinux>
284 <hbox>
285 <text wrap="true">
286 <label>
287 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
288 </label>
289 </text>
290 </hbox>
291 <hbox>
292 <text use-markup="true">
293 <label>"<b>Configuration :</b>"</label>
294 </text>
295 <entry editable="false">
296 <default>
297 $(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')/pxelinux.cfg/default
298 </default>
299 <variable>PXE_CONF</variable>
300 </entry>
301 <button>
302 <input file icon="accessories-text-editor"></input>
303 <action>dir=\$(dirname \$PXE_CONF); [ -d \$dir ] || mkdir -p \$dir</action>
304 <action>lzma d /usr/share/boot/pxelinux.0.lzma \$(dirname \$PXE_CONF)/../pxelinux.0</action>
305 <action>sed -i "/^boot_file/d" \$UDHCPD_CONF</action>
306 <action>echo "boot_file pxelinux.0" >> \$UDHCPD_CONF</action>
307 <action>grep -q "^siaddr" \$UDHCPD_CONF || echo "siaddr \$(ifconfig \$INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> \$UDHCPD_CONF</action>
308 <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>
309 <action type="lauch">leafpad \$PXE_CONF</action>
310 </button>
311 </hbox>
312 <hbox>
313 $(wikibutton http://doc.slitaz.org/en:guides:pxe)
314 <button>
315 <input file icon="system-file-manager"></input>
316 <label>Network boot files</label>
317 <action>$xterm -geometry 100x25 -title "Network boot files (q to quit)" -e "find \$(dirname \$(dirname \$PXE_CONF)) -exec ls -ld {} \; | less"</action>
318 </button>
319 </hbox>
320 </frame>
321 EOT
322 }
324 data_pxe()
325 {
326 [ -f /usr/share/boot/pxelinux.0.lzma ] && cat <<EOT
327 true PXElinux tab_pxelinux
328 EOT
329 [ -f /usr/share/boot/gpxe.pxe ] && cat <<EOT
330 true PXE\ forwarder tab_gpxe
331 EOT
332 }
334 #
335 # PXE
336 #
337 tab_pxe()
338 {
339 use_tab data_pxe
340 }
342 #
343 # Busybox dnsd
344 #
345 tab_dnsd()
346 {
347 cat <<EOT
348 <frame Dnsd (busybox master dns)>
349 $(helpdaemon dnsd 80x15 DNSD_OPTIONS DNSD_OPTS)
350 $(configfile /etc/dnsd.conf DNSD_CONF)
351 <hbox>
352 $(startstopdaemon dnsd busybox)
353 </hbox>
354 </frame>
355 EOT
356 }
358 #
359 # ISC Bind
360 #
361 tab_named()
362 {
363 cat <<EOT
364 <frame Named (ISC bind)>
365 $(helpdaemon named 80x10 NAMED_OPTIONS NAMED_OPTS)
366 $(configfile /etc/bind/named.conf.local NAMED_CONF)
367 <hbox>
368 $(startstopdaemon named bind)
369 </hbox>
370 </frame>
371 EOT
372 }
374 #
375 # DNSmasq
376 #
377 tab_dnsmasq()
378 {
379 cat <<EOT
380 <frame DNSmasq (DNS/DHCP/TFTP)>
381 $(helpdaemon dnsmasq 100x34 DNSMASQ_OPTIONS DNSMASQ_OPTS)
382 $(configfile /etc/dnsmasq.conf DNSMASQ_CONF)
383 <hbox>
384 $(startstopdaemon dnsmasq)
385 </hbox>
386 </frame>
387 EOT
388 }
390 data_dns()
391 {
392 cat <<EOT
393 dnsd Dnsd tab_dnsd
394 named Named tab_named
395 dnsmasq DNSmasq tab_dnsmasq
396 #TODO sheerdns Sheerdns tab_sheerdns
397 EOT
398 }
400 #
401 # dns tab
402 #
403 tab_dns()
404 {
405 use_tab data_dns
406 }
408 #
409 # Postfix
410 #
411 tab_postfix()
412 {
413 cat <<EOT
414 <frame Postfix>
415 $(webbutton postfix)
416 $(configfile /etc/postfix/main.cf POSTFIX_CONF)
417 <hbox>
418 $(startstopdaemon postfix)
419 </hbox>
420 </frame>
421 EOT
422 }
424 #
425 # Fetchmail
426 #
427 tab_fetchmail()
428 {
429 cat <<EOT
430 <frame Fetchmail>
431 $(webbutton fetchmail)
432 $(helpdaemon fetchmail 100x34 FETCHMAIL_OPTIONS FETCHMAIL_OPTS)
433 $(configfile /etc/fetchmail.conf FETCHMAIL_CONF)
434 <hbox>
435 $(startstopdaemon fetchmail)
436 </hbox>
437 </frame>
438 EOT
439 }
441 #
442 # Postgrey
443 #
444 tab_postgrey()
445 {
446 cat <<EOT
447 <frame Postgrey (SMTP grey list)>
448 $(helpdaemon postgrey 100x34 POSTGREY_OPTIONS POSTGREY_OPTS)
449 $(webbutton postgrey)
450 <hbox>
451 $(startstopdaemon postgrey)
452 </hbox>
453 </frame>
454 EOT
455 }
457 data_smtp()
458 {
459 cat <<EOT
460 postfix Postfix tab_postfix
461 fetchmail Fetchmail tab_fetchmail
462 postgrey Grey\ list tab_postgrey
463 EOT
464 }
466 #
467 # smtp tab
468 #
469 tab_smtp()
470 {
471 use_tab data_smtp
472 }
474 #
475 # Cyrus IMAP
476 #
477 tab_cyrus()
478 {
479 cat <<EOT
480 <frame Cyrus IMAP>
481 $(webbutton cyrus-imapd)
482 $(configfile /etc/imapd.conf IMAPD_CONF)
483 $(configfile /etc/cyrus.conf CYRUS_CONF)
484 <hbox>
485 $(startstopdaemon cyrus-imapd)
486 </hbox>
487 </frame>
488 EOT
489 }
491 #
492 # Perdition IMAP/POP3 proxy
493 #
494 tab_perdition()
495 {
496 cat <<EOT
497 <frame Perdition proxy>
498 $(webbutton perdition)
499 $(helpdaemon perdition 100x34 PERDITION_OPTIONS PERDITION_OPTS)
500 $(configfile /etc/perdition/perdition.imap4.conf PROXY_IMAP_CONF)
501 $(configfile /etc/perdition/perdition.pop3.conf PROXY_POP3_CONF)
502 <hbox>
503 $(startstopdaemon perdition)
504 </hbox>
505 </frame>
506 EOT
507 }
509 data_imap()
510 {
511 cat <<EOT
512 cyradm Cyrus tab_cyrus
513 perdition Proxy tab_perdition
514 EOT
515 }
517 #
518 # imap tab
519 #
520 tab_imap()
521 {
522 use_tab data_imap
523 }
525 #
526 # Squid
527 #
528 tab_squid()
529 {
530 cat <<EOT
531 <frame Squid>
532 $(helpdaemon squid 100x34 SQUID_OPTIONS SQUID_OPTS)
533 $(webbutton squid)
534 $(configfile /etc/squid.conf SQUID_CONF)
535 $([ -s /etc/squidGuard/squidGuard.conf ] && configfile /etc/squidGuard/squidGuard.conf SQUIDGUARD_CONF)
536 <hbox>
537 $(startstopdaemon squid)
538 </hbox>
539 </frame>
540 EOT
541 }
543 #
544 # Asterisk
545 #
546 tab_asterisk()
547 {
548 cat <<EOT
549 <frame Asterisk telephony>
550 $(webbutton asterisk)
551 $(configfile /etc/asterisk/extensions.conf ASTERISK_CONF)
552 <hbox>
553 $(startstopdaemon asterisk)
554 </hbox>
555 </frame>
556 EOT
557 }
559 #
560 # OpenLDAP
561 #
562 tab_openldap()
563 {
564 cat <<EOT
565 <frame OpenLDAP>
566 $(helpdaemon /usr/libexec/slapd 100x34 LDAP_OPTIONS LDAP_OPTS)
567 $(webbutton openldap)
568 $(configfile /etc/openldap/slapd.conf LDAP_CONF)
569 <hbox>
570 $(startstopdaemon openldap)
571 </hbox>
572 </frame>
573 EOT
574 }
576 #
577 # MySQL
578 #
579 tab_mysql()
580 {
581 cat <<EOT
582 <frame MySQL>
583 $(helpdaemon mysqld_safe 100x34 MYSQL_OPTIONS MYSQL_OPTS)
584 $(webbutton mysql)
585 $(configfile /etc/my.conf MYSQL_CONF)
586 <hbox>
587 $(startstopdaemon mysql)
588 </hbox>
589 </frame>
590 EOT
591 }
593 #
594 # PostgreSQL
595 #
596 tab_postgresql()
597 {
598 cat <<EOT
599 <frame PostgreSQL>
600 $(helpdaemon postgres 100x34 PGSQL_OPTIONS PGSQL_OPTS)
601 $(webbutton postgresql)
602 $(configfile /etc/postgresql.conf POSTGRESQL_CONF)
603 <hbox>
604 $(startstopdaemon postgresql)
605 </hbox>
606 </frame>
607 EOT
608 }
610 data_sql()
611 {
612 cat <<EOT
613 mysqld_safe MySQL tab_mysql
614 postgres PostgreSQL tab_postgresql
615 EOT
616 }
618 #
619 # sql tab
620 #
621 tab_sql()
622 {
623 use_tab data_sql
624 }
626 #
627 # rsync server
628 #
629 tab_rsync()
630 {
631 cat <<EOT
632 <frame Rsync>
633 $(helpdaemon rsync 80x30 RSYNCD_OPTIONS RSYNCD_OPTS 1)
634 $(configfile /etc/rsyncd.conf RSYNCD_CONF)
635 $(datafile /etc/rsyncd.secrets RSYNCD_SECRETS 'Secrets file :')
636 <hbox>
637 $(startstopdaemon rsyncd rsync)
638 </hbox>
639 </frame>
640 EOT
641 }
643 php_ini()
644 {
645 [ -f /etc/php.ini ] && cat <<EOT
646 <frame PHP>
647 $(configfile /etc/php.ini PHP_CONF)
648 </frame>
649 EOT
650 }
652 #
653 # Apache server
654 #
655 tab_apache()
656 {
657 cat <<EOT
658 <frame Apache>
659 $(configfile /etc/apache/httpd.conf HTTPD_CONF)
660 $(php_ini)
661 <hbox>
662 $(startstopdaemon apache)
663 </hbox>
664 </frame>
665 EOT
666 }
668 #
669 # Lighttpd server
670 #
671 tab_lighttpd()
672 {
673 cat <<EOT
674 <frame Lighttpd>
675 $(helpdaemon lighttpd 80x15 LIGHTTPD_OPTIONS LIGHTTPD_OPTS)
676 $(configfile /etc/lighttpd/lighttpd.conf LIGHTTPD_CONF)
677 $(php_ini)
678 <hbox>
679 $(startstopdaemon lighttpd)
680 </hbox>
681 </frame>
682 EOT
683 }
685 #
686 # Busybox httpd server
687 #
688 tab_httpd()
689 {
690 cat <<EOT
691 <frame httpd (busybox)>
692 $(helpdaemon httpd 80x30 HTTPD_OPTIONS HTTPD_OPTS)
693 $(configfile /etc/httpd.conf HTTPD_CONF)
694 $(php_ini)
695 <hbox>
696 $(startstopdaemon httpd busybox)
697 </hbox>
698 </frame>
699 EOT
700 }
702 data_http()
703 {
704 cat <<EOT
705 /etc/apache/httpd.conf Apache tab_apache
706 lighttpd Lighttpd tab_lighttpd
707 /etc/httpd.conf Busybox\ httpd tab_httpd
708 EOT
709 }
711 #
712 # http tab
713 #
714 tab_http()
715 {
716 use_tab data_http
717 }
719 #
720 # Samba servers
721 #
722 tab_wins()
723 {
724 cat <<EOT
725 <frame Samba: smbd & nmbd>
726 $(configfile /etc/samba/smb.conf SMBD_CONF)
727 <hbox>
728 <button>
729 <label>Reload</label>
730 <input file icon="reload"></input>
731 <action>/etc/init.d/samba reload</action>
732 </button>
733 $(startstopdaemon samba)
734 </hbox>
735 </frame>
736 EOT
737 }
739 #
740 # x11vnc
741 #
742 tab_vnc()
743 {
744 cat <<EOT
745 <frame x11vnc>
746 $(helpdaemon x11vnc 80x30 X11VNC_OPTIONS X11VNC_OPTS)
747 <hbox>
748 <text use-markup="true">
749 <label>"<b>New password</b>"</label>
750 </text>
751 <entry>
752 <variable>X11VNC_PASSWD</variable>
753 </entry>
754 <button>
755 <input file icon="reload"></input>
756 <label>Update</label>
757 <action>x11vnc -storepasswd \$X11VNC_PASSWD /etc/vnc.secret</action>
758 </button>
759 </hbox>
760 <hbox>
761 $(startstopdaemon x11vnc)
762 </hbox>
763 </frame>
764 EOT
765 }
767 #
768 # knock server
769 #
770 tab_knockd()
771 {
772 cat <<EOT
773 <frame Knockd: trigger backdoors>
774 $(helpdaemon knockd 80x15 KNOCK_OPTIONS KNOCK_OPTS)
775 $(configfile /etc/knockd.conf KNOCKD_CONF)
776 <hbox>
777 $(startstopdaemon knockd knock)
778 </hbox>
779 </frame>
780 EOT
781 }
783 data_servers()
784 {
785 local $pxe
786 pxe="#"
787 [ -x /usr/bin/tftpd -a -x /usr/sbin/udhcpd ] && pxe="inetd"
788 [ -x /usr/sbin/dnsmasq ] && pxe="true"
789 [ -f /usr/share/boot/pxelinux.0.lzma -o /usr/share/boot/gpxe.pxe ] || pxe="#"
790 cat <<EOT
791 $([ -x /usr/sbin/dropbear -o -x /usr/sbin/sshd ] && echo "true" ||
792 echo "#") SSH tab_sshd
793 $([ -x /usr/sbin/lighttpd -o -x /usr/bin/httpd ] && echo "true" ||
794 echo "#") HTTP tab_http
795 rsync Rsync tab_rsync
796 smbd SAMBA tab_wins
797 inetd Inetd tab_inetd
798 zcip ZeroConf tab_zcip
799 $([ -x /usr/sbin/udhcpd -o -x /usr/sbin/dhcpd -o -x /usr/sbin/dnsmasq ] &&
800 echo "true" ||
801 echo "#") DHCP tab_dhcpd
802 $pxe PXE tab_pxe
803 dnsmasq tftpd tab_dnsmasq
804 $([ -x /usr/sbin/dnsd -o -x /usr/sbin/named -o -x /usr/sbin/dnsmasq ] &&
805 echo "true" ||
806 echo "#") DNS tab_dns
807 x11vnc VNC tab_vnc
808 knockd Knock tab_knockd
809 $([ -x /usr/bin/mysqld_safe -o -x /usr/bin/postgres ] &&
810 echo "true" ||
811 echo "#") SQL tab_sql
812 slapcat LDAP tab_openldap
813 postfix SMTP tab_smtp
814 cyradm IMAP/POP3 tab_imap
815 squid Web\ cache tab_squid
816 asterisk Telephony tab_asterisk
817 #TODO+callback pppd Pppd tab_pppd
818 #TODO pptpd PoPToP tab_poptop
819 EOT
820 }
822 #
823 # Servers tab
824 #
825 tab_servers()
826 {
827 use_tab data_servers
828 }
830 #
831 # Firewall tab
832 #
833 tab_firewall()
834 {
835 cat <<EOT
836 <frame Iptables>
837 $(configfile /etc/firewall.conf IPTABLES_CONF)
838 <hbox>
839 $(helpbutton iptables 80x30)
840 $(manbutton 8 iptables)
841 $(webbutton iptables)
842 <button>
843 <label>Load</label>
844 <input file icon="reload"></input>
845 <action>cat \$IPTABLES_CONF | /sbin/iptables-restore</action>
846 </button>
847 <button>
848 <label>Save</label>
849 <input file icon="go-jump"></input>
850 <action>/sbin/iptables-save > \$IPTABLES_CONF</action>
851 </button>
852 </hbox>
853 </frame>
854 EOT
855 }
857 #
858 # knock client
859 #
860 tab_knock()
861 {
862 cat <<EOT
863 <frame Knock>
864 <hbox>
865 <text use-markup="true">
866 <label>"<b>Options : </b>"</label>
867 </text>
868 <entry editable="true">
869 <variable>KNOCK_OPTS</variable>
870 <default>myserver.example.com 123:tcp 456:udp 789:tcp</default>
871 </entry>
872 </hbox>
873 <hbox>
874 $(helpbutton knock 80x12)
875 <button>
876 <label>Start</label>
877 <input file icon="forward"></input>
878 <action>knock \$KNOCK_OPTS</action>
879 </button>
880 </hbox>
881 </frame>
882 EOT
883 }
885 data_main()
886 {
887 cat <<EOT
888 #program tab name function
889 true Servers tab_servers
890 iptables Firewall tab_firewall
891 knock Knock tab_knock
892 true Status tab_status
893 EOT
894 }
896 tab_main()
897 {
898 use_tab data_main
899 }
901 ######################################################
902 #
903 # Serverbox GUI
904 #
905 ######################################################
907 # Only root can configure server.
908 check_root
910 # English/French help dialog.
911 export HELP='
912 <window title="Network status" icon-name="network-wire">
913 <vbox>
914 <text use-markup="true">
915 <label>
916 "
917 <b>SliTaz - Serverbox</b>"
918 </label>
919 </text>
920 <frame English>
921 <text wrap="true" width-chars="58">
922 <label>
923 "Serverbox lets you manage and setup servers. First, install and
924 edit any configuration files. Then, start or stop the servers."
925 </label>
926 </text>
927 </frame>
928 <frame Francais>
929 <text wrap="true" width-chars="58">
930 <label>
931 "Serverbox peut demarrer ou arreter le reseau, configurer
932 les interfaces reseau ou editer directement les fichiers."
933 </label>
934 </text>
935 </frame>
936 </vbox>
937 </window>
938 '
940 # The main dialog with notebook, start/stop buttons and all options.
941 # Note that /etc/network.conf is seded when an interface is activated.
942 #
943 head='
944 <window title="SliTaz Server Manager" icon-name="network-wired">
945 <vbox>
947 <hbox>
948 <text use-markup="true">
949 <label>"<b>Server Manager</b>"</label>
950 </text>
951 <pixmap>
952 <input file>/usr/share/pixmaps/netbox.png</input>
953 </pixmap>
954 </hbox>
955 '
956 bottom='
957 <hbox>
958 <button help>
959 <label>Help</label>
960 <action type="launch">HELP</action>
961 </button>
962 <button>
963 <label>Quit</label>
964 <input file icon="exit"></input>
965 <action type="exit">Exit</action>
966 </button>
967 </hbox>
969 </vbox>
970 </window>
971 '
973 SERVER_BOX="${head}$(tab_main)${bottom}"
975 export SERVER_BOX
977 gtkdialog --center --program=SERVER_BOX >/dev/null