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=NIIshKXc7kLF7icdhNeUNZE64i/SLGFg076AOZCeCIU=; b=u9LoR34uxnZjUHO5RDSsxFdbtC uw6PPb7xiVP4lhNapJ+3jLIlYH+P3EcUadCrg68l8ddcB3hlPX6gZPD+KXlRbJgtb3FmoFpBBYuBu cDbnSiLF46o4l6ndE9fZrFqZdEOEyTcsE5SPtwaDM14lfD2CAz1favAeMqILIZrv8GqnIOWmVQFUo 2tq2W0OpNtfS/bUNE5xSgbLdBoBvnx4BGeUH3v5bLzVIZ/EkDuD9+12wDZLI5mDh+bAmujqhblq0i rw/xcmZ7B+/vk2K2Ivslb+kpM6gCNtGSpKdtcBQXXoWB/fG3idMDsAvMaPrZXYaTWUX9fd4rM4HIK DFs6KXjA==; Date: Thu, 1 Oct 2020 20:50:03 +0300 From: Arseny Maslennikov To: ALT Linux Team development discussions Message-ID: <20201001175003.GB1037402@cello> References: <47512e07a05fdc1ebf794e304eade1c4c13605fb.1576183643.git.legion@altlinux.org> <20200917131052.GD286846@cello> <20201001172534.ifraykilpepx3fbb@comp-core-i7-2640m-0182e6> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KFztAG8eRSV9hGtP" Content-Disposition: inline In-Reply-To: <20201001172534.ifraykilpepx3fbb@comp-core-i7-2640m-0182e6> OpenPGP: url=http://grep.cs.msu.ru/~ar/pgp-key.asc X-SA-Exim-Connect-IP: 37.204.119.143 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, 01 Oct 2020 17:50:07 -0000 Archived-At: List-Archive: List-Post: --KFztAG8eRSV9hGtP Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 01, 2020 at 07:25:34PM +0200, Alexey Gladkov wrote: > On Thu, Sep 17, 2020 at 04:10:52PM +0300, Arseny Maslennikov wrote: > > 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) $(MAN5= PAGES) $(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)/hash= er-privd > >=20 > > The systemd service is not installed. >=20 > I don't really care about systemd. I'm not an expert in creating services > for it. I hope that someone who can create and test the service. It may be > you :) >=20 I understand. That note was declaring a statement, not blaming you in any way; I can help take care of systemd support. > > > $(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-pr= ivd.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 > >=20 > > 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. > >=20 > > > +Documentation=3Dman:hasher-priv(8) > >=20 > > 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. > >=20 > > > + > > > +[Service] > > > +ExecStart=3D/usr/sbin/hasher-privd > >=20 > > Suggested replacement: > > "ExecStart=3D/usr/sbin/hasher-privd -f" > >=20 > > 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. > >=20 > > > +Restart=3Don-failure > > > + > > > +[Install] > > > +WantedBy=3Dmulti-user.target > > > diff --git a/hasher-priv/hasher-privd.sysvinit b/hasher-priv/hasher-p= rivd.sysvinit > > > 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|co= ndstop|condrestart|condreload}" > > > + RETVAL=3D1 > > > +esac > > > + > > > +exit $RETVAL > > > --=20 > > > 2.24.0 > > >=20 >=20 >=20 >=20 > --=20 > Rgrds, legion >=20 > _______________________________________________ > Devel mailing list > Devel@lists.altlinux.org > https://lists.altlinux.org/mailman/listinfo/devel --KFztAG8eRSV9hGtP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE56JD3UKTLEu/ddrm9dQjyAYL01AFAl92FsYACgkQ9dQjyAYL 01Dx0A/+PAThI/F2oLio62RhGpq2O8IPgrrqsTea+wcHX7211nj35ZFQM+inu4ol q6NbV/PGACPniagNJN1AxbgMjRUH3iYNvPyaEo9yKgcRYc6VGF+qGoQb4x2h6Jns nC2yoXob4/IT+/IAHHwN+pWDDcK+4LsdFUbnwxGtwa6Geg/CfXW4/IdV5l/DBF5N L8p8x/yBMKXAhKaDnQOOIowxPSSokduqHGH431NH/DzolWYeGzvtYgljMsk4l49R 0L00Ib6LKQlQBafPmEiAmUk/aSm3pz8kSdUOCwF98P62GI9h0QjtNszxhAw8gUwa yFwSJENl+CgZ+19JpE4bXs7NI2gpU6nmpPeUQQP4gYbPYQ679uQ8dYr/1B4qnzmp hxqGBx5BGGDqgWOrfzdqNU4i9qMp7P08kvGdVwyEyoTl+9iMZegdt3WN7xorLQU9 u6nloA6I2G7c3pMyyHi9rYPMAtGVew5G3DdHMYGenu8gVEyysnT+FkMjra7mWPw1 dfshlMwNS3RZV3vyMn13x1F8DJOi7c3xFu/ZwlTyVir5yZUwSwf4K5mPqlIwiyg7 tdVW/KXKr4Mx1TxuIBQnNPzuqVtgmM84mkxeT6+U0KFNLRh6RxsQTCm4OX7PPjVk QIS30IEtq+2+sY3S0gM6ipu1tQheI9WZi7oiUl6JsGvsy/fNrAg= =1Poi -----END PGP SIGNATURE----- --KFztAG8eRSV9hGtP--