summaryrefslogtreecommitdiff
path: root/src/journal/journald-audit.c
AgeCommit message (Collapse)AuthorFilesLines
2019-10-31tree-wide: drop missing.hYu Watanabe1-1/+1
2019-06-20tree-wide: drop alloca() in loopYu Watanabe1-2/+5
2019-04-29codespell: fix spelling errorsBen Boeckel1-1/+1
2019-01-26tree-wide: use newa() instead of alloca() wherever we canLennart Poettering1-1/+1
Typesafety is nice. And this way we can take benefit of the new size assert() the previous commit added.
2018-11-17journald: check whether sscanf has changed the value corresponding to %nEvgeny Vereshchagin1-1/+2
It's possible for sscanf to receive strings containing all three fields and not matching the template at the same time. When this happens the value of k doesn't change, which basically means that process_audit_string tries to access memory randomly. Sometimes it works and sometimes it doesn't :-) See also https://bugzilla.redhat.com/show_bug.cgi?id=1059314.
2018-11-16tests: add a fuzzer for process_audit_stringEvgeny Vereshchagin1-1/+1
2018-10-18tree-wide: introduce setsockopt_int() helper and make use of it everywhereLennart Poettering1-2/+2
As suggested by @heftig: https://github.com/systemd/systemd/commit/6d5e65f6454212cd400d0ebda34978a9f20cc26a#commitcomment-30938667
2018-10-15tree-wide: add a single version of "static const int one = 1"Lennart Poettering1-2/+1
All over the place we define local variables for the various sockopts that take a bool-like "int" value. Sometimes they are const, sometimes static, sometimes both, sometimes neither. Let's clean this up, introduce a common const variable "const_int_one" (as well as one matching "const_int_zero") and use it everywhere, all acorss the codebase.
2018-10-13journal: voidify fd_nonblock()Lennart Poettering1-1/+1
CID #1396098 CID #1396096 CID #1396091 CID #1396086
2018-06-19add _AUDIT_TYPE_NAME field to audit records in the journalJérémy Rosen1-2/+5
2018-06-18do not filter out deprecated USER audit messagesJérémy Rosen1-2/+2
2018-06-14tree-wide: remove Lennart's copyright linesLennart Poettering1-3/+0
These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
2018-06-14tree-wide: drop 'This file is part of systemd' blurbLennart Poettering1-2/+0
This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
2018-04-06tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek1-13/+0
Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
2017-11-19Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek1-0/+1
This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-16core: implement /run/systemd/units/-based path for passing unit info from ↵Lennart Poettering1-10/+9
PID 1 to journald And let's make use of it to implement two new unit settings with it: 1. LogLevelMax= is a new per-unit setting that may be used to configure log priority filtering: set it to LogLevelMax=notice and only messages of level "notice" and lower (i.e. more important) will be processed, all others are dropped. 2. LogExtraFields= is a new per-unit setting for configuring per-unit journal fields, that are implicitly included in every log record generated by the unit's processes. It takes field/value pairs in the form of FOO=BAR. Also, related to this, one exisiting unit setting is ported to this new facility: 3. The invocation ID is now pulled from /run/systemd/units/ instead of cgroupfs xattrs. This substantially relaxes requirements of systemd on the kernel version and the privileges it runs with (specifically, cgroupfs xattrs are not available in containers, since they are stored in kernel memory, and hence are unsafe to permit to lesser privileged code). /run/systemd/units/ is a new directory, which contains a number of files and symlinks encoding the above information. PID 1 creates and manages these files, and journald reads them from there. Note that this is supposed to be a direct path between PID 1 and the journal only, due to the special runtime environment the journal runs in. Normally, today we shouldn't introduce new interfaces that (mis-)use a file system as IPC framework, and instead just an IPC system, but this is very hard to do between the journal and PID 1, as long as the IPC system is a subject PID 1 manages, and itself a client to the journal. This patch cleans up a couple of types used in journal code: specifically we switch to size_t for a couple of memory-sizing values, as size_t is the right choice for everything that is memory. Fixes: #4089 Fixes: #3041 Fixes: #4441
2017-11-16journal: reindent field mapping tablesLennart Poettering1-23/+23
Let's fix up whitespace so that the tables look nicely aligned.
2017-11-16journal: make use of IOVEC_MAKE() where it makes senseLennart Poettering1-6/+2
2017-10-04tree-wide: use IN_SET macro (#6977)Yu Watanabe1-4/+4
2017-10-02tree-wide: use IN_SET where possibleAndreas Rammhold1-1/+1
In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
2017-09-22io-util: add new IOVEC_INIT/IOVEC_MAKE macrosLennart Poettering1-7/+7
This adds IOVEC_INIT() and IOVEC_MAKE() for initializing iovec structures from a pointer and a size. On top of these IOVEC_INIT_STRING() and IOVEC_MAKE_STRING() are added which take a string and automatically determine the size of the string using strlen(). This patch removes the old IOVEC_SET_STRING() macro, given that IOVEC_MAKE_STRING() is now useful for similar purposes. Note that the old IOVEC_SET_STRING() invocations were two characters shorter than the new ones using IOVEC_MAKE_STRING(), but I think the new syntax is more readable and more generic as it simply resolves to a C99 literal structure initialization. Moreover, we can use very similar syntax now for initializing strings and pointer+size iovec entries. We canalso use the new macros to initialize function parameters on-the-fly or array definitions. And given that we shouldn't have so many ways to do the same stuff, let's just settle on the new macros. (This also converts some code to use _cleanup_ where dynamically allocated strings were using IOVEC_SET_STRING() before, to modernize things a bit)
2017-07-31journald: add minimal client metadata cachingLennart Poettering1-1/+1
Cache client metadata, in order to be improve runtime behaviour under pressure. This is inspired by @vcaputo's work, specifically: https://github.com/systemd/systemd/pull/2280 That code implements related but different semantics. For a longer explanation what this change implements please have a look at the long source comment this patch adds to journald-context.c. After this commit: # time bash -c 'dd bs=$((1024*1024)) count=$((1*1024)) if=/dev/urandom | systemd-cat' 1024+0 records in 1024+0 records out 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 11.2783 s, 95.2 MB/s real 0m11.283s user 0m0.007s sys 0m6.216s Before this commit: # time bash -c 'dd bs=$((1024*1024)) count=$((1*1024)) if=/dev/urandom | systemd-cat' 1024+0 records in 1024+0 records out 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 52.0788 s, 20.6 MB/s real 0m52.099s user 0m0.014s sys 0m7.170s As side effect, this corrects the journal's rate limiter feature: we now always use the unit name as key for the ratelimiter.
2016-02-22tree-wide: make ++/-- usage consistent WRT spacingVito Caputo1-3/+3
Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack1-2/+0
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2016-01-26journald: fix LOG_AUTH facility in audit codeLennart Poettering1-2/+2
Fixes: #2304
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering1-0/+1
2015-10-27io-util.h: move iovec stuff from macro.h to io-util.hLennart Poettering1-1/+2
2015-10-27util-lib: split out hex/dec/oct encoding/decoding into its own fileLennart Poettering1-0/+1
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering1-1/+2
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering1-1/+2
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-09-09tree-wide: drop {} from one-line if blocksLennart Poettering1-2/+1
Patch via coccinelle.
2015-05-20journald: handle more gracefully when bind() fails on audit socketsLennart Poettering1-3/+8
2015-04-23journal: use audit event names instead of numbersZbigniew Jędrzejewski-Szmek1-3/+5
<audit-1400> is replaced by AVC, etc. A fallback mechanism is provided for unlisted event types. Occasionally new types are added to the kernel, but not too often. Add a simple "test", which simply prints the mapping.
2015-03-14journald: add syslog fields for audit messagesZbigniew Jędrzejewski-Szmek1-1/+5
Audit messages would be displayed as "unknown[1]". Also specify AUTH as facility... This seems to be the closest match (/* security/authorization messages */).
2015-01-22Assorted format fixesZbigniew Jędrzejewski-Szmek1-1/+1
Types used for pids and uids in various interfaces are unpredictable. Too bad.
2015-01-05journald: prefix exported calls with "server_", unexport unnecessary callsLennart Poettering1-1/+1
2014-12-30tree-wide: spelling fixesVeres Lajos1-2/+2
https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
2014-11-28treewide: another round of simplificationsMichal Schmidt1-8/+4
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt1-3/+3
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: more log_*_errno + return simplificationsMichal Schmidt1-12/+6
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt1-4/+4
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt1-4/+4
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-06journal: adjust audit log messages a bitLennart Poettering1-2/+2
2014-11-04journald: include audit message type number in MESSAGE= stringLennart Poettering1-2/+3
2014-11-04journal: also consider audit fields with '-' validLennart Poettering1-3/+13
2014-11-04journald: don't pass around SO_TIMESTAMP timestamp for audit, which we don't ↵Lennart Poettering1-4/+3
have anyway
2014-11-04journald: suppress low-level audit text prefix in MESSAGE= fieldLennart Poettering1-2/+6
Let's make the log output more readable, and the header can be reconstructed in full from the other fields
2014-11-04journald: properly decode audit's proctitle= fieldLennart Poettering1-3/+17
2014-11-04journald: enable audit in the kernel when initializingLennart Poettering1-0/+50
Similar to auditd actually turn on auditing as we are starting. This way we can operate entirely without auditd around.
2014-11-03journald: there's no point in turning on SO_TIMESTAMP for audit sockets, ↵Lennart Poettering1-6/+0
audit doesn't support timestamps anyway