From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=altlinux.org; s=dkim; h=Subject:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=vnw4jNY1swzzYi/maNpAmkh+AqWQ7sNZjKKMKVauZKY=; b=nac+JiAPDD/L5Qyy1ShUb2BEUW kivZktDaJJVed+h6C18ThXc6ltEzIJs3/vpCMlEmuVn2G+9AC3RobY37dEoRhesjWIqMyBJewgIlh dpO8+2+gQI4f2pfTziyXgQ1hNIlZWlphzVprtR5y3GY1Vh8hIirs03/cZKwgeaoCsuT07RPM79wml BJ30ofVLfhhxrEnzDkCFmfFBMxtD5n02SLj6zfrXWz08pvAYrgCjgF9LHBb5+jY1iEDSRQR0CjifT WUNas/WP4slytXynQjBnT3J4bgIj+geAvGxdPIyUpqKtRKf0CdPdjmB3IFuuKmRhg2jCo82HLd23x IPApT9yw==; Date: Thu, 17 Sep 2020 16:10:52 +0300 From: Arseny Maslennikov To: Alex Gladkov , ALT Linux Team development discussions Message-ID: <20200917131052.GD286846@cello> References: <47512e07a05fdc1ebf794e304eade1c4c13605fb.1576183643.git.legion@altlinux.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GyRA7555PLgSTuth" Content-Disposition: inline In-Reply-To: <47512e07a05fdc1ebf794e304eade1c4c13605fb.1576183643.git.legion@altlinux.org> OpenPGP: url=http://grep.cs.msu.ru/~ar/pgp-key.asc X-SA-Exim-Connect-IP: 10.7.5.179 X-SA-Exim-Mail-From: arseny@altlinux.org X-SA-Exim-Version: 4.2.1 X-SA-Exim-Scanned: Yes (on mail.cs.msu.ru) Cc: ldv@altlinux.org Subject: Re: [devel] [PATCH hasher-priv v1 2/3] Add systemd and sysvinit service files X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2020 13:10:55 -0000 Archived-At: List-Archive: List-Post: --GyRA7555PLgSTuth Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 13, 2019 at 12:42:04PM +0100, Alex Gladkov wrote: > From: Alexey Gladkov >=20 > Signed-off-by: Alexey Gladkov > --- > hasher-priv/Makefile | 4 ++ > hasher-priv/hasher-privd.service | 11 ++++ > hasher-priv/hasher-privd.sysvinit | 86 +++++++++++++++++++++++++++++++ > 3 files changed, 101 insertions(+) > create mode 100644 hasher-priv/hasher-privd.service > create mode 100755 hasher-priv/hasher-privd.sysvinit >=20 > diff --git a/hasher-priv/Makefile b/hasher-priv/Makefile > index 82aa385..c73216f 100644 > --- a/hasher-priv/Makefile > +++ b/hasher-priv/Makefile > @@ -14,6 +14,8 @@ MAN8PAGES =3D $(PROJECT).8 hasher-useradd.8 > TARGETS =3D $(PROJECT) hasher-privd hasher-useradd $(HELPERS) $(MAN5PAGE= S) $(MAN8PAGES) > =20 > sysconfdir =3D /etc > +initdir=3D$(sysconfdir)/rc.d/init.d > +systemd_unitdir=3D/lib/systemd/system > libexecdir =3D /usr/lib > sbindir =3D /usr/sbin > mandir =3D /usr/share/man > @@ -72,6 +74,8 @@ install: all > $(MKDIR_P) -m750 $(DESTDIR)$(helperdir) > $(INSTALL) -p -m700 $(PROJECT) $(DESTDIR)$(helperdir)/ > $(INSTALL) -p -m755 $(HELPERS) $(DESTDIR)$(helperdir)/ > + $(MKDIR_P) -m755 $(DESTDIR)$(initdir) > + $(INSTALL) -p -m755 hasher-privd.sysvinit $(DESTDIR)$(initdir)/hasher-p= rivd The systemd service is not installed. > $(MKDIR_P) -m755 $(DESTDIR)$(sbindir) > $(INSTALL) -p -m755 hasher-privd $(DESTDIR)$(sbindir)/ > $(INSTALL) -p -m755 hasher-useradd $(DESTDIR)$(sbindir)/ > diff --git a/hasher-priv/hasher-privd.service b/hasher-priv/hasher-privd.= service > new file mode 100644 > index 0000000..e5ed9ac > --- /dev/null > +++ b/hasher-priv/hasher-privd.service > @@ -0,0 +1,11 @@ > +[Unit] > +Description=3DA privileged helper for the hasher project > +ConditionVirtualization=3D!container In response to earlier reviewers: hasher-priv as of today does not work inside a userns-unprivileged container and does not produce clear diagnostics (and, from my own experience when I was joining ALT, the developers did not as well). Thus, for now this condition is justified. Perhaps in the future, when (and if) we introduce the ability to reuse a mainstream container runtime as the hasher environment for users R and B, it would make sense for us to lift this condition. > +Documentation=3Dman:hasher-priv(8) Ah yes, I forgot. The patchset contains no changes to the man pages, so the effort and behaviour change is not reflected. I agree it's best to revisit them once we're done with the code, though. > + > +[Service] > +ExecStart=3D/usr/sbin/hasher-privd Suggested replacement: "ExecStart=3D/usr/sbin/hasher-privd -f" The service implicitly, by default, has Type=3Dsimple, which means the following: - the main process(-es) is defined by the ExecStart=3D command line(-s) and is intended to persist while the service is launched and active; - its pid/tgid is tracked by the service manager and can be queried; - the service manager puts it into its own cgroup; - its standard output and standard error are redirected to system log; - (follows from the above) the main process never has a controlling terminal or standard file descriptors pointing to any terminal, its sid is equal to its tgid =E2=80=94 and so it does not have to perform manual steps to daemonize. > +Restart=3Don-failure > + > +[Install] > +WantedBy=3Dmulti-user.target > diff --git a/hasher-priv/hasher-privd.sysvinit b/hasher-priv/hasher-privd= =2Esysvinit > new file mode 100755 > index 0000000..914fb53 > --- /dev/null > +++ b/hasher-priv/hasher-privd.sysvinit > @@ -0,0 +1,86 @@ > +#! /bin/sh > + > +### BEGIN INIT INFO > +# Short-Description: A privileged helper for the hasher project > +# Description: A privileged helper for the hasher project > +# Provides: hasher-priv > +# Required-Start: $remote_fs > +# Required-Stop: $remote_fs > +# Default-Start: 2 3 4 5 > +# Default-Stop: 0 1 6 > +### END INIT INFO > + > +WITHOUT_RC_COMPAT=3D1 > + > +# Source function library. > +. /etc/init.d/functions > + > +NAME=3Dhasher-privd > +PIDFILE=3D"/var/run/$NAME.pid" > +LOCKFILE=3D"/var/lock/subsys/$NAME" > +RETVAL=3D0 > + > +start() > +{ > + start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" -- "$NAME" > + RETVAL=3D$? > + return $RETVAL > +} > + > +stop() > +{ > + stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" "$NAME" > + RETVAL=3D$? > + return $RETVAL > +} > + > +restart() > +{ > + stop > + start > +} > + > +# See how we were called. > +case "$1" in > + start) > + start > + ;; > + stop) > + stop > + ;; > + status) > + status --pidfile "$PIDFILE" "$NAME" > + RETVAL=3D$? > + ;; > + restart) > + restart > + ;; > + reload) > + restart > + ;; > + condstart) > + if [ ! -e "$LOCKFILE" ]; then > + start > + fi > + ;; > + condstop) > + if [ -e "$LOCKFILE" ]; then > + stop > + fi > + ;; > + condrestart) > + if [ -e "$LOCKFILE" ]; then > + restart > + fi > + ;; > + condreload) > + if [ -e "$LOCKFILE" ]; then > + reload > + fi > + ;; > + *) > + msg_usage "${0##*/} {start|stop|status|restart|reload|condstart|condst= op|condrestart|condreload}" > + RETVAL=3D1 > +esac > + > +exit $RETVAL > --=20 > 2.24.0 >=20 --GyRA7555PLgSTuth Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE56JD3UKTLEu/ddrm9dQjyAYL01AFAl9jYFwACgkQ9dQjyAYL 01CvnRAAz10EiJyOhEhRWYSaz1R73nJOX8lj0t+4LULDef3B9tzKYW8j/KMiKelP Z+XhwyYYT4uUmAYoEjoBxDnPvsxPZPvIQZAcZSVwAqISNYB6H1bet6tTThXehGde v+gSupFHR2/1QxSVwuxfyjcgd2N7VITjABED6trPD3NV08/QpRQoKUaqUfD6H280 HOQJ7Ut3O+XyiefZwCoorIec8Wu3ZV3u4grzmhF0PlY6CDRpNGB+y5Ey48WXZV8N qo601ZyqKRP3kauRRJmDG2OGJgSyiuDy5vA37dF1gCUAoVXFSFeeiXZhpPwEMRNZ NW1Ltc1qwF3Al956XYNZOUagBMJv5gNZZs4aQhVJozsbTY0FiBprYcRQAReU4aSy okIAZieDxQacFTjzxAFSslyBR2J8/jwnDIO29/E6s88zISsS3If7TR+sJ9/k/95A GfKzY4OKNUV69HsyLm4sKoWqLhddBIyj5A8jngzapyR8sMKVM6veLKuP0mcrowl5 1C02FEazfErEEiVftXurWszcaxNgPDbr6EuakRITWWhgQe+77NnOsQQHlGBh3RtR qkoQPRuJIkQThBRdRmhYXlkykul0cwFv6yfM8nqmSuEtHko4s8l7oM10m/oymDtQ lJ1qC4x/gr052/lRFPpsVPdXjPfOL1dV63NAZlcVURvEvYJRqDo= =w8M+ -----END PGP SIGNATURE----- --GyRA7555PLgSTuth--