mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-19 11:20:15 +00:00
Shellcheck compliance
scripts/openvpn/pivpnDebug.sh * SC1090: ShellCheck can't follow non-constant source. Use a directive to specify location. * Disabled warning message * SC2154: <VariableName> is referenced but not assigned. * Disabled warning message * SC2086: Double quote to prevent globbing and word splitting. * Added double quotes * SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). * Added double quotes
This commit is contained in:
parent
e476cc11ee
commit
0e313fa3b3
1 changed files with 4 additions and 2 deletions
|
@ -8,6 +8,7 @@ if [ ! -f "${setupVars}" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "${setupVars}"
|
source "${setupVars}"
|
||||||
|
|
||||||
echo -e "::::\t\t\e[4mPiVPN debug\e[0m\t\t ::::"
|
echo -e "::::\t\t\e[4mPiVPN debug\e[0m\t\t ::::"
|
||||||
|
@ -18,6 +19,7 @@ git --git-dir /usr/local/src/pivpn/.git rev-parse --abbrev-ref HEAD
|
||||||
git --git-dir /usr/local/src/pivpn/.git log -n 1 --format='Commit: %H%nAuthor: %an%nDate: %ad%nSummary: %s'
|
git --git-dir /usr/local/src/pivpn/.git log -n 1 --format='Commit: %H%nAuthor: %an%nDate: %ad%nSummary: %s'
|
||||||
printf "=============================================\n"
|
printf "=============================================\n"
|
||||||
echo -e "::::\t \e[4mInstallation settings\e[0m \t ::::"
|
echo -e "::::\t \e[4mInstallation settings\e[0m \t ::::"
|
||||||
|
# shellcheck disable=SC2154
|
||||||
sed "s/$pivpnHOST/REDACTED/" < ${setupVars}
|
sed "s/$pivpnHOST/REDACTED/" < ${setupVars}
|
||||||
printf "=============================================\n"
|
printf "=============================================\n"
|
||||||
echo -e ":::: \e[4mServer configuration shown below\e[0m ::::"
|
echo -e ":::: \e[4mServer configuration shown below\e[0m ::::"
|
||||||
|
@ -30,7 +32,7 @@ echo -e ":::: \t\e[4mRecursive list of files in\e[0m\t ::::\n::: \e[4m/etc/openv
|
||||||
ls -LR /etc/openvpn/easy-rsa/pki/ -Ireqs -Icerts_by_serial
|
ls -LR /etc/openvpn/easy-rsa/pki/ -Ireqs -Icerts_by_serial
|
||||||
printf "=============================================\n"
|
printf "=============================================\n"
|
||||||
echo -e "::::\t\t\e[4mSelf check\e[0m\t\t ::::"
|
echo -e "::::\t\t\e[4mSelf check\e[0m\t\t ::::"
|
||||||
/opt/pivpn/self_check.sh ${VPN}
|
/opt/pivpn/self_check.sh "${VPN}"
|
||||||
printf "=============================================\n"
|
printf "=============================================\n"
|
||||||
echo -e ":::: Having trouble connecting? Take a look at the FAQ:"
|
echo -e ":::: Having trouble connecting? Take a look at the FAQ:"
|
||||||
echo -e ":::: \e[1mhttps://docs.pivpn.io/faq\e[0m"
|
echo -e ":::: \e[1mhttps://docs.pivpn.io/faq\e[0m"
|
||||||
|
@ -40,7 +42,7 @@ OVPNLOG="$(tail -n 20 /var/log/openvpn.log)"
|
||||||
|
|
||||||
# Regular expession taken from https://superuser.com/a/202835, it will match invalid IPs
|
# Regular expession taken from https://superuser.com/a/202835, it will match invalid IPs
|
||||||
# like 123.456.789.012 but it's fine since the log only contains valid ones.
|
# like 123.456.789.012 but it's fine since the log only contains valid ones.
|
||||||
declare -a IPS_TO_HIDE=($(grepcidr -v 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 <<< "$OVPNLOG" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | uniq))
|
declare -a IPS_TO_HIDE=("$(grepcidr -v 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 <<< "$OVPNLOG" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | uniq)")
|
||||||
for IP in "${IPS_TO_HIDE[@]}"; do
|
for IP in "${IPS_TO_HIDE[@]}"; do
|
||||||
OVPNLOG="${OVPNLOG//"$IP"/REDACTED}"
|
OVPNLOG="${OVPNLOG//"$IP"/REDACTED}"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue