commit 2c3071763d034f1cf8c4fd4caf450ae352765e89 Author: Thomas de Roo Date: Tue Jul 4 10:46:25 2023 +0200 eerste opzet diff --git a/DebianTweaks.sh b/DebianTweaks.sh new file mode 100755 index 0000000..e9d569e --- /dev/null +++ b/DebianTweaks.sh @@ -0,0 +1,41 @@ +#!/bin/bash + + +#Set the correct mailer fqdn +echo $(hostname -f) > /etc/mailname + +#Add mailto address in crontab +awk '/PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin/ { print; print "MAILTO=thomas@de-roo.org"; next }1' /etc/crontab > /tmp/crontab.temp +cat /tmp/crontab.temp > /etc/crontab +rm /tmp/crontab.temp + +#Better logon-message +figlet $(hostname)>/etc/motd + +#SNMP things. N.B.: replace VULHIERDELOCATIEIN later +cat > /etc/snmp/snmpd.conf << 'EOF' +sysLocation VULHIERDELOCATIEIN +sysContact Thomas de Roo +rocommunity cacti +rocommunity librenms +includeAllDisks 10% + +#OS Distribution Detection +extend distro /usr/bin/distro + +#Hardware Detection +# (uncomment for x86 platforms) +extend manufacturer '/bin/cat /sys/devices/virtual/dmi/id/sys_vendor' +extend hardware '/bin/cat /sys/devices/virtual/dmi/id/product_name' +extend serial '/bin/cat /sys/devices/virtual/dmi/id/product_serial' + +# (uncomment for ARM platforms) +#extend hardware '/bin/cat /sys/firmware/devicetree/base/model' +#extend serial '/bin/cat /sys/firmware/devicetree/base/serial-number' +EOF + +curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro +chmod a+x /usr/bin/distro +echo @reboot root chmod 444 /sys/devices/virtual/dmi/id/product_serial >> /etc/crontab +chmod 444 /sys/devices/virtual/dmi/id/product_serial +systemctl restart snmpd