[Bug 269198] dns/blocky: running daemon as non-root user is not supported

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 28 Jan 2023 08:28:03 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269198

            Bug ID: 269198
           Summary: dns/blocky: running daemon as non-root user is not
                    supported
           Product: Ports & Packages
           Version: Latest
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: eduardo@FreeBSD.org
          Reporter: bspiegel100@gmail.com
          Assignee: eduardo@FreeBSD.org
             Flags: maintainer-feedback?(eduardo@FreeBSD.org)

Created attachment 239759
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=239759&action=edit
Patch with improved rc.d script

Most rc.d scripts support a standard <service name>_user option in /etc/rc.conf
to run the service as the specified user. The rc.d script for dns/blocky
doesn't observe this setting. As a result, it's not possible to run as a user
other than root (blocky documentation recommends using a non-privileged user).

Please see the attached patch for an updated rc script that supports this
option. Thanks for considering!


Steps to Reproduce:

Install dns/blocky, add the following to /etc/rc.conf and run service blocky
start.

    blocky_user="<any user other than root>"
    blocky_enable="YES"


Actual Behavior:

The blocky daemon runs as root regardless of what's in /etc/rc.conf. Tested on
14.0-CURRENT and 13.1-RELEASE with blocky version 0.20_2 (from ports) and
0.20_1 (package).


Expected Behavior:

The blocky daemon should run as the specified user.


Proposed Solution:

The current rc.d script overrides the built-in start_cmd function (which checks
for standard options like <name>_user and <name>_chroot). The replacement
function doesn't check these options.

The patch instead defines the command in $command and $command_args vars, adds
handling for file permissions to support non-root users, and does a few minor
touch-ups.

-- 
You are receiving this mail because:
You are the assignee for the bug.