|
|
8335b1 |
|
|
|
8335b1 |
Log the SELinux context at startup.
|
|
|
8335b1 |
|
|
|
8335b1 |
Upstream-Status: unlikely to be any interest in this upstream
|
|
|
8335b1 |
|
|
|
8335b1 |
--- httpd-2.4.1/configure.in.selinux
|
|
|
8335b1 |
+++ httpd-2.4.1/configure.in
|
|
|
8335b1 |
@@ -458,6 +458,11 @@ fopen64
|
|
|
8335b1 |
dnl confirm that a void pointer is large enough to store a long integer
|
|
|
8335b1 |
APACHE_CHECK_VOID_PTR_LEN
|
|
|
8335b1 |
|
|
|
8335b1 |
+AC_CHECK_LIB(selinux, is_selinux_enabled, [
|
|
|
8335b1 |
+ AC_DEFINE(HAVE_SELINUX, 1, [Defined if SELinux is supported])
|
|
|
8335b1 |
+ APR_ADDTO(AP_LIBS, [-lselinux])
|
|
|
8335b1 |
+])
|
|
|
8335b1 |
+
|
|
|
8335b1 |
AC_CACHE_CHECK([for gettid()], ac_cv_gettid,
|
|
|
8335b1 |
[AC_TRY_RUN(#define _GNU_SOURCE
|
|
|
8335b1 |
#include <unistd.h>
|
|
|
8335b1 |
--- httpd-2.4.1/server/core.c.selinux
|
|
|
8335b1 |
+++ httpd-2.4.1/server/core.c
|
|
|
8335b1 |
@@ -58,6 +58,10 @@
|
|
|
8335b1 |
#include <unistd.h>
|
|
|
8335b1 |
#endif
|
|
|
8335b1 |
|
|
|
8335b1 |
+#ifdef HAVE_SELINUX
|
|
|
8335b1 |
+#include <selinux/selinux.h>
|
|
|
8335b1 |
+#endif
|
|
|
8335b1 |
+
|
|
|
8335b1 |
/* LimitRequestBody handling */
|
|
|
8335b1 |
#define AP_LIMIT_REQ_BODY_UNSET ((apr_off_t) -1)
|
|
|
8335b1 |
#define AP_DEFAULT_LIMIT_REQ_BODY ((apr_off_t) 0)
|
|
|
8335b1 |
@@ -4452,6 +4456,28 @@ static int core_post_config(apr_pool_t *
|
|
|
8335b1 |
}
|
|
|
8335b1 |
#endif
|
|
|
8335b1 |
|
|
|
8335b1 |
+#ifdef HAVE_SELINUX
|
|
|
8335b1 |
+ {
|
|
|
8335b1 |
+ static int already_warned = 0;
|
|
|
8335b1 |
+ int is_enabled = is_selinux_enabled() > 0;
|
|
|
8335b1 |
+
|
|
|
8335b1 |
+ if (is_enabled && !already_warned) {
|
|
|
8335b1 |
+ security_context_t con;
|
|
|
8335b1 |
+
|
|
|
8335b1 |
+ if (getcon(&con) == 0) {
|
|
|
8335b1 |
+
|
|
|
8335b1 |
+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
|
|
|
8335b1 |
+ "SELinux policy enabled; "
|
|
|
8335b1 |
+ "httpd running as context %s", con);
|
|
|
8335b1 |
+
|
|
|
8335b1 |
+ already_warned = 1;
|
|
|
8335b1 |
+
|
|
|
8335b1 |
+ freecon(con);
|
|
|
8335b1 |
+ }
|
|
|
8335b1 |
+ }
|
|
|
8335b1 |
+ }
|
|
|
8335b1 |
+#endif
|
|
|
8335b1 |
+
|
|
|
8335b1 |
return OK;
|
|
|
8335b1 |
}
|
|
|
8335b1 |
|