|
|
1ff636 |
From 4dd0d6644c71149a0a1af89944b95325ac4d2f18 Mon Sep 17 00:00:00 2001
|
|
|
1ff636 |
From: Michal Sekletar <msekleta@redhat.com>
|
|
|
1ff636 |
Date: Wed, 23 Sep 2015 11:26:58 +0200
|
|
|
1ff636 |
Subject: [PATCH] shutdown: make sure /run/nologin has correct label
|
|
|
1ff636 |
|
|
|
1ff636 |
rhel-only for now, not yet posted upstream
|
|
|
1ff636 |
|
|
|
1ff636 |
Related: #1264073
|
|
|
1ff636 |
---
|
|
|
1ff636 |
src/shutdownd/shutdownd.c | 8 +++++++-
|
|
|
1ff636 |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
1ff636 |
|
|
|
1ff636 |
diff --git a/src/shutdownd/shutdownd.c b/src/shutdownd/shutdownd.c
|
|
|
181b3f |
index 701882b96..e1917a626 100644
|
|
|
1ff636 |
--- a/src/shutdownd/shutdownd.c
|
|
|
1ff636 |
+++ b/src/shutdownd/shutdownd.c
|
|
|
1ff636 |
@@ -39,6 +39,8 @@
|
|
|
1ff636 |
#include "utmp-wtmp.h"
|
|
|
1ff636 |
#include "mkdir.h"
|
|
|
1ff636 |
#include "fileio.h"
|
|
|
1ff636 |
+#include "selinux-util.h"
|
|
|
1ff636 |
+#include "fileio-label.h"
|
|
|
1ff636 |
|
|
|
1ff636 |
union shutdown_buffer {
|
|
|
1ff636 |
struct sd_shutdown_command command;
|
|
|
1ff636 |
@@ -278,6 +280,8 @@ int main(int argc, char *argv[]) {
|
|
|
1ff636 |
|
|
|
1ff636 |
umask(0022);
|
|
|
1ff636 |
|
|
|
1ff636 |
+ mac_selinux_init(NULL);
|
|
|
1ff636 |
+
|
|
|
1ff636 |
n_fds = sd_listen_fds(true);
|
|
|
1ff636 |
if (n_fds < 0) {
|
|
|
1ff636 |
log_error_errno(r, "Failed to read listening file descriptors from environment: %m");
|
|
|
1ff636 |
@@ -404,7 +408,7 @@ int main(int argc, char *argv[]) {
|
|
|
1ff636 |
|
|
|
1ff636 |
log_info("Creating /run/nologin, blocking further logins...");
|
|
|
1ff636 |
|
|
|
1ff636 |
- e = write_string_file_atomic("/run/nologin", "System is going down.");
|
|
|
1ff636 |
+ e = write_string_file_atomic_label("/run/nologin", "System is going down.");
|
|
|
1ff636 |
if (e < 0)
|
|
|
1ff636 |
log_error_errno(e, "Failed to create /run/nologin: %m");
|
|
|
1ff636 |
else
|
|
|
1ff636 |
@@ -433,6 +437,8 @@ finish:
|
|
|
1ff636 |
|
|
|
1ff636 |
unlink("/run/systemd/shutdown/scheduled");
|
|
|
1ff636 |
|
|
|
1ff636 |
+ mac_selinux_finish();
|
|
|
1ff636 |
+
|
|
|
1ff636 |
if (exec_shutdown && !b.command.dry_run) {
|
|
|
1ff636 |
char sw[3];
|
|
|
1ff636 |
|