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