diff --git a/shellpki.sh b/shellpki.sh index 2db71fb..a4c13f5 100755 --- a/shellpki.sh +++ b/shellpki.sh @@ -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}~")