From patchwork Mon Mar 17 19:51:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 8522 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4ZGlwS24Xjz3xFJ for ; Mon, 17 Mar 2025 19:51:36 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4ZGlwP1l5Zz5c6 for ; Mon, 17 Mar 2025 19:51:33 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4ZGlwP10RLz34PV for ; Mon, 17 Mar 2025 19:51:33 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4ZGlwL0bVxz2xc2 for ; Mon, 17 Mar 2025 19:51:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4ZGlwK0ns9z4nJ; Mon, 17 Mar 2025 19:51:29 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1742241089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1Zx11q7i2Jcb3y/Xz+uCuMGZ0k26q3eZ6tUM4Tj4kMY=; b=Ur/iiY69ZLfLyLGMoibBIe3/Eowv+3RhBW6bY2O1mJu3sm1p6YVkeqcqksvs4g5gULKG1w 7Fr+UsUCxYXFXkAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1742241089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1Zx11q7i2Jcb3y/Xz+uCuMGZ0k26q3eZ6tUM4Tj4kMY=; b=MrXaOid5ybkndBWDFFrK31Dp1Hy3u4bIY2oPFWkBlf9wITofiwlDZRe3M4Vo5/hgUlI5aX Awx7azjKM53t+ujM7HNaT5b38jRiuLrP8hBNggSv6fgYNQSLP/c7WpftpN9XUHygyn69k1 pyIyVPueLc+Ztr8eqgHkPx/V4/fRn2XckaXae8f2DtjOu/sgkF1EMw46gY12SCZv68fH+n RsA/v0LZ6XHdRWgjb8e6IC53HJcBiYeUlIpUTCiu97PF0Ti4fBfTrvNJrgR23LxKcHbcOF ugL0Hufs3tTJ5v3G9WDNfBPJHUrTJXQvujwZVO3c55kQ0uANZ0EbDguVxweg3Q== From: Adolf Belka To: development@lists.ipfire.org Cc: Adolf Belka Subject: [PATCH 1/3] collectd: Fixes bug13832 - uncomments include openvpn plugin only if openvpn is running Date: Mon, 17 Mar 2025 20:51:21 +0100 Message-ID: <20250317195123.2092-1-adolf.belka@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 - Added code to check if openvpn.pid exists and only then uncomment the include openvpn plugin line in collectd.conf - Tested out on my vm testbed and the include openvpn plugin line in collectd.conf is only uncommented if the openvpn server is run ning and has a pid. Fixes: Bug13832 Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- src/initscripts/system/collectd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/initscripts/system/collectd b/src/initscripts/system/collectd index 263511fc7..f86b64e9d 100644 --- a/src/initscripts/system/collectd +++ b/src/initscripts/system/collectd @@ -143,6 +143,13 @@ case "$1" in sed -i -e "s|^#LoadPlugin swap|LoadPlugin swap|g" /etc/collectd.conf fi + # Enable openvpn plugin if openvpn.pid found + if [ ! -e /var/run/openvpn.pid ]; then + sed -i -e 's|^include "/etc/collectd.vpn"$|#include "/etc/collectd.vpn"|g' /etc/collectd.conf + else + sed -i -e 's|^#include "/etc/collectd.vpn"$|include "/etc/collectd.vpn"|g' /etc/collectd.conf + fi + if [ $(date +%Y) -gt 2011 ]; then boot_mesg "Starting Collection daemon..." /usr/sbin/collectd -C /etc/collectd.conf From patchwork Mon Mar 17 19:51:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 8524 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4ZGlwS2ZgYz3xMg for ; Mon, 17 Mar 2025 19:51:36 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4ZGlwP26rmz5cB for ; Mon, 17 Mar 2025 19:51:33 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4ZGlwP1LCkz34P3 for ; Mon, 17 Mar 2025 19:51:33 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4ZGlwL125Kz34M5 for ; Mon, 17 Mar 2025 19:51:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4ZGlwK4tKVz5XY; Mon, 17 Mar 2025 19:51:29 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1742241089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IG7DTYNVrDA1DWH89tZkVYGO94gNOL7wsstTwjDnK68=; b=Yjj8XDch1gf2Ra7np2qkx0D6EsgMrYuCkBcgmzoUBN++pXG/fSL/FPxZhoBfwjH0uoYBQq Cbd6ty0gYJi2oOAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1742241089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IG7DTYNVrDA1DWH89tZkVYGO94gNOL7wsstTwjDnK68=; b=GzjBrR+5Ft+x2JWq2T80XSBC3bNKoDd/YcwNJvvPa0q5cv4e6o/B9YbZdHmvZfaT9sjdlZ Fim+RFQafP3119QMuybhaWKiL2ie+afQiz2kXPZUueElBnVJIgFHYVwcL7YGoUeaR9++iS V3tstrUEvVLXwK8vUOv0jmbknKeA2HhIQ/O/PXIg3Th2NOcZbYY92dxJLrF4CqyVv2MGOm YmkGaeZJa4yHfjuLQolaq7X5TbcKFSu8gu4DrHKBoLIHvjcEdHhN69pHmjYdvY0V84Az/s aSKo2p10rZnDst1TB5NuzfexJWXaOrS4KsE3AF7NdoTqhJyI4VDEO4iVuL3tBA== From: Adolf Belka To: development@lists.ipfire.org Cc: Adolf Belka Subject: [PATCH 2/3] collectd.conf: Fixes bug13832 - include openvpn plugin line commented out by default Date: Mon, 17 Mar 2025 20:51:22 +0100 Message-ID: <20250317195123.2092-2-adolf.belka@ipfire.org> In-Reply-To: <20250317195123.2092-1-adolf.belka@ipfire.org> References: <20250317195123.2092-1-adolf.belka@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 - The include openvpn plugin line in collectd.conf is changed to be commented out by default. - When booting if the openvpn server is running then the collectd initscript will uncomment the include openvpn plugin line. Fixes: bug13832 Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- config/collectd/collectd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/collectd/collectd.conf b/config/collectd/collectd.conf index 020604e74..16f7dae09 100644 --- a/config/collectd/collectd.conf +++ b/config/collectd/collectd.conf @@ -83,5 +83,5 @@ include "/etc/collectd.precache" #include "/etc/collectd.thermal" -include "/etc/collectd.vpn" +#include "/etc/collectd.vpn" include "/etc/collectd.d/*" From patchwork Mon Mar 17 19:51:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 8523 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4ZGlwS2Sghz3xKW for ; Mon, 17 Mar 2025 19:51:36 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4ZGlwP2RyFz5cF for ; Mon, 17 Mar 2025 19:51:33 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4ZGlwP1lJgz34QY for ; Mon, 17 Mar 2025 19:51:33 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4ZGlwL157Vz34MZ for ; Mon, 17 Mar 2025 19:51:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4ZGlwK6dVtz5V1; Mon, 17 Mar 2025 19:51:29 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1742241090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lu10WGhx0CQBbA8rb2A/YV6RTn0QEh3lAcnu3rRS5k4=; b=4s1MRlJVIE/4HsAMQ5Ln+tVdrIOK8EXwK4Zze+LxawNqMjG+expC0pTvbIh6o//wFIhWL3 EIesj9+W/88zkSCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1742241090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lu10WGhx0CQBbA8rb2A/YV6RTn0QEh3lAcnu3rRS5k4=; b=MD12A4nTSDhETjduapxEGCv6B889oF8B9nZfEYnn5M10w2lJOI4jvSb2hvXkwnDqr04+H3 nh51ej/v/UL6QTmWy+7vlj+Hkh53B9dvGFwo2esnb0olic10Dh/S/oDjXYbOrrdCQf/zdY jTW+8sSFDEUIgVxu4zkBC/CmI1roRf3HpjOFiubk1OWS5LtBztyaAfy5yLzBApFdCX53UB pqhuU1tfkW9pkCrBBbdwdukGAGti8duXEkxigGWw80rqEt7W+eMUKeONPPTbJvHXI9s8QY KtvrRcZGrOc/JsfhfDFGPz/XVrjAp4efMxMRLlBgkJbo1WSRQlmI2t2Hzw7qeQ== From: Adolf Belka To: development@lists.ipfire.org Cc: Adolf Belka Subject: [PATCH 3/3] ovpnmain.cgi: Fixes bug13832 - restart collectd initscript on openvpn server status change Date: Mon, 17 Mar 2025 20:51:23 +0100 Message-ID: <20250317195123.2092-3-adolf.belka@ipfire.org> In-Reply-To: <20250317195123.2092-1-adolf.belka@ipfire.org> References: <20250317195123.2092-1-adolf.belka@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 - When the openvpn server status is changed from RUNNING to STOPPED or vice versa then the collectd initscript is restarted to ensure that the include openvpn plugin line in the collectd.conf file is correctly uncommented or not. Fixes: bug13832 Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- html/cgi-bin/ovpnmain.cgi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 20f256f4b..f16ba0591 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -782,6 +782,10 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'start ovpn server'} || &General::system("/usr/local/bin/openvpnctrl", "-k"); &emptyserverlog(); } + + # restart collectd to uncomment include openvpn plugin command if openvpn pid exists + &General::system("/usr/local/bin/collectdctrl", "restart"); + # #restart openvpn server # if ($cgiparams{'ACTION'} eq $Lang::tr{'restart ovpn server'}){ #workarund, till SIGHUP also works when running as nobody