From owner-freebsd-stable@freebsd.org Tue Nov 19 17:25:36 2019 Return-Path: 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 D6D391B8C39 for ; Tue, 19 Nov 2019 17:25:36 +0000 (UTC) (envelope-from wfc@mintsol.com) Received: from scully.mintsol.com (scully.mintsol.com [199.182.77.206]) by mx1.freebsd.org (Postfix) with ESMTP id 47HXlg5YBYz3F6M for ; Tue, 19 Nov 2019 17:25:35 +0000 (UTC) (envelope-from wfc@mintsol.com) Received: from mintsol.com (officecc.mintsol.com [96.85.114.33]) by scully.mintsol.com with esmtp; Tue, 19 Nov 2019 12:25:29 -0500 id 00A498C1.000000005DD42589.0001500A Received: from localhost (localhost [127.0.0.1]) (IDENT: uid 1002) by mintsol.com with esmtp; Tue, 19 Nov 2019 12:25:29 -0500 id 000008C6.5DD42589.00010A2D Date: Tue, 19 Nov 2019 12:25:29 -0500 (EST) From: Walter Cramer To: mike tancsa cc: Christos Chatzaras , freebsd-stable Subject: Re: jexec as user? In-Reply-To: Message-ID: <20191119120818.M60603@mulder.mintsol.com> References: <1237616943.9.1574163726832@localhost> MIME-Version: 1.0 X-Rspamd-Queue-Id: 47HXlg5YBYz3F6M X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of wfc@mintsol.com designates 199.182.77.206 as permitted sender) smtp.mailfrom=wfc@mintsol.com X-Spamd-Result: default: False [-2.50 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+a:scully.mintsol.com]; NEURAL_HAM_LONG(-0.99)[-0.991,0]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[mintsol.com]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; CTYPE_MIXED_BOGUS(1.00)[]; IP_SCORE(-2.31)[ip: (-6.05), ipnet: 199.182.77.0/24(-3.03), asn: 22768(-2.42), country: US(-0.05)]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:22768, ipnet:199.182.77.0/24, country:US]; MIME_TRACE(0.00)[0:+,1:+] Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 17:25:36 -0000 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 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: 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 ; 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 ; 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 , freebsd-stable References: <1237616943.9.1574163726832@localhost> Cc: Ronald Klop 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 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