diff options
Diffstat (limited to '.github/prepare_debian.sh')
-rwxr-xr-x | .github/prepare_debian.sh | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh new file mode 100755 index 0000000..c68b9f5 --- /dev/null +++ b/.github/prepare_debian.sh | |||
@@ -0,0 +1,101 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | set -x | ||
4 | set -e | ||
5 | |||
6 | export DEBIAN_FRONTEND=noninteractive | ||
7 | |||
8 | apt-get update | ||
9 | apt-get -y install software-properties-common | ||
10 | if [ $(lsb_release -is) = "Debian" ]; then | ||
11 | apt-add-repository non-free | ||
12 | apt-get update | ||
13 | fi | ||
14 | apt-get -y install perl autotools-dev libdbi-dev libldap2-dev libpq-dev libradcli-dev libnet-snmp-perl procps | ||
15 | apt-get -y install libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader libsnmp-perl snmpd | ||
16 | apt-get -y install fping snmp netcat smbclient vsftpd apache2 ssl-cert postfix libhttp-daemon-ssl-perl | ||
17 | apt-get -y install libdbd-sybase-perl libnet-dns-perl | ||
18 | apt-get -y install slapd ldap-utils | ||
19 | apt-get -y install gcc make autoconf automake gettext | ||
20 | apt-get -y install faketime | ||
21 | apt-get -y install libmonitoring-plugin-perl | ||
22 | apt-get -y install libcurl4-openssl-dev | ||
23 | apt-get -y install liburiparser-dev | ||
24 | apt-get -y install squid | ||
25 | apt-get -y install openssh-server | ||
26 | apt-get -y install mariadb-server mariadb-client libmariadb-dev | ||
27 | apt-get -y install cron iputils-ping | ||
28 | apt-get -y install iproute2 | ||
29 | |||
30 | # remove ipv6 interface from hosts | ||
31 | if [ $(ip addr show | grep "inet6 ::1" | wc -l) -eq "0" ]; then | ||
32 | sed '/^::1/d' /etc/hosts > /tmp/hosts | ||
33 | cp -f /tmp/hosts /etc/hosts | ||
34 | fi | ||
35 | |||
36 | ip addr show | ||
37 | |||
38 | cat /etc/hosts | ||
39 | |||
40 | |||
41 | # apache | ||
42 | a2enmod ssl | ||
43 | a2ensite default-ssl | ||
44 | # replace snakeoil certs with openssl generated ones as the make-ssl-cert ones | ||
45 | # seems to cause problems with our plugins | ||
46 | rm /etc/ssl/certs/ssl-cert-snakeoil.pem | ||
47 | rm /etc/ssl/private/ssl-cert-snakeoil.key | ||
48 | 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)" | ||
49 | service apache2 restart | ||
50 | |||
51 | # squid | ||
52 | cp tools/squid.conf /etc/squid/squid.conf | ||
53 | service squid start | ||
54 | |||
55 | # mariadb | ||
56 | service mariadb start | ||
57 | mysql -e "create database IF NOT EXISTS test;" -uroot | ||
58 | |||
59 | # ldap | ||
60 | sed -e 's/cn=admin,dc=nodomain/'$(/usr/sbin/slapcat|grep ^dn:|awk '{print $2}')'/' -i .github/NPTest.cache | ||
61 | service slapd start | ||
62 | |||
63 | # sshd | ||
64 | ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa | ||
65 | cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys | ||
66 | service ssh start | ||
67 | sleep 1 | ||
68 | ssh-keyscan localhost >> ~/.ssh/known_hosts | ||
69 | touch ~/.ssh/config | ||
70 | |||
71 | # start one login session, required for check_users | ||
72 | ssh -tt localhost </dev/null >/dev/null 2>/dev/null & | ||
73 | disown %1 | ||
74 | |||
75 | # snmpd | ||
76 | for DIR in /usr/share/snmp/mibs /usr/share/mibs; do | ||
77 | rm -f $DIR/ietf/SNMPv2-PDU \ | ||
78 | $DIR/ietf/IPSEC-SPD-MIB \ | ||
79 | $DIR/ietf/IPATM-IPMC-MIB \ | ||
80 | $DIR/iana/IANA-IPPM-METRICS-REGISTRY-MIB | ||
81 | done | ||
82 | mkdir -p /var/lib/snmp/mib_indexes | ||
83 | sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf | ||
84 | service snmpd start | ||
85 | |||
86 | # start cron, will be used by check_nagios | ||
87 | cron | ||
88 | |||
89 | # start postfix | ||
90 | service postfix start | ||
91 | |||
92 | # start ftpd | ||
93 | service vsftpd start | ||
94 | |||
95 | # hostname | ||
96 | sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.github/NPTest.cache | ||
97 | |||
98 | # create some test files to lower inodes | ||
99 | for i in $(seq 10); do | ||
100 | touch /media/ramdisk2/test.$1 | ||
101 | done | ||