wok-6.x diff mirror-tools/stuff/host/install @ rev 5973
mirror-tools: add host scripts
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Aug 08 19:48:39 2010 +0200 (2010-08-08) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mirror-tools/stuff/host/install Sun Aug 08 19:48:39 2010 +0200 1.3 @@ -0,0 +1,25 @@ 1.4 +#!/bin/sh 1.5 + 1.6 +grep -qs lguest-slitaz /etc/inittab || { 1.7 +sed -i 's|^tty1::|tty16::respawn:/boot/lguest-slitaz tty16 /boot/guests/mirror.slitaz.org 192.168.0.1\n&|' /etc/inittab 1.8 +cat >> /etc/init.d/local.sh <<EOT 1.9 +. /etc/network.conf 1.10 +iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE 1.11 +for port in 22 873 ; do 1.12 + iptables -t nat -A PREROUTING -i $INTERFACE --dport $port \ 1.13 + -j DNAT --to-destination 192.168.0.6:$port 1.14 +done 1.15 +for port in 80 443 ; do 1.16 + iptables -A INPUT -p tcp -m tcp --dport $port -j ACCEPT 1.17 +done 1.18 +for iface in tap+ ; do 1.19 + iptables -A INPUT -i $iface -j ACCEPT 1.20 + iptables -A OUTPUT -o $iface -j ACCEPT 1.21 + iptables -A FORWARD -i $iface -m state \ 1.22 + --state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT 1.23 + iptables -A FORWARD -o $iface -m state \ 1.24 + --state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT 1.25 +done 1.26 +echo "1" > /proc/sys/net/ipv4/ip_forward 1.27 +EOT 1.28 +}