mirror of
https://github.com/angristan/openvpn-install.git
synced 2025-12-15 16:37:03 +01:00
feat: support headless client revocation by name (#1387)
Add support for revoking clients by setting the CLIENT environment variable directly with the client name, in addition to the existing CLIENTNUMBER support (from https://github.com/angristan/openvpn-install/pull/1328) This makes headless revocation more user-friendly as users no longer need to know the client's index number.
This commit is contained in:
@@ -1627,6 +1627,15 @@ function selectClient() {
|
||||
log_fatal "You have no existing clients!"
|
||||
fi
|
||||
|
||||
# If CLIENT is set, validate it exists as a valid client
|
||||
if [[ -n $CLIENT ]]; then
|
||||
if tail -n +2 /etc/openvpn/server/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | grep -qx "$CLIENT"; then
|
||||
return
|
||||
else
|
||||
log_fatal "Client '$CLIENT' not found or not valid"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $show_expiry == "true" ]]; then
|
||||
local i=1
|
||||
while read -r client; do
|
||||
|
||||
Reference in New Issue
Block a user