-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A feature to disable / enable single wireguard client configs #1186
Conversation
I've not tested this yet, however I would change the command line behavior:
|
Will do |
Tested OK on pi4. |
scripts/wireguard/bash-completion
Outdated
dashopts="-a -c -d -l -qr -r -h -u -up -bk -dis -ena" | ||
opts="add clients debug list qrcode remove help uninstall update backup disable enable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old completion options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
scripts/wireguard/disableCONF.sh
Outdated
|
||
cd /etc/wireguard | ||
if [ ! -s configs/clients.txt ]; then | ||
echo "::: There are no clients to remove" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change instead of remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do
When a cient is disabled, Example
I would add parenthesis and a space to make the wg0.conf easier to read:
|
Will address this |
I've got a problem with the logic now -the pivpn -c command uses the wireguard config to get the information about the clients, but the disabled ones are not in that config file - they are not known to the wg0 service. So I don't see how to get the disabled clients listed on the connected clients command. I could do the same as the pivpn -l command when I add the disabled ones to the bottom of the list. |
all comments above addressed, tested on AWS Ubuntu 18.04 and 20.04. |
Still getting an error on
I would have added the disabled status in the client.txt file #1186 (comment) |
Changed to all clients disabled working, tested on rpi3. I don't think that clients.txt needs changing as well the file already tracking the disabled. I dislike changing data in more than one place unless actually needed, and it will make the code more complicated. |
Addresses #1111
Code like the delete, but comment out lines for the user in configs, wg0.conf instead of delete.
-dis or disable
-ena or enable
-ena -v will give a list of clients disabled
-dis -v will give a list of clients disabled
Tested OK on AWS Ubuntu 20.04 and AWS Ubuntu 18.04 AMD64. Have to do an apt-get update and apt-get upgrade before the install works. Tested creating client, connecting, disabling, enabling, multiple client create, client delete, -l and -c functions. For some reason installation has to be root on the AWS machines.
Also tested Rpi3+ Buster: getting Warning: The unit file, source configuration file or drop-ins of [email protected] changed on disk. Run 'systemctl daemon-reload' to reload units.