mirror of
https://github.com/pcvolkmer/docker-wireguard-boringtun.git
synced 2025-04-19 13:26:50 +00:00
Remove interactive configuration
This commit is contained in:
parent
f85d6dc215
commit
0957eda443
@ -30,7 +30,7 @@ Customize the file `docker-compose`. You can change the following environment va
|
||||
* `CLIENTS`: Number of clients for which configurations are to be created. Do not use more than 240 clients.
|
||||
* `DISABLE_FORWARD_ALL_TRAFFIC`: Use `true` or `yes` to not add iptables rules and do not forward all traffic.
|
||||
|
||||
If no environment variables are set, config creation script will ask you for settings.
|
||||
If a required environment variable is not set, config creation script will end with an error.
|
||||
|
||||
### Create config files
|
||||
|
||||
|
@ -6,39 +6,29 @@ rm *-client_*.png 2>/dev/null
|
||||
|
||||
echo "Create configuration files"
|
||||
|
||||
while [[ -z $DEVICE ]]; do
|
||||
echo -n "Device (eg tun0): "
|
||||
read DEVICE
|
||||
done
|
||||
if [[ -z $DEVICE ]]; then
|
||||
DEVICE="tun0"
|
||||
fi
|
||||
echo " - Writing server config to file $DEVICE.conf"
|
||||
|
||||
while [[ -z $SERVER_HOST ]]; do
|
||||
echo -n "Endpoint hostname: "
|
||||
read SERVER_HOST
|
||||
done
|
||||
if [[ -z $SERVER_HOST ]]; then
|
||||
echo " ERROR: No server hostname!"
|
||||
exit 1
|
||||
fi
|
||||
echo " - Using endpoint hostname $SERVER_HOST"
|
||||
|
||||
if [[ -z $SERVER_PORT ]]; then
|
||||
echo -n "Endpoint port: "
|
||||
read SERVER_PORT
|
||||
echo " ERROR: No server port!"
|
||||
exit 1
|
||||
fi
|
||||
echo " - Using port $SERVER_PORT"
|
||||
|
||||
if [[ -z $NETWORK ]]; then
|
||||
echo -n "Network (/24): "
|
||||
read NETWORK
|
||||
NETWORK="192.168.42.0"
|
||||
else
|
||||
NETWORK=$(echo -n $NETWORK | sed -r "s/\.[0-9]+$//")
|
||||
fi
|
||||
echo " - Using network $NETWORK/24"
|
||||
NETWORK=$(echo -n $NETWORK | sed -r "s/\.[0-9]+$//")
|
||||
|
||||
while [[ -z $CLIENTS ]]; do
|
||||
echo -n "Number of clients: "
|
||||
read CLIENTS
|
||||
done
|
||||
if (( $CLIENTS > 240 )); then
|
||||
CLIENTS=240
|
||||
fi
|
||||
echo " - Generating $CLIENTS client configs and client QR codes"
|
||||
echo " - Using network $NETWORK.0/24"
|
||||
|
||||
if [ "$DISABLE_FORWARD_ALL_TRAFFIC" != "true" ] && [ "$DISABLE_FORWARD_ALL_TRAFFIC" != "yes" ]; then
|
||||
echo " - Forward all traffic"
|
||||
@ -46,6 +36,11 @@ else
|
||||
echo " - Do not forward all traffic"
|
||||
fi
|
||||
|
||||
if (( $CLIENTS > 240 )); then
|
||||
CLIENTS=240
|
||||
fi
|
||||
echo " - Generating $CLIENTS client configs and client QR codes"
|
||||
|
||||
SERVER_SEC_KEY=$(wg genkey)
|
||||
SERVER_PUB_KEY=$(echo $SERVER_SEC_KEY | wg pubkey)
|
||||
|
||||
@ -113,6 +108,7 @@ PublicKey = $SERVER_PUB_KEY
|
||||
AllowedIPs = 0.0.0.0/0, ::/0
|
||||
Endpoint = $SERVER_HOST:$SERVER_PORT
|
||||
EOF
|
||||
|
||||
done
|
||||
|
||||
# Create QR-codes for clients
|
||||
|
Loading…
x
Reference in New Issue
Block a user