From a33b3ecb70b028bc8bbba664a982efe83728aaf0 Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Feb 19 2016 11:19:56 +0000 Subject: AllowVMCoreTask/AllowUserCoreTask configuration options --- diff --git a/0001-Allow-disabling-particular-tasks-in-the-manager.patch b/0001-Allow-disabling-particular-tasks-in-the-manager.patch new file mode 100644 index 0000000..fa23840 --- /dev/null +++ b/0001-Allow-disabling-particular-tasks-in-the-manager.patch @@ -0,0 +1,177 @@ +From 757976faf59bc2caad63102c1b17463933c1b7fa Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Fri, 19 Feb 2016 06:51:32 +0100 +Subject: [PATCH] Allow disabling particular tasks in the manager + +Userspace core support is still a bit problematic, so it is not a good +idea to offer this type of tasks to users in the manager. + +I decided to move the task forms to separate files because I wanted to +avoid the need to escape strings in Python code. + +Signed-off-by: Jakub Filak +--- + src/Makefile.am | 2 ++ + src/config/retrace-server.conf | 7 +++++++ + src/manager.wsgi | 13 +++++++++++++ + src/manager.xhtml | 31 ++----------------------------- + src/manager_usrcore_task_form.xhtml | 17 +++++++++++++++++ + src/manager_vmcore_task_form.xhtml | 13 +++++++++++++ + 6 files changed, 54 insertions(+), 29 deletions(-) + create mode 100644 src/manager_usrcore_task_form.xhtml + create mode 100644 src/manager_vmcore_task_form.xhtml + +diff --git a/src/Makefile.am b/src/Makefile.am +index dfd3f53..043c416 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -39,6 +39,8 @@ interface_PYTHON = backtrace.wsgi \ + + interface_DATA = index.xhtml \ + manager.xhtml \ ++ manager_vmcore_task_form.xhtml \ ++ manager_usrcore_task_form.xhtml \ + managertask.xhtml \ + stats.xhtml + # interfacedir should probably be $$(pkgdatadir)/retrace +diff --git a/src/config/retrace-server.conf b/src/config/retrace-server.conf +index 28991a7..8eab59f 100644 +--- a/src/config/retrace-server.conf ++++ b/src/config/retrace-server.conf +@@ -22,6 +22,12 @@ AllowExternalDir = 0 + # Allow to create tasks owned by task manager (security risk) + AllowTaskManager = 0 + ++# Allow to create VMCore tasks in the task manager ++AllowVMCoreTask = 1 ++ ++# Allow to create Userspace core tasks in the task manager ++AllowUsrCoreTask = 1 ++ + # If white list is disabled, anyone can delete tasks + TaskManagerAuthDelete = 0 + +@@ -143,6 +149,7 @@ EmailNotify = 0 + # Who sends the e-mail notifications + EmailNotifyFrom = retrace@localhost + ++ + [archhosts] + i386 = + x86_64 = +diff --git a/src/manager.wsgi b/src/manager.wsgi +index 93ead9d..59d1372 100644 +--- a/src/manager.wsgi ++++ b/src/manager.wsgi +@@ -602,6 +602,18 @@ def application(environ, start_response): + + custom_url = "%s/__custom__" % match.group(1) + ++ vmcore_form = "" ++ if CONFIG["AllowVMCoreTask"]: ++ with open("/usr/share/retrace-server/manager_vmcore_task_form.xhtml") as f: ++ vmcore_form = f.read(1 << 20) # 1MB ++ output = output.replace("{vmcore_task_form}", vmcore_form) ++ ++ usrcore_form = "" ++ if CONFIG["AllowUsrCoreTask"]: ++ with open("/usr/share/retrace-server/manager_usrcore_task_form.xhtml") as f: ++ usrcore_form = f.read(1 << 20) # 1MB ++ output = output.replace("{usrcore_task_form}", usrcore_form) ++ + output = output.replace("{title}", title) + output = output.replace("{sitename}", sitename) + output = output.replace("{available_str}", available_str) +@@ -619,4 +631,5 @@ def application(environ, start_response): + output = output.replace("{running}", "\n ".join(running)) + output = output.replace("{finished}", "\n ".join(finished)) + ++ + return response(start_response, "200 OK", output, [("Content-Type", "text/html")]) +diff --git a/src/manager.xhtml b/src/manager.xhtml +index 041f994..5c3f231 100644 +--- a/src/manager.xhtml ++++ b/src/manager.xhtml +@@ -182,35 +182,8 @@ + + + +-

vmcore

+-
+-
+- Kernel version (e.g. 2.6.32-287.el6.x86_64, empty to autodetect): +- Be more verbose in case of error +-
+-
+- Custom core location: +- +- +-
Any URL that wget can download or a local path (file:///foo/bar or just /foo/bar)
+-
+-
+-

coredump

+-
+-
+-

All of these three fields override contents of package, executable and os_release files contained in the coredump archive. If you're uploading you have just the bare (compressed) coredump, you must specify these.

+- Be more verbose in case of error
+- Package (e.g. coreutils-8.22-11.el7):
+- Executable (e.g. /usr/bin/sleep):
+- OS Release (e.g. Red Hat Enterprise Linux Workstation release 7.0 (Maipo)): +-
+-
+- Custom core location: +- +- +-
Any URL that wget can download or a local path (file:///foo/bar or just /foo/bar)
+-
+-
++{vmcore_task_form} ++{usrcore_task_form} +
+
+
+diff --git a/src/manager_usrcore_task_form.xhtml b/src/manager_usrcore_task_form.xhtml +new file mode 100644 +index 0000000..c210600 +--- /dev/null ++++ b/src/manager_usrcore_task_form.xhtml +@@ -0,0 +1,17 @@ ++

userspace core

++
++
++

All of these three fields override contents of package, executable and os_release files contained in the coredump archive. If you're uploading you have just the bare (compressed) coredump, you must specify these.

++ Be more verbose in case of error
++ Package (e.g. coreutils-8.22-11.el7):
++ Executable (e.g. /usr/bin/sleep):
++ OS Release (e.g. Red Hat Enterprise Linux Workstation release 7.0 (Maipo)): ++
++
++ Custom core location: ++ ++ ++
Any URL that wget can download or a local path (file:///foo/bar or just /foo/bar)
++
++
++ +diff --git a/src/manager_vmcore_task_form.xhtml b/src/manager_vmcore_task_form.xhtml +new file mode 100644 +index 0000000..2307b3b +--- /dev/null ++++ b/src/manager_vmcore_task_form.xhtml +@@ -0,0 +1,13 @@ ++

vmcore

++
++
++ Kernel version (e.g. 2.6.32-287.el6.x86_64, empty to autodetect): ++ Be more verbose in case of error ++
++
++ Custom core location: ++ ++ ++
Any URL that wget can download or a local path (file:///foo/bar or just /foo/bar)
++
++
+-- +2.7.1 + diff --git a/0002-Add-VMCoreTask-and-UsrCoreTask-to-config.patch b/0002-Add-VMCoreTask-and-UsrCoreTask-to-config.patch new file mode 100644 index 0000000..05c318d --- /dev/null +++ b/0002-Add-VMCoreTask-and-UsrCoreTask-to-config.patch @@ -0,0 +1,28 @@ +From 48e93c23eca3800f0053d262b62e7b2f3f2f512a Mon Sep 17 00:00:00 2001 +From: Patrik Helia +Date: Fri, 19 Feb 2016 11:10:11 +0100 +Subject: [PATCH] Add VMCoreTask and UsrCoreTask to config + +/manager page returned error 500 because VMCoreTask and UsrCoreTask missed in config variable + +Signed-off-by: Patrik Helia +--- + src/lib/retrace.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/lib/retrace.py b/src/lib/retrace.py +index 8664788..9031ea9 100644 +--- a/src/lib/retrace.py ++++ b/src/lib/retrace.py +@@ -157,6 +157,8 @@ CONFIG = { + "AllowExternalDir": False, + "AllowInteractive": False, + "AllowTaskManager": False, ++ "AllowVMCoreTask" : False, ++ "AllowUsrCoreTask" : False, + "TaskManagerAuthDelete": False, + "TaskManagerDeleteUsers": [], + "UseFTPTasks": False, +-- +2.7.1 + diff --git a/retrace-server.spec b/retrace-server.spec index 02b909a..6717437 100644 --- a/retrace-server.spec +++ b/retrace-server.spec @@ -3,13 +3,15 @@ Summary: Application for remote coredump analysis Name: retrace-server Version: 1.14 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: Applications/System URL: https://fedorahosted.org/abrt/wiki/AbrtRetraceServer Source: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz # git format-patch -N -M --topo-order %%{version} +Patch0001: 0001-Allow-disabling-particular-tasks-in-the-manager.patch +Patch0002: 0002-Add-VMCoreTask-and-UsrCoreTask-to-config.patch BuildArch: noarch @@ -52,6 +54,8 @@ generation service over a network using HTTP protocol. %prep %setup -q +%patch0001 -p1 +%patch0002 -p1 %build autoreconf @@ -136,6 +140,9 @@ fi %doc COPYING INSTALL README TODO %changelog +* Fri Feb 19 2016 Jakub Filak - 1.14-2 +- Introduce AllowVMCoreTask and AllowUserCoreTask configuration options + * Tue Feb 16 2016 Jakub Filak - 1.14-1 - New upstream release 1.14