Commit 02584795 authored by ssrq's avatar ssrq

[type/__easy_rsa_cert] Remove pki-presence and ca-presence explorers

parent 60acc2df
#!/bin/sh -e
# Return "absent" if no CA present, "present" otherwise
base_dir=$(cat "${__object:?}/parameter/dir")
pki_dir="${base_dir}/pki"
result="absent"
# Check all the files
expected_files_in_pki="serial index.txt index.txt.attr ca.crt private/ca.key"
# Check all the folders
for file in ${expected_files_in_pki}; do
if [ -f "${pki_dir}/${file}" ]; then
result="present"
fi
done
expected_dirs_in_pki="issued certs_by_serial"
for dir in ${expected_dirs_in_pki}; do
if [ -d "${pki_dir}/${dir}" ]; then
result="present"
fi
done
echo ${result}
#!/bin/sh -e
# Return "absent" if no easy-rsa PKI is present, "present" if one is present.
# TODO could something of this be deduplicated with the __easy_rsa_pki type?
base_dir=$(cat "${__object:?}/parameter/dir")
# Do we even have a `pki`-directory?
if [ ! -d "${base_dir}/pki" ]; then
echo "absent"
exit 0
fi
# pki-folder is present, check if everything is all right
expected_folders="private reqs"
for folder in ${expected_folders}; do
dir="${base_dir}/pki/${folder}"
if [ ! -d "${dir}" ]; then
echo "Missing ${dir}" >&2
exit 1
fi
done
# Check for openssl config file
openssl_easyrsa_conf_file="${base_dir}/pki/openssl-easyrsa.cnf"
if [ ! -f "${openssl_easyrsa_conf_file}" ]; then
echo "Missing ${openssl_easyrsa_conf_file}" >&2
exit 1
fi
# Nothing wrong found, return "present"
echo "present"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment