Re: [systemd-devel] [PATCH] [RFCv6] Optionally save core dumps as plain files

2013-05-14 Thread Oleksii Shevchuk
Colin Walters walt...@verbum.org writes:

 So...what do you think about dropping the User/Group settings,
 having /var/log/coredump have the same permissions as the journal?  I.e.
 owned by root:root and with an ACL for access by adm or whatever?

I like this
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] [RFCv6] Optionally save core dumps as plain files

2013-05-09 Thread Colin Walters
On Tue, 2013-04-30 at 22:32 +0300, Oleksii Shevchuk wrote:

 +termvarnameUser=/varname/term
 +termvarnameGroup=/varname/term
 +
 +listitemparaEnforce UID/GID of
 +literalsystemd-coredump/literal while 
 loading
 +and storing coredump. 

Like having the adm group be able to read core files or something?
Would people really want that?  

 If not set, then uid/gid of

then the

 +crashed process will be used. This can be 
 used
 +for allowing user or group of users
 +to have access to system core dumps.

This can be used to allow a user or group of users...

 +varlistentry
 +termvarnameFileStorage=/varname/term
 +
 +listitemparaOne of
 +literalvolatile/literal and,
 +literalpersistent/literal
 +value.

One of literalvolatile/ or literalpersistent/.

 If literalvolatile/literal, core dump will be
 +stored as file to 
 /run/log/coredump/MACHINE-ID/COMM-TMPSUFFIX location;
 +if literalpersistent/literal -- to
 +/var/log/coredump/MACHINE-ID/COMM-TMPSUFFIX 
 location.

I'm uncertain about including COMM (a user-controlled string) in
filenames.  Perhaps sanitized.

 +Storage directory will be created if not 
 exists. If
 +literalnone/literal, then core dump will 
 not be stored
 +as file at all.

not be stored. ?  But here's where ideally we at least ship something
capable of extracting backtraces.

 +literalUser=/literal and 
 literalGroup=/literal
 +not setted, then directory will be created 
 with 1777

not set.  And really world writable?  Why?  Shouldn't systemd-coredump
be the only thing capable of writing to the directory?  Note we could
open() the fd as root, and then drop privileges.

 +
 filename/var/log/coredump/MACHINE-ID/filename. If value equals
 +to zero, then backend will be ommited.

omitted.

 +if (!config-user) {
 +mode |= S_IRGRP | S_IWGRP | S_IXGRP;
 +mode |= S_IROTH | S_IWOTH | S_IXOTH;

Ok right, so looking at the actual code, we setresuid early on to the
dumping user, and then rely on world-writability.   It would be a lot
better to do what I suggested above and call open() first and then drop
credentials?

For what it's worth I just looked at:
http://bazaar.launchpad.net/~daisy-pluckers/whoopsie/trunk/view/head:/src/whoopsie.c
They simply rely on a static kernel core pattern and monitor the
directory with inotify, which is interesting.  The downside I guess is
that the kernel will bindly keep filling up the disk, whereas doing the
dumping in userspace we can have more flexible control over placement
and storage usage.

So...what do you think about dropping the User/Group settings,
having /var/log/coredump have the same permissions as the journal?  I.e.
owned by root:root and with an ACL for access by adm or whatever?



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] [RFCv6] Optionally save core dumps as plain files

2013-04-30 Thread Oleksii Shevchuk
Introduce configuration file: /etc/systemd/coredump.conf with
configurable uid/gid parameters, optional backends to journal
and files, per storage size limits

Default filestorage choosed as /run/log/coredump or /var/log/coredump
with next reason:
1. These files produced with systemd component
2. These files registered with journal
---
 Makefile-man.am  |   1 +
 Makefile.am  |  13 +-
 man/coredump.conf.xml| 142 ++
 src/core/manager.c   |   1 +
 src/journal/coredump-gperf.gperf |  22 ++
 src/journal/coredump.c   | 567 +++
 src/journal/coredump.conf|  15 ++
 src/journal/coredump.h   |  51 
 src/journal/journald-server.h|   2 +-
 9 files changed, 703 insertions(+), 111 deletions(-)
 create mode 100644 man/coredump.conf.xml
 create mode 100644 src/journal/coredump-gperf.gperf
 create mode 100644 src/journal/coredump.conf
 create mode 100644 src/journal/coredump.h

diff --git a/Makefile-man.am b/Makefile-man.am
index 4f14a6a..c442201 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -8,6 +8,7 @@ MANPAGES += \
man/hostname.5 \
man/journalctl.1 \
man/journald.conf.5 \
+   man/coredump.conf.5 \
man/kernel-command-line.7 \
man/kernel-install.8 \
man/locale.conf.5 \
diff --git a/Makefile.am b/Makefile.am
index 9e0f5fb..e985bb6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2881,7 +2881,8 @@ nodist_systemunit_DATA += \
units/systemd-journal-flush.service
 
 dist_pkgsysconf_DATA += \
-   src/journal/journald.conf
+   src/journal/journald.conf \
+   src/journal/coredump.conf
 
 pkgconfiglib_DATA += \
src/journal/libsystemd-journal.pc
@@ -2900,10 +2901,12 @@ EXTRA_DIST += \
src/journal/libsystemd-journal.sym \
units/systemd-journald.service.in \
units/systemd-journal-flush.service.in \
-   src/journal/journald-gperf.gperf
+   src/journal/journald-gperf.gperf \
+   src/journal/coredump-gperf.gperf
 
 CLEANFILES += \
-   src/journal/journald-gperf.c
+   src/journal/journald-gperf.c \
+   src/journal/coredump-gperf.c
 
 # 
--
 if HAVE_MICROHTTPD
@@ -2948,10 +2951,12 @@ EXTRA_DIST += \
 # 
--
 if ENABLE_COREDUMP
 systemd_coredump_SOURCES = \
-   src/journal/coredump.c
+   src/journal/coredump.c \
+   src/journal/coredump-gperf.c
 
 systemd_coredump_LDADD = \
libsystemd-journal-internal.la \
+   libsystemd-id128-internal.la \
libsystemd-label.la \
libsystemd-shared.la
 
diff --git a/man/coredump.conf.xml b/man/coredump.conf.xml
new file mode 100644
index 000..8ab92c1
--- /dev/null
+++ b/man/coredump.conf.xml
@@ -0,0 +1,142 @@
+?xml version='1.0'? !--*-nxml-*--
+?xml-stylesheet type=text/xsl 
href=http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl;?
+!DOCTYPE refentry PUBLIC -//OASIS//DTD DocBook XML V4.2//EN
+http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd;
+
+!--
+  This file is part of systemd.
+
+  Copyright 2013 Lennart Poettering
+ Oleksii Shevchuk
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see http://www.gnu.org/licenses/.
+--
+
+refentry id=coredump.conf
+refentryinfo
+titlecoredump.conf/title
+productnamesystemd/productname
+
+authorgroup
+author
+contribDeveloper/contrib
+firstnameLennart/firstname
+surnamePoettering/surname
+emaillenn...@poettering.net/email
+/author
+author
+contribDeveloper/contrib
+firstnameOleksii/firstname
+surnameShevchuk/surname
+emailalx...@gmail.com/email
+/author
+/authorgroup
+/refentryinfo
+
+refmeta
+refentrytitlecoredump.conf/refentrytitle
+manvolnum5/manvolnum
+/refmeta
+
+refnamediv
+refnamecoredump.conf/refname
+  

Re: [systemd-devel] [PATCH] [RFCv6] Optionally save core dumps as plain files

2013-04-30 Thread Colin Walters
Since I've been submitting minor bandaid fixes for
src/journal/coredump.c, let me say that while I haven't looked at this
patch in detail, the idea and the outlines of the code make a lot of
sense to me, and I'd be very happy if it landed.

If it needs review, I could probably do that sometime this week.  Or is
it blocked on the large binary blobs should go in the journal issue?




___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] [RFCv6] Optionally save core dumps as plain files

2013-04-30 Thread Oleksii Shevchuk
 If it needs review, I could probably do that sometime this week.  Or is
 it blocked on the large binary blobs should go in the journal issue?

I don't think it's really blocked, so I will be glad to have review :)
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel