forked from WireGuard/wireguard-tools
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auth notifications for unknown peers
- Loading branch information
1 parent
7815aca
commit bd6261a
Showing
3 changed files
with
21 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Public Key,Allowed Ips,PSK | ||
/Ca5004uiLJVBqSPaBUKg5zBszO9qbzEUCWmVkelkjY=,"10.8.1.10/32",E37VXqGtGvwftop/uFsbZcIO76Ox1kMmB6Sz/JoIw2I= |
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 |
---|---|---|
@@ -1,5 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "came with arguments: " | ||
echo $* | ||
ACCOUNTS_FILE=$1 | ||
INTERFACE_NAME=$2 | ||
PUBLIC_KEY=$3 | ||
ENDPOINT=$4 | ||
ADVANCED_SECURITY=$5 | ||
|
||
ACCOUNT_STR=`grep "${PUBLIC_KEY}" "${ACCOUNTS_FILE}"` | ||
|
||
if [ "${ACCOUNT_STR}" == "" ]; then | ||
echo "Public key not found in accounts file!" | ||
exit 255 | ||
fi | ||
|
||
ACCOUNT=(${ACCOUNT_STR//,/ }) | ||
ALLOWED_IPS=$(echo ${ACCOUNT[1]}|tr -d '"') | ||
PSK=$(echo ${ACCOUNT[2]}|tr -d '"') | ||
|
||
awg set "${INTERFACE_NAME}" peer "${PUBLIC_KEY}" allowed-ips "${ALLOWED_IPS}" endpoint "${ENDPOINT}" allowed-ips "${ALLOWED_IPS}" preshared-key "${PSK}" advanced-security "${ADVANCED_SECURITY}" | ||
exit $? |
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