Changeset 403 for server/common


Ignore:
Timestamp:
Sep 17, 2007, 2:37:42 PM (17 years ago)
Author:
presbrey
Message:
allow directives like SetEnv PYTHONPATH/PERL5LIB etc.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/common/patches/httpd-suexec-scripts.patch

    r315 r403  
    4848 #ifdef HAVE_PWD_H
    4949 #include <pwd.h>
    50 @@ -95,6 +98,7 @@
     50@@ -95,6 +98,9 @@
    5151 {
    5252     /* variable name starts with */
     
    5454+    "HTTPS_",
    5555     "SSL_",
     56+    "PERL",
     57+    "PYTHON",
    5658 
    5759     /* variable name is */
    58 @@ -140,6 +144,7 @@
     60@@ -140,6 +146,7 @@
    5961     "UNIQUE_ID=",
    6062     "USER_NAME=",
     
    6466 };
    6567 
    66 @@ -245,6 +250,53 @@
     68@@ -245,6 +252,53 @@
    6769     environ = cleanenv;
    6870 }
     
    118120 {
    119121     int userdir = 0;        /* ~userdir flag             */
    120 @@ -450,7 +501,7 @@
     122@@ -450,7 +504,7 @@
    121123      * Error out if attempt is made to execute as root or as
    122124      * a UID less than AP_UID_MIN.  Tsk tsk.
     
    127129         exit(107);
    128130     }
    129 @@ -482,6 +533,17 @@
     131@@ -482,6 +536,19 @@
    130132         log_err("failed to setuid (%ld: %s)\n", uid, cmd);
    131133         exit(110);
    132134     }
    133 +    if (uid == 102) {
    134 +        if (setexeccon("system_u:system_r:signup_t:s0") == -1) {
    135 +            log_err("failed to setexeccon (%ld: %s) to signup_t\n", uid, cmd);
    136 +            exit(201);
    137 +        }
    138 +    } else {
    139 +        if (setexeccon("user_u:user_r:user_t:s0") == -1) {
    140 +            log_err("failed to setexeccon (%ld: %s) to user_t\n", uid, cmd);
    141 +            exit(202);
    142 +        }
     135+    if (is_selinux_enabled()) {
     136+       if (uid == 102) {
     137+           if (setexeccon("system_u:system_r:signup_t:s0") == -1) {
     138+               log_err("failed to setexeccon (%ld: %s) to signup_t\n", uid, cmd);
     139+               exit(201);
     140+           }
     141+       } else {
     142+           if (setexeccon("user_u:user_r:user_t:s0") == -1) {
     143+               log_err("failed to setexeccon (%ld: %s) to user_t\n", uid, cmd);
     144+               exit(202);
     145+           }
     146+       }
    143147+    }
    144148 
    145149     /*
    146150      * Get the current working directory, as well as the proper
    147 @@ -513,6 +575,13 @@
     151@@ -513,6 +580,13 @@
    148152             exit(113);
    149153         }
     
    159163     if ((strncmp(cwd, dwd, strlen(dwd))) != 0) {
    160164         log_err("command not in docroot (%s/%s)\n", cwd, cmd);
    161 @@ -530,15 +598,17 @@
     165@@ -530,15 +604,17 @@
    162166     /*
    163167      * Error out if cwd is writable by others.
     
    178182         exit(117);
    179183     }
    180 @@ -546,10 +616,12 @@
     184@@ -546,10 +622,12 @@
    181185     /*
    182186      * Error out if the program is writable by others.
     
    191195     /*
    192196      * Error out if the file is setuid or setgid.
    193 @@ -563,6 +635,7 @@
     197@@ -563,6 +641,7 @@
    194198      * Error out if the target name/group is different from
    195199      * the name/group of the cwd or the program.
     
    199203         (gid != dir_info.st_gid) ||
    200204         (uid != prg_info.st_uid) ||
    201 @@ -574,6 +647,7 @@
     205@@ -574,6 +653,7 @@
    202206                 prg_info.st_uid, prg_info.st_gid);
    203207         exit(120);
     
    207211      * Error out if the program is not executable for the user.
    208212      * Otherwise, she won't find any error in the logs except for
    209 @@ -609,6 +683,13 @@
     213@@ -609,6 +689,13 @@
    210214         log = NULL;
    211215     }
Note: See TracChangeset for help on using the changeset viewer.