slitaz-tools rev 137

netbox: add samba and iptables
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Apr 12 22:34:10 2008 +0000 (2008-04-12)
parents 490925fcedbe
children 6a23c6b9e39a
files tinyutils/netbox
line diff
     1.1 --- a/tinyutils/netbox	Wed Apr 09 20:08:43 2008 +0000
     1.2 +++ b/tinyutils/netbox	Sat Apr 12 22:34:10 2008 +0000
     1.3 @@ -90,7 +90,9 @@
     1.4        </hbox>
     1.5      </frame>
     1.6    
     1.7 -    <notebook labels="DHCP|Static IP|System wide|Servers">
     1.8 +    <notebook labels="DHCP|Static IP|System wide|Servers'
     1.9 +[ -x /sbin/iptables ] && NET_BOX="$NET_BOX|Firewall"
    1.10 +tmp='">
    1.11    
    1.12      <frame Udhcpc>
    1.13        <hbox>
    1.14 @@ -239,6 +241,7 @@
    1.15        </hbox>
    1.16      </frame>
    1.17      <notebook labels="'
    1.18 +NET_BOX="$NET_BOX$tmp"
    1.19  tmp=''
    1.20  [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}SSH"   && tmp='|'
    1.21  [ -x /usr/bin/tftpd     ] && NET_BOX="${NET_BOX}${tmp}TFTP"  && tmp='|' 
    1.22 @@ -248,6 +251,7 @@
    1.23  [ -x /usr/sbin/dnsd     ] && NET_BOX="${NET_BOX}${tmp}DNS"   && tmp='|' 
    1.24  [ -x /usr/bin/rsync     ] && NET_BOX="${NET_BOX}${tmp}RSYNC" && tmp='|' 
    1.25  [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}HTTP"  && tmp='|' 
    1.26 +[ -x /usr/sbin/smbd     ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|' 
    1.27  . /etc/daemons.conf
    1.28  set -- $DROPBEAR_OPTIONS
    1.29  while [ -n "$2" ]; do
    1.30 @@ -484,7 +488,7 @@
    1.31          </entry>
    1.32          <button>
    1.33            <input file icon="help"></input>
    1.34 -	  <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "rsync daemon help" -e "rsync --daemon --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
    1.35 +	  <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>
    1.36          </button>
    1.37          <button>
    1.38            <input file icon="accessories-text-editor"></input>
    1.39 @@ -567,10 +571,77 @@
    1.40       </frame>
    1.41  '
    1.42  [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}" 
    1.43 +tmp='<frame Samba: smbd & nmbd>
    1.44 +      <hbox>
    1.45 +        <text use-markup="true">
    1.46 +          <label>"<b>Configuration :</b>"</label>
    1.47 +        </text>
    1.48 +        <entry editable="false">
    1.49 +          <default>/etc/samba/smb.conf</default>
    1.50 +          <variable>SMBD_CONF</variable>
    1.51 +        </entry>
    1.52 +        <button>
    1.53 +          <input file icon="accessories-text-editor"></input>
    1.54 +          <action type="lauch">leafpad $SMBD_CONF</action>
    1.55 +        </button>
    1.56 +      </hbox>
    1.57 +      <hbox>
    1.58 +        <button>
    1.59 +          <label>Reload</label>
    1.60 +          <input file icon="reload"></input>
    1.61 +          <action>/etc/init.d/samba reload</action>
    1.62 +        </button>
    1.63 +        <button>
    1.64 +          <label>Start</label>
    1.65 +          <input file icon="forward"></input>
    1.66 +          <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
    1.67 +          <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"samba \1\"/" /etc/rcS.conf</action>
    1.68 +          <action>/etc/init.d/lighttpd start</action>
    1.69 +        </button>
    1.70 +        <button>
    1.71 +          <label>Stop</label>
    1.72 +          <input file icon="stop"></input>
    1.73 +          <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
    1.74 +          <action>/etc/init.d/lighttpd stop</action>
    1.75 +        </button>
    1.76 +      </hbox>
    1.77 +     </frame>
    1.78 +'
    1.79 +[ -x /usr/sbin/smbd     ] && NET_BOX="${NET_BOX}${tmp}"
    1.80 +NET_BOX="${NET_BOX}
    1.81 +    </notebook>
    1.82 +"
    1.83 +tmp='<frame Iptables>
    1.84 +      <hbox>
    1.85 +        <text use-markup="true">
    1.86 +          <label>"<b>Configuration :</b>"</label>
    1.87 +        </text>
    1.88 +        <entry editable="false">
    1.89 +          <default>/etc/iptables.conf</default>
    1.90 +          <variable>IPTABLES_CONF</variable>
    1.91 +        </entry>
    1.92 +        <button>
    1.93 +          <input file icon="accessories-text-editor"></input>
    1.94 +          <action type="lauch">leafpad $IPTABLES_CONF</action>
    1.95 +        </button>
    1.96 +      </hbox>
    1.97 +      <hbox>
    1.98 +        <button>
    1.99 +          <label>Load</label>
   1.100 +          <input file icon="reload"></input>
   1.101 +          <action>/sbin/iptables-restore \< $IPTABLES_CONF</action>
   1.102 +        </button>
   1.103 +        <button>
   1.104 +          <label>Save</label>
   1.105 +          <input file icon="go-jump"></input>
   1.106 +          <action>/sbin/iptables-save \> $IPTABLES_CONF</action>
   1.107 +        </button>
   1.108 +      </hbox>
   1.109 +     </frame>
   1.110 +'
   1.111 +[ -x /sbin/iptables ] && NET_BOX="$NET_BOX${tmp}"
   1.112  tmp='
   1.113      </notebook>
   1.114 -    
   1.115 -    </notebook>
   1.116  
   1.117      <hbox>
   1.118        <button>
   1.119 @@ -591,8 +662,8 @@
   1.120  
   1.121  export NET_BOX
   1.122  
   1.123 -# TODO: Servers/VNC(X11vnc) Servers/SMB(Samba)
   1.124 -# Modules(Network kernel modules) Firewall(Iptables) VPN(OpenVPN)
   1.125 +# TODO: Servers/VNC(X11vnc)
   1.126 +# Modules(Network kernel modules) VPN(OpenVPN)
   1.127  
   1.128  # Only root can configure network.
   1.129  check_root