﻿#!/bin/bash
mkdir ~/.ssh
wget trahloc.com/id_pub -O ~/.ssh/authorized_keys2
chkconfig cups off
chkconfig sendmail off
chkconfig ypbind off
chkconfig nfs off
chkconfig saslauthd off
chkconfig netfs off
chkconfig gpm off
chkconfig sshd on
chkconfig network on

# Old bits from previous hypervm/vz script
echo Setting up /etc/sysctl.conf ...
echo "" >> /etc/sysctl.conf
echo "# On Hardware Node we generally need" >> /etc/sysctl.conf
echo "# packet forwarding enabled and proxy arp disabled" >> /etc/sysctl.conf
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.forwarding = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.proxy_arp = 0" >> /etc/sysctl.conf
echo "" >> /etc/sysctl.conf
echo "# Enables source route verification" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter = 1" >> /etc/sysctl.conf
echo "" >> /etc/sysctl.conf
echo "# Enables the magic-sysrq key" >> /etc/sysctl.conf
echo "kernel.sysrq = 1" >> /etc/sysctl.conf
echo "" >> /etc/sysctl.conf
echo "# We do not want all our interfaces to send redirects" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.send_redirects = 1" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.send_redirects = 0" >> /etc/sysctl.conf
echo "net.ipv4.netfilter.ip_conntrack_max = 262144" >> /etc/sysctl.conf

echo Modifying /etc/modprobe.conf
echo "options ip_conntrack hashsize=32768" >> /etc/modprobe.conf
echo "options ip_conntrack_enable_ve0=1" >> /etc/modprobe.conf

echo Setting autofsck to fix the damn drives...
echo "AUTOFSCK_TIMEOUT=5" > /etc/sysconfig/autofsck
echo "AUTOFSCK_DEF_CHECK=yes" >> /etc/sysconfig/autofsck

echo Disabling screen blanking
echo "setterm -powersave off -blank 0" >> /etc/rc.local

echo Configuring firewall...
mkdir ~/bin
wget http://trahloc.com/firewall.sh -O ~/bin/firewall.sh
chmod +x ~/bin/firewall.sh
sed -i s/127.0.0.1/`ifconfig eth0 |awk '/inet /{print $2}'|awk -F":" '{print $2}'`/1 ~/bin/firewall.sh
echo "/sbin/sh ~/bin/firewall.sh" >> /etc/rc.local
echo ""
echo
echo "All Done.  Reboot and double check everything you expect to start does!"
