Setzt automatisch folgende Konfigurationen:

  • DNS
  • APT-Proxy
  • NTP
  • SNMP
  • SYSLOG

Erstellt ist das Script auf Ubuntu 10.04 und muss ggfs. für andere Distributionen angepasst werden. Dient nur zur Anregung.

#!/bin/bash
# Variablen
TIMESRV=TIMESERVER
SNMPCOMM=COMMUNITY
APTSRV=APTPROXYSERVER
IPADRESSE=`ip addr show eth0 | grep -v inet6 | grep inet | awk '{print $2}' | cut -d\/ -f1`
DNSSRV=DNSSERVER
DOMAIN=DOMAIN
LOGSRV=RSYSLOGSERVER

# DNS Einstellungen
> /etc/resolv.conf
echo "nameserver $DNSSRV" >> /etc/resolv.conf
echo "domain $DOMAIN" >> /etc/resolv.conf
echo "search $DOMAIN" >> /etc/resolv.conf

# APT-Proxy
mv /etc/apt/sources.list /etc/apt/sources.list.orig
grep '^deb' /etc/apt/sources.list.orig | sed -e 's/http\:\/\//http\:\/\/'$APTSRV'\//g' > /etc/apt/sources.list

# Programminstallationen
aptitude update && aptitude -y upgrade && aptitude -y install snmpd rsyslog openntpd

# OpenNTP
mv /etc/openntpd/ntpd.conf /etc/openntpd/ntpd.conf.orig
echo "server $TIMESRV" > /etc/openntpd/ntpd.conf
service openntpd restart

# SNMP Einstellungen
mv /etc/default/snmpd /etc/default/snmpd.orig
sed -e "s/127\.0\.0\.1/127\.0\.0\.1\ $IPADRESSE/g" /etc/default/snmpd.orig > /etc/default/snmpd
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
echo "rocommunity $SNMPCOMM" > /etc/snmp/snmpd.conf
for i in `df -hP | grep '^/dev/' | awk '{print $6}'`
 do
 echo disk $i >> /etc/snmp/snmpd.conf
done
service snmpd restart

# Rsyslog
echo "*.err;*.crit;*.warn;*.panic       @$LOGSRV" > /etc/rsyslog.d/10-custom.conf
service rsyslog restart