$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
1 changed files with 2 additions and 2 deletions

View File

@ -398,13 +398,13 @@ check() {
}
main() {
[ "$(id -u)" -eq 0 ] || error "Please become root before running ${0} !"
# default config
# TODO : override with /etc/default/shellpki
CONFFILE="/etc/shellpki/openssl.cnf"
PKIUSER="shellpki"
[ "${USER}" != "root" ] || [ "${USER}" != "${PKIUSER}" ] || error "Please become root before running ${0} !"
# retrieve CA path from config file
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}~")