Commit Graph

7 Commits

Author SHA1 Message Date
Stefan Berger 99887fec10 ima: Also apply signatures to config files
Even though config files may be close to what could be described as
'mutuable files', we now want to give the user control over the
installation of signatures on these files as well. We enable this
through a variable in the macro file. For this, we should be aware
that the signatures of these files may become incorrect or missing
once RPM post installation scripts or other programs have modified
these configuration files.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com
2018-02-12 10:21:40 +02:00
Gleb Fotengauer-Malinovskiy a0c138592d Include system.h in ima and syslog plugins
Currently, there is no harm if config.h is not included in these files
because they are not sensitive to macros defined in config.h, but any
code added later or any plugin created using these plugins as examples
might be affected by these macros and therefore has to include config.h.

An example of bug when this header is not included properly can be seen
in the previous commit.

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
2017-03-24 12:51:39 +02:00
Stefan Berger 9d8c7b6dbd ima-plugin: Move the IMA plugin to the fsm_file_prepare hook
Since newly installed files may be invoked by post install scriptlets,
we need to have them signed before the scriptlets are executed.
Therefore, we now move the IMA plugin to the fsm_file_prepare hook.
This way we can also correctly handle skipped files without silencing
away any errors from lsetxattr().

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-10-10 15:09:52 +03:00
Stefan Berger 7d89f49c4d ima-plugin: Have executable configuration files signed
Some configuration files are executables and so they require the
signature in the extended attribute. If they are not executable,
they can be skipped.

Examples for configuration files that are also executables are
the grub files in /etc/grub.d.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-10-10 14:54:42 +03:00
Stefan Berger e9e9b66779 Fix handling of zero-length file digests
Do not try to convert a zero-length file digest to a binary representation.
Zero-length file digests may stem from directory entries and symbolic links.
Return an empty signature in this case.

Returning an empty signature results in the ima.so plugin getting a sequence
of zeroes that it would write into security.ima xattr. Check for a signature
header consisting of only zeroes and do not write it into the filesystem.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-29 17:23:44 +02:00
Fionnuala Gunter 7bcc79b239 Fix file signatures not installing
Only the first file signature was getting installed. rpmfiNext returns
the next file iterator index and -1 on termination. Now the loop correctly
terminates only when rpmfiNext return value is negative.
2015-09-01 10:49:11 +02:00
fin@linux.vnet.ibm.com 8c70222a1f IMA plugin labels ima xattr with file signatures
This plugin extracts file signatures from rpmfiles and writes them to
security.ima xattr. Only non-config file signatures are installed.

Changelog:
- use rpmfi instead of rpmfiles
- use rpmfiFN instead of fsmFsPath

Signed-off-by: Lubos Kardos <lkardos@redhat.com>
2015-08-12 14:23:31 +02:00