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