-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trim generated .ovpn files and add cli
- Loading branch information
Showing
6 changed files
with
51 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_NAME='./clients' | ||
|
||
# Function to add clients | ||
add_clients() { | ||
local password=$1 | ||
shift | ||
for name in "$@"; do | ||
sudo docker exec openvpn bash /opt/app/bin/genclient.sh "$name" "$password" | ||
done | ||
} | ||
|
||
# Function to remove clients | ||
remove_clients() { | ||
for name in "$@"; do | ||
sudo docker exec openvpn bash /opt/app/bin/rmclient.sh "$name" | ||
done | ||
} | ||
|
||
# Main script logic | ||
case "$1" in | ||
add) | ||
if [ "$#" -lt 3 ]; then | ||
echo "Usage: $SCRIPT_NAME add <password> <names...>" | ||
exit 1 | ||
fi | ||
add_clients "$2" "${@:3}" | ||
;; | ||
remove) | ||
if [ "$#" -lt 2 ]; then | ||
echo "Usage: $SCRIPT_NAME remove <names...>" | ||
exit 1 | ||
fi | ||
remove_clients "${@:2}" | ||
;; | ||
*) | ||
echo "Usage: $SCRIPT_NAME {add|remove} <arguments>" | ||
exit 1 | ||
;; | ||
esac |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters