# HG changeset patch # User Rohit Joshi # Date 1269426982 14400 # Node ID eae75165f38c56e6a0fe51dbb89f0fb14153f415 # Parent 612580c572508ad7fd59608a642b48a935a86319 add serverbox (separated from netbox) diff -r 612580c57250 -r eae75165f38c tinyutils/serverbox --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tinyutils/serverbox Wed Mar 24 06:36:22 2010 -0400 @@ -0,0 +1,748 @@ +#!/bin/sh +# +# Gtkdialog box to manage servers. +# Please use tab to indent. + +VERSION=20100315 + +. /usr/lib/slitaz/gui_functions + +# Check if user is root. +check_root() +{ + if test $(id -u) != 0 ; then + echo -e " +You must be root to run `basename $0`. Please type 'su' and +root password to become super-user.\n" + exit 0 + fi +} +# +# Status servers +# +tab_status_servers() +{ +local servers +servers="dropbear sshd inetd dhcpd dnsd named rsync httpd mbd vnc pppd knock" +cat < + + for i in $servers; do ps ww | grep \$i | grep -v grep | fold -s; done + + +EOT +} + +data_status() +{ +cat < + + + + + $2 + user@elsewhere + + + + +EOT +} +# +# Dropbear client & server +# +tab_dropbear() +{ +. /etc/daemons.conf +set -- $DROPBEAR_OPTIONS +while [ -n "$2" ]; do + [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break + shift +done + +cat < +$(helpdaemon dropbear 80x30 DROPBEAR_OPTIONS DROPBEAR_OPTS) +$(datafile /etc/dropbear/banner DROPBEAR_BANNER 'Banner :') +$(sshremote DROPBEAR_PEER 'dbclient -i /etc/dropbear/dropbear_rsa_host_key') + + $(startstopdaemon dropbear) + + +EOT +} + +# +# OpenSSH client & server +# +tab_openssh() +{ +cat < +$(helpdaemon sshd 80x30 OPENSSH_OPTIONS OPENSSH_OPTS 8 nohelp) +$(configfile /etc/ssh/sshd_config OPENSSH_CONF '5 sshd_config') +$(sshremote OPENSSH_PEER 'ssh -i /etc/ssh/ssh_host_rsa_key') + + $(startstopdaemon openssh) + + +EOT +} + +data_sshd() +{ +cat < +$(helpdaemon inetd 60x14 INETD_OPTIONS INETD_OPTS) +$(configfile /etc/inetd.conf INETD_CONF) + +EOT +for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do + i=$(basename $i) + helpbutton $i 60x19 $i +done +cat < + +EOT +} + +# +# ZeroConf +# +tab_zcip() +{ + + . /etc/daemons.conf +if [ -x /sbin/zcip -a -z "$ZCIP_OPTIONS" ]; then + ZCIP_OPTIONS="eth0 /etc/zcip.script" + cat >> /etc/daemons.conf < +$(helpdaemon zcip 60x14 ZCIP_OPTIONS ZCIP_OPTS) +$(datafile /etc/zcip.script CZIP_SCRIPT 'Script :') + + $(startstopdaemon zcip) + + +EOT +} + +# +# Dhcpd ISC +# +tab_isc_dhcpd() +{ +cat < +$(helpdaemon dhcpd 60x14 DHCPD_OPTIONS DHCPD_OPTS) +$(configfile /etc/dhcpd.conf DHCPD_CONF) + + $(startstopdaemon dhcpd dhcp) + + +EOT +} + +# +# Dhcpd Busybox +# +tab_udhcpd() +{ +cat < +$(helpdaemon udhcpd 60x14 UDHCPD_OPTIONS UDHCPD_OPTS) +$(configfile /etc/udhcpd.conf UDHCPD_CONF) + + $(startstopdaemon udhcpd busybox) + + +EOT +} + +data_dhcpd() +{ +cat < + + + + + + + + +"$(dd bs=1 skip=5 count=255 if=/usr/share/boot/gpxe.pxe 2> /dev/null | strings)" + + WEB_PXE + + + +$(wikibutton http://wiki.slitaz.org/doku.php?id=quickstart:pxe) + + + +EOT +} + +# +# PXE server +# +tab_pxelinux() +{ +cat < + + + + + + + + + + + +$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')/pxelinux.cfg/default + + PXE_CONF + + + + +$(wikibutton http://wiki.slitaz.org/doku.php?id=quickstart:pxe) + + + +EOT +} + +data_pxe() +{ +[ -f /usr/share/boot/pxelinux.0.lzma ] && cat < +$(helpdaemon dnsd 80x15 DNSD_OPTIONS DNSD_OPTS) +$(configfile /etc/dnsd.conf DNSD_CONF) + + $(startstopdaemon dnsd busybox) + + +EOT +} + +# +# ISC Bind +# +tab_named() +{ +cat < +$(helpdaemon named 80x10 NAMED_OPTIONS NAMED_OPTS) +$(configfile /etc/bind/named.conf.local NAMED_CONF) + + $(startstopdaemon named bind) + + +EOT +} + +# +# DNSmasq +# +tab_dnsmasq() +{ +cat < +$(helpdaemon dnsmasq 100x34 DNSMASQ_OPTIONS DNSMASQ_OPTS) +$(configfile /etc/dnsmasq.conf DNSMASQ_CONF) + + $(startstopdaemon dnsmasq) + + +EOT +} + +data_dns() +{ +cat < +$(helpdaemon rsync 80x30 RSYNCD_OPTIONS RSYNCD_OPTS 1) +$(configfile /etc/rsyncd.conf RSYNCD_CONF) +$(datafile /etc/rsyncd.secrets RSYNCD_SECRETS 'Secrets file :') + + $(startstopdaemon rsyncd rsync) + + +EOT +} + +php_ini() +{ +[ -f /etc/php.ini ] && cat < +$(configfile /etc/php.ini PHP_CONF) + +EOT +} + +# +# Apache server +# +tab_apache() +{ +cat < +$(configfile /etc/apache/httpd.conf HTTPD_CONF) +$(php_ini) + + $(startstopdaemon apache) + + +EOT +} + +# +# Lighttpd server +# +tab_lighttpd() +{ +cat < +$(helpdaemon lighttpd 80x15 LIGHTTPD_OPTIONS LIGHTTPD_OPTS) +$(configfile /etc/lighttpd/lighttpd.conf LIGHTTPD_CONF) +$(php_ini) + + $(startstopdaemon lighttpd) + + +EOT +} + +# +# Busybox httpd server +# +tab_httpd() +{ +cat < +$(helpdaemon httpd 80x30 HTTPD_OPTIONS HTTPD_OPTS) +$(configfile /etc/httpd.conf HTTPD_CONF) +$(php_ini) + + $(startstopdaemon httpd busybox) + + +EOT +} + +data_http() +{ +cat < +$(configfile /etc/samba/smb.conf SMBD_CONF) + + + $(startstopdaemon samba) + + +EOT +} + +# +# x11vnc +# +tab_vnc() +{ +cat < +$(helpdaemon x11vnc 80x30 X11VNC_OPTIONS X11VNC_OPTS) + + + + + + X11VNC_PASSWD + + + + + $(startstopdaemon x11vnc) + + +EOT +} + +# +# knock server +# +tab_knockd() +{ +cat < +$(helpdaemon knockd 80x15 KNOCK_OPTIONS KNOCK_OPTS) +$(configfile /etc/knockd.conf KNOCKD_CONF) + + $(startstopdaemon knockd knock) + + +EOT +} + +data_servers() +{ +local $pxe +pxe="#" +[ -x /usr/bin/tftpd -a -x /usr/sbin/udhcpd ] && pxe="inetd" +[ -x /usr/sbin/dnsmasq ] && pxe="true" +[ -f /usr/share/boot/pxelinux.0.lzma -o /usr/share/boot/gpxe.pxe ] || pxe="#" +cat < +$(configfile /etc/firewall.conf IPTABLES_CONF) + +$(helpbutton iptables 80x30) +$(manbutton 8 iptables) +$(webbutton iptables) + + + + +EOT +} + +# +# knock client +# +tab_knock() +{ +cat < + + + + + + KNOCK_OPTS + myserver.example.com 123:tcp 456:udp 789:tcp + + + +$(helpbutton knock 80x12) + + + +EOT +} + +data_main() +{ +cat </dev/null