aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Alonso Cardenas Marquez <acm@FreeBSD.org>2026-08-10 03:49:41 +0000
committerJose Alonso Cardenas Marquez <acm@FreeBSD.org>2026-08-10 03:49:41 +0000
commit572d4c2c3cf6b632fde8aedf8e6689247e51ba5d (patch)
tree99747f578f3e6bc0f35d271b5e5fc4e07fcecda5
parentda9ace912237cea39214354260599893838a6c86 (diff)
sysutils/bhyvemgrd: New port: privileged helper daemon for bhyvemgr
Bhyvemgrd exposes a JSON-based IPC interface over a UNIX domain socket, allowing the bhyvemgr client to request privileged operations required for bhyve virtual machines, execute system-level tasks, monitor VM process states, and receive asynchronous state notifications.
-rw-r--r--GIDs2
-rw-r--r--UIDs2
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/bhyvemgrd/Makefile43
-rw-r--r--sysutils/bhyvemgrd/distinfo3
-rw-r--r--sysutils/bhyvemgrd/files/bhyvemgrd.in99
-rw-r--r--sysutils/bhyvemgrd/files/pkg-message.in18
-rw-r--r--sysutils/bhyvemgrd/pkg-descr4
-rw-r--r--sysutils/bhyvemgrd/pkg-plist3
9 files changed, 173 insertions, 2 deletions
diff --git a/GIDs b/GIDs
index f035f3924909..2bbce925224a 100644
--- a/GIDs
+++ b/GIDs
@@ -775,7 +775,7 @@ cirrus:*:828:
# free: 830
# free: 831
beehive:*:832:
-# free: 833
+bhyvemgrd:*:833:
pocket-id:*:834:
filebrowser:*:835:
tinyauth:*:836:
diff --git a/UIDs b/UIDs
index f460c3b88c80..58282d895bed 100644
--- a/UIDs
+++ b/UIDs
@@ -780,7 +780,7 @@ cirrus:*:828:828::0:0:Cirrus CI:/usr/local/cirrus:/bin/sh
# free: 830
# free: 831
beehive:*:832:832::0:0:beehive user:/nonexistent:/usr/sbin/nologin
-# free: 833
+bhyvemgrd:*:833:833::0:0:bhyvemgrd daemon user:/nonexistent:/usr/sbin/nologin
pocket-id:*:834:834::0:0:OIDC provider that allows users to authenticate with their passkeys:/var/db/pocket-id:/usr/sbin/nologin
filebrowser:*:835:835::0:0:Web File Browser:/var/db/filebrowser:/usr/sbin/nologin
tinyauth:*:836:836::0:0:Simplest way to protect your apps with a login screen:/var/db/tinyauth:/usr/sbin/nologin
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 06bcdea99e15..dfabb0fe85d5 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -124,6 +124,7 @@
SUBDIR += bhyve-firmware
SUBDIR += bhyve-rc
SUBDIR += bhyvemgr
+ SUBDIR += bhyvemgrd
SUBDIR += bin
SUBDIR += biosfont
SUBDIR += bkpupsd
diff --git a/sysutils/bhyvemgrd/Makefile b/sysutils/bhyvemgrd/Makefile
new file mode 100644
index 000000000000..f5115eb4803e
--- /dev/null
+++ b/sysutils/bhyvemgrd/Makefile
@@ -0,0 +1,43 @@
+PORTNAME= bhyvemgrd
+DISTVERSIONPREFIX= v
+PORTVERSION= 1.0.0
+CATEGORIES= sysutils
+PKGNAMESUFFIX= ${LAZARUS_PKGNAMESUFFIX}
+
+MAINTAINER= acm@FreeBSD.org
+COMMENT= privileged helper daemon for bhyvemgr
+WWW= https://github.com/alonsobsd/bhyvemgrd
+
+LICENSE= BSD3CLAUSE
+
+ONLY_FOR_ARCHS?=amd64
+
+USES= fpc
+USE_GITHUB= yes
+GH_ACCOUNT= alonsobsd
+
+.include <bsd.port.pre.mk>
+
+.if ${OPSYS} == FreeBSD && (${OSVERSION} >= 1500000)
+ONLY_FOR_ARCHS= aarch64 amd64
+.endif
+
+FPC_LPR_FILE= ${PORTNAME}.lpr
+
+BHYVEMGRD_USER= bhyvemgrd
+BHYVEMGRD_GROUP=bhyvemgrd
+USERS= ${BHYVEMGRD_USER}
+GROUPS= ${BHYVEMGRD_GROUP}
+
+USE_RC_SUBR= ${PORTNAME}
+SUB_FILES= pkg-message
+
+do-build:
+ @cd ${WRKSRC}/src && ${LOCALBASE}/bin/fpc ${FPC_LPR_FILE}
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${PREFIX}/etc/bhyvemgrd
+ ${INSTALL_PROGRAM} ${WRKSRC}/src/${PORTNAME} ${STAGEDIR}${PREFIX}/sbin/${PORTNAME}
+ ${INSTALL_DATA} ${WRKSRC}/setup/daemon.conf ${STAGEDIR}${PREFIX}/etc/bhyvemgrd/daemon.conf.sample
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/bhyvemgrd/distinfo b/sysutils/bhyvemgrd/distinfo
new file mode 100644
index 000000000000..d4db1d10e52a
--- /dev/null
+++ b/sysutils/bhyvemgrd/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1786333499
+SHA256 (alonsobsd-bhyvemgrd-v1.0.0_GH0.tar.gz) = 5483b1d5be6dd135c5b962ae18f703a2472a18265300ecc972b1156a9779303f
+SIZE (alonsobsd-bhyvemgrd-v1.0.0_GH0.tar.gz) = 13397
diff --git a/sysutils/bhyvemgrd/files/bhyvemgrd.in b/sysutils/bhyvemgrd/files/bhyvemgrd.in
new file mode 100644
index 000000000000..e9d8ff4edd4d
--- /dev/null
+++ b/sysutils/bhyvemgrd/files/bhyvemgrd.in
@@ -0,0 +1,99 @@
+#!/bin/sh
+
+# PROVIDE: bhyvemgrd
+# REQUIRE: NETWORKING
+# KEYWORD: shutdown
+#
+# Configuration settings for bhyvemgrd in /etc/rc.conf:
+#
+# bhyvemgrd_enable: run bhyvemgrd as service (default=NO)
+#
+
+. /etc/rc.subr
+
+name=bhyvemgrd
+rcvar=bhyvemgrd_enable
+
+load_rc_config ${name}
+
+: ${bhyvemgrd_enable:=NO}
+
+bhyvemgrd_user="bhyvemgrd"
+bhyvemgrd_group="bhyvemgrd"
+bhyvemgrd_logfile="/var/log/bhyvemgrd.log"
+bhyvemgrd_socketdir="/var/run/bhyvemgrd"
+
+pidfile="/var/run/${name}/${name}.pid"
+procname="/usr/local/sbin/bhyvemgrd"
+command="/usr/sbin/daemon"
+command_args="-t ${name} -p ${pidfile} -o ${bhyvemgrd_logfile} ${procname}"
+
+start_precmd=${name}_prestart
+status_cmd=${name}_status
+stop_cmd=${name}_stop
+restart_cmd=${name}_restart
+reload_cmd=${name}_reload
+extra_commands="reload status"
+
+bhyvemgrd_prestart()
+{
+ if [ ! -d "${bhyvemgrd_socketdir}" ]; then
+ mkdir ${bhyvemgrd_socketdir}
+ chmod 770 ${bhyvemgrd_socketdir}
+ chown ${bhyvemgrd_user}:${bhyvemgrd_group} ${bhyvemgrd_socketdir}
+ fi
+ if [ ! -e ${pidfile} ]; then
+ install -o ${bhyvemgrd_user} -g ${bhyvemgrd_group} /dev/null ${pidfile};
+ fi
+ if [ ! -e "${bhyvemgrd_logfile}" ]; then
+ install -o root -g ${bhyvemgrd_group} -m 660 /dev/null ${bhyvemgrd_logfile};
+ fi
+}
+
+bhyvemgrd_status()
+{
+ # If running, show pid
+ if [ -f ${pidfile} ]
+ then
+ echo "${name} is running as pid" `cat ${pidfile}`
+ else
+ echo "${name} is not running."
+ fi
+}
+
+bhyvemgrd_stop()
+{
+ if [ -f ${pidfile} ]
+ then
+ pid_child=$(pgrep -P `cat ${pidfile}`)
+
+ if [ ! -z "${pid_child}" ]; then
+ echo "Stopping ${name}."
+ echo "${name} cannot be stopped. There are some vms running:"
+ pgrep -fl -P `cat ${pidfile}`
+ return 1
+ else
+ kill -SIGTERM `cat ${pidfile}`
+ echo "Stopping ${name}."
+ fi
+ else
+ echo "${name} not running? (check ${pidfile})."
+ fi
+}
+
+bhyvemgrd_reload()
+{
+ echo "Performing reload ${name}"
+ kill -SIGHUP `cat ${pidfile}`
+}
+
+
+bhyvemgrd_restart()
+{
+ echo "Performing restart ${name}"
+ run_rc_command stop || return $?
+ sleep 2
+ run_rc_command start
+}
+
+run_rc_command "$1"
diff --git a/sysutils/bhyvemgrd/files/pkg-message.in b/sysutils/bhyvemgrd/files/pkg-message.in
new file mode 100644
index 000000000000..59633330b74a
--- /dev/null
+++ b/sysutils/bhyvemgrd/files/pkg-message.in
@@ -0,0 +1,18 @@
+[
+{ type: install
+ message: <<EOM
+bhyvemgrd was installed
+
+1) bhyvemgrd config file sample is located at %%LOCALBASE%%/etc/bhyvemgrd
+
+2) Log messages are saved to /var/log/bhyvemgrd.log file
+
+3) For an optimal use of bhyvemgrd, some settings must be applied to your system.
+ Take a look at the following url:
+
+ https://github.com/alonsobsd/bhyvemgrd/blob/main/README.md
+
+4) Enjoy it ;)
+EOM
+}
+]
diff --git a/sysutils/bhyvemgrd/pkg-descr b/sysutils/bhyvemgrd/pkg-descr
new file mode 100644
index 000000000000..8a86fe3204fc
--- /dev/null
+++ b/sysutils/bhyvemgrd/pkg-descr
@@ -0,0 +1,4 @@
+Bhyvemgrd exposes a JSON-based IPC interface over a UNIX domain socket,
+allowing the bhyvemgr client to request privileged operations required for
+bhyve virtual machines, execute system-level tasks, monitor VM process states,
+and receive asynchronous state notifications.
diff --git a/sysutils/bhyvemgrd/pkg-plist b/sysutils/bhyvemgrd/pkg-plist
new file mode 100644
index 000000000000..35ccccea8c11
--- /dev/null
+++ b/sysutils/bhyvemgrd/pkg-plist
@@ -0,0 +1,3 @@
+@sample %%ETCDIR%%/daemon.conf.sample
+sbin/bhyvemgrd
+@dir(root,bhyvemgrd,770) %%ETCDIR%%