From f7f7309b99f9f0eb4176a4c7cb8e5991d23b5b74 Mon Sep 17 00:00:00 2001 From: Lorenz <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 6 Nov 2022 23:12:41 +0100 Subject: Update GitHub runner (#1810) * Update action/checkout to v3 * Format debian prepare script --- .github/prepare_debian.sh | 61 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 16 deletions(-) (limited to '.github/prepare_debian.sh') diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index 4021c104..d8a76da6 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -11,21 +11,51 @@ if [ $(lsb_release -is) = "Debian" ]; then apt-add-repository non-free apt-get update fi -apt-get -y install perl autotools-dev libdbi-dev libldap2-dev libpq-dev libradcli-dev libnet-snmp-perl procps -apt-get -y install libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader libsnmp-perl snmpd -apt-get -y install fping snmp netcat-openbsd smbclient vsftpd apache2 ssl-cert postfix libhttp-daemon-ssl-perl -apt-get -y install libdbd-sybase-perl libnet-dns-perl -apt-get -y install slapd ldap-utils -apt-get -y install gcc make autoconf automake gettext -apt-get -y install faketime -apt-get -y install libmonitoring-plugin-perl -apt-get -y install libcurl4-openssl-dev -apt-get -y install liburiparser-dev -apt-get -y install squid -apt-get -y install openssh-server -apt-get -y install mariadb-server mariadb-client libmariadb-dev -apt-get -y install cron iputils-ping -apt-get -y install iproute2 +apt-get -y install perl \ + autotools-dev \ + libdbi-dev \ + libldap2-dev \ + libpq-dev \ + libradcli-dev \ + libnet-snmp-perl \ + procps \ + libdbi0-dev \ + libdbd-sqlite3 \ + libssl-dev \ + dnsutils \ + snmp-mibs-downloader \ + libsnmp-perl \ + snmpd \ + fping \ + snmp \ + netcat-openbsd \ + smbclient \ + vsftpd \ + apache2 \ + ssl-cert \ + postfix \ + libhttp-daemon-ssl-perl \ + libdbd-sybase-perl \ + libnet-dns-perl \ + slapd \ + ldap-utils \ + gcc \ + make \ + autoconf \ + automake \ + gettext \ + faketime \ + libmonitoring-plugin-perl \ + libcurl4-openssl-dev \ + liburiparser-dev \ + squid \ + openssh-server \ + mariadb-server \ + mariadb-client \ + libmariadb-dev \ + cron \ + iputils-ping \ + iproute2 # remove ipv6 interface from hosts if [ $(ip addr show | grep "inet6 ::1" | wc -l) -eq "0" ]; then @@ -37,7 +67,6 @@ ip addr show cat /etc/hosts - # apache a2enmod ssl a2ensite default-ssl -- cgit v1.2.3-74-g34f1 From 843f17918886edd5c8d14e5a9967785c654053c8 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 6 Feb 2023 05:45:36 +0000 Subject: Adding non-free source list (Closes: #1837) (due https://lists.debian.org/debian-devel-announce/2023/02/msg00000.html) --- .github/prepare_debian.sh | 1 + 1 file changed, 1 insertion(+) (limited to '.github/prepare_debian.sh') diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index d8a76da6..5222659e 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -5,6 +5,7 @@ set -e export DEBIAN_FRONTEND=noninteractive +sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources apt-get update apt-get -y install software-properties-common if [ $(lsb_release -is) = "Debian" ]; then -- cgit v1.2.3-74-g34f1 From 483ae9fca47a424bcdbb75bfd63c90afd28b9ccc Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 11 May 2023 18:01:38 +0000 Subject: CI: Fallback on software-properties-common --- .github/prepare_debian.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to '.github/prepare_debian.sh') diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index 5222659e..aa224ef9 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -5,13 +5,18 @@ set -e export DEBIAN_FRONTEND=noninteractive -sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources -apt-get update -apt-get -y install software-properties-common -if [ $(lsb_release -is) = "Debian" ]; then - apt-add-repository non-free - apt-get update +source /etc/os-release + +if [ ${ID} = "debian" ]; then + if [ -f /etc/apt/sources.list.d/debian.sources ]; then + sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources + else + apt-get update + apt-get -y install software-properties-common + apt-add-repository non-free + fi fi +apt-get update apt-get -y install perl \ autotools-dev \ libdbi-dev \ -- cgit v1.2.3-74-g34f1 From 0918a6a30b204bd61e4b42c5731e18dc86a9e6c4 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 11 May 2023 18:23:56 +0000 Subject: CI: Fallback on mysql service --- .github/prepare_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/prepare_debian.sh') diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index aa224ef9..7f5592b4 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -88,7 +88,7 @@ cp tools/squid.conf /etc/squid/squid.conf service squid start # mariadb -service mariadb start +service mariadb start || service mysql start mysql -e "create database IF NOT EXISTS test;" -uroot # ldap -- cgit v1.2.3-74-g34f1 From c57b7157daa0a170f9ef76776d493afa123a8d32 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 27 Aug 2023 23:51:40 +0200 Subject: Try to not delete random MIBs to avoid compiling errors --- .github/prepare_debian.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to '.github/prepare_debian.sh') diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index 7f5592b4..a1e65c04 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -108,12 +108,13 @@ ssh -tt localhost /dev/null 2>/dev/null & disown %1 # snmpd -for DIR in /usr/share/snmp/mibs /usr/share/mibs; do - rm -f $DIR/ietf/SNMPv2-PDU \ - $DIR/ietf/IPSEC-SPD-MIB \ - $DIR/ietf/IPATM-IPMC-MIB \ - $DIR/iana/IANA-IPPM-METRICS-REGISTRY-MIB -done +service snmpd stop +#for DIR in /usr/share/snmp/mibs /usr/share/mibs; do +# rm -f $DIR/ietf/SNMPv2-PDU \ +# $DIR/ietf/IPSEC-SPD-MIB \ +# $DIR/ietf/IPATM-IPMC-MIB \ +# $DIR/iana/IANA-IPPM-METRICS-REGISTRY-MIB +#done mkdir -p /var/lib/snmp/mib_indexes sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf service snmpd start -- cgit v1.2.3-74-g34f1 From 70d0457562d58c16acd2a3514c9e4cc3f07ec923 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Mon, 28 Aug 2023 13:05:44 +0200 Subject: Remove dead code from test machine prepare script --- .github/prepare_debian.sh | 6 ------ 1 file changed, 6 deletions(-) (limited to '.github/prepare_debian.sh') diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index a1e65c04..9611670d 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -109,12 +109,6 @@ disown %1 # snmpd service snmpd stop -#for DIR in /usr/share/snmp/mibs /usr/share/mibs; do -# rm -f $DIR/ietf/SNMPv2-PDU \ -# $DIR/ietf/IPSEC-SPD-MIB \ -# $DIR/ietf/IPATM-IPMC-MIB \ -# $DIR/iana/IANA-IPPM-METRICS-REGISTRY-MIB -#done mkdir -p /var/lib/snmp/mib_indexes sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf service snmpd start -- cgit v1.2.3-74-g34f1 From 06ebad83995921b622aecbd2111f1f6e6c62efc4 Mon Sep 17 00:00:00 2001 From: Franz Schwartau Date: Tue, 29 Aug 2023 15:12:47 +0200 Subject: check_smtp: add tests for --ssl --- .github/NPTest.cache | 1 + .github/prepare_debian.sh | 6 +++++- plugins/t/check_smtp.t | 20 +++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) (limited to '.github/prepare_debian.sh') diff --git a/.github/NPTest.cache b/.github/NPTest.cache index e3694573..d488d1b9 100644 --- a/.github/NPTest.cache +++ b/.github/NPTest.cache @@ -27,6 +27,7 @@ 'NP_HOST_TCP_SMTP' => 'localhost', 'NP_HOST_TCP_SMTP_NOSTARTTLS' => '', 'NP_HOST_TCP_SMTP_STARTTLS' => 'localhost', + 'NP_HOST_TCP_SMTP_TLS' => 'localhost', 'NP_HOST_TLS_CERT' => 'localhost', 'NP_HOST_TLS_HTTP' => 'localhost', 'NP_HOST_UDP_TIME' => 'none', diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index 9611670d..dcf778bc 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -116,7 +116,11 @@ service snmpd start # start cron, will be used by check_nagios cron -# start postfix +# postfix +cat <> /etc/postfix/master.cf +smtps inet n - n - - smtpd + -o smtpd_tls_wrappermode=yes +EOD service postfix start # start ftpd diff --git a/plugins/t/check_smtp.t b/plugins/t/check_smtp.t index fd09ed22..1a1ebe3e 100644 --- a/plugins/t/check_smtp.t +++ b/plugins/t/check_smtp.t @@ -14,6 +14,8 @@ my $host_tcp_smtp_starttls = getTestParameter( "NP_HOST_TCP_SMTP_STARTTLS", "A host providing SMTP with STARTTLS", $host_tcp_smtp); my $host_tcp_smtp_nostarttls = getTestParameter( "NP_HOST_TCP_SMTP_NOSTARTTLS", "A host providing SMTP without STARTTLS", ""); +my $host_tcp_smtp_tls = getTestParameter( "NP_HOST_TCP_SMTP_TLS", + "A host providing SMTP with TLS", $host_tcp_smtp); my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1" ); @@ -22,7 +24,7 @@ my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost" ); my $res; -plan tests => 10; +plan tests => 16; SKIP: { skip "No SMTP server defined", 4 unless $host_tcp_smtp; @@ -42,6 +44,10 @@ SKIP: { local $TODO = "Output is over two lines"; like ( $res->output, qr/^SMTP WARNING/, "Correct error message" ); } + + $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp --ssl -p 25" ); + is ($res->return_code, 2, "Check rc of connecting to $host_tcp_smtp with TLS on standard SMTP port" ); + like ($res->output, qr/^CRITICAL - Cannot make SSL connection\./, "Check output of connecting to $host_tcp_smtp with TLS on standard SMTP port"); } SKIP: { @@ -58,6 +64,18 @@ SKIP: { is ($res->output, "WARNING - TLS not supported by server", "Right error message" ); } +SKIP: { + skip "No SMTP server with TLS defined", 1 unless $host_tcp_smtp_tls; + $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls --ssl" ); + is ($res->return_code, 0, "Check rc of connecting to $host_tcp_smtp_tls with TLS" ); + like ($res->output, qr/^SMTP OK - /, "Check output of connecting to $host_tcp_smtp_tls with TLS" ); + + my $unused_port = 4465; + $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls -p $unused_port --ssl" ); + is ($res->return_code, 2, "Check rc of connecting to $host_tcp_smtp_tls with TLS on unused port $unused_port" ); + like ($res->output, qr/^connect to address $host_tcp_smtp_tls and port $unused_port: Connection refused/, "Check output of connecting to $host_tcp_smtp_tls with TLS on unused port $unused_port"); +} + $res = NPTest->testCmd( "./check_smtp $host_nonresponsive" ); is ($res->return_code, 2, "CRITICAL - host non responding" ); -- cgit v1.2.3-74-g34f1