SunQuest
           Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 20th, 2001, 05:09 PM
Nitro Nitro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: USA
Posts: 27 Nitro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Nitro Send a message via AIM to Nitro
Apache Vhosts and suEXEC

I'm running apache 1.3.20 and have tried configuring suEXEC for my virtual hosts.

My compile options for suEXEC are:

--enable-suexec \
--suexec-caller=apache \
--suexec-userdir=webroot \
--suexec-docroot=/usr/local/www/ \
--suexec-logfile=/usr/local/www/logs/suexec_log.txt \
--suexec-uidmin=99 \
--suexec-gidmin=99 \
--suexec-safepath="/usr/local/bin:/usr/bin:/bin

The default host is in /usr/local/www/webroot/, and cgi works fine there.

Now, I add a virtualhost to apache config file, and he is a real unix user with the name jim, with his home directory in /home/jim.

(Virtualhost *)
User jim
Group jim
DocumentRoot /home/jim/webroot
ServerName jim (just for the post)
ServerAdmin jim
ErrorLog /home/jim/logs/error_log.txt
TransferLog /home/jim/logs/access_log.txt
(Directory /home/jim)
Options ExecCGI Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
(/Directory)
(/Virtualhost)

That should work shouldn't it? I have --suexec-userdir=webroot which means that it is save to execute CGI's in the user's ~/webroot/ correct? It doesn't though, I get and error, check the suexec log and it gives me:
[2001-07-18 22:58:35]: error: command not in docroot (/home/jim/webroot/test.cgi)
[2001-07-18 23:02:10]: info: (target/actual) uid: (jim/jim) gid: (jim/jim) cmd: test.cgi


Why is it looking at the suexec-docroot, shouldn't it be checking userdir?

I have to be overlooking something simple, any help would be greatly appreciated.

Reply With Quote
  #2  
Old July 21st, 2001, 08:26 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> have tried configuring suEXEC for my virtual hosts

It's very bad and insecure if you enable suEXEC for just your vhosts and not your defaut server.

>> I have --suexec-userdir=webroot which means that it is save to execute CGI's in the user's
~/webroot/ correct?

Yes with the appropriate permission. However, userdir mechanism is built in (so long as you specified which name to use during compilation), you don't need to specify which User or Group at all. That said, you don't need to put within <VirtualHost>.

>> Why is it looking at the suexec-docroot, shouldn't it be checking userdir?

Because it sees DocumentRoot so it doesn't aware it was for a userdir environment.

Note, in suEXEC environment for userdir, the suexec wrapper will handle the job for determining the user and group based on the file owner and group as well as the directory. In addition, it will lookup /etc/passwd file to determine whether the $HOME for jim is really /home/jim, then append the subdir webroot under jim's $HOME to match against.

Reply With Quote
  #3  
Old July 21st, 2001, 01:46 PM
Nitro Nitro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: USA
Posts: 27 Nitro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Nitro Send a message via AIM to Nitro
It worked!

I dropped the User and Group in my vhosts and it works fine now.


THANKS, so then what would be the purpose of using User and Group in my vhost specifications?

- Thanks

Reply With Quote
  #4  
Old July 22nd, 2001, 05:31 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> so then what would be the purpose of using User and Group in my vhost specifications?

First of all, userdir is just too dynamic. You can have Apache running while adding a new user, with the appropriate permission, this new user is ready to test CGI script without restarting Apache.
As you can tell from this, there is no need to specify which user+group the new user belongs to. Say you have 1 million users, it just doesn't make sense to put all the user+group for each userdir. As I mentioned previously, for userdir environment, suEXEC wrapper will lookup /etc/passwd when it's told.

Say you changed jim's $HOME to /opt/web/jim, then /opt/web/jim/webroot still will work under suEXEC environment. That is, without restarting Apache. However, the <Directory /opt/web/*/webroot> should be added.

For vhost, the user+pass must exist before starting Apache because Apache will lookup /etc/passwd and check for the existence of the user+group. In this case, Apache doesn't look for the $HOME directory for the user. In fact, this user doesn't require to have a $HOME directory at all.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Apache Vhosts and suEXEC


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway