go2rtc: run service as regular user

Improve security a bit by dropping root privileges.
Also instruct procd to respawn.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
pull/25127/head
Vladimir Ermakov 2024-10-12 10:38:10 +00:00 committed by Rosen Penev
parent 3ab468be20
commit 27e7c37ddb
2 changed files with 7 additions and 1 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=go2rtc
PKG_VERSION:=1.9.4
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/AlexxIT/go2rtc/tar.gz/v$(PKG_VERSION)?
@ -28,6 +28,7 @@ define Package/go2rtc
TITLE:=go2rtc camera streaming
URL:=https://github.com/AlexxIT/go2rtc
DEPENDS:=$(GO_ARCH_DEPENDS) +ffmpeg
USERID:=go2rtc:go2rtc
endef
define Package/go2rtc/description

View File

@ -4,9 +4,14 @@ START=99
USE_PROCD=1
PROG=/usr/bin/go2rtc
USER=go2rtc
GROUP=go2rtc
start_service() {
procd_open_instance
procd_set_param command "$PROG" -config /etc/go2rtc.yaml
procd_set_param user "$USER"
procd_set_param group "$GROUP"
procd_set_param respawn
procd_close_instance
}