slitaz-tools view tinyutils/serverbox @ rev 708
Add: name[pt_BR] to desktop files
author | Claudinei Pereira <claudinei@slitaz.org> |
---|---|
date | Wed Mar 14 03:55:38 2012 -0300 (2012-03-14) |
parents | 7fdb586cf6bf |
children |
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 \
27 knock postfix fetchmail cyrus perdition slapd sql squid slim cron ntp nfsd \
28 ftpd cups"
29 cat <<EOT
30 <tree>
31 <label>Server processes</label>
32 <input>for i in $servers; do ps ww | grep \$i | grep -v grep; done</input>
33 </tree>
34 EOT
35 }
37 data_status()
38 {
39 cat <<EOT
40 ps Servers tab_status_servers
41 EOT
42 }
44 #
45 # Status
46 #
47 tab_status()
48 {
49 use_tab data_status
50 }
52 sshremote()
53 {
54 cat << EOT
55 <hbox>
56 <text use-markup="true">
57 <label>"<b>Remote :</b>"</label>
58 </text>
59 <entry>
60 <variable>$2</variable>
61 <default>user@elsewhere</default>
62 </entry>
63 <button>
64 <input file icon="utilities-terminal"></input>
65 <label>Connect</label>
66 <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>
67 </button>
68 <button>
69 <input file icon="go-up"></input>
70 <label>Send key</label>
71 <action>$xterm -geometry 80x10 -title "send ssh key" -e "$0 call sendsshkey \$$2; echo -e \"----\nENTER to continue...\" && read close"</action>
72 </button>
73 </hbox>
74 EOT
75 }
76 #
77 # Dropbear client & server
78 #
79 tab_dropbear()
80 {
81 . /etc/daemons.conf
82 set -- $DROPBEAR_OPTIONS
83 while [ -n "$2" ]; do
84 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
85 shift
86 done
88 cat <<EOT
89 <frame Dropbear>
90 $(helpdaemon dropbear 80x35 DROPBEAR_OPTIONS DROPBEAR_OPTS)
91 $(datafile /etc/dropbear/banner DROPBEAR_BANNER 'Banner :')
92 $(sshremote DROPBEAR_PEER 'dbclient -i /etc/dropbear/dropbear_rsa_host_key')
93 <hbox>
94 $(startstopdaemon dropbear)
95 </hbox>
96 </frame>
97 EOT
98 }
100 #
101 # OpenSSH client & server
102 #
103 tab_openssh()
104 {
105 cat <<EOT
106 <frame OpenSSH>
107 $(helpdaemon sshd 80x30 OPENSSH_OPTIONS OPENSSH_OPTS 8 nohelp)
108 $(configfile /etc/ssh/sshd_config OPENSSH_CONF '5 sshd_config')
109 $(sshremote OPENSSH_PEER 'ssh -i /etc/ssh/ssh_host_rsa_key')
110 <hbox>
111 $(startstopdaemon openssh)
112 </hbox>
113 </frame>
114 EOT
115 }
117 data_sshd()
118 {
119 cat <<EOT
120 dropbear Dropbear tab_dropbear
121 sshd OpenSSH tab_openssh
122 EOT
123 }
125 #
126 # SSH tab
127 #
128 tab_sshd()
129 {
130 use_tab data_sshd
131 }
133 #
134 # Busybox Inetd
135 #
136 tab_inetd()
137 {
138 cat <<EOT
139 <frame Inetd (busybox)>
140 $(helpdaemon inetd 60x20 INETD_OPTIONS INETD_OPTS)
141 $(configfile /etc/inetd.conf INETD_CONF)
142 <hbox>
143 EOT
144 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
145 i=$(basename $i)
146 helpbutton $i 60x24 $i
147 done
148 cat <<EOT
149 $(startstopdaemon inetd)
150 </hbox>
151 </frame>
152 EOT
153 }
155 #
156 # ZeroConf
157 #
158 tab_zcip()
159 {
161 . /etc/daemons.conf
162 if [ -x /sbin/zcip -a -z "$ZCIP_OPTIONS" ]; then
163 ZCIP_OPTIONS="eth0 /etc/zcip.script"
164 cat >> /etc/daemons.conf <<EOT
165 # ZeroConf options
166 ZCIP_OPTIONS="$ZCIP_OPTIONS"
168 EOT
169 fi
170 cat <<EOT
171 <frame Zcip (busybox)>
172 $(helpdaemon zcip 60x20 ZCIP_OPTIONS ZCIP_OPTS)
173 $(datafile /etc/zcip.script CZIP_SCRIPT 'Script :')
174 <hbox>
175 $(startstopdaemon zcip)
176 </hbox>
177 </frame>
178 EOT
179 }
181 #
182 # Dhcpd ISC
183 #
184 tab_isc_dhcpd()
185 {
186 cat <<EOT
187 <frame Dhcpd (ISC)>
188 $(helpdaemon dhcpd 60x14 DHCPD_OPTIONS DHCPD_OPTS)
189 $(configfile /etc/dhcpd.conf DHCPD_CONF)
190 <hbox>
191 $(startstopdaemon dhcpd dhcp)
192 </hbox>
193 </frame>
194 EOT
195 }
197 #
198 # Dhcpd Busybox
199 #
200 tab_udhcpd()
201 {
202 cat <<EOT
203 <frame Udhcpd (busybox)>
204 $(helpdaemon udhcpd 60x18 UDHCPD_OPTIONS UDHCPD_OPTS)
205 $(configfile /etc/udhcpd.conf UDHCPD_CONF)
206 <hbox>
207 $(startstopdaemon udhcpd busybox)
208 </hbox>
209 </frame>
210 EOT
211 }
213 data_dhcpd()
214 {
215 cat <<EOT
216 udhcpd Udhcpd tab_udhcpd
217 dhcpd Dhcpd tab_isc_dhcpd
218 dnsmasq DNSmasq tab_dnsmasq
219 EOT
220 }
222 #
223 # dhcpd tab
224 #
225 tab_dhcpd()
226 {
227 use_tab data_dhcpd
228 }
230 #
231 # PXE forwarder
232 #
233 tab_gpxe()
234 {
235 cat <<EOT
236 <frame PXE forwarder>
237 <hbox>
238 <text use-markup="true">
239 <label>"<b>WEB boot URL(s) :</b>"</label>
240 </text>
241 </hbox>
242 <hbox>
243 <entry editable="true">
244 <default>
245 "$(dd bs=1 skip=5 count=255 if=/usr/share/boot/gpxe.pxe 2> /dev/null | strings)"
246 </default>
247 <variable>WEB_PXE</variable>
248 </entry>
249 </hbox>
250 <hbox>
251 $(wikibutton http://doc.slitaz.org/en:guides:pxe)
252 <button>
253 <input file icon="go-jump"></input>
254 <label>Install</label>
255 <action>
256 echo -n "\$WEB_PXE" | cat - /dev/zero | \
257 dd conv=notrunc bs=1 seek=5 count=255 of=/usr/share/boot/gpxe.pxe
258 </action>
259 <action>
260 sed -i "s|tftpd -r .*\$|tftpd -r /usr/share/boot|" /etc/inetd.conf
261 </action>
262 <action> sed -i "/^boot_file/d" \$UDHCPD_CONF </action>
263 <action> echo "boot_file gpxe.pxe" >> \$UDHCPD_CONF </action>
264 <action> /etc/init.d/inetd restart </action>
265 <action> /etc/init.d/udhcpd restart </action>
266 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)inetd \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
267 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)udhcpd \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
268 <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"udhcpd inetd \1\\"/" /etc/rcS.conf</action>
269 </button>
270 </hbox>
271 </frame>
272 EOT
273 }
275 #
276 # PXE server
277 #
278 tab_pxelinux()
279 {
280 cat <<EOT
281 <frame PXElinux>
282 <hbox>
283 <text wrap="true">
284 <label>
285 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
286 </label>
287 </text>
288 </hbox>
289 <hbox>
290 <text use-markup="true">
291 <label>"<b>Configuration :</b>"</label>
292 </text>
293 <entry editable="false">
294 <default>
295 $(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')/pxelinux.cfg/default
296 </default>
297 <variable>PXE_CONF</variable>
298 </entry>
299 <button>
300 <input file icon="accessories-text-editor"></input>
301 <action>dir=\$(dirname \$PXE_CONF); [ -d \$dir ] || mkdir -p \$dir</action>
302 <action>lzma d /usr/share/boot/pxelinux.0.lzma \$(dirname \$PXE_CONF)/../pxelinux.0</action>
303 <action>sed -i "/^boot_file/d" \$UDHCPD_CONF</action>
304 <action>echo "boot_file pxelinux.0" >> \$UDHCPD_CONF</action>
305 <action>grep -q "^siaddr" \$UDHCPD_CONF || echo "siaddr \$(ifconfig \$INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> \$UDHCPD_CONF</action>
306 <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>
307 <action type="lauch">leafpad \$PXE_CONF</action>
308 </button>
309 </hbox>
310 <hbox>
311 $(wikibutton http://doc.slitaz.org/en:guides:pxe)
312 <button>
313 <input file icon="system-file-manager"></input>
314 <label>Network boot files</label>
315 <action>$xterm -geometry 100x25 -title "Network boot files (q to quit)" -e "find \$(dirname \$(dirname \$PXE_CONF)) -exec ls -ld {} \; | less"</action>
316 </button>
317 </hbox>
318 </frame>
319 EOT
320 }
322 data_pxe()
323 {
324 [ -f /usr/share/boot/pxelinux.0.lzma ] && cat <<EOT
325 true PXElinux tab_pxelinux
326 EOT
327 [ -f /usr/share/boot/gpxe.pxe ] && cat <<EOT
328 true PXE\ forwarder tab_gpxe
329 EOT
330 }
332 #
333 # PXE
334 #
335 tab_pxe()
336 {
337 use_tab data_pxe
338 }
340 #
341 # Busybox dnsd
342 #
343 tab_dnsd()
344 {
345 cat <<EOT
346 <frame Dnsd (busybox master dns)>
347 $(helpdaemon dnsd 80x24 DNSD_OPTIONS DNSD_OPTS)
348 $(configfile /etc/dnsd.conf DNSD_CONF)
349 <hbox>
350 $(startstopdaemon dnsd busybox)
351 </hbox>
352 </frame>
353 EOT
354 }
356 #
357 # ISC Bind
358 #
359 tab_named()
360 {
361 cat <<EOT
362 <frame Named (ISC bind)>
363 $(helpdaemon named 80x10 NAMED_OPTIONS NAMED_OPTS)
364 $(configfile /etc/bind/named.conf.local NAMED_CONF)
365 <hbox>
366 $(startstopdaemon named bind)
367 </hbox>
368 </frame>
369 EOT
370 }
372 #
373 # DNSmasq
374 #
375 tab_dnsmasq()
376 {
377 cat <<EOT
378 <frame DNSmasq (DNS/DHCP/TFTP)>
379 $(helpdaemon dnsmasq 100x34 DNSMASQ_OPTIONS DNSMASQ_OPTS)
380 $(configfile /etc/dnsmasq.conf DNSMASQ_CONF)
381 <hbox>
382 $(startstopdaemon dnsmasq)
383 </hbox>
384 </frame>
385 EOT
386 }
388 data_dns()
389 {
390 cat <<EOT
391 dnsd Dnsd tab_dnsd
392 named Named tab_named
393 dnsmasq DNSmasq tab_dnsmasq
394 #TODO sheerdns Sheerdns tab_sheerdns
395 EOT
396 }
398 #
399 # dns tab
400 #
401 tab_dns()
402 {
403 use_tab data_dns
404 }
406 #
407 # Postfix
408 #
409 tab_postfix()
410 {
411 cat <<EOT
412 <frame Postfix>
413 $(configfile /etc/postfix/main.cf POSTFIX_CONF)
414 <hbox>
415 $(startstopdaemon postfix)
416 </hbox>
417 </frame>
418 EOT
419 }
421 #
422 # Fetchmail
423 #
424 tab_fetchmail()
425 {
426 cat <<EOT
427 <frame Fetchmail>
428 $(helpdaemon fetchmail 100x34 FETCHMAIL_OPTIONS FETCHMAIL_OPTS)
429 $(configfile /etc/fetchmail.conf FETCHMAIL_CONF)
430 <hbox>
431 $(startstopdaemon fetchmail)
432 </hbox>
433 </frame>
434 EOT
435 }
437 #
438 # Postgrey
439 #
440 tab_postgrey()
441 {
442 cat <<EOT
443 <frame Postgrey (SMTP grey list)>
444 $(helpdaemon postgrey 100x34 POSTGREY_OPTIONS POSTGREY_OPTS)
445 <hbox>
446 $(startstopdaemon postgrey)
447 </hbox>
448 </frame>
449 EOT
450 }
452 data_smtp()
453 {
454 cat <<EOT
455 postfix Postfix tab_postfix
456 fetchmail Fetchmail tab_fetchmail
457 postgrey Grey\ list tab_postgrey
458 EOT
459 }
461 #
462 # smtp tab
463 #
464 tab_smtp()
465 {
466 use_tab data_smtp
467 }
469 #
470 # Cyrus IMAP
471 #
472 tab_cyrus()
473 {
474 cat <<EOT
475 <frame Cyrus IMAP/POP3>
476 $(configfile /etc/imapd.conf IMAPD_CONF)
477 $(configfile /etc/cyrus.conf CYRUS_CONF)
478 <hbox>
479 $(startstopdaemon cyrus-imapd)
480 </hbox>
481 </frame>
482 EOT
483 }
485 #
486 # Perdition IMAP/POP3 proxy
487 #
488 tab_perdition()
489 {
490 cat <<EOT
491 <frame Perdition IMAP/POP3 proxy>
492 $(helpdaemon perdition 100x34 PERDITION_OPTIONS PERDITION_OPTS)
493 $(configfile /etc/perdition/perdition.imap4.conf PROXY_IMAP_CONF)
494 $(configfile /etc/perdition/perdition.pop3.conf PROXY_POP3_CONF)
495 <hbox>
496 $(startstopdaemon perdition)
497 </hbox>
498 </frame>
499 EOT
500 }
502 data_imap()
503 {
504 cat <<EOT
505 cyradm Cyrus tab_cyrus
506 perdition Proxy tab_perdition
507 EOT
508 }
510 #
511 # imap tab
512 #
513 tab_imap()
514 {
515 use_tab data_imap
516 }
518 #
519 # Squid
520 #
521 tab_squid()
522 {
523 cat <<EOT
524 <frame Squid>
525 $(helpdaemon squid 100x26 SQUID_OPTIONS SQUID_OPTS)
526 $(configfile /etc/squid.conf SQUID_CONF)
527 $([ -s /etc/squidGuard/squidGuard.conf ] && configfile /etc/squidGuard/squidGuard.conf SQUIDGUARD_CONF)
528 <hbox>
529 $(startstopdaemon squid)
530 </hbox>
531 </frame>
532 EOT
533 }
535 #
536 # Asterisk
537 #
538 tab_asterisk()
539 {
540 cat <<EOT
541 <frame Asterisk telephony>
542 $(configfile /etc/asterisk/extensions.conf ASTERISK_CONF)
543 <hbox>
544 $(startstopdaemon asterisk)
545 </hbox>
546 </frame>
547 EOT
548 }
550 #
551 # OpenLDAP
552 #
553 tab_openldap()
554 {
555 cat <<EOT
556 <frame OpenLDAP>
557 $(configfile /etc/openldap/slapd.conf LDAP_CONF)
558 <hbox>
559 $(startstopdaemon openldap)
560 </hbox>
561 </frame>
562 EOT
563 }
565 #
566 # MySQL
567 #
568 tab_mysql()
569 {
570 cat <<EOT
571 <frame MySQL>
572 $(helpdaemon mysqld_safe 100x24 MYSQL_OPTIONS MYSQL_OPTS)
573 $(configfile /etc/my.conf MYSQL_CONF)
574 <hbox>
575 $(startstopdaemon mysql)
576 </hbox>
577 </frame>
578 EOT
579 }
581 #
582 # PostgreSQL
583 #
584 tab_postgresql()
585 {
586 cat <<EOT
587 <frame PostgreSQL>
588 $(helpdaemon postgres 100x34 PGSQL_OPTIONS PGSQL_OPTS)
589 $(configfile /etc/postgresql.conf POSTGRESQL_CONF)
590 <hbox>
591 $(startstopdaemon postgresql)
592 </hbox>
593 </frame>
594 EOT
595 }
597 data_sql()
598 {
599 cat <<EOT
600 mysqld_safe MySQL tab_mysql
601 postgres PostgreSQL tab_postgresql
602 EOT
603 }
605 #
606 # sql tab
607 #
608 tab_sql()
609 {
610 use_tab data_sql
611 }
613 #
614 # Slim display manager
615 #
616 tab_slim()
617 {
618 cat <<EOT
619 <frame Slim display manager>
620 $(helpdaemon slim 80x10 SLIM_OPTIONS SLIM_OPTS)
621 $(configfile /etc/slim.conf SLIM_CONF)
622 <hbox>
623 $(startstopdaemon slim)
624 </hbox>
625 </frame>
626 EOT
627 }
629 #
630 # Cron
631 #
632 tab_cron()
633 {
634 cat <<EOT
635 <frame Crond (busybox)>
636 $(helpdaemon crond 80x15 CROND_OPTIONS CROND_OPTS)
637 <hbox>
638 $(startstopdaemon crond)
639 </hbox>
640 </frame>
641 EOT
642 }
644 #
645 # NTP
646 #
647 tab_ntp()
648 {
649 cat <<EOT
650 <frame Ntpd>
651 $(helpdaemon ntpd 100x34 NTP_OPTIONS NTP_OPTS)
652 $(configfile /etc/ntp.conf NTP_CONF)
653 <hbox>
654 $(startstopdaemon ntp)
655 </hbox>
656 </frame>
657 EOT
658 }
660 #
661 # nfsd
662 #
663 tab_nfsd()
664 {
665 cat <<EOT
666 <frame Nfsd>
667 $(configfile /etc/exports EXPORTS)
668 <hbox>
669 $(startstopdaemon nfsd nfs-utils)
670 </hbox>
671 </frame>
672 EOT
673 }
675 #
676 # unfsd
677 #
678 tab_unfsd()
679 {
680 cat <<EOT
681 <frame Unfsd>
682 $(helpdaemon ntpd 80x20 UNFSD_OPTIONS UNFSD_OPTS)
683 $(configfile /etc/exports EXPORTS)
684 <hbox>
685 $(startstopdaemon unfsd unfs3)
686 </hbox>
687 </frame>
688 EOT
689 }
691 data_nfs()
692 {
693 cat <<EOT
694 rpc.nfsd Nfsd tab_nfsd
695 unfsd Unfsd tab_unfsd
696 EOT
697 }
699 #
700 # nfs tab
701 #
702 tab_nfs()
703 {
704 use_tab data_nfs
705 }
707 #
708 # ftpd
709 #
710 tab_ftpd()
711 {
712 cat <<EOT
713 <frame ftpd>
714 $(helpdaemon ftpd 100x34 FTPD_OPTIONS FTPD_OPTS)
715 <hbox>
716 $(startstopdaemon ftpd)
717 </hbox>
718 </frame>
719 EOT
720 }
722 #
723 # pure-ftpd
724 #
725 tab_pureftpd()
726 {
727 cat <<EOT
728 <frame pure-ftpd>
729 $(helpdaemon pure-ftpd 80x34 PUREFTPD_OPTIONS PUREFTPD_OPTS)
730 <hbox>
731 $(startstopdaemon pure-ftpd)
732 </hbox>
733 </frame>
734 EOT
735 }
737 data_ftp()
738 {
739 cat <<EOT
740 $(readlink /usr/bin/ftpd | grep -q busybox && echo "true" ||
741 echo "#") Busybox\ ftpd tab_ftpd
742 pure-ftpd pure-ftpd tab_pureftpd
743 EOT
744 }
746 #
747 # ftp tab
748 #
749 tab_ftp()
750 {
751 use_tab data_ftp
752 }
754 #
755 # NTP
756 #
757 tab_ntp()
758 {
759 cat <<EOT
760 <frame Ntpd>
761 $(helpdaemon ntpd 80x20 NTP_OPTIONS NTP_OPTS)
762 $(configfile /etc/ntp.conf NTP_CONF)
763 <hbox>
764 $(startstopdaemon ntp)
765 </hbox>
766 </frame>
767 EOT
768 }
770 #
771 # cups
772 #
773 tab_cups()
774 {
775 cat <<EOT
776 <frame Cupsd>
777 $(helpdaemon cupsd 80x12 CUPSD_OPTIONS CUPSD_OPTS)
778 $(configfile /etc/cups/cupsd.conf CUPSD_CONF)
779 <hbox>
780 $(startstopdaemon cupsd)
781 </hbox>
782 </frame>
783 EOT
784 }
786 #
787 # rsync server
788 #
789 tab_rsync()
790 {
791 cat <<EOT
792 <frame Rsync>
793 $(helpdaemon rsync 80x30 RSYNCD_OPTIONS RSYNCD_OPTS 1)
794 $(configfile /etc/rsyncd.conf RSYNCD_CONF)
795 $(datafile /etc/rsyncd.secrets RSYNCD_SECRETS 'Secrets file :')
796 <hbox>
797 $(startstopdaemon rsyncd rsync)
798 </hbox>
799 </frame>
800 EOT
801 }
803 php_ini()
804 {
805 [ -f /etc/php.ini ] && cat <<EOT
806 <frame PHP>
807 $(configfile /etc/php.ini PHP_CONF)
808 </frame>
809 EOT
810 }
812 #
813 # Apache server
814 #
815 tab_apache()
816 {
817 cat <<EOT
818 <frame Apache>
819 $(configfile /etc/apache/httpd.conf HTTPD_CONF)
820 $(php_ini)
821 <hbox>
822 $(startstopdaemon apache)
823 </hbox>
824 </frame>
825 EOT
826 }
828 #
829 # Lighttpd server
830 #
831 tab_lighttpd()
832 {
833 cat <<EOT
834 <frame Lighttpd>
835 $(helpdaemon lighttpd 80x15 LIGHTTPD_OPTIONS LIGHTTPD_OPTS)
836 $(configfile /etc/lighttpd/lighttpd.conf LIGHTTPD_CONF)
837 $(php_ini)
838 <hbox>
839 $(startstopdaemon lighttpd)
840 </hbox>
841 </frame>
842 EOT
843 }
845 #
846 # Busybox httpd server
847 #
848 tab_httpd()
849 {
850 cat <<EOT
851 <frame httpd (busybox)>
852 $(helpdaemon httpd 80x30 HTTPD_OPTIONS HTTPD_OPTS)
853 $(configfile /etc/httpd.conf HTTPD_CONF)
854 $(php_ini)
855 <hbox>
856 $(startstopdaemon httpd busybox)
857 </hbox>
858 </frame>
859 EOT
860 }
862 data_http()
863 {
864 cat <<EOT
865 /etc/apache/httpd.conf Apache tab_apache
866 lighttpd Lighttpd tab_lighttpd
867 /etc/httpd.conf Busybox\ httpd tab_httpd
868 squid Web\ cache tab_squid
869 EOT
870 }
872 #
873 # http tab
874 #
875 tab_http()
876 {
877 use_tab data_http
878 }
880 #
881 # Samba servers
882 #
883 tab_wins()
884 {
885 cat <<EOT
886 <frame Samba: smbd & nmbd>
887 $(configfile /etc/samba/smb.conf SMBD_CONF)
888 <hbox>
889 <button>
890 <label>Reload</label>
891 <input file icon="reload"></input>
892 <action>/etc/init.d/samba reload</action>
893 </button>
894 $(startstopdaemon samba)
895 </hbox>
896 </frame>
897 EOT
898 }
900 #
901 # x11vnc
902 #
903 tab_vnc()
904 {
905 cat <<EOT
906 <frame x11vnc>
907 $(helpdaemon x11vnc 80x30 X11VNC_OPTIONS X11VNC_OPTS)
908 <hbox>
909 <text use-markup="true">
910 <label>"<b>New password</b>"</label>
911 </text>
912 <entry>
913 <variable>X11VNC_PASSWD</variable>
914 </entry>
915 <button>
916 <input file icon="reload"></input>
917 <label>Update</label>
918 <action>x11vnc -storepasswd \$X11VNC_PASSWD /etc/vnc.secret</action>
919 </button>
920 </hbox>
921 <hbox>
922 $(startstopdaemon x11vnc)
923 </hbox>
924 </frame>
925 EOT
926 }
928 #
929 # knock server
930 #
931 tab_knockd()
932 {
933 cat <<EOT
934 <frame Knockd: trigger backdoors>
935 $(helpdaemon knockd 80x15 KNOCK_OPTIONS KNOCK_OPTS)
936 $(configfile /etc/knockd.conf KNOCKD_CONF)
937 <hbox>
938 $(startstopdaemon knockd knock)
939 </hbox>
940 </frame>
941 EOT
942 }
944 data_servers()
945 {
946 local $pxe
947 pxe="#"
948 [ -x /usr/bin/tftpd -a -x /usr/sbin/udhcpd ] && pxe="inetd"
949 [ -x /usr/sbin/dnsmasq ] && pxe="true"
950 [ -f /usr/share/boot/pxelinux.0.lzma -o /usr/share/boot/gpxe.pxe ] || pxe="#"
951 cat <<EOT
952 slim Slim tab_slim
953 crond Crond tab_cron
954 inetd Inetd tab_inetd
955 zcip ZeroConf tab_zcip
956 $([ -x /usr/sbin/udhcpd -o -x /usr/sbin/dhcpd -o -x /usr/sbin/dnsmasq ] &&
957 echo "true" ||
958 echo "#") DHCP tab_dhcpd
959 $pxe PXE tab_pxe
960 $([ -x /usr/sbin/dnsd -o -x /usr/sbin/named -o -x /usr/sbin/dnsmasq ] &&
961 echo "true" ||
962 echo "#") DNS tab_dns
963 ntpd NTP tab_ntp
964 cupsd CUPS tab_cups
965 $([ -x /usr/bin/mysqld_safe -o -x /usr/bin/postgres ] && echo "true" ||
966 echo "#") SQL tab_sql
967 knockd Knock tab_knockd
968 $([ -x /usr/sbin/dropbear -o -x /usr/sbin/sshd ] && echo "true" ||
969 echo "#") SSH tab_sshd
970 x11vnc VNC tab_vnc
971 dnsmasq TFTP tab_dnsmasq
972 $([ -x /usr/bin/ftpd -o -x /usr/sbin/pure-ftpd ] && echo "true" ||
973 echo "#") FTP tab_ftp
974 $([ -x /usr/sbin/lighttpd -o -x /usr/bin/httpd -o -x /usr/sbin/squid ] && echo "true" ||
975 echo "#") HTTP tab_http
976 rsync Rsync tab_rsync
977 $([ -x /usr/sbin/rpc.nfsd -o -x /usr/bin/unfsd ] && echo "true" ||
978 echo "#") NFS tab_nfs
979 smbd SAMBA tab_wins
980 slapcat LDAP tab_openldap
981 postfix SMTP tab_smtp
982 cyradm IMAP tab_imap
983 asterisk Telephony tab_asterisk
984 #TODO+callback pppd Pppd tab_pppd
985 #TODO pptpd PoPToP tab_poptop
986 EOT
987 }
989 #
990 # Servers tab
991 #
992 tab_servers()
993 {
994 use_tab data_servers
995 }
997 #
998 # Firewall tab
999 #
1000 tab_firewall()
1001 {
1002 cat <<EOT
1003 <frame Iptables>
1004 $(configfile /etc/firewall.conf IPTABLES_CONF)
1005 <hbox>
1006 $(helpbutton iptables 80x30)
1007 $(manbutton 8 iptables)
1008 $(webbutton iptables)
1009 <button>
1010 <label>Load</label>
1011 <input file icon="reload"></input>
1012 <action>cat \$IPTABLES_CONF | /sbin/iptables-restore</action>
1013 </button>
1014 <button>
1015 <label>Save</label>
1016 <input file icon="go-jump"></input>
1017 <action>/sbin/iptables-save > \$IPTABLES_CONF</action>
1018 </button>
1019 </hbox>
1020 </frame>
1021 EOT
1022 }
1024 #
1025 # knock client
1026 #
1027 tab_knock()
1028 {
1029 cat <<EOT
1030 <frame Knock>
1031 <hbox>
1032 <text use-markup="true">
1033 <label>"<b>Options : </b>"</label>
1034 </text>
1035 <entry editable="true">
1036 <variable>KNOCK_OPTS</variable>
1037 <default>myserver.example.com 123:tcp 456:udp 789:tcp</default>
1038 </entry>
1039 </hbox>
1040 <hbox>
1041 $(helpbutton knock 80x12)
1042 <button>
1043 <label>Start</label>
1044 <input file icon="forward"></input>
1045 <action>knock \$KNOCK_OPTS</action>
1046 </button>
1047 </hbox>
1048 </frame>
1049 EOT
1050 }
1052 data_main()
1053 {
1054 cat <<EOT
1055 #program tab name function
1056 true Servers tab_servers
1057 iptables Firewall tab_firewall
1058 knock Knock tab_knock
1059 true Status tab_status
1060 EOT
1061 }
1063 tab_main()
1064 {
1065 use_tab data_main
1066 }
1068 ######################################################
1069 #
1070 # Serverbox GUI
1071 #
1072 ######################################################
1074 # Only root can configure server.
1075 check_root
1077 # English/French help dialog.
1078 export HELP='
1079 <window title="Network status" icon-name="network-wire">
1080 <vbox>
1081 <text use-markup="true">
1082 <label>
1083 "
1084 <b>SliTaz - Serverbox</b>"
1085 </label>
1086 </text>
1087 <frame English>
1088 <text wrap="true" width-chars="58">
1089 <label>
1090 "Serverbox lets you manage and setup servers. First, install and
1091 edit any configuration files. Then, start or stop the servers."
1092 </label>
1093 </text>
1094 </frame>
1095 <frame Francais>
1096 <text wrap="true" width-chars="58">
1097 <label>
1098 "Serverbox peut demarrer ou arreter le reseau, configurer
1099 les interfaces reseau ou editer directement les fichiers."
1100 </label>
1101 </text>
1102 </frame>
1103 </vbox>
1104 </window>
1105 '
1107 # The main dialog with notebook, start/stop buttons and all options.
1108 # Note that /etc/network.conf is seded when an interface is activated.
1109 #
1110 head='
1111 <window title="SliTaz Server Manager" icon-name="network-wired">
1112 <vbox>
1114 <hbox>
1115 <text use-markup="true">
1116 <label>"<b>Server Manager</b>"</label>
1117 </text>
1118 <pixmap>
1119 <input file>/usr/share/pixmaps/netbox.png</input>
1120 </pixmap>
1121 </hbox>
1122 '
1123 bottom='
1124 <hbox>
1125 <button help>
1126 <label>Help</label>
1127 <action type="launch">HELP</action>
1128 </button>
1129 <button>
1130 <label>Quit</label>
1131 <input file icon="exit"></input>
1132 <action type="exit">Exit</action>
1133 </button>
1134 </hbox>
1136 </vbox>
1137 </window>
1138 '
1140 SERVER_BOX="${head}$(tab_main)${bottom}"
1142 export SERVER_BOX
1144 gtkdialog --center --program=SERVER_BOX >/dev/null