Changeset 405 for server/common


Ignore:
Timestamp:
Sep 17, 2007, 4:06:51 PM (17 years ago)
Author:
andersk
Message:
Revert r403 pending discussion of its security implications.
File:
1 edited

Legend:

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

    r403 r405  
    4848 #ifdef HAVE_PWD_H
    4949 #include <pwd.h>
    50 @@ -95,6 +98,9 @@
     50@@ -95,6 +98,7 @@
    5151 {
    5252     /* variable name starts with */
     
    5454+    "HTTPS_",
    5555     "SSL_",
    56 +    "PERL",
    57 +    "PYTHON",
    5856 
    5957     /* variable name is */
    60 @@ -140,6 +146,7 @@
     58@@ -140,6 +144,7 @@
    6159     "UNIQUE_ID=",
    6260     "USER_NAME=",
     
    6664 };
    6765 
    68 @@ -245,6 +252,53 @@
     66@@ -245,6 +250,53 @@
    6967     environ = cleanenv;
    7068 }
     
    120118 {
    121119     int userdir = 0;        /* ~userdir flag             */
    122 @@ -450,7 +504,7 @@
     120@@ -450,7 +501,7 @@
    123121      * Error out if attempt is made to execute as root or as
    124122      * a UID less than AP_UID_MIN.  Tsk tsk.
     
    129127         exit(107);
    130128     }
    131 @@ -482,6 +536,19 @@
     129@@ -482,6 +533,17 @@
    132130         log_err("failed to setuid (%ld: %s)\n", uid, cmd);
    133131         exit(110);
    134132     }
    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 +       }
     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+        }
    147143+    }
    148144 
    149145     /*
    150146      * Get the current working directory, as well as the proper
    151 @@ -513,6 +580,13 @@
     147@@ -513,6 +575,13 @@
    152148             exit(113);
    153149         }
     
    163159     if ((strncmp(cwd, dwd, strlen(dwd))) != 0) {
    164160         log_err("command not in docroot (%s/%s)\n", cwd, cmd);
    165 @@ -530,15 +604,17 @@
     161@@ -530,15 +598,17 @@
    166162     /*
    167163      * Error out if cwd is writable by others.
     
    182178         exit(117);
    183179     }
    184 @@ -546,10 +622,12 @@
     180@@ -546,10 +616,12 @@
    185181     /*
    186182      * Error out if the program is writable by others.
     
    195191     /*
    196192      * Error out if the file is setuid or setgid.
    197 @@ -563,6 +641,7 @@
     193@@ -563,6 +635,7 @@
    198194      * Error out if the target name/group is different from
    199195      * the name/group of the cwd or the program.
     
    203199         (gid != dir_info.st_gid) ||
    204200         (uid != prg_info.st_uid) ||
    205 @@ -574,6 +653,7 @@
     201@@ -574,6 +647,7 @@
    206202                 prg_info.st_uid, prg_info.st_gid);
    207203         exit(120);
     
    211207      * Error out if the program is not executable for the user.
    212208      * Otherwise, she won't find any error in the logs except for
    213 @@ -609,6 +689,13 @@
     209@@ -609,6 +683,13 @@
    214210         log = NULL;
    215211     }
Note: See TracChangeset for help on using the changeset viewer.