{"id":20378289,"url":"https://github.com/botto/wireguard_rest_api","last_synced_at":"2025-03-04T22:18:59.594Z","repository":{"id":136724349,"uuid":"198108092","full_name":"botto/wireguard_rest_api","owner":"botto","description":"Small WebServer that allows you to control a wireguard device.","archived":false,"fork":false,"pushed_at":"2019-07-05T10:46:12.000Z","size":6378,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-15T07:18:42.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/botto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-21T21:43:09.000Z","updated_at":"2020-04-17T08:40:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"3b86eadd-5035-49a0-8127-8903919d1a2e","html_url":"https://github.com/botto/wireguard_rest_api","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/botto%2Fwireguard_rest_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/botto%2Fwireguard_rest_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/botto%2Fwireguard_rest_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/botto%2Fwireguard_rest_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/botto","download_url":"https://codeload.github.com/botto/wireguard_rest_api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241928679,"owners_count":20043861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T01:49:48.416Z","updated_at":"2025-03-04T22:18:59.588Z","avatar_url":"https://github.com/botto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [WireGuard REST API](https://gitlab.com/gun1x/wireguard_rest_api)\n\n*If you need any modifications/improvements to this project, please let me know.*\n\nThis webserver allows you to control one wireguard interface located on the server. It allows you to get/set configuration of the WireGuard device, and also about the Peers configured on the device.\n\nAll the GET commands do not require authentication. All the PUT/DELETE commands require authentication.\n\nCurrently one server can manage only one wireguard device. This could change in the future, if anybody needs one server that manages multiple interfaces.\n\n## Usage examples:\n\n### get all information\n```bash\n$ curl -k \"https://server:31337/\"\n{\n    \"Name\": \"internal\",\n    \"Type\": \"Linux kernel\",\n    \"PublicKey\": \"YTV4cu1ucfKDej2SqRX91ldU7uT9S+s96/RFJmuwyjg=\",\n    \"FirewallMark\": 0,\n    \"ListenPort\": 1337,\n    \"Message\": \"available commands: /peers /privateKey /publicKey /listenPort\"\n}\n```\n\n### get all the peers\n```bash\n$ curl -k -G --user \"user:pass\" \"https://server:31337/peers\"\n[\n    {\n        \"PeerLoopIndex\": 0,\n        \"PublicKey\": \"xzSmPlkbxCslHIZhon/fJZ7pjWrP4HSlSh2h1He/BCg=\",\n        \"AllowedIPs\": \"10.100.0.3/32\",\n        \"Endpoint\": \"192.168.121.39:58917\",\n        \"LastHandshake\": \"2019-05-21 14:12:37.051697687 +0000 UTC\",\n        \"BytesReceived\": 264056,\n        \"BytesSent\": 322256\n    },\n    {\n        \"PeerLoopIndex\": 1,\n        \"PublicKey\": \"yKtnb6UgriaIm1Xi9DQ+BcTwPFITlQLQ9M2BmxMCrhs=\",\n        \"AllowedIPs\": \"10.100.0.2/32\",\n        \"Endpoint\": \"192.168.121.148:34790\",\n        \"LastHandshake\": \"2019-05-21 13:31:12.104693013 +0000 UTC\",\n        \"BytesReceived\": 119780,\n        \"BytesSent\": 143476\n    },\n    {\n        \"PeerLoopIndex\": 2,\n        \"PublicKey\": \"+wOFGJo7bjuGhf/nMZ4IB9bNr475x2GURy6089UkJHM=\",\n        \"AllowedIPs\": \"10.100.0.5/32\",\n        \"Endpoint\": \"192.168.121.12:49446\",\n        \"LastHandshake\": \"2019-05-21 13:31:12.186561752 +0000 UTC\",\n        \"BytesReceived\": 92740,\n        \"BytesSent\": 97424\n    }\n]\n```\n\n### get only public key\n```bash\n $ curl -k \"https://server:31337/publicKey\"\n{\"PublicKey\": \"YTV4cu1ucfKDej2SqRX91ldU7uT9S+s96/RFJmuwyjg=\"}\n```\n\n### change the private key\n```bash\n $ curl -k \"https://server:31337/privateKey\"\n{\n    \"status\": \"ERROR\",\n    \"message\": \"Use the DELETE request to generate a new key pair, or GET the /publicKey\",\n    \"error\": \"bad HTTP method\"\n}\n\n $ curl -X DELETE -k -G --user \"user:pass\"  \"https://server:31337/privateKey\"\n{\n    \"status\": \"OK\",\n    \"message\": \"GET public key at /publicKey\"\n}\n\n $ curl -k \"https://server:31337/publicKey\"           \n{ \"PublicKey\": \"daxw/ElaZgOypvBNbAL8es4DotrsxnQagwnFq7Ch5DU=\" }\n```\n\n## Running with Docker\n\nThe server will run by default on port 31337, but you can change that in [docker start.sh](https://gitlab.com/gun1x/wireguard_rest_api/blob/master/start.sh).\n\n```\ndocker pull \"registry.gitlab.com/gun1x/wireguard_rest_api\"\ndocker rm --force \"wireguard_rest_api\"\ndocker run \\\n  --rm \\\n  --net=host \\\n  --cap-add NET_ADMIN \\\n  --env WIREGUARD_INTERFACE=wg1337 \\\n  --env WIREGUARD_ADMIN=user \\\n  --env WIREGUARD_ADMIN_PASS=pass \\\n  --env WIREGUARD_DUMP_FILE=\"/root/wireguard_dump\" \\\n  --volume \"/root/wireguard_dump:/root/wireguard_dump:rw\" \\\n  --name wireguard_rest_api \\\n  -it \"registry.gitlab.com/gun1x/wireguard_rest_api\"\n```\n\n`wireguard_dump` can be removed if you do not need reboot persistance. Be aware that `wireguard_dump` will save the private key on the disk.\n\n## Running without docker\n\nThe server can run without Docker, as long as it has the environment variables. Let me know if you consider you need better documnetation for this.\n\nThe interface must be created before the server is started, as detailed in the [docker start.sh](https://gitlab.com/gun1x/wireguard_rest_api/blob/master/start.sh), which is a good example of how to run the server, and should work on any distribution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbotto%2Fwireguard_rest_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbotto%2Fwireguard_rest_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbotto%2Fwireguard_rest_api/lists"}