mirror of
https://github.com/pcvolkmer/docker-wireguard-boringtun.git
synced 2025-04-19 21:36:49 +00:00
Limit clients and add date to configs
This commit is contained in:
parent
e9e9839e64
commit
fbbb26f4cb
@ -33,6 +33,9 @@ while [[ -z $CLIENTS ]]; do
|
|||||||
echo -n "Number of clients: "
|
echo -n "Number of clients: "
|
||||||
read CLIENTS
|
read CLIENTS
|
||||||
done
|
done
|
||||||
|
if [[ "240" > "$CLIENTS" ]]; then
|
||||||
|
CLIENTS=240
|
||||||
|
fi
|
||||||
echo " - Generating $CLIENTS client configs and client QR codes"
|
echo " - Generating $CLIENTS client configs and client QR codes"
|
||||||
|
|
||||||
SERVER_SEC_KEY=$(wg genkey)
|
SERVER_SEC_KEY=$(wg genkey)
|
||||||
@ -54,7 +57,6 @@ cat <<EOF >> $DEVICE.conf
|
|||||||
##############
|
##############
|
||||||
# SERVER
|
# SERVER
|
||||||
##############
|
##############
|
||||||
|
|
||||||
[Interface]
|
[Interface]
|
||||||
Address = $NETWORK.1/24
|
Address = $NETWORK.1/24
|
||||||
ListenPort = $SERVER_PORT
|
ListenPort = $SERVER_PORT
|
||||||
@ -62,7 +64,7 @@ PrivateKey = $SERVER_SEC_KEY
|
|||||||
|
|
||||||
PostUp = iptables -A FORWARD -i $DEVICE -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
PostUp = iptables -A FORWARD -i $DEVICE -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
||||||
PostDown = iptables -D FORWARD -i $DEVICE -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
|
PostDown = iptables -D FORWARD -i $DEVICE -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
|
||||||
|
# <- $(date)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Print out client peers
|
# Print out client peers
|
||||||
@ -72,7 +74,7 @@ cat << EOF >> $DEVICE.conf
|
|||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = ${CLIENT_PUB_KEYS[$i]}
|
PublicKey = ${CLIENT_PUB_KEYS[$i]}
|
||||||
AllowedIPs = $NETWORK.$(($i+10))/32
|
AllowedIPs = $NETWORK.$(($i+10))/32
|
||||||
|
# <- $(date)
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -82,8 +84,9 @@ for (( i=1; i<=$CLIENTS; i++ )); do
|
|||||||
cat <<EOF >> $DEVICE-client_$i.conf
|
cat <<EOF >> $DEVICE-client_$i.conf
|
||||||
##############
|
##############
|
||||||
# CLIENT $i
|
# CLIENT $i
|
||||||
|
#
|
||||||
|
# <- $(date)
|
||||||
##############
|
##############
|
||||||
|
|
||||||
[Interface]
|
[Interface]
|
||||||
Address = $NETWORK.$(($i+10))/24
|
Address = $NETWORK.$(($i+10))/24
|
||||||
ListenPort = $SERVER_PORT
|
ListenPort = $SERVER_PORT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user