diff options
| author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-03-10 11:33:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-10 11:33:25 +0100 |
| commit | 5077120a251980b4fafed61b4aa8fa5730a85443 (patch) | |
| tree | 8500b8f5dbe774b399cfdc79f5665ba88ef7f255 /.github/prepare_debian.sh | |
| parent | a3de84594104ac87a91e200d569fb57edacca928 (diff) | |
| parent | 269718094177fb8a7e3d3005d1310495009fe8c4 (diff) | |
| download | monitoring-plugins-5077120a251980b4fafed61b4aa8fa5730a85443.tar.gz | |
Merge branch 'master' into master
Diffstat (limited to '.github/prepare_debian.sh')
| -rwxr-xr-x | .github/prepare_debian.sh | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh new file mode 100755 index 00000000..5222659e --- /dev/null +++ b/.github/prepare_debian.sh | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | export DEBIAN_FRONTEND=noninteractive | ||
| 7 | |||
| 8 | sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources | ||
| 9 | apt-get update | ||
| 10 | apt-get -y install software-properties-common | ||
| 11 | if [ $(lsb_release -is) = "Debian" ]; then | ||
| 12 | apt-add-repository non-free | ||
| 13 | apt-get update | ||
| 14 | fi | ||
| 15 | apt-get -y install perl \ | ||
| 16 | autotools-dev \ | ||
| 17 | libdbi-dev \ | ||
| 18 | libldap2-dev \ | ||
| 19 | libpq-dev \ | ||
| 20 | libradcli-dev \ | ||
| 21 | libnet-snmp-perl \ | ||
| 22 | procps \ | ||
| 23 | libdbi0-dev \ | ||
| 24 | libdbd-sqlite3 \ | ||
| 25 | libssl-dev \ | ||
| 26 | dnsutils \ | ||
| 27 | snmp-mibs-downloader \ | ||
| 28 | libsnmp-perl \ | ||
| 29 | snmpd \ | ||
| 30 | fping \ | ||
| 31 | snmp \ | ||
| 32 | netcat-openbsd \ | ||
| 33 | smbclient \ | ||
| 34 | vsftpd \ | ||
| 35 | apache2 \ | ||
| 36 | ssl-cert \ | ||
| 37 | postfix \ | ||
| 38 | libhttp-daemon-ssl-perl \ | ||
| 39 | libdbd-sybase-perl \ | ||
| 40 | libnet-dns-perl \ | ||
| 41 | slapd \ | ||
| 42 | ldap-utils \ | ||
| 43 | gcc \ | ||
| 44 | make \ | ||
| 45 | autoconf \ | ||
| 46 | automake \ | ||
| 47 | gettext \ | ||
| 48 | faketime \ | ||
| 49 | libmonitoring-plugin-perl \ | ||
| 50 | libcurl4-openssl-dev \ | ||
| 51 | liburiparser-dev \ | ||
| 52 | squid \ | ||
| 53 | openssh-server \ | ||
| 54 | mariadb-server \ | ||
| 55 | mariadb-client \ | ||
| 56 | libmariadb-dev \ | ||
| 57 | cron \ | ||
| 58 | iputils-ping \ | ||
| 59 | iproute2 | ||
| 60 | |||
| 61 | # remove ipv6 interface from hosts | ||
| 62 | if [ $(ip addr show | grep "inet6 ::1" | wc -l) -eq "0" ]; then | ||
| 63 | sed '/^::1/d' /etc/hosts > /tmp/hosts | ||
| 64 | cp -f /tmp/hosts /etc/hosts | ||
| 65 | fi | ||
| 66 | |||
| 67 | ip addr show | ||
| 68 | |||
| 69 | cat /etc/hosts | ||
| 70 | |||
| 71 | # apache | ||
| 72 | a2enmod ssl | ||
| 73 | a2ensite default-ssl | ||
| 74 | # replace snakeoil certs with openssl generated ones as the make-ssl-cert ones | ||
| 75 | # seems to cause problems with our plugins | ||
| 76 | rm /etc/ssl/certs/ssl-cert-snakeoil.pem | ||
| 77 | rm /etc/ssl/private/ssl-cert-snakeoil.key | ||
| 78 | openssl req -nodes -newkey rsa:2048 -x509 -sha256 -days 365 -nodes -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem -subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=$(hostname)" | ||
| 79 | service apache2 restart | ||
| 80 | |||
| 81 | # squid | ||
| 82 | cp tools/squid.conf /etc/squid/squid.conf | ||
| 83 | service squid start | ||
| 84 | |||
| 85 | # mariadb | ||
| 86 | service mariadb start | ||
| 87 | mysql -e "create database IF NOT EXISTS test;" -uroot | ||
| 88 | |||
| 89 | # ldap | ||
| 90 | sed -e 's/cn=admin,dc=nodomain/'$(/usr/sbin/slapcat|grep ^dn:|awk '{print $2}')'/' -i .github/NPTest.cache | ||
| 91 | service slapd start | ||
| 92 | |||
| 93 | # sshd | ||
| 94 | ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa | ||
| 95 | cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys | ||
| 96 | service ssh start | ||
| 97 | sleep 1 | ||
| 98 | ssh-keyscan localhost >> ~/.ssh/known_hosts | ||
| 99 | touch ~/.ssh/config | ||
| 100 | |||
| 101 | # start one login session, required for check_users | ||
| 102 | ssh -tt localhost </dev/null >/dev/null 2>/dev/null & | ||
| 103 | disown %1 | ||
| 104 | |||
| 105 | # snmpd | ||
| 106 | for DIR in /usr/share/snmp/mibs /usr/share/mibs; do | ||
| 107 | rm -f $DIR/ietf/SNMPv2-PDU \ | ||
| 108 | $DIR/ietf/IPSEC-SPD-MIB \ | ||
| 109 | $DIR/ietf/IPATM-IPMC-MIB \ | ||
| 110 | $DIR/iana/IANA-IPPM-METRICS-REGISTRY-MIB | ||
| 111 | done | ||
| 112 | mkdir -p /var/lib/snmp/mib_indexes | ||
| 113 | sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf | ||
| 114 | service snmpd start | ||
| 115 | |||
| 116 | # start cron, will be used by check_nagios | ||
| 117 | cron | ||
| 118 | |||
| 119 | # start postfix | ||
| 120 | service postfix start | ||
| 121 | |||
| 122 | # start ftpd | ||
| 123 | service vsftpd start | ||
| 124 | |||
| 125 | # hostname | ||
| 126 | sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.github/NPTest.cache | ||
| 127 | |||
| 128 | # create some test files to lower inodes | ||
| 129 | for i in $(seq 10); do | ||
| 130 | touch /media/ramdisk2/test.$1 | ||
| 131 | done | ||
