Fix gitdaemon rc.d(8) script's mechanism for setting the daemon's UID.

UID switching was controlled via git-dameon's --user option in $daemon_flags.
This is problematic in case $gitdaemon_flags is unwittingly set to some value
which omits the --user option: git-daemon would then run as root.

The fix implemented here sets $daemon_user to _gitdaemon by default,
and leaves $daemon_flags empty by default. This ensures that git-daemon
runs as user _gitdaemon regardless of the value of $gitdaemon_flags.

Anyone using git-daemon should check their system. If gitdaemon is
currently running as root, set gitdaemon_user=_gitdaemon in rc.conf.local
and restart the service.

ok kn@
This commit is contained in:
stsp 2019-07-16 09:56:55 +00:00
parent 3ff02ae6d6
commit 89b375f628
2 changed files with 4 additions and 3 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.200 2019/06/26 15:07:57 kn Exp $
# $OpenBSD: Makefile,v 1.201 2019/07/16 09:56:55 stsp Exp $
COMMENT-main = GIT - Tree History Storage Tool
COMMENT-svn = GIT - subversion interoperability tools
COMMENT-x11 = GIT - graphical tools
V = 2.22.0
REVISION = 0
DISTNAME = git-${V}
PKGNAME-main = ${DISTNAME}
PKGNAME-svn = git-svn-${V}

View File

@ -1,9 +1,9 @@
#!/bin/ksh
#
# $OpenBSD: gitdaemon.rc,v 1.3 2018/01/11 19:27:02 rpe Exp $
# $OpenBSD: gitdaemon.rc,v 1.4 2019/07/16 09:56:55 stsp Exp $
daemon="${TRUEPREFIX}/bin/git daemon --detach"
daemon_flags="--user=_gitdaemon"
daemon_user="_gitdaemon"
. /etc/rc.d/rc.subr