Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 90699 invoked from network); 28 Jul 2005 11:34:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Jul 2005 11:34:07 -0000 Received: (qmail 6324 invoked by uid 500); 28 Jul 2005 11:33:53 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 6310 invoked by uid 500); 28 Jul 2005 11:33:52 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 6296 invoked by uid 99); 28 Jul 2005 11:33:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2005 04:33:52 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 80.168.69.50 is neither permitted nor denied by domain of b.candler@pobox.com) Received: from [80.168.69.50] (HELO leto.uk.clara.net) (80.168.69.50) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2005 04:33:45 -0700 Received: from bloodhound.noc.clara.net ([195.8.70.207]) by leto.uk.clara.net with esmtp (Exim 4.43) id 1Dy6e4-000FPP-N0 for users@httpd.apache.org; Thu, 28 Jul 2005 12:33:48 +0100 Received: from personal by bloodhound.noc.clara.net with local (Exim 4.50 (FreeBSD)) id 1Dy6e4-0000l5-Ml for users@httpd.apache.org; Thu, 28 Jul 2005 12:33:48 +0100 Date: Thu, 28 Jul 2005 12:33:48 +0100 From: Brian Candler To: users@httpd.apache.org Message-ID: <20050728113348.GA2852@uk.tiscali.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] shtml and suexec X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I have a suexec-related question. I'm running (and looking at the source code for) Apache 1.3.33. I am mapping the Host: header to the filesystem path using mod_rewrite and a dbm map, for mass virtual hosting. Since "User" can only be set statically inside a container, it looks like I can't use Apache's suexec, so I need something like cgiwrap which runs under the userid of the script file itself. However, this model seems to break down for .shtml pages which contain, say, Firstly, I need "foo" to run under the userid of the .shtml page (or the website owner), not the userid of program "foo". Secondly, shtml users expect their cmd to be run under a shell; however in main/util_script.c, I see that if suexec is active, the shell is not run. if (ap_suexec_enabled ... if (shellcmd) { execle(SUEXEC_BIN, SUEXEC_BIN, execuser, grpname, argv0, NULL, env); } ... but in the non-suexec case: else { if (shellcmd) { execle(SHELL_PATH, SHELL_PATH, "-c", argv0, NULL, env); } So as far as I can tell isn't going to work if suexec is active, since in suexec, argv[3]="echo hello". I guess the wrapper could run a shell, but there's no flag telling it to do so. I am considering whether I need to write my own setuid wrapper, and pass the site username in an environment variable: e.g. RewriteMap hostmap dbm:/conf/hostmap RewriteCond ${hostmap:${tolower:%{HTTP_HOST}}} root=(/[^,]+),uid=(\d+) RewriteRule ^(.*\.shtml) %1$1 [E=UID:%2] This seems pretty hairy to me. Or perhaps the wrapper can look at SCRIPT_FILENAME or PATH_TRANSLATED and stat() that file? Anybody have any other suggestions? A third party module which uses a .db or .cdb file to lookup the "Host:" header and set docroot+UID+GID would be acceptable. Otherwise, I guess what I really want is to be able to set [USER=...] in a mod_rewrite rule, but looking at the docs for apache 2.0 and 2.1, I don't think this feature has been added. Regards, Brian Candler. --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org