Fix ShellCheck errors: remove local outside functions, fix openssl redirections, unquote loop var
This commit is contained in:
@@ -117,10 +117,10 @@ fetch_cert() {
|
||||
local host="$1" port="$2" pem_file
|
||||
pem_file="${CERT_TMP}/${host}_${port}.pem"
|
||||
verbose "Fetching certificate from ${host}:${port}"
|
||||
if echo | timeout "${CONNECT_TIMEOUT}" openssl s_client \
|
||||
if timeout "${CONNECT_TIMEOUT}" openssl s_client \
|
||||
-connect "${host}:${port}" \
|
||||
-servername "${host}" \
|
||||
-showcerts </dev/null 2>/dev/null \
|
||||
-showcerts < /dev/null 2>/dev/null \
|
||||
| openssl x509 -outform PEM > "${pem_file}" 2>/dev/null; then
|
||||
if [[ -s "${pem_file}" ]]; then
|
||||
echo "${pem_file}"
|
||||
@@ -134,11 +134,11 @@ fetch_cert() {
|
||||
fetch_chain() {
|
||||
local host="$1" port="$2" chain_file
|
||||
chain_file="${CERT_TMP}/${host}_${port}_chain.pem"
|
||||
echo | timeout "${CONNECT_TIMEOUT}" openssl s_client \
|
||||
timeout "${CONNECT_TIMEOUT}" openssl s_client \
|
||||
-connect "${host}:${port}" \
|
||||
-servername "${host}" \
|
||||
-showcerts </dev/null 2>"${CERT_TMP}/s_client_err.txt" \
|
||||
> "${chain_file}" 2>/dev/null || true
|
||||
-showcerts < /dev/null 2>"${CERT_TMP}/s_client_err.txt" \
|
||||
> "${chain_file}" || true
|
||||
if [[ -s "${chain_file}" ]]; then
|
||||
echo "${chain_file}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user