Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
b662d82ae3 | |||
bad40c1d1a | |||
bd099af12f | |||
c794049d19 |
@ -25,7 +25,8 @@ services:
|
|||||||
$ docker compose up -d
|
$ docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
> ▶️ For both variants, persistent config and key files will be stored in the `./data` directory. Feel free to change this to your needs.
|
> [!TIP]
|
||||||
|
> For both variants, persistent config and key files will be stored in the `./data` directory. Feel free to change this to your needs.
|
||||||
|
|
||||||
## Client Management
|
## Client Management
|
||||||
Generate new client keys and output its config:
|
Generate new client keys and output its config:
|
||||||
@ -43,4 +44,5 @@ Revoke a client's keys:
|
|||||||
$ docker compose exec main clientmgmt revoke
|
$ docker compose exec main clientmgmt revoke
|
||||||
```
|
```
|
||||||
|
|
||||||
> ▶️ If you are using docker run, replace `docker compose exec main` with `docker exec -it openvpn`.
|
> [!NOTE]
|
||||||
|
> If you are using docker run, replace `docker compose exec main` with `docker exec -it openvpn`.
|
||||||
|
@ -96,14 +96,14 @@ clientmgmt_add(){
|
|||||||
# ask whether auto-detection should be used
|
# ask whether auto-detection should be used
|
||||||
local answer="x"
|
local answer="x"
|
||||||
local first=0
|
local first=0
|
||||||
until [[ -z "$answer" || "$answer" =~ ^Y|y|N|n$ ]]; do
|
until [[ -z "$answer" || "$answer" =~ ^(Y|y|N|n)$ ]]; do
|
||||||
[[ "$first" -le 0 ]] && first=1 || echo "Invalid answer '$answer'"
|
[[ "$first" -le 0 ]] && first=1 || echo "Invalid answer '$answer'"
|
||||||
read -ep "Auto-detect public IP-Address using icanhazip.com? [Y/n]: " answer
|
read -ep "Auto-detect public IP-Address using icanhazip.com? [Y/n]: " answer
|
||||||
done
|
done
|
||||||
|
|
||||||
# maybe do auto-detection
|
# maybe do auto-detection
|
||||||
local public_ip=""
|
local public_ip=""
|
||||||
if [[ ! "$answer" =~ ^N|n$ ]]; then
|
if [[ ! "$answer" =~ ^(N|n)$ ]]; then
|
||||||
local exit=0
|
local exit=0
|
||||||
local icanhazip
|
local icanhazip
|
||||||
icanhazip=$(wget -O - -q icanhazip.com) || exit=$?
|
icanhazip=$(wget -O - -q icanhazip.com) || exit=$?
|
||||||
@ -307,7 +307,7 @@ clientmgmt_askname(){
|
|||||||
|
|
||||||
## VALIDATE ##
|
## VALIDATE ##
|
||||||
# check for reserved names
|
# check for reserved names
|
||||||
if [[ "$answer" =~ ^ca|server$ ]]; then
|
if [[ "$answer" =~ ^(ca|server)$ ]]; then
|
||||||
log_error "Name is reserved for internal use: '$answer'"
|
log_error "Name is reserved for internal use: '$answer'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ trap_exit(){
|
|||||||
q=$(( q + 1 ))
|
q=$(( q + 1 ))
|
||||||
snore 1
|
snore 1
|
||||||
if [[ "$q" -ge 15 ]]; then
|
if [[ "$q" -ge 15 ]]; then
|
||||||
log_warn "Sending kill to OpenVPN"
|
echo "Sending kill to OpenVPN" 1>&2
|
||||||
kill -s KILL -- $openvpn_pid 2> /dev/null || true
|
kill -s KILL -- $openvpn_pid 2> /dev/null || true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@ -53,7 +53,8 @@ proc_running(){
|
|||||||
# try reading state
|
# try reading state
|
||||||
local state_path="/proc/$1/stat"
|
local state_path="/proc/$1/stat"
|
||||||
[[ ! -f "$state_path" ]] && return 1
|
[[ ! -f "$state_path" ]] && return 1
|
||||||
local state=$(cat "$state_path" | cut -d ' ' -f3)
|
local state
|
||||||
|
state=$(cat "$state_path" 2> /dev/null | cut -d ' ' -f3) || return 1
|
||||||
|
|
||||||
# parse state
|
# parse state
|
||||||
case "$state" in
|
case "$state" in
|
||||||
|
Loading…
Reference in New Issue
Block a user