systemd | ||
.dockerignore | ||
.gitignore | ||
docker-compose.yml | ||
Dockerfile | ||
index.js | ||
LICENSE.md | ||
package-lock.json | ||
package.json | ||
README.md | ||
wireguard.js |
wgapi
NodeJS server to add and remove wireguard configs
Installation
Docker
Install docker and docker-compose. Then create a project directory and pull the docker-compose.yml
file
$ sudo mkdir /srv/wgapi
$ cd /srv/wgapi
$ sudo wget https://gitea.gf4.pw/gf4/wgapi/raw/branch/master/docker-compose.yml
Edit the compose file according to its comments. Then you can start the service.
docker-compose up -d
The API will modify your wireguard configuration file. Changes will not take effect unless the interface is restarted periodically. One way of doing this is with a systemd timer.
TODO: Add systemd timer and instructions
NOTE: The API is not protected by any authentication. As it stands, anyone can connect to your API and access your wireguard network! Be sure to protect it with authentication in a web proxy or by blocking access with a firewall.
Usage
Once the server is listening, there are two endpoints that clients can direct requests to.
Add
This endpoint adds a peer to the wireguard server.
TODO: Write how to use it.
Delete
This endpoint deletes a peer from the server.
TODO: Write how to use it.
Notes
After a config has been downloaded by a client, the user is free to modify it to peer with friends' hosts.
TODO: Add instructions on how to do this.
License (GPLv2)
Copyright © 2021 Keith Irwin
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.