This is a lightweight gRPC service that can create, read, configure and delete WireGuard devices, written in C++ with performance and security in mind.
cmake -Bbuild .
cmake --build build
A binary would be avaliable at ./build/wgrpc
.
The server requires
CAP_NET_ADMIN
capability to manage network devices. You can either run the binary as root or manually attach this capability, see capabilities(7).
Usage: wgrpc [options]
Options:
--help Show help
--address ip (=[::]) Set address
--port port (=50051) Set port
This server supports gRPC Reflection, so you can interact with server using tools like gRPCurl or grpc-cli:
$ grpc_cli ls localhost:50051 proto.WireGuardService
CreateDevice
ConfigureDevice
GetDevices
GetDevice
DeleteDevice
GeneratePrivateKey
GeneratePublicKey
GeneratePresharedKey
$ grpc_cli call localhost:50051 proto.WireGuardService.GeneratePrivateKey
reading request message from stdin...
connecting to localhost:50051
key: "oN7o8iA3E1XvPOSs+W5X7Q5vTjdvOGlBM0UxWHZQT1M="
Rpc succeeded with OK status
Method Name | Request Type | Response Type | Description |
---|---|---|---|
CreateDevice | CreateDevice.Request | EmptyResponse | Creates a device |
ConfigureDevice | ConfigureDevice.Request | EmptyResponse | Configures a device by name |
GetDevices | EmptyRequest | GetDevices.Response | Returns current devices |
GetDevice | GetDevice.Request | GetDevice.Response | Returns a device by name |
DeleteDevice | DeleteDevice.Request | EmptyResponse | Deletes a device by name |
GeneratePrivateKey | EmptyRequest | GeneratePrivateKey.Response | Generates a new private key |
GeneratePublicKey | GeneratePublicKey.Request | GeneratePublicKey.Response | Generates a new public key from a provided private key |
GeneratePresharedKey | EmptyRequest | GeneratePresharedKey.Response | Generates a new preshared key |