From owner-freebsd-hackers@freebsd.org Mon Jun 26 07:33:09 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED143DA381F for ; Mon, 26 Jun 2017 07:33:09 +0000 (UTC) (envelope-from ap00@mail.ru) Received: from fallback.mail.ru (fallback10.m.smailru.net [94.100.178.50]) (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 9C21B6ACA7 for ; Mon, 26 Jun 2017 07:33:09 +0000 (UTC) (envelope-from ap00@mail.ru) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Subject:CC:To:Message-ID:From:Date; bh=9stAolLcjxM9N2ujpGec8qrhu8/R7hf3hbYGXYpV2Bs=; b=J1fnBxvM0J36KX2To6M9hpHdsA8nxOWQl1eYp3cC3/GNbyU71Qwjhrx/QH8cSUJrAPIumrYEKDr18E/mN9IyNleEug8yDT4zJSQGqnypFJHQXeb5K1JZuDL6J3ts3O+bKAF+njmnTRMw2ENoIzBqXoMFZgR5Putq+6i8WAk9d/c=; Received: from [10.161.64.53] (port=43830 helo=smtp45.i.mail.ru) by fallback10.m.smailru.net with esmtp (envelope-from ) id 1dPOW3-0002Sm-Lv for freebsd-hackers@freebsd.org; Mon, 26 Jun 2017 10:32:59 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Subject:CC:To:Message-ID:From:Date; bh=9stAolLcjxM9N2ujpGec8qrhu8/R7hf3hbYGXYpV2Bs=; b=J1fnBxvM0J36KX2To6M9hpHdsA8nxOWQl1eYp3cC3/GNbyU71Qwjhrx/QH8cSUJrAPIumrYEKDr18E/mN9IyNleEug8yDT4zJSQGqnypFJHQXeb5K1JZuDL6J3ts3O+bKAF+njmnTRMw2ENoIzBqXoMFZgR5Putq+6i8WAk9d/c=; Received: from [91.190.121.202] (port=51447 helo=pstation) by smtp45.i.mail.ru with esmtpa (envelope-from ) id 1dPOVu-0008Pz-F3; Mon, 26 Jun 2017 10:32:50 +0300 Date: Mon, 26 Jun 2017 10:32:48 +0300 From: Anthony Pankov X-Priority: 3 (Normal) Message-ID: <18210175522.20170626103248@mail.ru> To: Adrian Chadd CC: "freebsd-hackers@freebsd.org" Subject: Re: using rc.subr only by root restriction In-Reply-To: References: <1599987034.20170623182536@mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-7FA49CB5: 0D63561A33F958A5AAE05B6E071A5D117F4BB36BF72BC175CC6B8FF7CF8174AB725E5C173C3A84C3727597FF642BA4D7256FB4D121764FE54E672349037D5FA5C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F8DB212830C5B42F72623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-Mailru-Sender: D8D48EF70163D79D00784CDFC8FD3107552760D774ED4673E56A22638F06347337A118895F133E2350D5CF8590B94F4EC77752E0C033A69E81198BD1A48777B793AC9912533B2342AE208404248635DF X-Mras: OK X-7FA49CB5: 0D63561A33F958A59659FFADB9A45DFAB610131013E1ADDECFDE9DE105D7132C462275124DF8B9C920A5816FF58DF6CF574AF45C6390F7469DAA53EE0834AAEE X-Mailru-Sender: A5480F10D64C900521F65ACE11A97E3D6F92290C323249C20F9E20292745FFF1044891705FD94CA8B26AAFE52D544DF9D50E20E2BC48EF5AA99AB44EAB91793CEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: OK X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jun 2017 07:33:10 -0000 Hello, > this was my fault. :) Did you mean that you've commited a patch which change the behavior? > There are some limits that you can set as a user. > I think this is a fine change; but I can't speak for the correctness > of using rc.subr as a general library set for your own purposes. :0 At this time I don't think that my patch is a best solutions. First of all I don't see any explanation of ${name}_login_class in rc.subr(8). Silently applying 'daemon' login class to all services seems to be very surprising. I think there are people who modified 'daemon' login class and get a weird result in their system. I know how complex to investigate such things. May be we can agree at "explicit is better than implicit" principle and do not apply a login class when ${name}_login_class is not declared explicity? It will solve my problem too. > On 23 June 2017 at 08:25, Anthony Pankov via freebsd-hackers > wrote: >> Greetings >> >> I was deploying my new system based on FreeBSD 11 and got =D1=84 >> surprise. >> I have specific subsystem which use own startup scripts tied to rc.subr >> for better integration. Those scripts can be used not only by sys= tem startup but also by >> unpriveleged user. >> With FreeBSD 11 in case of unpriveleged user the error appear: "limit= s: >> setrlimit datasize: Operation not permitted" >> >> There is a thread on a forum about the issue: https://forums.freebsd.org= /threads/58304/ >> >> I've never seen a warning to do not use rc.subr in regular scripts so= I >> made it this way. >> >> May be we can consider to patch rc.subr and remove this >> restriction? >> >> >> >> P.S. This patch helps, but may be there is a better way. >> --- /etc/rc.subr.old 2017-06-21 07:11:39.716210000 +0300 >> +++ /etc/rc.subr 2017-06-21 07:18:21.215444000 +0300 >> @@ -1072,7 +1072,9 @@ >> fi >> >> # Prepend default limits >> - _doit=3D"limits -C $_login_class $_doit" >> + if [ `id -u` -eq 0 ]; then >> + _doit=3D"limits -C $_login_class $_doit" >> + fi >> >> # run the full command >> # >> >> >> -- >> >> Anthony Pankov mailto:ap00@mail.ru >>