mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
iiab-diagnostics: redact most all passwords, if line does not begin with #
This commit is contained in:
parent
03f1c84643
commit
3a3ae2202d
1 changed files with 3 additions and 2 deletions
|
@ -38,12 +38,13 @@ function cat_file_raw() { # $1 = path/filename; $2 = # of lines, for tail
|
||||||
echo "FILE EXISTS BUT IS EMPTY!" >> $outfile
|
echo "FILE EXISTS BUT IS EMPTY!" >> $outfile
|
||||||
elif [ $# -eq 1 ]; then
|
elif [ $# -eq 1 ]; then
|
||||||
echo >> $outfile
|
echo >> $outfile
|
||||||
# Redact most passwords from /etc/hostapd/hostapd.conf, /etc/wpa_supplicant/wpa_supplicant.conf, /etc/iiab/local_vars.yml -- not much to worry about in /etc/iiab/iiab.ini
|
# Redact most passwords from /etc/hostapd/hostapd.conf, /etc/wpa_supplicant/wpa_supplicant.conf, /etc/iiab/local_vars.yml, /etc/netplan/* -- not much to worry about in /etc/iiab/iiab.ini
|
||||||
cat $1 | sed -e 's/^\(\s*psk=\).*/\1[REDACTED]/; s/^\(\s*wpa_passphrase=\).*/\1[REDACTED]/; s/^\([^#].*assword:\).*/\1 [REDACTED]/' | iconv -t UTF-8//IGNORE >> $outfile
|
cat $1 | sed -e 's/^\(\s*psk=\).*/\1[REDACTED]/; s/^\(\s*wpa_passphrase=\).*/\1[REDACTED]/; s/^\([^#].*assword:\).*/\1 [REDACTED]/' | iconv -t UTF-8//IGNORE >> $outfile
|
||||||
else # e.g. last 100 lines, maximum
|
else # e.g. last 100 lines, maximum
|
||||||
echo " ...ITS LAST $2 LINES FOLLOW..." >> $outfile
|
echo " ...ITS LAST $2 LINES FOLLOW..." >> $outfile
|
||||||
echo >> $outfile
|
echo >> $outfile
|
||||||
tail -$2 $1 | iconv -t UTF-8//IGNORE >> $outfile
|
# Redact most passwords from /etc/hostapd/hostapd.conf, /etc/wpa_supplicant/wpa_supplicant.conf, /etc/iiab/local_vars.yml, /etc/netplan/* -- not much to worry about in /etc/iiab/iiab.ini
|
||||||
|
tail -$2 $1 | sed -e 's/^\(\s*psk=\).*/\1[REDACTED]/; s/^\(\s*wpa_passphrase=\).*/\1[REDACTED]/; s/^\([^#].*assword:\).*/\1 [REDACTED]/' | iconv -t UTF-8//IGNORE >> $outfile
|
||||||
fi
|
fi
|
||||||
echo >> $outfile
|
echo >> $outfile
|
||||||
elif [ -h $1 ]; then
|
elif [ -h $1 ]; then
|
||||||
|
|
Loading…
Reference in a new issue