diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-08-17 22:10:11 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-08-17 22:10:11 +0200 |
commit | f982e6f7612401a9a789bb8f40d2adca34c85c10 (patch) | |
tree | 6cf70d5b2176c74e84afe4020f456967f5dc0d6e /src | |
parent | 6c7be122acd666d4e93541179d89747aa12efb67 (diff) |
journal: set secure deletion flags for FSS file
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/journalctl.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 5c21ab0adf..25f41f6322 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -30,6 +30,8 @@ #include <time.h> #include <getopt.h> #include <sys/stat.h> +#include <sys/ioctl.h> +#include <linux/fs.h> #include <systemd/sd-journal.h> @@ -453,7 +455,7 @@ static int setup_keys(void) { size_t mpk_size, seed_size, state_size, i; uint8_t *mpk, *seed, *state; ssize_t l; - int fd = -1, r; + int fd = -1, r, attr = 0; sd_id128_t machine, boot; char *p = NULL, *k = NULL; struct FSSHeader h; @@ -530,6 +532,16 @@ static int setup_keys(void) { goto finish; } + /* Enable secure remove, exclusion from dump, synchronous + * writing and in-place updating */ + if (ioctl(fd, FS_IOC_GETFLAGS, &attr) < 0) + log_warning("FS_IOC_GETFLAGS failed: %m"); + + attr |= FS_SECRM_FL|FS_NODUMP_FL|FS_SYNC_FL|FS_NOCOW_FL; + + if (ioctl(fd, FS_IOC_SETFLAGS, &attr) < 0) + log_warning("FS_IOC_SETFLAGS failed: %m"); + zero(h); memcpy(h.signature, "KSHHRHLP", 8); h.machine_id = machine; |