diff options
author | Matt Dunwoodie <ncon@mail.noconroy.net> | 2019-05-19 16:08:29 +1000 |
---|---|---|
committer | Matt Dunwoodie <ncon@mail.noconroy.net> | 2019-05-19 16:08:29 +1000 |
commit | 5b158d2d9723c9d014c5b608e522f0cd7a684cee (patch) | |
tree | d16303d3608518a2807f1a8f7abdef4ad713340c | |
parent | Add support for new ioctls (diff) | |
download | wireguard-monolithic-historical-5b158d2d9723c9d014c5b608e522f0cd7a684cee.tar.xz wireguard-monolithic-historical-5b158d2d9723c9d014c5b608e522f0cd7a684cee.zip |
Add retrieval of private key from device
Before mdlayher notified me that wg(8) actually can view the device
private key (with `WG_HIDE_KEYS=never wg`), I did not have a need for
it. It was straight forward to add in kernel.
This functionality will also be implemented in wgctrl-go.
-rw-r--r-- | src/tools/ipc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/ipc.c b/src/tools/ipc.c index f54ca90..fb9cc90 100644 --- a/src/tools/ipc.c +++ b/src/tools/ipc.c @@ -1015,6 +1015,11 @@ static int openbsd_get_device(struct wgdevice **device, const char *interface) dev->flags |= WGDEVICE_HAS_PUBLIC_KEY; } + if (!IS_NULL_KEY(wgs.gs_privkey)) { + memcpy(dev->private_key, wgs.gs_privkey, WG_KEY_SIZE); + dev->flags |= WGDEVICE_HAS_PRIVATE_KEY; + } + dev->first_peer = dev->last_peer = NULL; for (size_t i = 0; i < wgs.gs_num_peers; i++) { |