33#ifdef HAVE_SYS_RESOURCE_H
34#include <sys/resource.h>
50#ifdef HAVE_SYS_PRCTL_H
55#define DEFAULT_USER "#-1"
58#define DEFAULT_GROUP "#-1"
63 const char *user_name;
100 "getpwuid: couldn't determine user name from uid %ld, "
101 "you probably need to modify the User directive",
119 "setgid: unable to set group id to Group %ld",
128 "initgroups: unable to set groups for User %s "
151 "Cannot chroot when not started as root");
169 if (
chdir(
"/") != 0) {
172 "Can't chdir to new root");
185 "setuid: unable to change to uid: %ld",
189#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
195 "set dumpable failed - this child will not coredump"
196 " after software errors");
217#if !defined (BIG_SECURITY_HOLE) && !defined (OS2)
219 return "Error:\tApache has not been designed to serve pages while\n"
220 "\trunning as root. There are known race conditions that\n"
221 "\twill allow any local user to read any file on the system.\n"
222 "\tIf you still desire to serve pages as root then\n"
223 "\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n"
224 "\tand then rebuild the server.\n"
225 "\tIt is strongly suggested that you instead modify the User\n"
226 "\tdirective in your httpd.conf file to list a non-root\n"
258 return "ChrootDir must be a valid directory";
287#ifdef AP_SUEXEC_CAPABILITIES
289#define SETUID_TEST(finfo) (1)
291#define SETUID_TEST(finfo) (finfo.protection & APR_USETID)
338 "Cannot chroot when not started as root");
351 if (
chdir(
"/") != 0) {
353 "Can't chdir to new root");
365 "setuid: unable to change to uid: %ld",
369#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
374 "set dumpable failed - this child will not coredump"
375 " after software errors");
414 "Effective user id for this server"),
416 "Effective group id for this server"),
418 "The directory to chroot(2) into"),
420 "Enable or disable suEXEC support"),
Symbol export macros and hook functions.
Apache Multi-Processing Module library.
APR Portability Routines.
APR Thread and Process Library.
static apr_pool_t * pconf
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
void ap_hook_test_config(ap_HOOK_test_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define AP_DECLARE_MODULE(foo)
#define AP_INIT_FLAG(directive, func, mconfig, where, help)
void ap_hook_pre_config(ap_HOOK_pre_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
int ap_exists_config_define(const char *name)
int ap_sys_privileges_handlers(int inc)
int ap_coredumpdir_configured
void ap_hook_drop_privileges(ap_HOOK_drop_privileges_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
int initgroups(const char *name, gid_t basegid)
int ap_unixd_setup_child(void)
apr_fileperms_t apr_uid_t uid
apr_fileperms_t apr_uid_t apr_gid_t gid
#define STANDARD20_MODULE_STUFF
int ap_is_directory(apr_pool_t *p, const char *name)
const char * ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
const char int apr_pool_t * pool
apr_int32_t apr_int32_t apr_int32_t err
static const command_rec unixd_cmds[]
static const char * unixd_set_user(cmd_parms *cmd, void *dummy, const char *arg)
static int unixd_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
static int set_group_privs(void)
static int unixd_drop_privileges(apr_pool_t *pool, server_rec *s)
static const char * unixd_set_suexec(cmd_parms *cmd, void *dummy, int arg)
static void unixd_hooks(apr_pool_t *pool)
static const char * unixd_set_chroot_dir(cmd_parms *cmd, void *dummy, const char *arg)
static const char * unixd_set_group(cmd_parms *cmd, void *dummy, const char *arg)
#define SETUID_TEST(finfo)
static void unixd_dump_config(apr_pool_t *p, server_rec *s)
common stuff that unix MPMs will want
Multi-Processing Modules functions.
A structure to store information for each virtual server.