mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-19 19:30:16 +00:00
Allow reuse of cert name once revoked.
This commit is contained in:
parent
dc9924f147
commit
bfd2c43570
1 changed files with 14 additions and 4 deletions
|
@ -83,13 +83,23 @@ if [[ -z "${NAME}" ]]; then
|
|||
fi
|
||||
|
||||
# Check if name is already in use
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
if [ "$(echo "$line" | sed -e 's:.*/CN=::')" == "${NAME}" ]; then
|
||||
echo "Name is already in use."
|
||||
exit 1
|
||||
while read -r line || [ -n "${line}" ]; do
|
||||
STATUS=$(echo "$line" | awk '{print $1}')
|
||||
|
||||
if [[ "${STATUS}" = "V" ]]; then
|
||||
CERT=$(echo "$line" | sed -e 's:.*/CN=::')
|
||||
if [ "${CERT}" == "${NAME}" ]; then
|
||||
INUSE="1"
|
||||
fi
|
||||
fi
|
||||
done <${INDEX}
|
||||
|
||||
if [ "${INUSE}" == "1" ]; then
|
||||
printf "\n!! This name is already in use by a Valid Certificate."
|
||||
printf "\nPlease choose another name or revoke this certificate first.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if name is reserved
|
||||
if [ "${NAME}" == "ta" ] || [ "${NAME}" == "server" ] || [ "${NAME}" == "ca" ]; then
|
||||
echo "Sorry, this is in use by the server and cannot be used by clients."
|
||||
|
|
Loading…
Reference in a new issue