fixed?
This commit is contained in:
@@ -1,25 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# vagamente baseado nas fontes:
|
depth=$1
|
||||||
# - https://github.com/OpenVPN/openvpn/blob/master/contrib/OCSP_check/OCSP_check.sh
|
if [ "$depth" -eq 0 ]; then
|
||||||
|
if [ -n "$tls_serial_0" ]; then
|
||||||
cur_depth=$1
|
# é preciso converter o serial para hexadecimal porque o openssl espera em hex
|
||||||
|
hex_serial=$(printf '%x' "$tls_serial_0")
|
||||||
if [ "$cur_depth" -eq 0 ]; then
|
status=$(openssl ocsp -issuer /etc/openvpn/server/ca.crt -serial "0x$hex_serial" -url http://10.60.0.1:8888 -CAfile /etc/openvpn/server/ca.crt 2>/dev/null)
|
||||||
eval serial="\$tls_serial_${cur_depth}"
|
if echo "$status" | grep -q "good"; then
|
||||||
|
exit 0 # sucesso
|
||||||
if [ -n "$serial" ]; then
|
|
||||||
hex_serial=$(printf '%x' "$serial")
|
|
||||||
status=$(openssl ocsp -issuer /etc/openvpn/server/ca.crt -no_nonce -CAfile /etc/openvpn/server/ca.crt -url http://10.60.0.1:8888 -serial "0x${hex_serial}" 2>&1)
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
if echo "$status" | grep -Eq "(error|fail|revoked)"; then
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
if echo "$status" | grep -Eq "good"; then
|
|
||||||
exit 0
|
exit 1 # revogado ou não encontrado
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# se chegou aqui, falhou
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user