From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2923720964; Wed, 5 Apr 2017 03:44:45 +0000 (UTC) Date: Wed, 5 Apr 2017 03:44:44 +0000 From: Eric Wong To: Jeremy Evans Cc: unicorn-public@bogomips.org Subject: Re: Patch: Add support for chroot to Worker#user V2 Message-ID: <20170405034444.GA7010@starla> References: <20170223184605.GA67612@jeremyevans.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170223184605.GA67612@jeremyevans.local> List-Id: Jeremy Evans wrote: > @@ -134,6 +136,11 @@ def user(user, group = nil) > Process.initgroups(user, gid) > Process::GID.change_privilege(gid) > end > + if chroot > + chroot = Dir.pwd if chroot == true > + Dir.chroot(chroot) > + Dir.chdir('/') > + end By the way, I noticed in configurator.rb (for working_directory), we also update ENV['PWD'] after chdir. Perhaps we should do so, here? For working_directory, I preserved ENV['PWD'] in case Dir.pwd wasn't aware of symlinks; or there's code which relies on env['PWD'] without caring for making the syscalls required for Dir.pwd... I'm not sure how much it matters in practice...