#!/bin/sh
set $(cat /tmp/ipsub_intern.txt | tr "/" " ")
IP_INT=$1
SUB_INT=$2
set $(cat /tmp/ipsub_extern.txt | tr "/" " ")
IP_EXT=$1
SUB_EXT=$2
set $(echo $IP_INT | tr "." " ")
IP_INT_LAST=$4
IP_INT_LAST_P=`expr $4 + 1` IP_PARTNER=$1.$2.$3.$IP_INT_LAST_P
rm -f /etc/hosts.allow /etc/hosts.deny /etc/inetd.conf
cp /KNOPPIX/etc/inetd.conf /etc/
rm -f /etc/ssh/sshd_config
cp /KNOPPIX/etc/ssh/sshd_config /etc/ssh/
rm -f /etc/inetd.conf
cp /KNOPPIX/etc/inetd.conf /etc/
echo "in.telnetd: $IP_PARTNER,192.168.216.254" >> /etc/hosts.allow
echo "sshd: $IP_PARTNER,192.168.216.254" >> /etc/hosts.allow
echo "ALL:ALL" >> /etc/hosts.deny
echo "ListenAddress $IP_EXT" >> /etc/ssh/sshd_config
echo "sshd: $IP_PARTNER,192.168.216.254" >> /etc/inetd.conf
echo "telnet stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.telnetd" >> /etc/inetd.conf
/etc/init.d/inetd restart
echo "Telnet und SSH gestartet"