Date: Tue, 19 Nov 2019 12:25:29 -0500 (EST) From: Walter Cramer <wfc@mintsol.com> To: mike tancsa <mike@sentex.net> Cc: Christos Chatzaras <chris@cretaforce.gr>, freebsd-stable <freebsd-stable@freebsd.org> Subject: Re: jexec as user? Message-ID: <20191119120818.M60603@mulder.mintsol.com> In-Reply-To: <f78012e9-9de9-8c47-111b-383ce6773ac9@sentex.net> References: <1237616943.9.1574163726832@localhost> <a572c2ec-52b6-0999-9106-75051cfc9821@sentex.net> <F75AA78E-EC55-49F8-9CEA-AB6C6F0BD742@cretaforce.gr> <f78012e9-9de9-8c47-111b-383ce6773ac9@sentex.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 19 Nov 2019, mike tancsa wrote: > On 11/19/2019 8:09 AM, Christos Chatzaras wrote: > On 19 Nov 2019, at 15:02, mike tancsa <mike@sentex.net> wrote: >> On 11/19/2019 6:42 AM, Ronald Klop wrote: >>> Hi, >>> >>> Is it possible to jexec into a jail as a regular user. Or to enable >>> that somewhere? >>> Or is the way to do such a thing to set up ssh in the jail? >>> >> On 11.3 at least, does not the built in functionality of jexec do what >> you need ? >> >> jexec [-l] [-u username | -U username] jail [command ...] >> >> # jexec -U testuser 3 csh >> testuser@cacticonsole:/ % id >> uid=3D1005(testuser) gid=3D1005(testuser) groups=3D1005(testuser) >> testuser@cacticonsole:/ % >> > I think he wants to use jexec as a normal user from the main OS. > > If he wants to run jexec as root and login to jail as user then your comm= and works. Ahhh, my mistake.=C2=A0 =C2=A0 A sudo entry then ? =C2=A0=C2=A0=C2=A0 ---Mike At least on older FreeBSD versions, it's easy to wrap `jexec` in a few=20 lines (literally a half-dozen) of C code, suid after compiling, and have=20 users in the host environment jump into jails with it. (I haven't set=20 this up in a while, to know if there are issues with 11.X or 12.X.) OTOH, there is a bitter-regret-filled gap between knowing enough to do=20 that, and knowing enough to securely write and deploy suid-root programs. -Walter _______________________________________________ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" From owner-freebsd-stable@freebsd.org Tue Nov 19 19:31:27 2019 Return-Path: <owner-freebsd-stable@freebsd.org> Delivered-To: freebsd-stable@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 D97C41BBE20 for <freebsd-stable@mailman.nyi.freebsd.org>; Tue, 19 Nov 2019 19:31:27 +0000 (UTC) (envelope-from SRS0=ydOD=ZL=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47HbXt4HZvz3M3f for <freebsd-stable@freebsd.org>; Tue, 19 Nov 2019 19:31:26 +0000 (UTC) (envelope-from SRS0=ydOD=ZL=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 149BC28411; Tue, 19 Nov 2019 20:31:22 +0100 (CET) Received: from illbsd.quip.test (ip-62-24-92-232.net.upcbroadband.cz [62.24.92.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id A71F32840C; Tue, 19 Nov 2019 20:31:20 +0100 (CET) Subject: Re: jexec as user? To: Christos Chatzaras <chris@cretaforce.gr>, freebsd-stable <freebsd-stable@freebsd.org> References: <1237616943.9.1574163726832@localhost> <a572c2ec-52b6-0999-9106-75051cfc9821@sentex.net> <F75AA78E-EC55-49F8-9CEA-AB6C6F0BD742@cretaforce.gr> Cc: Ronald Klop <ronald-lists@klop.ws> From: Miroslav Lachman <000.fbsd@quip.cz> Message-ID: <06464ab7-abc4-9ee4-a27e-9e4591eebc83@quip.cz> Date: Tue, 19 Nov 2019 20:31:20 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3 MIME-Version: 1.0 In-Reply-To: <F75AA78E-EC55-49F8-9CEA-AB6C6F0BD742@cretaforce.gr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47HbXt4HZvz3M3f X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of SRS0=ydOD=ZL=quip.cz=000.fbsd@elsa.codelab.cz has no SPF policy when checking 94.124.105.4) smtp.mailfrom=SRS0=ydOD=ZL=quip.cz=000.fbsd@elsa.codelab.cz X-Spamd-Result: default: False [5.07 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; IP_SCORE(0.89)[ip: (0.41), ipnet: 94.124.104.0/21(0.20), asn: 42000(3.76), country: CZ(0.09)]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[quip.cz]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.98)[0.984,0]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_SPAM_LONG(1.00)[0.996,0]; RCVD_IN_DNSWL_NONE(0.00)[4.105.124.94.list.dnswl.org : 127.0.10.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=ydOD=ZL=quip.cz=000.fbsd@elsa.codelab.cz]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; SUBJECT_ENDS_QUESTION(1.00)[]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz, SRS0=ydOD=ZL=quip.cz=000.fbsd@elsa.codelab.cz] X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Production branch of FreeBSD source code <freebsd-stable.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-stable>, <mailto:freebsd-stable-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-stable/>; List-Post: <mailto:freebsd-stable@freebsd.org> List-Help: <mailto:freebsd-stable-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-stable>, <mailto:freebsd-stable-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 19 Nov 2019 19:31:27 -0000 Christos Chatzaras wrote on 2019/11/19 14:09: > > >> On 19 Nov 2019, at 15:02, mike tancsa <mike@sentex.net> wrote: >> >> On 11/19/2019 6:42 AM, Ronald Klop wrote: >>> Hi, >>> >>> Is it possible to jexec into a jail as a regular user. Or to enable >>> that somewhere? >>> Or is the way to do such a thing to set up ssh in the jail? >>> >> On 11.3 at least, does not the built in functionality of jexec do what >> you need ? >> >> jexec [-l] [-u username | -U username] jail [command ...] >> >> # jexec -U testuser 3 csh >> testuser@cacticonsole:/ % id >> uid=1005(testuser) gid=1005(testuser) groups=1005(testuser) >> testuser@cacticonsole:/ % >> > > I think he wants to use jexec as a normal user from the main OS. > > If he wants to run jexec as root and login to jail as user then your command works. If you want to use jexec as normal user in host, look at sysutils/jailme from ports: https://www.freshports.org/sysutils/jailme/ This version is installed setuid and does some sanity checking to ensure the username and UID match between the jail and the host system. WWW: https://github.com/Intermedix/jailme Miroslav Lachman PS: I never used jailme personally
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191119120818.M60603>