mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-22 16:28:28 +02:00
more verbose messages on certificate verification
This commit is contained in:
16
test.sh
16
test.sh
@@ -10,6 +10,7 @@ if [[ ! "${CI:-false}" == "true" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
_TEST() {
|
_TEST() {
|
||||||
|
echo
|
||||||
echo "${1} "
|
echo "${1} "
|
||||||
}
|
}
|
||||||
_SUBTEST() {
|
_SUBTEST() {
|
||||||
@@ -31,7 +32,7 @@ _FAIL() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
_CHECK_FILE() {
|
_CHECK_FILE() {
|
||||||
_SUBTEST "Checking if file exists: ${1}"
|
_SUBTEST "Checking if file '${1}' exists..."
|
||||||
if [[ -e "${1}" ]]; then
|
if [[ -e "${1}" ]]; then
|
||||||
_PASS
|
_PASS
|
||||||
else
|
else
|
||||||
@@ -39,7 +40,7 @@ _CHECK_FILE() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
_CHECK_LOG() {
|
_CHECK_LOG() {
|
||||||
_SUBTEST "Checking if log contains '${1}'"
|
_SUBTEST "Checking if log contains '${1}'..."
|
||||||
if grep -- "${1}" tmplog > /dev/null; then
|
if grep -- "${1}" tmplog > /dev/null; then
|
||||||
_PASS
|
_PASS
|
||||||
else
|
else
|
||||||
@@ -47,7 +48,7 @@ _CHECK_LOG() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
_CHECK_NOT_LOG() {
|
_CHECK_NOT_LOG() {
|
||||||
_SUBTEST "Checking if log doesn't contain '${1}'"
|
_SUBTEST "Checking if log doesn't contain '${1}'..."
|
||||||
if grep -- "${1}" tmplog > /dev/null; then
|
if grep -- "${1}" tmplog > /dev/null; then
|
||||||
_FAIL "Found in log: ${1}"
|
_FAIL "Found in log: ${1}"
|
||||||
else
|
else
|
||||||
@@ -150,10 +151,13 @@ rm account_key.pem
|
|||||||
|
|
||||||
# Check if certificate is valid in various ways
|
# Check if certificate is valid in various ways
|
||||||
_TEST "Verifying certificate..."
|
_TEST "Verifying certificate..."
|
||||||
openssl x509 -in "certs/${TMP_URL}/cert.pem" -noout -text > tmplog 2> errorlog
|
_SUBTEST "Verifying certificate on its own..."
|
||||||
|
openssl x509 -in "certs/${TMP_URL}/cert.pem" -noout -text > tmplog 2> errorlog && _PASS || _FAIL
|
||||||
_CHECK_LOG "CN=${TMP_URL}"
|
_CHECK_LOG "CN=${TMP_URL}"
|
||||||
openssl x509 -in "certs/${TMP_URL}/fullchain.pem" -noout -text > /dev/null 2>> errorlog
|
_SUBTEST "Verifying file with full chain..."
|
||||||
(openssl verify -verbose -CAfile "certs/${TMP_URL}/fullchain.pem" -purpose sslserver "certs/${TMP_URL}/fullchain.pem" 2>&1 || true) | (grep -v ': OK$' || true) >> errorlog 2>> errorlog
|
openssl x509 -in "certs/${TMP_URL}/fullchain.pem" -noout -text > /dev/null 2>> errorlog && _PASS || _FAIL
|
||||||
|
_SUBTEST "Verifying certificate against CA certificate..."
|
||||||
|
(openssl verify -verbose -CAfile "certs/${TMP_URL}/fullchain.pem" -purpose sslserver "certs/${TMP_URL}/fullchain.pem" 2>&1 || true) | (grep -v ': OK$' || true) >> errorlog 2>> errorlog && _PASS || _FAIL
|
||||||
_CHECK_ERRORLOG
|
_CHECK_ERRORLOG
|
||||||
|
|
||||||
# Revoke certificate using certificate key
|
# Revoke certificate using certificate key
|
||||||
|
|||||||
Reference in New Issue
Block a user