slitaz-tools diff oldstuff/gtkdialog/serverbox @ rev 1012
Update Makefile
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Feb 11 23:45:29 2017 +0100 (2017-02-11) |
parents | eb7469a8467f |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/oldstuff/gtkdialog/serverbox Sat Feb 11 23:45:29 2017 +0100 1.3 @@ -0,0 +1,1144 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +# Gtkdialog box to manage servers. 1.7 +# Please use tab to indent. 1.8 + 1.9 +VERSION=20100315 1.10 + 1.11 +. /usr/lib/slitaz/gui_functions 1.12 + 1.13 +# Check if user is root. 1.14 +check_root() 1.15 +{ 1.16 + if test $(id -u) != 0 ; then 1.17 + echo -e " 1.18 +You must be root to run `basename $0`. Please type 'su' and 1.19 +root password to become super-user.\n" 1.20 + exit 0 1.21 + fi 1.22 +} 1.23 +# 1.24 +# Status servers 1.25 +# 1.26 +tab_status_servers() 1.27 +{ 1.28 +local servers 1.29 +servers="dropbear sshd inetd dhcpd dnsd named rsync httpd mbd vnc pppd \ 1.30 +knock postfix fetchmail cyrus perdition slapd sql squid slim cron ntp nfsd \ 1.31 +ftpd cups" 1.32 +cat <<EOT 1.33 +<tree> 1.34 + <label>Server processes</label> 1.35 + <input>for i in $servers; do ps ww | grep \$i | grep -v grep; done</input> 1.36 +</tree> 1.37 +EOT 1.38 +} 1.39 + 1.40 +data_status() 1.41 +{ 1.42 +cat <<EOT 1.43 +ps Servers tab_status_servers 1.44 +EOT 1.45 +} 1.46 + 1.47 +# 1.48 +# Status 1.49 +# 1.50 +tab_status() 1.51 +{ 1.52 +use_tab data_status 1.53 +} 1.54 + 1.55 +sshremote() 1.56 +{ 1.57 + cat << EOT 1.58 + <hbox> 1.59 + <text use-markup="true"> 1.60 + <label>"<b>Remote :</b>"</label> 1.61 + </text> 1.62 + <entry> 1.63 + <variable>$2</variable> 1.64 + <default>user@elsewhere</default> 1.65 + </entry> 1.66 + <button> 1.67 + <input file icon="utilities-terminal"></input> 1.68 + <label>Connect</label> 1.69 + <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> 1.70 + </button> 1.71 + <button> 1.72 + <input file icon="go-up"></input> 1.73 + <label>Send key</label> 1.74 + <action>$xterm -geometry 80x10 -title "send ssh key" -e "$0 call sendsshkey \$$2; echo -e \"----\nENTER to continue...\" && read close"</action> 1.75 + </button> 1.76 + </hbox> 1.77 +EOT 1.78 +} 1.79 +# 1.80 +# Dropbear client & server 1.81 +# 1.82 +tab_dropbear() 1.83 +{ 1.84 +. /etc/daemons.conf 1.85 +set -- $DROPBEAR_OPTIONS 1.86 +while [ -n "$2" ]; do 1.87 + [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break 1.88 + shift 1.89 +done 1.90 + 1.91 +cat <<EOT 1.92 + <frame Dropbear> 1.93 +$(helpdaemon dropbear 80x35 DROPBEAR_OPTIONS DROPBEAR_OPTS) 1.94 +$(datafile /etc/dropbear/banner DROPBEAR_BANNER 'Banner :') 1.95 +$(sshremote DROPBEAR_PEER 'dbclient -i /etc/dropbear/dropbear_rsa_host_key') 1.96 + <hbox> 1.97 + $(startstopdaemon dropbear) 1.98 + </hbox> 1.99 + </frame> 1.100 +EOT 1.101 +} 1.102 + 1.103 +# 1.104 +# OpenSSH client & server 1.105 +# 1.106 +tab_openssh() 1.107 +{ 1.108 +cat <<EOT 1.109 + <frame OpenSSH> 1.110 +$(helpdaemon sshd 80x30 OPENSSH_OPTIONS OPENSSH_OPTS 8 nohelp) 1.111 +$(configfile /etc/ssh/sshd_config OPENSSH_CONF '5 sshd_config') 1.112 +$(sshremote OPENSSH_PEER 'ssh -i /etc/ssh/ssh_host_rsa_key') 1.113 + <hbox> 1.114 + $(startstopdaemon openssh) 1.115 + </hbox> 1.116 + </frame> 1.117 +EOT 1.118 +} 1.119 + 1.120 +data_sshd() 1.121 +{ 1.122 +cat <<EOT 1.123 +dropbear Dropbear tab_dropbear 1.124 +sshd OpenSSH tab_openssh 1.125 +EOT 1.126 +} 1.127 + 1.128 +# 1.129 +# SSH tab 1.130 +# 1.131 +tab_sshd() 1.132 +{ 1.133 +use_tab data_sshd 1.134 +} 1.135 + 1.136 +# 1.137 +# Busybox Inetd 1.138 +# 1.139 +tab_inetd() 1.140 +{ 1.141 +cat <<EOT 1.142 +<frame Inetd (busybox)> 1.143 +$(helpdaemon inetd 60x20 INETD_OPTIONS INETD_OPTS) 1.144 +$(configfile /etc/inetd.conf INETD_CONF) 1.145 + <hbox> 1.146 +EOT 1.147 +for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do 1.148 + i=$(basename $i) 1.149 + helpbutton $i 60x24 $i 1.150 +done 1.151 +cat <<EOT 1.152 + $(startstopdaemon inetd) 1.153 + </hbox> 1.154 + </frame> 1.155 +EOT 1.156 +} 1.157 + 1.158 +# 1.159 +# ZeroConf 1.160 +# 1.161 +tab_zcip() 1.162 +{ 1.163 + 1.164 + . /etc/daemons.conf 1.165 +if [ -x /sbin/zcip -a -z "$ZCIP_OPTIONS" ]; then 1.166 + ZCIP_OPTIONS="eth0 /etc/zcip.script" 1.167 + cat >> /etc/daemons.conf <<EOT 1.168 +# ZeroConf options 1.169 +ZCIP_OPTIONS="$ZCIP_OPTIONS" 1.170 + 1.171 +EOT 1.172 +fi 1.173 +cat <<EOT 1.174 + <frame Zcip (busybox)> 1.175 +$(helpdaemon zcip 60x20 ZCIP_OPTIONS ZCIP_OPTS) 1.176 +$(datafile /etc/zcip.script CZIP_SCRIPT 'Script :') 1.177 + <hbox> 1.178 + $(startstopdaemon zcip) 1.179 + </hbox> 1.180 + </frame> 1.181 +EOT 1.182 +} 1.183 + 1.184 +# 1.185 +# Dhcpd ISC 1.186 +# 1.187 +tab_isc_dhcpd() 1.188 +{ 1.189 +cat <<EOT 1.190 + <frame Dhcpd (ISC)> 1.191 +$(helpdaemon dhcpd 60x14 DHCPD_OPTIONS DHCPD_OPTS) 1.192 +$(configfile /etc/dhcpd.conf DHCPD_CONF) 1.193 + <hbox> 1.194 + $(startstopdaemon dhcpd dhcp) 1.195 + </hbox> 1.196 + </frame> 1.197 +EOT 1.198 +} 1.199 + 1.200 +# 1.201 +# Dhcpd Busybox 1.202 +# 1.203 +tab_udhcpd() 1.204 +{ 1.205 +cat <<EOT 1.206 + <frame Udhcpd (busybox)> 1.207 +$(helpdaemon udhcpd 60x18 UDHCPD_OPTIONS UDHCPD_OPTS) 1.208 +$(configfile /etc/udhcpd.conf UDHCPD_CONF) 1.209 + <hbox> 1.210 + $(startstopdaemon udhcpd busybox) 1.211 + </hbox> 1.212 + </frame> 1.213 +EOT 1.214 +} 1.215 + 1.216 +data_dhcpd() 1.217 +{ 1.218 +cat <<EOT 1.219 +udhcpd Udhcpd tab_udhcpd 1.220 +dhcpd Dhcpd tab_isc_dhcpd 1.221 +dnsmasq DNSmasq tab_dnsmasq 1.222 +EOT 1.223 +} 1.224 + 1.225 +# 1.226 +# dhcpd tab 1.227 +# 1.228 +tab_dhcpd() 1.229 +{ 1.230 +use_tab data_dhcpd 1.231 +} 1.232 + 1.233 +# 1.234 +# PXE forwarder 1.235 +# 1.236 +tab_gpxe() 1.237 +{ 1.238 +cat <<EOT 1.239 +<frame PXE forwarder> 1.240 + <hbox> 1.241 + <text use-markup="true"> 1.242 + <label>"<b>WEB boot URL(s) :</b>"</label> 1.243 + </text> 1.244 + </hbox> 1.245 + <hbox> 1.246 + <entry editable="true"> 1.247 + <default> 1.248 +"$(dd bs=1 skip=5 count=255 if=/usr/share/boot/gpxe.pxe 2> /dev/null | strings)" 1.249 + </default> 1.250 + <variable>WEB_PXE</variable> 1.251 + </entry> 1.252 + </hbox> 1.253 + <hbox> 1.254 +$(wikibutton http://doc.slitaz.org/en:guides:pxe) 1.255 + <button> 1.256 + <input file icon="go-jump"></input> 1.257 + <label>Install</label> 1.258 + <action> 1.259 + echo -n "\$WEB_PXE" | cat - /dev/zero | \ 1.260 + dd conv=notrunc bs=1 seek=5 count=255 of=/usr/share/boot/gpxe.pxe 1.261 + </action> 1.262 + <action> 1.263 + sed -i "s|tftpd -r .*\$|tftpd -r /usr/share/boot|" /etc/inetd.conf 1.264 + </action> 1.265 + <action> sed -i "/^boot_file/d" \$UDHCPD_CONF </action> 1.266 + <action> echo "boot_file gpxe.pxe" >> \$UDHCPD_CONF </action> 1.267 + <action> /etc/init.d/inetd restart </action> 1.268 + <action> /etc/init.d/udhcpd restart </action> 1.269 + <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)inetd \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action> 1.270 + <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)udhcpd \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action> 1.271 + <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"udhcpd inetd \1\\"/" /etc/rcS.conf</action> 1.272 + </button> 1.273 + </hbox> 1.274 +</frame> 1.275 +EOT 1.276 +} 1.277 + 1.278 +# 1.279 +# PXE server 1.280 +# 1.281 +tab_pxelinux() 1.282 +{ 1.283 +cat <<EOT 1.284 +<frame PXElinux> 1.285 + <hbox> 1.286 + <text wrap="true"> 1.287 + <label> 1.288 +"Launch Dhcpd and Inetd with Tftpd to start the PXE service." 1.289 + </label> 1.290 + </text> 1.291 + </hbox> 1.292 + <hbox> 1.293 + <text use-markup="true"> 1.294 + <label>"<b>Configuration :</b>"</label> 1.295 + </text> 1.296 + <entry editable="false"> 1.297 + <default> 1.298 +$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')/pxelinux.cfg/default 1.299 + </default> 1.300 + <variable>PXE_CONF</variable> 1.301 + </entry> 1.302 + <button> 1.303 + <input file icon="accessories-text-editor"></input> 1.304 + <action>dir=\$(dirname \$PXE_CONF); [ -d \$dir ] || mkdir -p \$dir</action> 1.305 + <action>lzma d /usr/share/boot/pxelinux.0.lzma \$(dirname \$PXE_CONF)/../pxelinux.0</action> 1.306 + <action>sed -i "/^boot_file/d" \$UDHCPD_CONF</action> 1.307 + <action>echo "boot_file pxelinux.0" >> \$UDHCPD_CONF</action> 1.308 + <action>grep -q "^siaddr" \$UDHCPD_CONF || echo "siaddr \$(ifconfig \$INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> \$UDHCPD_CONF</action> 1.309 + <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> 1.310 + <action type="lauch">leafpad \$PXE_CONF</action> 1.311 + </button> 1.312 + </hbox> 1.313 + <hbox> 1.314 +$(wikibutton http://doc.slitaz.org/en:guides:pxe) 1.315 + <button> 1.316 + <input file icon="system-file-manager"></input> 1.317 + <label>Network boot files</label> 1.318 + <action>$xterm -geometry 100x25 -title "Network boot files (q to quit)" -e "find \$(dirname \$(dirname \$PXE_CONF)) -exec ls -ld {} \; | less"</action> 1.319 + </button> 1.320 + </hbox> 1.321 + </frame> 1.322 +EOT 1.323 +} 1.324 + 1.325 +data_pxe() 1.326 +{ 1.327 +[ -f /usr/share/boot/pxelinux.0.lzma ] && cat <<EOT 1.328 +true PXElinux tab_pxelinux 1.329 +EOT 1.330 +[ -f /usr/share/boot/gpxe.pxe ] && cat <<EOT 1.331 +true PXE\ forwarder tab_gpxe 1.332 +EOT 1.333 +} 1.334 + 1.335 +# 1.336 +# PXE 1.337 +# 1.338 +tab_pxe() 1.339 +{ 1.340 +use_tab data_pxe 1.341 +} 1.342 + 1.343 +# 1.344 +# Busybox dnsd 1.345 +# 1.346 +tab_dnsd() 1.347 +{ 1.348 +cat <<EOT 1.349 + <frame Dnsd (busybox master dns)> 1.350 +$(helpdaemon dnsd 80x24 DNSD_OPTIONS DNSD_OPTS) 1.351 +$(configfile /etc/dnsd.conf DNSD_CONF) 1.352 + <hbox> 1.353 + $(startstopdaemon dnsd busybox) 1.354 + </hbox> 1.355 + </frame> 1.356 +EOT 1.357 +} 1.358 + 1.359 +# 1.360 +# ISC Bind 1.361 +# 1.362 +tab_named() 1.363 +{ 1.364 +cat <<EOT 1.365 + <frame Named (ISC bind)> 1.366 +$(helpdaemon named 80x10 NAMED_OPTIONS NAMED_OPTS) 1.367 +$(configfile /etc/bind/named.conf.local NAMED_CONF) 1.368 + <hbox> 1.369 + $(startstopdaemon named bind) 1.370 + </hbox> 1.371 + </frame> 1.372 +EOT 1.373 +} 1.374 + 1.375 +# 1.376 +# DNSmasq 1.377 +# 1.378 +tab_dnsmasq() 1.379 +{ 1.380 +cat <<EOT 1.381 + <frame DNSmasq (DNS/DHCP/TFTP)> 1.382 +$(helpdaemon dnsmasq 100x34 DNSMASQ_OPTIONS DNSMASQ_OPTS) 1.383 +$(configfile /etc/dnsmasq.conf DNSMASQ_CONF) 1.384 + <hbox> 1.385 + $(startstopdaemon dnsmasq) 1.386 + </hbox> 1.387 + </frame> 1.388 +EOT 1.389 +} 1.390 + 1.391 +data_dns() 1.392 +{ 1.393 +cat <<EOT 1.394 +dnsd Dnsd tab_dnsd 1.395 +named Named tab_named 1.396 +dnsmasq DNSmasq tab_dnsmasq 1.397 +#TODO sheerdns Sheerdns tab_sheerdns 1.398 +EOT 1.399 +} 1.400 + 1.401 +# 1.402 +# dns tab 1.403 +# 1.404 +tab_dns() 1.405 +{ 1.406 +use_tab data_dns 1.407 +} 1.408 + 1.409 +# 1.410 +# Postfix 1.411 +# 1.412 +tab_postfix() 1.413 +{ 1.414 +cat <<EOT 1.415 + <frame Postfix> 1.416 +$(configfile /etc/postfix/main.cf POSTFIX_CONF) 1.417 + <hbox> 1.418 + $(startstopdaemon postfix) 1.419 + </hbox> 1.420 + </frame> 1.421 +EOT 1.422 +} 1.423 + 1.424 +# 1.425 +# Fetchmail 1.426 +# 1.427 +tab_fetchmail() 1.428 +{ 1.429 +cat <<EOT 1.430 + <frame Fetchmail> 1.431 +$(helpdaemon fetchmail 100x34 FETCHMAIL_OPTIONS FETCHMAIL_OPTS) 1.432 +$(configfile /etc/fetchmail.conf FETCHMAIL_CONF) 1.433 + <hbox> 1.434 + $(startstopdaemon fetchmail) 1.435 + </hbox> 1.436 + </frame> 1.437 +EOT 1.438 +} 1.439 + 1.440 +# 1.441 +# Postgrey 1.442 +# 1.443 +tab_postgrey() 1.444 +{ 1.445 +cat <<EOT 1.446 + <frame Postgrey (SMTP grey list)> 1.447 +$(helpdaemon postgrey 100x34 POSTGREY_OPTIONS POSTGREY_OPTS) 1.448 + <hbox> 1.449 + $(startstopdaemon postgrey) 1.450 + </hbox> 1.451 + </frame> 1.452 +EOT 1.453 +} 1.454 + 1.455 +data_smtp() 1.456 +{ 1.457 +cat <<EOT 1.458 +postfix Postfix tab_postfix 1.459 +fetchmail Fetchmail tab_fetchmail 1.460 +postgrey Grey\ list tab_postgrey 1.461 +EOT 1.462 +} 1.463 + 1.464 +# 1.465 +# smtp tab 1.466 +# 1.467 +tab_smtp() 1.468 +{ 1.469 +use_tab data_smtp 1.470 +} 1.471 + 1.472 +# 1.473 +# Cyrus IMAP 1.474 +# 1.475 +tab_cyrus() 1.476 +{ 1.477 +cat <<EOT 1.478 + <frame Cyrus IMAP/POP3> 1.479 +$(configfile /etc/imapd.conf IMAPD_CONF) 1.480 +$(configfile /etc/cyrus.conf CYRUS_CONF) 1.481 + <hbox> 1.482 + $(startstopdaemon cyrus-imapd) 1.483 + </hbox> 1.484 + </frame> 1.485 +EOT 1.486 +} 1.487 + 1.488 +# 1.489 +# Perdition IMAP/POP3 proxy 1.490 +# 1.491 +tab_perdition() 1.492 +{ 1.493 +cat <<EOT 1.494 + <frame Perdition IMAP/POP3 proxy> 1.495 +$(helpdaemon perdition 100x34 PERDITION_OPTIONS PERDITION_OPTS) 1.496 +$(configfile /etc/perdition/perdition.imap4.conf PROXY_IMAP_CONF) 1.497 +$(configfile /etc/perdition/perdition.pop3.conf PROXY_POP3_CONF) 1.498 + <hbox> 1.499 + $(startstopdaemon perdition) 1.500 + </hbox> 1.501 + </frame> 1.502 +EOT 1.503 +} 1.504 + 1.505 +data_imap() 1.506 +{ 1.507 +cat <<EOT 1.508 +cyradm Cyrus tab_cyrus 1.509 +perdition Proxy tab_perdition 1.510 +EOT 1.511 +} 1.512 + 1.513 +# 1.514 +# imap tab 1.515 +# 1.516 +tab_imap() 1.517 +{ 1.518 +use_tab data_imap 1.519 +} 1.520 + 1.521 +# 1.522 +# Squid 1.523 +# 1.524 +tab_squid() 1.525 +{ 1.526 +cat <<EOT 1.527 + <frame Squid> 1.528 +$(helpdaemon squid 100x26 SQUID_OPTIONS SQUID_OPTS) 1.529 +$(configfile /etc/squid.conf SQUID_CONF) 1.530 +$([ -s /etc/squidGuard/squidGuard.conf ] && configfile /etc/squidGuard/squidGuard.conf SQUIDGUARD_CONF) 1.531 + <hbox> 1.532 + $(startstopdaemon squid) 1.533 + </hbox> 1.534 + </frame> 1.535 +EOT 1.536 +} 1.537 + 1.538 +# 1.539 +# Asterisk 1.540 +# 1.541 +tab_asterisk() 1.542 +{ 1.543 +cat <<EOT 1.544 + <frame Asterisk telephony> 1.545 +$(configfile /etc/asterisk/extensions.conf ASTERISK_CONF) 1.546 + <hbox> 1.547 + $(startstopdaemon asterisk) 1.548 + </hbox> 1.549 + </frame> 1.550 +EOT 1.551 +} 1.552 + 1.553 +# 1.554 +# OpenLDAP 1.555 +# 1.556 +tab_openldap() 1.557 +{ 1.558 +cat <<EOT 1.559 + <frame OpenLDAP> 1.560 +$(configfile /etc/openldap/slapd.conf LDAP_CONF) 1.561 + <hbox> 1.562 + $(startstopdaemon openldap) 1.563 + </hbox> 1.564 + </frame> 1.565 +EOT 1.566 +} 1.567 + 1.568 +# 1.569 +# MySQL 1.570 +# 1.571 +tab_mysql() 1.572 +{ 1.573 +cat <<EOT 1.574 + <frame MySQL> 1.575 +$(helpdaemon mysqld_safe 100x24 MYSQL_OPTIONS MYSQL_OPTS) 1.576 +$(configfile /etc/my.conf MYSQL_CONF) 1.577 + <hbox> 1.578 + $(startstopdaemon mysql) 1.579 + </hbox> 1.580 + </frame> 1.581 +EOT 1.582 +} 1.583 + 1.584 +# 1.585 +# PostgreSQL 1.586 +# 1.587 +tab_postgresql() 1.588 +{ 1.589 +cat <<EOT 1.590 + <frame PostgreSQL> 1.591 +$(helpdaemon postgres 100x34 PGSQL_OPTIONS PGSQL_OPTS) 1.592 +$(configfile /etc/postgresql.conf POSTGRESQL_CONF) 1.593 + <hbox> 1.594 + $(startstopdaemon postgresql) 1.595 + </hbox> 1.596 + </frame> 1.597 +EOT 1.598 +} 1.599 + 1.600 +data_sql() 1.601 +{ 1.602 +cat <<EOT 1.603 +mysqld_safe MySQL tab_mysql 1.604 +postgres PostgreSQL tab_postgresql 1.605 +EOT 1.606 +} 1.607 + 1.608 +# 1.609 +# sql tab 1.610 +# 1.611 +tab_sql() 1.612 +{ 1.613 +use_tab data_sql 1.614 +} 1.615 + 1.616 +# 1.617 +# Slim display manager 1.618 +# 1.619 +tab_slim() 1.620 +{ 1.621 +cat <<EOT 1.622 + <frame Slim display manager> 1.623 +$(helpdaemon slim 80x10 SLIM_OPTIONS SLIM_OPTS) 1.624 +$(configfile /etc/slim.conf SLIM_CONF) 1.625 + <hbox> 1.626 + $(startstopdaemon slim) 1.627 + </hbox> 1.628 + </frame> 1.629 +EOT 1.630 +} 1.631 + 1.632 +# 1.633 +# Cron 1.634 +# 1.635 +tab_cron() 1.636 +{ 1.637 +cat <<EOT 1.638 + <frame Crond (busybox)> 1.639 +$(helpdaemon crond 80x15 CROND_OPTIONS CROND_OPTS) 1.640 + <hbox> 1.641 + $(startstopdaemon crond) 1.642 + </hbox> 1.643 + </frame> 1.644 +EOT 1.645 +} 1.646 + 1.647 +# 1.648 +# NTP 1.649 +# 1.650 +tab_ntp() 1.651 +{ 1.652 +cat <<EOT 1.653 + <frame Ntpd> 1.654 +$(helpdaemon ntpd 100x34 NTP_OPTIONS NTP_OPTS) 1.655 +$(configfile /etc/ntp.conf NTP_CONF) 1.656 + <hbox> 1.657 + $(startstopdaemon ntp) 1.658 + </hbox> 1.659 + </frame> 1.660 +EOT 1.661 +} 1.662 + 1.663 +# 1.664 +# nfsd 1.665 +# 1.666 +tab_nfsd() 1.667 +{ 1.668 +cat <<EOT 1.669 + <frame Nfsd> 1.670 +$(configfile /etc/exports EXPORTS) 1.671 + <hbox> 1.672 + $(startstopdaemon nfsd nfs-utils) 1.673 + </hbox> 1.674 + </frame> 1.675 +EOT 1.676 +} 1.677 + 1.678 +# 1.679 +# unfsd 1.680 +# 1.681 +tab_unfsd() 1.682 +{ 1.683 +cat <<EOT 1.684 + <frame Unfsd> 1.685 +$(helpdaemon ntpd 80x20 UNFSD_OPTIONS UNFSD_OPTS) 1.686 +$(configfile /etc/exports EXPORTS) 1.687 + <hbox> 1.688 + $(startstopdaemon unfsd unfs3) 1.689 + </hbox> 1.690 + </frame> 1.691 +EOT 1.692 +} 1.693 + 1.694 +data_nfs() 1.695 +{ 1.696 +cat <<EOT 1.697 +rpc.nfsd Nfsd tab_nfsd 1.698 +unfsd Unfsd tab_unfsd 1.699 +EOT 1.700 +} 1.701 + 1.702 +# 1.703 +# nfs tab 1.704 +# 1.705 +tab_nfs() 1.706 +{ 1.707 +use_tab data_nfs 1.708 +} 1.709 + 1.710 +# 1.711 +# ftpd 1.712 +# 1.713 +tab_ftpd() 1.714 +{ 1.715 +cat <<EOT 1.716 + <frame ftpd> 1.717 +$(helpdaemon ftpd 100x34 FTPD_OPTIONS FTPD_OPTS) 1.718 + <hbox> 1.719 + $(startstopdaemon ftpd) 1.720 + </hbox> 1.721 + </frame> 1.722 +EOT 1.723 +} 1.724 + 1.725 +# 1.726 +# pure-ftpd 1.727 +# 1.728 +tab_pureftpd() 1.729 +{ 1.730 +cat <<EOT 1.731 + <frame pure-ftpd> 1.732 +$(helpdaemon pure-ftpd 80x34 PUREFTPD_OPTIONS PUREFTPD_OPTS) 1.733 + <hbox> 1.734 + $(startstopdaemon pure-ftpd) 1.735 + </hbox> 1.736 + </frame> 1.737 +EOT 1.738 +} 1.739 + 1.740 +data_ftp() 1.741 +{ 1.742 +cat <<EOT 1.743 +$(readlink /usr/bin/ftpd | grep -q busybox && echo "true" || 1.744 +echo "#") Busybox\ ftpd tab_ftpd 1.745 +pure-ftpd pure-ftpd tab_pureftpd 1.746 +EOT 1.747 +} 1.748 + 1.749 +# 1.750 +# ftp tab 1.751 +# 1.752 +tab_ftp() 1.753 +{ 1.754 +use_tab data_ftp 1.755 +} 1.756 + 1.757 +# 1.758 +# NTP 1.759 +# 1.760 +tab_ntp() 1.761 +{ 1.762 +cat <<EOT 1.763 + <frame Ntpd> 1.764 +$(helpdaemon ntpd 80x20 NTP_OPTIONS NTP_OPTS) 1.765 +$(configfile /etc/ntp.conf NTP_CONF) 1.766 + <hbox> 1.767 + $(startstopdaemon ntp) 1.768 + </hbox> 1.769 + </frame> 1.770 +EOT 1.771 +} 1.772 + 1.773 +# 1.774 +# cups 1.775 +# 1.776 +tab_cups() 1.777 +{ 1.778 +cat <<EOT 1.779 + <frame Cupsd> 1.780 +$(helpdaemon cupsd 80x12 CUPSD_OPTIONS CUPSD_OPTS) 1.781 +$(configfile /etc/cups/cupsd.conf CUPSD_CONF) 1.782 + <hbox> 1.783 + $(startstopdaemon cupsd) 1.784 + </hbox> 1.785 + </frame> 1.786 +EOT 1.787 +} 1.788 + 1.789 +# 1.790 +# rsync server 1.791 +# 1.792 +tab_rsync() 1.793 +{ 1.794 +cat <<EOT 1.795 + <frame Rsync> 1.796 +$(helpdaemon rsync 80x30 RSYNCD_OPTIONS RSYNCD_OPTS 1) 1.797 +$(configfile /etc/rsyncd.conf RSYNCD_CONF) 1.798 +$(datafile /etc/rsyncd.secrets RSYNCD_SECRETS 'Secrets file :') 1.799 + <hbox> 1.800 + $(startstopdaemon rsyncd rsync) 1.801 + </hbox> 1.802 + </frame> 1.803 +EOT 1.804 +} 1.805 + 1.806 +php_ini() 1.807 +{ 1.808 +[ -f /etc/php.ini ] && cat <<EOT 1.809 + <frame PHP> 1.810 +$(configfile /etc/php.ini PHP_CONF) 1.811 + </frame> 1.812 +EOT 1.813 +} 1.814 + 1.815 +# 1.816 +# Apache server 1.817 +# 1.818 +tab_apache() 1.819 +{ 1.820 +cat <<EOT 1.821 + <frame Apache> 1.822 +$(configfile /etc/apache/httpd.conf HTTPD_CONF) 1.823 +$(php_ini) 1.824 + <hbox> 1.825 + $(startstopdaemon apache) 1.826 + </hbox> 1.827 + </frame> 1.828 +EOT 1.829 +} 1.830 + 1.831 +# 1.832 +# Lighttpd server 1.833 +# 1.834 +tab_lighttpd() 1.835 +{ 1.836 +cat <<EOT 1.837 + <frame Lighttpd> 1.838 +$(helpdaemon lighttpd 80x15 LIGHTTPD_OPTIONS LIGHTTPD_OPTS) 1.839 +$(configfile /etc/lighttpd/lighttpd.conf LIGHTTPD_CONF) 1.840 +$(php_ini) 1.841 + <hbox> 1.842 + $(startstopdaemon lighttpd) 1.843 + </hbox> 1.844 + </frame> 1.845 +EOT 1.846 +} 1.847 + 1.848 +# 1.849 +# Busybox httpd server 1.850 +# 1.851 +tab_httpd() 1.852 +{ 1.853 +cat <<EOT 1.854 + <frame httpd (busybox)> 1.855 +$(helpdaemon httpd 80x30 HTTPD_OPTIONS HTTPD_OPTS) 1.856 +$(configfile /etc/httpd.conf HTTPD_CONF) 1.857 +$(php_ini) 1.858 + <hbox> 1.859 + $(startstopdaemon httpd busybox) 1.860 + </hbox> 1.861 + </frame> 1.862 +EOT 1.863 +} 1.864 + 1.865 +data_http() 1.866 +{ 1.867 +cat <<EOT 1.868 +/etc/apache/httpd.conf Apache tab_apache 1.869 +lighttpd Lighttpd tab_lighttpd 1.870 +/etc/httpd.conf Busybox\ httpd tab_httpd 1.871 +squid Web\ cache tab_squid 1.872 +EOT 1.873 +} 1.874 + 1.875 +# 1.876 +# http tab 1.877 +# 1.878 +tab_http() 1.879 +{ 1.880 +use_tab data_http 1.881 +} 1.882 + 1.883 +# 1.884 +# Samba servers 1.885 +# 1.886 +tab_wins() 1.887 +{ 1.888 +cat <<EOT 1.889 + <frame Samba: smbd & nmbd> 1.890 +$(configfile /etc/samba/smb.conf SMBD_CONF) 1.891 + <hbox> 1.892 + <button> 1.893 + <label>Reload</label> 1.894 + <input file icon="reload"></input> 1.895 + <action>/etc/init.d/samba reload</action> 1.896 + </button> 1.897 + $(startstopdaemon samba) 1.898 + </hbox> 1.899 + </frame> 1.900 +EOT 1.901 +} 1.902 + 1.903 +# 1.904 +# x11vnc 1.905 +# 1.906 +tab_vnc() 1.907 +{ 1.908 +cat <<EOT 1.909 + <frame x11vnc> 1.910 +$(helpdaemon x11vnc 80x30 X11VNC_OPTIONS X11VNC_OPTS) 1.911 + <hbox> 1.912 + <text use-markup="true"> 1.913 + <label>"<b>New password</b>"</label> 1.914 + </text> 1.915 + <entry> 1.916 + <variable>X11VNC_PASSWD</variable> 1.917 + </entry> 1.918 + <button> 1.919 + <input file icon="reload"></input> 1.920 + <label>Update</label> 1.921 + <action>x11vnc -storepasswd \$X11VNC_PASSWD /etc/vnc.secret</action> 1.922 + </button> 1.923 + </hbox> 1.924 + <hbox> 1.925 + $(startstopdaemon x11vnc) 1.926 + </hbox> 1.927 + </frame> 1.928 +EOT 1.929 +} 1.930 + 1.931 +# 1.932 +# knock server 1.933 +# 1.934 +tab_knockd() 1.935 +{ 1.936 +cat <<EOT 1.937 + <frame Knockd: trigger backdoors> 1.938 +$(helpdaemon knockd 80x15 KNOCK_OPTIONS KNOCK_OPTS) 1.939 +$(configfile /etc/knockd.conf KNOCKD_CONF) 1.940 + <hbox> 1.941 + $(startstopdaemon knockd knock) 1.942 + </hbox> 1.943 + </frame> 1.944 +EOT 1.945 +} 1.946 + 1.947 +data_servers() 1.948 +{ 1.949 +local $pxe 1.950 +pxe="#" 1.951 +[ -x /usr/bin/tftpd -a -x /usr/sbin/udhcpd ] && pxe="inetd" 1.952 +[ -x /usr/sbin/dnsmasq ] && pxe="true" 1.953 +[ -f /usr/share/boot/pxelinux.0.lzma -o /usr/share/boot/gpxe.pxe ] || pxe="#" 1.954 +cat <<EOT 1.955 +slim Slim tab_slim 1.956 +crond Crond tab_cron 1.957 +inetd Inetd tab_inetd 1.958 +zcip ZeroConf tab_zcip 1.959 +$([ -x /usr/sbin/udhcpd -o -x /usr/sbin/dhcpd -o -x /usr/sbin/dnsmasq ] && 1.960 +echo "true" || 1.961 +echo "#") DHCP tab_dhcpd 1.962 +$pxe PXE tab_pxe 1.963 +$([ -x /usr/sbin/dnsd -o -x /usr/sbin/named -o -x /usr/sbin/dnsmasq ] && 1.964 +echo "true" || 1.965 +echo "#") DNS tab_dns 1.966 +ntpd NTP tab_ntp 1.967 +cupsd CUPS tab_cups 1.968 +$([ -x /usr/bin/mysqld_safe -o -x /usr/bin/postgres ] && echo "true" || 1.969 +echo "#") SQL tab_sql 1.970 +knockd Knock tab_knockd 1.971 +$([ -x /usr/sbin/dropbear -o -x /usr/sbin/sshd ] && echo "true" || 1.972 +echo "#") SSH tab_sshd 1.973 +x11vnc VNC tab_vnc 1.974 +dnsmasq TFTP tab_dnsmasq 1.975 +$([ -x /usr/bin/ftpd -o -x /usr/sbin/pure-ftpd ] && echo "true" || 1.976 +echo "#") FTP tab_ftp 1.977 +$([ -x /usr/sbin/lighttpd -o -x /usr/bin/httpd -o -x /usr/sbin/squid ] && echo "true" || 1.978 +echo "#") HTTP tab_http 1.979 +rsync Rsync tab_rsync 1.980 +$([ -x /usr/sbin/rpc.nfsd -o -x /usr/bin/unfsd ] && echo "true" || 1.981 +echo "#") NFS tab_nfs 1.982 +smbd SAMBA tab_wins 1.983 +slapcat LDAP tab_openldap 1.984 +postfix SMTP tab_smtp 1.985 +cyradm IMAP tab_imap 1.986 +asterisk Telephony tab_asterisk 1.987 +#TODO+callback pppd Pppd tab_pppd 1.988 +#TODO pptpd PoPToP tab_poptop 1.989 +EOT 1.990 +} 1.991 + 1.992 +# 1.993 +# Servers tab 1.994 +# 1.995 +tab_servers() 1.996 +{ 1.997 +use_tab data_servers 1.998 +} 1.999 + 1.1000 +# 1.1001 +# Firewall tab 1.1002 +# 1.1003 +tab_firewall() 1.1004 +{ 1.1005 +cat <<EOT 1.1006 + <frame Iptables> 1.1007 +$(configfile /etc/firewall.conf IPTABLES_CONF) 1.1008 + <hbox> 1.1009 +$(helpbutton iptables 80x30) 1.1010 +$(manbutton 8 iptables) 1.1011 +$(webbutton iptables) 1.1012 + <button> 1.1013 + <label>Load</label> 1.1014 + <input file icon="reload"></input> 1.1015 + <action>cat \$IPTABLES_CONF | /sbin/iptables-restore</action> 1.1016 + </button> 1.1017 + <button> 1.1018 + <label>Save</label> 1.1019 + <input file icon="go-jump"></input> 1.1020 + <action>/sbin/iptables-save > \$IPTABLES_CONF</action> 1.1021 + </button> 1.1022 + </hbox> 1.1023 + </frame> 1.1024 +EOT 1.1025 +} 1.1026 + 1.1027 +# 1.1028 +# knock client 1.1029 +# 1.1030 +tab_knock() 1.1031 +{ 1.1032 +cat <<EOT 1.1033 + <frame Knock> 1.1034 + <hbox> 1.1035 + <text use-markup="true"> 1.1036 + <label>"<b>Options : </b>"</label> 1.1037 + </text> 1.1038 + <entry editable="true"> 1.1039 + <variable>KNOCK_OPTS</variable> 1.1040 + <default>myserver.example.com 123:tcp 456:udp 789:tcp</default> 1.1041 + </entry> 1.1042 + </hbox> 1.1043 + <hbox> 1.1044 +$(helpbutton knock 80x12) 1.1045 + <button> 1.1046 + <label>Start</label> 1.1047 + <input file icon="forward"></input> 1.1048 + <action>knock \$KNOCK_OPTS</action> 1.1049 + </button> 1.1050 + </hbox> 1.1051 + </frame> 1.1052 +EOT 1.1053 +} 1.1054 + 1.1055 +data_main() 1.1056 +{ 1.1057 +cat <<EOT 1.1058 +#program tab name function 1.1059 +true Servers tab_servers 1.1060 +iptables Firewall tab_firewall 1.1061 +knock Knock tab_knock 1.1062 +true Status tab_status 1.1063 +EOT 1.1064 +} 1.1065 + 1.1066 +tab_main() 1.1067 +{ 1.1068 +use_tab data_main 1.1069 +} 1.1070 + 1.1071 +###################################################### 1.1072 +# 1.1073 +# Serverbox GUI 1.1074 +# 1.1075 +###################################################### 1.1076 + 1.1077 +# Only root can configure server. 1.1078 +check_root 1.1079 + 1.1080 +# English/French help dialog. 1.1081 +export HELP=' 1.1082 +<window title="Network status" icon-name="network-wire"> 1.1083 +<vbox> 1.1084 + <text use-markup="true"> 1.1085 + <label> 1.1086 +" 1.1087 +<b>SliTaz - Serverbox</b>" 1.1088 + </label> 1.1089 + </text> 1.1090 + <frame English> 1.1091 + <text wrap="true" width-chars="58"> 1.1092 + <label> 1.1093 +"Serverbox lets you manage and setup servers. First, install and 1.1094 +edit any configuration files. Then, start or stop the servers." 1.1095 + </label> 1.1096 + </text> 1.1097 + </frame> 1.1098 + <frame Francais> 1.1099 + <text wrap="true" width-chars="58"> 1.1100 + <label> 1.1101 +"Serverbox peut demarrer ou arreter le reseau, configurer 1.1102 +les interfaces reseau ou editer directement les fichiers." 1.1103 + </label> 1.1104 + </text> 1.1105 + </frame> 1.1106 +</vbox> 1.1107 +</window> 1.1108 +' 1.1109 + 1.1110 +# The main dialog with notebook, start/stop buttons and all options. 1.1111 +# Note that /etc/network.conf is seded when an interface is activated. 1.1112 +# 1.1113 +head=' 1.1114 +<window title="SliTaz Server Manager" icon-name="network-wired"> 1.1115 + <vbox> 1.1116 + 1.1117 + <hbox> 1.1118 + <text use-markup="true"> 1.1119 + <label>"<b>Server Manager</b>"</label> 1.1120 + </text> 1.1121 + <pixmap> 1.1122 + <input file>/usr/share/pixmaps/netbox.png</input> 1.1123 + </pixmap> 1.1124 + </hbox> 1.1125 +' 1.1126 +bottom=' 1.1127 + <hbox> 1.1128 + <button help> 1.1129 + <label>Help</label> 1.1130 + <action type="launch">HELP</action> 1.1131 + </button> 1.1132 + <button> 1.1133 + <label>Quit</label> 1.1134 + <input file icon="exit"></input> 1.1135 + <action type="exit">Exit</action> 1.1136 + </button> 1.1137 + </hbox> 1.1138 + 1.1139 + </vbox> 1.1140 +</window> 1.1141 +' 1.1142 + 1.1143 +SERVER_BOX="${head}$(tab_main)${bottom}" 1.1144 + 1.1145 +export SERVER_BOX 1.1146 + 1.1147 +gtkdialog --center --program=SERVER_BOX >/dev/null