From owner-freebsd-ports@freebsd.org Mon Apr 26 11:46:20 2021 Return-Path: Delivered-To: freebsd-ports@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C2A45FC8BC for ; Mon, 26 Apr 2021 11:46:20 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FTNQM0tBXz3HL1 for ; Mon, 26 Apr 2021 11:46:18 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: by mail-lj1-f179.google.com with SMTP id m7so52851695ljp.10 for ; Mon, 26 Apr 2021 04:46:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=azMwT49tfkLIJgczAdgyrh97dgq/7vWIL6llbIfMMzw=; b=lG0QE8/i46MnmAAK7qniPomsEXZ0A7Vbi1aqbT75SSPbX3Q1c5r1jeQXiohNc5Q/vU c2s4/gaQ0zfabXsqtBZv/D5jcQsvGDMkkpg8LhM14IU2M373t+4WEgBwM/d6k7mOpBo2 LQvPGle8tPCUMrBnSz4D4mE08yTgYYz8udkcG2QRVxDbqrsdPR3OYf9johcy1KvHiV93 7P3o8f60+TIYnIj8QJFX3WHmxYgT/4PTG0Ihcn77QP2Rgi2qBa++GpiUG0IZ7dobPOIc S0LXP3gnFzeTX3pnN8Oayv2BY8zzvCu/PWRtyWsMW120XiNp+3FloLs64cgshy9RXZ3D An6g== X-Gm-Message-State: AOAM530L7q6nAw6YvlkZNCjDu9C+11p3XqUT93iwGW1Zs3bFjDTLnrng Ald3QC9GRaBjTog/6Id4r2IphqtlnKjwag== X-Google-Smtp-Source: ABdhPJy8WQpSpLQqbPXaZlB/MEoubvxce/lfsjQQ3kW3zb0pbGTULmYl7Z58RfpBzRPpZbKJn4R7wQ== X-Received: by 2002:a2e:751d:: with SMTP id q29mr12445562ljc.198.1619437577351; Mon, 26 Apr 2021 04:46:17 -0700 (PDT) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id u21sm1392806lfc.68.2021.04.26.04.46.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Apr 2021 04:46:17 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id a5so26707490ljk.0 for ; Mon, 26 Apr 2021 04:46:16 -0700 (PDT) X-Received: by 2002:a05:651c:205:: with SMTP id y5mr12585533ljn.301.1619437576865; Mon, 26 Apr 2021 04:46:16 -0700 (PDT) MIME-Version: 1.0 References: <5A7F1B5C-4382-450C-9674-C9F4866E632E@lassitu.de> In-Reply-To: <5A7F1B5C-4382-450C-9674-C9F4866E632E@lassitu.de> From: Gleb Popov Date: Mon, 26 Apr 2021 14:45:51 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Changing daemon user, dir ownership and updating packages To: Stefan Bethke Cc: FreeBSD Ports X-Rspamd-Queue-Id: 4FTNQM0tBXz3HL1 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of 6yearold@gmail.com designates 209.85.208.179 as permitted sender) smtp.mailfrom=6yearold@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; FORGED_SENDER(0.30)[arrowd@freebsd.org,6yearold@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.208.179:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[arrowd@freebsd.org,6yearold@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; R_DKIM_NA(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ports@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.208.179:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.179:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.179:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-ports] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Apr 2021 11:46:20 -0000 On Mon, Apr 26, 2021 at 11:03 AM Stefan Bethke wrote: > Am 13.04.2021 um 10:24 schrieb Stefan Bethke : > > > > As the maintainer, I've received this bug report: > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255009 > > > > If you'd like to run the daemon under a user different from the default > git, you also need to change the ownership of the working directories, > especially /var/*/gitea. > > > > The expectation is that upgrading the package will not change the > ownership of already existing directories. When installing a newer version > of the package, pkg appears to reset the ownership to those specified in > the package. > > > > The pkg-plist has this: > > @owner git > > @group git > > @dir /var/db/gitea > > @dir /var/log/gitea > > @dir /var/run/gitea > > > > I believe this to be best practice. Is there a better way to have pkg > create these dirs if they're missing, but not touch them if they are there > already? > > Adam has suggested a couple of approaches, but what I would really like is > a common, documented way for ports to handle this situation. > > Updating ownership and mode of entries in the rc script automatically > feels wrong to me, especially if it's a custom one-off for a single port. > Kinda creating a POLA violation. > > I think as a general approach, checking that directories and files that > the port knows will need to be writable for compatible access rights might > be the safe choice. > > But that still leaves pkg updating the ownership/mode of existing > directories as a surprise on updating a package. I think the "right" thing > here would be a kind of three-way merge between changes an updated package > brings in vs. changes the user has made on their system. That sound > complicated to get right. > > > Stefan > > -- > Stefan Bethke Fon +49 151 14070811 > I believe the general approach is what is called tmpfiles.d in systemd. It is a startup script that reads configuration files installed by 3rd-party software and creates file system hierarchies according to them. This is an example of such configuration file: https://github.com/Xpra-org/xpra/blob/master/fs/lib/tmpfiles.d/xpra.conf Maybe we need to grow our own implementation of tmpfiles.d.