Commit 652ea73b authored by ssrq's avatar ssrq

WIP Adding more optinoal params to __easy_rsa_cert

parent d0c70ca0
../../__easy_rsa_pki/files/check_parameter_validity.sh
\ No newline at end of file
......@@ -33,7 +33,13 @@ case "$os" in
;;
esac
## Test input for sanity
# Check validity of the supplied parameters
# shellcheck source=/dev/null # ${type} will be set at runtime
. "${__type}/files/check_parameter_validity.sh"
check_parameter_validity_usealgo
## Check required parameters for sanity
supplied_cert_type=$(cat "${__object:?}/parameter/cert-type")
case "${supplied_cert_type}" in
(server|client)
......@@ -44,12 +50,40 @@ case "${supplied_cert_type}" in
;;
esac
build_command="build-${supplied_cert_type}-full"
build_subcommand="build-${supplied_cert_type}-full"
optional_parameter_if_present() {
value_to_return=""
if [ -f "${__object:?}/parameter/$1" ]; then
supplied_value=$(head -n 1 "${__object:?}/parameter/$1")
value_to_return="${supplied_value}"
fi
echo "${value_to_return}"
}
# # TODO can this be condensed?
# cert_options=""
# ks_=$(optional_parameter_if_present keysize)
# if [ -n "${ks_}" ]; then
# cert_options=" --keysize=\"${ks_}\""
# fi
#
# ua_=$(optional_parameter_if_present use-algo)
# if [ -n "${ua_}" ]; then
# cert_options=" --use-algo=\"${ua_}\""
# fi
#
# dy_=$(optional_parameter_if_present cert-expiration-days)
# if [ -n "${dy_}" ]; then
# cert_options=" --days=\"${dy_}\""
# fi
#
cert_already_present=$(cat "${__object:?}/explorer/cert-presence")
command_to_execute="${easyrsa_executable} ${cert_options} ${build_subcommand} ${common_name} nopass"
if [ "${cert_already_present}" != "present" ]; then
directory_with_pki=$(cat "${__object:?}/parameter/pki-dir")
common_name="${__object_id:?}"
echo "cd ${directory_with_pki}"
echo "${easyrsa_executable} ${build_command} ${common_name} nopass"
echo "${command_to_execute}"
fi
......@@ -23,7 +23,14 @@ pki-dir
OPTIONAL PARAMETERS
-------------------
None.
keysize
The keysize to use for the request.
use-algo
The algorithm to use. Allowed values are "rsa" and "ec".
cert-expiration-days
Days until expiration of the certificate.
BOOLEAN PARAMETERS
......
keysize
use-algo
cert-expiration-days
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