privacy redact debug logs (#2817)

This commit is contained in:
/rootzoll 2021-12-18 14:18:42 +01:00 committed by GitHub
parent 06dbfa3d1f
commit 167264ff50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -115,6 +115,7 @@ function release() {
function debug() {
echo "Printing debug logs. Be patient, this should take maximum 2 minutes ..."
/home/admin/config.scripts/blitz.debug.sh > /var/cache/raspiblitz/debug.log
/home/admin/config.scripts/blitz.debug.sh redact /var/cache/raspiblitz/debug.log
if [ "$1" = "-l" ]||[ "$1" = "--link" ]; then
proxy="-X 5 -x localhost:9050"
if [ "$2" = "-n" ]||[ "$2" = "--no-tor" ]; then proxy=""; fi

View File

@ -2,6 +2,42 @@
# USE THIS SCRIPT FOR BASIC SYSTEM STATUS DEBUG INFO
if [ "$1" == "redact" ]; then
# get & check parameters
redactFile=$2
if [ "${redactFile}" == "" ]; then
echo "# FAIL: missing second parameter"
exit 1
fi
echo "# redacting file: ${redactFile}"
if [ $(ls ${redactFile} 2>/dev/null | grep -c "${redactFile}") -lt 1 ]; then
echo "# FAIL: file does not exist"
exi 1
fi
# redact nodeIDs
sed -i 's/[a-z0-9]*@/***@/' ${redactFile}
# redact IPv4s
sed -i 's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/*.*.*.*/' ${redactFile}
# redact onion adresses
sed -i 's/[a-z0-9]*.onion/***.onion/' ${redactFile}
# redact hostname
sed -i 's/hostname=[^\r\n]*/hostname=*****/' ${redactFile}
# redact balances
sed -i 's/[0-9]* mSAT/* mSAT/' ${redactFile}
sed -i 's/[0-9]*.[0-9]* BTC/* BTC/' ${redactFile}
sed -i 's/[0-9]*.[0-9]* BTC/* BTC/' ${redactFile}
sed -i 's/balance=[^\r\n]*/balance=****/' ${redactFile}
exit 0
fi
# load code software version
source /home/admin/_version.info