$USER can be root or $PKIUSER

This commit is contained in:
Victor LABORIE 2018-06-27 14:48:11 +02:00
parent 5f07a5e24c
commit 8e9d72071e

View file

@ -398,13 +398,13 @@ check() {
} }
main() { main() {
[ "$(id -u)" -eq 0 ] || error "Please become root before running ${0} !"
# default config # default config
# TODO : override with /etc/default/shellpki # TODO : override with /etc/default/shellpki
CONFFILE="/etc/shellpki/openssl.cnf" CONFFILE="/etc/shellpki/openssl.cnf"
PKIUSER="shellpki" PKIUSER="shellpki"
[ "${USER}" != "root" ] || [ "${USER}" != "${PKIUSER}" ] || error "Please become root before running ${0} !"
# retrieve CA path from config file # retrieve CA path from config file
CADIR=$(grep -E "^dir" "${CONFFILE}" | cut -d'=' -f2|xargs -n1) CADIR=$(grep -E "^dir" "${CONFFILE}" | cut -d'=' -f2|xargs -n1)
CAKEY=$(grep -E "^private_key" "${CONFFILE}" | cut -d'=' -f2|xargs -n1|sed "s~\$dir~${CADIR}~") CAKEY=$(grep -E "^private_key" "${CONFFILE}" | cut -d'=' -f2|xargs -n1|sed "s~\$dir~${CADIR}~")