mirror of
https://github.com/pcvolkmer/docker-wireguard-boringtun.git
synced 2025-04-19 21:36:49 +00:00
Check if optional public key is already used
This commit is contained in:
parent
41d0aed0e6
commit
d47e1a1a23
@ -19,6 +19,13 @@ if [ -z $1 ]; then
|
|||||||
CLIENT_SEC_KEY=$(wg genkey)
|
CLIENT_SEC_KEY=$(wg genkey)
|
||||||
CLIENT_PUB_KEY=$(echo $CLIENT_SEC_KEY | wg pubkey)
|
CLIENT_PUB_KEY=$(echo $CLIENT_SEC_KEY | wg pubkey)
|
||||||
else
|
else
|
||||||
|
# Check if public key is already used
|
||||||
|
for key in $(cat $DEVICE.conf | grep "PublicKey = " | sed "s/PublicKey = \(.*\)$/\1/"); do
|
||||||
|
if [[ "$1" == "$key" ]]; then
|
||||||
|
echo "Key '$1' already used!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
CLIENT_SEC_KEY="<place secret key here>"
|
CLIENT_SEC_KEY="<place secret key here>"
|
||||||
CLIENT_PUB_KEY=$1
|
CLIENT_PUB_KEY=$1
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user