
|
View Full Version : problem with suexec
clocker1996 05-09-2002, 10:47 PM When you configure apache with suexec, you have to specificy docroot..
So if your sites primarily are in
/home/sites/blah.com/public_html
then ur docroot is /home/sites
so --with-suexec-docroot=/home/sites
the thing is
what if you run out of space on /home partition
and you gotta start adding sites to
/usr/sites
Then what?
The site's that run off /usr/sites will have problems, wont they?
e.g. cgi files not running properly
or suexec not even working for sites in /usr/sites
Does anyone have a solution tothis? maybe iam looking at it the wrong way / missing something
AudiBoy 05-10-2002, 10:27 AM You can actually set more than one directory for suexec when you compile apache.
I can't recall off the top of my head how to do it, but try i search on google about suexec..
I ran into a simuliar problem awhile back
clocker1996 05-10-2002, 02:46 PM anyone else know.......?
Wazeh 05-11-2002, 06:37 PM I haven't tried this myself, but you might want to give it a try and see if it works. Try to make a symlink so /home/foo points to /usr/foo and see if that works.
cperciva 05-11-2002, 09:13 PM Originally posted by Wazeh
I haven't tried this myself, but you might want to give it a try and see if it works. Try to make a symlink so /home/foo points to /usr/foo and see if that works.
That won't work. Suexec uses getcwd() to get the *real* directory.
You're not supposed to do this, but my solution to this problem (well, second solution; the first solution is to partition the drive properly in the first place) would be to edit suexec.c and recompile.
Tim Greer 05-12-2002, 06:51 PM I don't think you can specify multiple document roots. I've never wanted to or had to though, so perhaps I'm just not up to speed on that?
As for hacking the suexec code, that's a possibility, but you're basically circumventing the purpose of SuEXEC at that point (depending). I.e., be very careful and don't touch it unless you know absolutely what you're doing.
I'd just have to agree, that you should have an initial well thought out partition scheme, to not run into a problem, as if anything, the /home partition should be one of the last to fill up, in theory anyway, and you can always sym link dir's and files that live in the /home partition arch.
cperciva 05-12-2002, 07:28 PM Ok, I had some time on my hands, so I put together a patch for you.
*** suexec.c.orig Sun May 12 16:04:20 2002
--- suexec.c Sun May 12 16:16:32 2002
***************
*** 263,268 ****
--- 263,273 ----
char *cmd; /* command to be executed */
char cwd[AP_MAXPATH]; /* current working directory */
char dwd[AP_MAXPATH]; /* docroot working directory */
+
+ #ifdef DOC_ROOT_2
+ char dwd2[AP_MAXPATH]; /* second docroot */
+ #endif
+
struct passwd *pw; /* password entry holder */
struct group *gr; /* group entry holder */
struct stat dir_info; /* directory info holder */
***************
*** 295,300 ****
--- 300,308 ----
#ifdef DOC_ROOT
fprintf(stderr, " -D DOC_ROOT=\"%s\"\n", DOC_ROOT);
#endif
+ #ifdef DOC_ROOT_2
+ fprintf(stderr, " -D DOC_ROOT_2=\"%s\"\n", DOC_ROOT_2);
+ #endif
#ifdef GID_MIN
fprintf(stderr, " -D GID_MID=%d\n", GID_MIN);
#endif
***************
*** 495,500 ****
--- 503,511 ----
if (((chdir(target_homedir)) != 0) ||
((chdir(USERDIR_SUFFIX)) != 0) ||
((getcwd(dwd, AP_MAXPATH)) == NULL) ||
+ #ifdef DOC_ROOT_2
+ ((getcwd(dwd2, AP_MAXPATH)) == NULL) ||
+ #endif
((chdir(cwd)) != 0)) {
log_err("emerg: cannot get docroot information (%s)\n",
target_homedir);
***************
*** 508,516 ****
log_err("emerg: cannot get docroot information (%s)\n", DOC_ROOT);
exit(113);
}
}
! if ((strncmp(cwd, dwd, strlen(dwd))) != 0) {
log_err("error: command not in docroot (%s/%s)\n", cwd, cmd);
exit(114);
}
--- 519,539 ----
log_err("emerg: cannot get docroot information (%s)\n", DOC_ROOT);
exit(113);
}
+ #ifdef DOC_ROOT_2
+ if (((chdir(DOC_ROOT_2)) != 0) ||
+ ((getcwd(dwd2, AP_MAXPATH)) == NULL) ||
+ ((chdir(cwd)) != 0)) {
+ log_err("emerg: cannot get docroot information (%s)\n", DOC_ROOT_2);
+ exit(113);
+ }
+ #endif
}
! if (((strncmp(cwd, dwd, strlen(dwd))) != 0)
! #ifdef DOC_ROOT_2
! && ((strncmp(cwd, dwd2, strlen(dwd2))) != 0)
! #endif
! ) {
log_err("error: command not in docroot (%s/%s)\n", cwd, cmd);
exit(114);
}
Shyne 05-12-2002, 07:30 PM Actually I believe it is possible. It's not hacking the source of suEXEC. You need to edit a default variable in one the source file. Find this file "suexec.h" and edit it. Find the option where it says DOC_ROOT, and you should be able to add new directories by seperating them with a ":".
Example
#define DOC_ROOT "/home:/usr:/var/cgi/blah"
I think this will only work if you actually compile suEXEC (make suexec) and then recompile apache it self.
cperciva 05-12-2002, 07:31 PM Originally posted by Shyne
Actually I believe it is possible. It's not hacking the source of suEXEC. You need to edit a default variable in one the source file. Find this file "suexec.h" and edit it. Find the option where it says DOC_ROOT, and you should be able to add new directories by seperating them with a ":".
That won't work.
Shyne 05-12-2002, 07:32 PM Why not? if you look at the file you'll see similar options are seperated the same way.
cperciva 05-12-2002, 07:34 PM Originally posted by Shyne
Why not? if you look at the file you'll see similar options are seperated the same way.
strncmp
|