2022-09-06 20:57:41 -06:00
|
|
|
#!/bin/bash
|
2023-04-02 13:46:52 -06:00
|
|
|
# FILE: wagon:back/lib/wg/peer/del
|
2022-09-06 20:57:41 -06:00
|
|
|
# DESCRIPTION: Delete a peer from a wireguard interface
|
|
|
|
# USAGE: del pubkey
|
|
|
|
|
2023-04-02 13:46:52 -06:00
|
|
|
source /etc/wagon/config
|
2022-09-06 20:57:41 -06:00
|
|
|
|
2022-09-10 16:27:51 -06:00
|
|
|
if ! res="$(sudo /usr/bin/wg set "${TLD}" peer "${1}" remove)"; then
|
2022-12-03 17:07:03 -07:00
|
|
|
printf 'ERROR! Wireguard failed: %s\n' "${res}" >&2
|
2022-12-03 18:23:13 -07:00
|
|
|
exit 1
|
2022-09-10 16:26:06 -06:00
|
|
|
fi
|