From a0ecfcc1dcb11e541456caeb76fc3c8758f1b785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Fri, 8 Oct 2021 21:50:46 +0200 Subject: [PATCH 1/4] Include df -h in debug log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- advanced/Scripts/piholeDebug.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 71e5c696..d8ef7f7e 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -585,6 +585,13 @@ processor_check() { fi } +disk_usage() { + local df + echo_current_diagnostic "Disk usage" + DF=$(df -h) + log_write "${DF}"; +} + parse_setup_vars() { echo_current_diagnostic "Setup variables" # If the file exists, @@ -1421,6 +1428,7 @@ diagnose_operating_system check_selinux check_firewalld processor_check +disk_usage check_networking check_name_resolution check_dhcp_servers From fdc4cf9869e11df5fed525b09684736c247b7e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Fri, 8 Oct 2021 21:54:50 +0200 Subject: [PATCH 2/4] Fix stickler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- advanced/Scripts/piholeDebug.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index d8ef7f7e..01daaa9f 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -586,7 +586,7 @@ processor_check() { } disk_usage() { - local df + local DF echo_current_diagnostic "Disk usage" DF=$(df -h) log_write "${DF}"; From 77a30ac0c25ca1f788e974b72d787e225a4ea82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Mon, 11 Oct 2021 17:31:03 +0200 Subject: [PATCH 3/4] Use mapfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- advanced/Scripts/piholeDebug.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 01daaa9f..1366c14b 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -586,10 +586,13 @@ processor_check() { } disk_usage() { - local DF + local file_system echo_current_diagnostic "Disk usage" - DF=$(df -h) - log_write "${DF}"; + mapfile -t file_system < <(df -h) + + for line in "${file_system[@]}"; do + log_write " ${line}" + done } parse_setup_vars() { From d84da7131000502a1b2d9792eab6124f6036081d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Mon, 11 Oct 2021 18:02:47 +0200 Subject: [PATCH 4/4] Only show lines not containing sensitive keywords MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- advanced/Scripts/piholeDebug.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 1366c14b..cd615825 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -587,11 +587,22 @@ processor_check() { disk_usage() { local file_system + local hide + echo_current_diagnostic "Disk usage" mapfile -t file_system < <(df -h) + # Some lines of df might contain sensitive information like usernames and passwords. + # E.g. curlftpfs filesystems (https://www.looklinux.com/mount-ftp-share-on-linux-using-curlftps/) + # We are not interested in those lines so we collect keyword, to remove them from the output + # Additinal keywords can be added, separated by "|" + hide="curlftpfs" + + # only show those lines not containg a sensitive phrase for line in "${file_system[@]}"; do + if [[ ! $line =~ $hide ]]; then log_write " ${line}" + fi done }