|
|
4e7d48 |
From b417cfa480d8ff69f1ab5f7a9b957ab0d266ecfe Mon Sep 17 00:00:00 2001
|
|
|
4e7d48 |
From: Martin Kutlak <mkutlak@redhat.com>
|
|
|
4e7d48 |
Date: Wed, 29 May 2019 11:32:31 +0200
|
|
|
4e7d48 |
Subject: [PATCH] Drop the setuid wrapper
|
|
|
4e7d48 |
|
|
|
4e7d48 |
The /proc/1 is owned by the UID running the container process (1xxxxxxxxx) so there is no
|
|
|
4e7d48 |
need to use setuid for CEL to write to /proc/1/fd/2.
|
|
|
4e7d48 |
|
|
|
4e7d48 |
Reverts:
|
|
|
4e7d48 |
https://github.com/abrt/abrt/commit/578317a67c0f30469c28752ea2f40ae87a1a356c
|
|
|
4e7d48 |
|
|
|
4e7d48 |
(cherry picked from commit 5caab93decc2e2a3c0abf5dc24bf23482680810e)
|
|
|
4e7d48 |
|
|
|
4e7d48 |
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
|
|
|
4e7d48 |
---
|
|
|
4e7d48 |
container-exception-logger.spec | 2 +-
|
|
|
4e7d48 |
src/container-exception-logger.c | 23 +++--------------------
|
|
|
4e7d48 |
2 files changed, 4 insertions(+), 21 deletions(-)
|
|
|
4e7d48 |
|
|
|
4e7d48 |
diff --git a/container-exception-logger.spec b/container-exception-logger.spec
|
|
|
4e7d48 |
index 7828667..3a6f1c8 100644
|
|
|
4e7d48 |
--- a/container-exception-logger.spec
|
|
|
4e7d48 |
+++ b/container-exception-logger.spec
|
|
|
4e7d48 |
@@ -35,7 +35,7 @@ mkdir -p %{buildroot}/%{_mandir}/man1
|
|
|
4e7d48 |
cp man/container-exception-logger.1 %{buildroot}/%{_mandir}/man1/container-exception-logger.1
|
|
|
4e7d48 |
|
|
|
4e7d48 |
%files
|
|
|
4e7d48 |
-%attr(6755, root, root) %{_bindir}/container-exception-logger
|
|
|
4e7d48 |
+%{_bindir}/container-exception-logger
|
|
|
4e7d48 |
%{_mandir}/man1/container-exception-logger.1.*
|
|
|
4e7d48 |
%license COPYING
|
|
|
4e7d48 |
|
|
|
4e7d48 |
diff --git a/src/container-exception-logger.c b/src/container-exception-logger.c
|
|
|
4e7d48 |
index 104ef74..d588de5 100644
|
|
|
4e7d48 |
--- a/src/container-exception-logger.c
|
|
|
4e7d48 |
+++ b/src/container-exception-logger.c
|
|
|
4e7d48 |
@@ -60,25 +60,8 @@ int main(int argc, char *argv[])
|
|
|
4e7d48 |
FILE *f = fopen(INIT_PROC_STDERR_FD_PATH, "w");
|
|
|
4e7d48 |
if (f == NULL)
|
|
|
4e7d48 |
{
|
|
|
4e7d48 |
- perror("Failed to open '"INIT_PROC_STDERR_FD_PATH"' as root");
|
|
|
4e7d48 |
-
|
|
|
4e7d48 |
- /* Try to open the 'INIT_PROC_STDERR_FD_PATH' as normal user because of
|
|
|
4e7d48 |
- https://github.com/minishift/minishift/issues/2058
|
|
|
4e7d48 |
- */
|
|
|
4e7d48 |
- if (seteuid(getuid()) == 0)
|
|
|
4e7d48 |
- {
|
|
|
4e7d48 |
- f = fopen(INIT_PROC_STDERR_FD_PATH, "w");
|
|
|
4e7d48 |
- if (f == NULL)
|
|
|
4e7d48 |
- {
|
|
|
4e7d48 |
- perror("Failed to open '"INIT_PROC_STDERR_FD_PATH"' as user");
|
|
|
4e7d48 |
- return 2;
|
|
|
4e7d48 |
- }
|
|
|
4e7d48 |
- }
|
|
|
4e7d48 |
- else
|
|
|
4e7d48 |
- {
|
|
|
4e7d48 |
- perror("Failed to setuid");
|
|
|
4e7d48 |
- return 3;
|
|
|
4e7d48 |
- }
|
|
|
4e7d48 |
+ perror("Failed to open '"INIT_PROC_STDERR_FD_PATH"'");
|
|
|
4e7d48 |
+ return 2;
|
|
|
4e7d48 |
}
|
|
|
4e7d48 |
|
|
|
4e7d48 |
setvbuf (f, NULL, _IONBF, 0);
|
|
|
4e7d48 |
@@ -99,7 +82,7 @@ int main(int argc, char *argv[])
|
|
|
4e7d48 |
{
|
|
|
4e7d48 |
perror("Failed to write to '"INIT_PROC_STDERR_FD_PATH"'");
|
|
|
4e7d48 |
fclose(f);
|
|
|
4e7d48 |
- return 4;
|
|
|
4e7d48 |
+ return 3;
|
|
|
4e7d48 |
}
|
|
|
4e7d48 |
}
|
|
|
4e7d48 |
fclose(f);
|
|
|
4e7d48 |
--
|
|
|
4e7d48 |
2.21.0
|
|
|
4e7d48 |
|