summaryrefslogtreecommitdiffstats
path: root/.github/prepare_debian.sh
diff options
context:
space:
mode:
Diffstat (limited to '.github/prepare_debian.sh')
-rwxr-xr-x.github/prepare_debian.sh131
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
3set -x
4set -e
5
6export DEBIAN_FRONTEND=noninteractive
7
8sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources
9apt-get update
10apt-get -y install software-properties-common
11if [ $(lsb_release -is) = "Debian" ]; then
12 apt-add-repository non-free
13 apt-get update
14fi
15apt-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
62if [ $(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
65fi
66
67ip addr show
68
69cat /etc/hosts
70
71# apache
72a2enmod ssl
73a2ensite default-ssl
74# replace snakeoil certs with openssl generated ones as the make-ssl-cert ones
75# seems to cause problems with our plugins
76rm /etc/ssl/certs/ssl-cert-snakeoil.pem
77rm /etc/ssl/private/ssl-cert-snakeoil.key
78openssl 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)"
79service apache2 restart
80
81# squid
82cp tools/squid.conf /etc/squid/squid.conf
83service squid start
84
85# mariadb
86service mariadb start
87mysql -e "create database IF NOT EXISTS test;" -uroot
88
89# ldap
90sed -e 's/cn=admin,dc=nodomain/'$(/usr/sbin/slapcat|grep ^dn:|awk '{print $2}')'/' -i .github/NPTest.cache
91service slapd start
92
93# sshd
94ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
95cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
96service ssh start
97sleep 1
98ssh-keyscan localhost >> ~/.ssh/known_hosts
99touch ~/.ssh/config
100
101# start one login session, required for check_users
102ssh -tt localhost </dev/null >/dev/null 2>/dev/null &
103disown %1
104
105# snmpd
106for 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
111done
112mkdir -p /var/lib/snmp/mib_indexes
113sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf
114service snmpd start
115
116# start cron, will be used by check_nagios
117cron
118
119# start postfix
120service postfix start
121
122# start ftpd
123service vsftpd start
124
125# hostname
126sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.github/NPTest.cache
127
128# create some test files to lower inodes
129for i in $(seq 10); do
130 touch /media/ramdisk2/test.$1
131done