From owner-freebsd-stable@FreeBSD.ORG Tue Oct 8 13:11:45 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8CC05B29 for ; Tue, 8 Oct 2013 13:11:45 +0000 (UTC) (envelope-from kraduk@gmail.com) Received: from mail-qe0-x232.google.com (mail-qe0-x232.google.com [IPv6:2607:f8b0:400d:c02::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4D3CF2269 for ; Tue, 8 Oct 2013 13:11:45 +0000 (UTC) Received: by mail-qe0-f50.google.com with SMTP id a11so6538083qen.23 for ; Tue, 08 Oct 2013 06:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rIeFw8hA5203g8Ab+SjBj/7Pwzk4uodeU9OKeN+MM1E=; b=vrghfo+af0XQitPqPV2gSRg7EUYqfxP8wTVCB2R6yM1F0l93CeWOLg9i/qHneppq/n zKNh+NDwKd4e+4IPEvXPlGA2bZi2+YDc4lJ7sSjYa+7kMKZEqimGl877d+cxGi/5/tt1 QiRXvtnKcbXb3gog4IrMUrxlPB2e5ZpbXnOi1NC1W11mfPlQe5vS0Yj0yE1r+a7hnChP Gn8RS0kZA/liDfGV4zMllxMBdawk30rc20zFwFsaH/j9RDQXPyDXhJd3M8H5TM0lygYY CdFRgfdicLu0SsZfbtr2/Mm2jXk0pdrI7pg+2PPXBWNys9t1wWFbujjAenOWDZwUTlDa l48Q== MIME-Version: 1.0 X-Received: by 10.224.120.6 with SMTP id b6mr3653620qar.11.1381237904432; Tue, 08 Oct 2013 06:11:44 -0700 (PDT) Received: by 10.224.55.77 with HTTP; Tue, 8 Oct 2013 06:11:44 -0700 (PDT) In-Reply-To: References: <58E65D87-C41C-4777-9EAA-005CE3506B6A@mac.com> Date: Tue, 8 Oct 2013 14:11:44 +0100 Message-ID: Subject: Re: Running a script via PHP From: krad To: Ronald Klop Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-stable X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 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, 08 Oct 2013 13:11:45 -0000 and just to be safe wrap it all up in a VIMAGE jail On 1 October 2013 14:39, Ronald Klop wrote: > On Fri, 27 Sep 2013 23:50:02 +0200, Charles Swiger > wrote: > > Hi-- >> >> On Sep 27, 2013, at 2:18 AM, Michael BlackHeart >> wrote: >> >>> Hello there, >>> It's quite off-topic, but I'm using freebsd-stable,so >>> >>> The priblem is - running a script that requires root privileges via PHP >>> (or >>> probably CGI - I do not care, just want it to be secure and working). >>> >> >> Unfortunately the combination of PHP, doing something which needs root, >> and >> security are inherently contradictory. >> >> The least risky approach would be to invoke the needed command via sudo, >> or >> possibly a small setuid-root C wrapper program which launches only the >> needed script >> with root permissions. Use sudo unless your C wrapper is careful enough >> to use >> exec() and not system(), sanitizes $PATH and other env variables, and >> guards against >> games with $IFS, shell metachars, and such. >> >> Regards, >> > > Use sudo, because your home grown C wrapper will make all the mistakes > which are already solved in sudo. Or will be spotted in the future in sudo > and will never be spotted in your program. > Chances are high that future requirements of your C wrapper will turn it > in a little sudo. > > Ronald. > > ______________________________**_________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/**mailman/listinfo/freebsd-**stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@**freebsd.org > " >