NetBSD Problem Report #55765
From kimmo@suominen.org Thu Oct 29 07:26:14 2020
Return-Path: <kimmo@suominen.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 14FC11A9239
for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Oct 2020 07:26:14 +0000 (UTC)
Message-Id: <20201029072608.D90A11B737@equinoxe.x.gw.fi>
Date: Thu, 29 Oct 2020 09:26:08 +0200 (EET)
From: kim@netbsd.org (Kimmo Suominen)
To: gnats-bugs@NetBSD.org
Subject: make security/priv work with per_user_tmp=YES
X-Send-Pr-Version: 3.95
>Number: 55765
>Category: pkg
>Synopsis: make security/priv work with per_user_tmp=YES
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kim
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 29 07:30:00 +0000 2020
>Closed-Date: Tue Feb 16 09:48:14 +0000 2021
>Last-Modified: Tue Feb 16 09:48:14 +0000 2021
>Originator: Kimmo Suominen
>Release: NetBSD 9.1
>Organization:
>Environment:
System: NetBSD equinoxe.x.gw.fi 9.1 NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
Using security/priv to run commands as another user on a
system with per_user_tmp=YES is not practical, because
after switching to another user /tmp no longer exists. This
is because the /private/tmp/@ruid target is created by
setusercontext(3), and security/priv does not call it (using
setuid(2)/setgid(2)/initgroups(3) instead).
>How-To-Repeat:
% su -m
# pkg_add priv
# echo 0:root:0000000: > /usr/pkg/etc/priv/${USER}
# rm -rf /private/tmp/0
Alternatively reboot the system, which would be the common cause
for /private/tmp/0 no longer existing.
% priv vipw
ex/vi: Error: Log file: No such file or directory
vipw: /usr/bin/vi: Undefined error: 0
vipw: /etc/master.passwd: unchanged
[The error from vi is also not as helpful as it could be.]
>Fix:
Proposed patch:
https://www.netbsd.org/~kim/priv-setusercontext.diff
Workaround: Only authorize users using the F_SU flag in the priv
configuration files. This requires creating the corresponding
"su-target" or "sutarget" links as well.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->simonb
Responsible-Changed-By: hauke@NetBSD.org
Responsible-Changed-When: Thu, 29 Oct 2020 19:29:20 +0000
Responsible-Changed-Why:
Over to maintainer.
From: "Kimmo Suominen" <kim@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55765 CVS commit: pkgsrc/security/priv
Date: Tue, 16 Feb 2021 09:42:06 +0000
Module Name: pkgsrc
Committed By: kim
Date: Tue Feb 16 09:42:06 UTC 2021
Modified Files:
pkgsrc/security/priv: Makefile distinfo
pkgsrc/security/priv/patches: patch-priv.c
Added Files:
pkgsrc/security/priv/patches: patch-Makefile.in patch-configure.in
patch-priv.h
Removed Files:
pkgsrc/security/priv/patches: patch-aa patch-ab
Log Message:
Use setusercontext(3)
Using setusercontext(3) makes per-user tmp work. Fixes PR 55765.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 pkgsrc/security/priv/Makefile
cvs rdiff -u -r1.9 -r1.10 pkgsrc/security/priv/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/security/priv/patches/patch-Makefile.in \
pkgsrc/security/priv/patches/patch-configure.in \
pkgsrc/security/priv/patches/patch-priv.h
cvs rdiff -u -r1.3 -r0 pkgsrc/security/priv/patches/patch-aa
cvs rdiff -u -r1.1 -r0 pkgsrc/security/priv/patches/patch-ab
cvs rdiff -u -r1.1 -r1.2 pkgsrc/security/priv/patches/patch-priv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: simonb->kim
Responsible-Changed-By: kim@NetBSD.org
Responsible-Changed-When: Tue, 16 Feb 2021 09:48:14 +0000
Responsible-Changed-Why:
I committed the fix to pkgsrc.
State-Changed-From-To: open->closed
State-Changed-By: kim@NetBSD.org
State-Changed-When: Tue, 16 Feb 2021 09:48:14 +0000
State-Changed-Why:
I committed the fix to pkgsrc. Ok by simonb@ and phone@.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.