From 4e7d48d41dcf56affe5fe7ac1bb74fa37bfa4cc9 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Dec 17 2020 10:22:25 +0000 Subject: import container-exception-logger-1.0.2-3.el8 --- diff --git a/.container-exception-logger.metadata b/.container-exception-logger.metadata new file mode 100644 index 0000000..c5dee44 --- /dev/null +++ b/.container-exception-logger.metadata @@ -0,0 +1 @@ +72c111e6d3dde6623a258107ca0fe8cc8d1eec30 SOURCES/container-exception-logger-1.0.2.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ed45bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/container-exception-logger-1.0.2.tar.gz diff --git a/SOURCES/0001-Use-a-correct-command-name-in-helper.patch b/SOURCES/0001-Use-a-correct-command-name-in-helper.patch new file mode 100644 index 0000000..50cc5d6 --- /dev/null +++ b/SOURCES/0001-Use-a-correct-command-name-in-helper.patch @@ -0,0 +1,32 @@ +From b7ef8a1407fe86a993b7829ecfc6879a2926c7ab Mon Sep 17 00:00:00 2001 +From: Martin Kutlak +Date: Wed, 5 Jun 2019 10:08:14 +0200 +Subject: [PATCH] Use a correct command name in helper + +abrt-container-logger was the old name. + +Related: rhbz#1698747 + +(cherry picked from commit 251787f2971ee50211e428dd0bdb37eea8b05a63) + +Signed-off-by: Martin Kutlak +--- + src/container-exception-logger.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/container-exception-logger.c b/src/container-exception-logger.c +index 104ef74..b26e4c6 100644 +--- a/src/container-exception-logger.c ++++ b/src/container-exception-logger.c +@@ -24,7 +24,7 @@ + int main(int argc, char *argv[]) + { + const char *program_usage_string = +- "Usage: abrt-container-logger [--no-tag | --tag STRING | --help]" ++ "Usage: container-exception-logger [--no-tag | --tag STRING | --help]" + "\n" + "\nThe tool reads from standard input and writes to '"INIT_PROC_STDERR_FD_PATH"'"; + +-- +2.21.0 + diff --git a/SOURCES/0002-Drop-the-setuid-wrapper.patch b/SOURCES/0002-Drop-the-setuid-wrapper.patch new file mode 100644 index 0000000..86a9f43 --- /dev/null +++ b/SOURCES/0002-Drop-the-setuid-wrapper.patch @@ -0,0 +1,76 @@ +From b417cfa480d8ff69f1ab5f7a9b957ab0d266ecfe Mon Sep 17 00:00:00 2001 +From: Martin Kutlak +Date: Wed, 29 May 2019 11:32:31 +0200 +Subject: [PATCH] Drop the setuid wrapper + +The /proc/1 is owned by the UID running the container process (1xxxxxxxxx) so there is no +need to use setuid for CEL to write to /proc/1/fd/2. + +Reverts: +https://github.com/abrt/abrt/commit/578317a67c0f30469c28752ea2f40ae87a1a356c + +(cherry picked from commit 5caab93decc2e2a3c0abf5dc24bf23482680810e) + +Signed-off-by: Martin Kutlak +--- + container-exception-logger.spec | 2 +- + src/container-exception-logger.c | 23 +++-------------------- + 2 files changed, 4 insertions(+), 21 deletions(-) + +diff --git a/container-exception-logger.spec b/container-exception-logger.spec +index 7828667..3a6f1c8 100644 +--- a/container-exception-logger.spec ++++ b/container-exception-logger.spec +@@ -35,7 +35,7 @@ mkdir -p %{buildroot}/%{_mandir}/man1 + cp man/container-exception-logger.1 %{buildroot}/%{_mandir}/man1/container-exception-logger.1 + + %files +-%attr(6755, root, root) %{_bindir}/container-exception-logger ++%{_bindir}/container-exception-logger + %{_mandir}/man1/container-exception-logger.1.* + %license COPYING + +diff --git a/src/container-exception-logger.c b/src/container-exception-logger.c +index 104ef74..d588de5 100644 +--- a/src/container-exception-logger.c ++++ b/src/container-exception-logger.c +@@ -60,25 +60,8 @@ int main(int argc, char *argv[]) + FILE *f = fopen(INIT_PROC_STDERR_FD_PATH, "w"); + if (f == NULL) + { +- perror("Failed to open '"INIT_PROC_STDERR_FD_PATH"' as root"); +- +- /* Try to open the 'INIT_PROC_STDERR_FD_PATH' as normal user because of +- https://github.com/minishift/minishift/issues/2058 +- */ +- if (seteuid(getuid()) == 0) +- { +- f = fopen(INIT_PROC_STDERR_FD_PATH, "w"); +- if (f == NULL) +- { +- perror("Failed to open '"INIT_PROC_STDERR_FD_PATH"' as user"); +- return 2; +- } +- } +- else +- { +- perror("Failed to setuid"); +- return 3; +- } ++ perror("Failed to open '"INIT_PROC_STDERR_FD_PATH"'"); ++ return 2; + } + + setvbuf (f, NULL, _IONBF, 0); +@@ -99,7 +82,7 @@ int main(int argc, char *argv[]) + { + perror("Failed to write to '"INIT_PROC_STDERR_FD_PATH"'"); + fclose(f); +- return 4; ++ return 3; + } + } + fclose(f); +-- +2.21.0 + diff --git a/SPECS/container-exception-logger.spec b/SPECS/container-exception-logger.spec new file mode 100644 index 0000000..df91e5f --- /dev/null +++ b/SPECS/container-exception-logger.spec @@ -0,0 +1,63 @@ +%global _hardened_build 1 + +Name: container-exception-logger +Version: 1.0.2 +Release: 3%{?dist} +Summary: Logging from a container to a host + +License: GPLv2+ +URL: https://github.com/abrt/container-exception-logger +# source is created by: +# git clone https://github.com/abrt/container-exception-logger +# cd container-exception-logger; tito build --tgz +Source0: %{name}-%{version}.tar.gz + +BuildRequires: gcc +BuildRequires: asciidoc +BuildRequires: libxslt +BuildRequires: git-core + +## git format-patch -N 06aaa69 --start-number=1 +Patch0001: 0001-Use-a-correct-command-name-in-helper.patch +Patch0002: 0002-Drop-the-setuid-wrapper.patch + +%description +%{name} is a tool designed to run inside of +a container which is able to get its input outside of the container. + +%prep +%autosetup -S git_am + +%build +gcc %{build_cflags} %{build_ldflags} src/container-exception-logger.c -o src/container-exception-logger +a2x -d manpage -f manpage man/container-exception-logger.1.asciidoc + +%install +mkdir -p %{buildroot}%{_bindir} +cp src/container-exception-logger %{buildroot}/%{_bindir}/container-exception-logger + +mkdir -p %{buildroot}/%{_mandir}/man1 +cp man/container-exception-logger.1 %{buildroot}/%{_mandir}/man1/container-exception-logger.1 + +%files +%{_bindir}/container-exception-logger +%{_mandir}/man1/container-exception-logger.1.* +%license COPYING + +%changelog +* Thu Jul 4 2019 Martin Kutlak 1.0.2-3 +- Build with ldflags + +* Thu Jun 13 2019 Martin Kutlak 1.0.2-2 +- Drop the setuid wrapper +- Use a correct command name in helper + +* Mon Mar 26 2018 Matej Habrnal 1.0.2-1 +- Use _hardened_build macro (mhabrnal@redhat.com) +- Add license (mhabrnal@redhat.com) + +* Fri Mar 23 2018 Unknown name 1.0.1-1 +- new package built with tito + +* Thu Mar 08 2018 Matej Habrnal 1.0.0-1 +- init