summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vmd/vmd.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2018-06-26 10:00:08 +0000
committerreyk <reyk@openbsd.org>2018-06-26 10:00:08 +0000
commit6cfffd577b03d2f54eda873c3414b64f23c82b46 (patch)
tree7da0d1fd57b179ca847fce244f991a128146034d /usr.sbin/vmd/vmd.c
parentAllow to read the password from a file with -y (diff)
downloadwireguard-openbsd-6cfffd577b03d2f54eda873c3414b64f23c82b46.tar.xz
wireguard-openbsd-6cfffd577b03d2f54eda873c3414b64f23c82b46.zip
Add "socket owner" to allow changing the owner of the vmd control socket.
This allows to open vmctl control or console access to other users that are not in group wheel. Access for non-root users still defaults to read-only actions unless you change the owner (user/group) of each individual VM. Requested by Mischa Peters OK mlarkin@
Diffstat (limited to 'usr.sbin/vmd/vmd.c')
-rw-r--r--usr.sbin/vmd/vmd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index cc2af555a16..9b1c66e2a52 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.86 2018/06/19 17:12:34 reyk Exp $ */
+/* $OpenBSD: vmd.c,v 1.87 2018/06/26 10:00:08 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -85,6 +85,7 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
struct vmd_vm *vm = NULL;
char *str = NULL;
uint32_t id = 0;
+ struct control_sock *rcs;
switch (imsg->hdr.type) {
case IMSG_VMDOP_START_VM_REQUEST:
@@ -275,6 +276,12 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
NULL, 0);
}
break;
+ case IMSG_VMDOP_DONE:
+ control_reset(&ps->ps_csock);
+ TAILQ_FOREACH(rcs, &ps->ps_rcsocks, cs_entry)
+ control_reset(rcs);
+ cmd = 0;
+ break;
default:
return (-1);
}