Re: Kdump with signed images

Mimi Zohar
2012-10-26T01:18:22Z

On Thu, 2012-10-25 at 14:55 -0400, Vivek Goyal wrote:
> On Thu, Oct 25, 2012 at 02:40:21PM -0400, Mimi Zohar wrote:
> > On Thu, 2012-10-25 at 10:10 -0400, Vivek Goyal wrote:
> > > On Thu, Oct 25, 2012 at 02:10:01AM -0400, Mimi Zohar wrote:
> > >
> > > [..]
> > > > IMA-appraisal verifies the integrity of file data, while EVM verifies
> > > > the integrity of the file metadata, such as LSM and IMA-appraisal
> > > > labels. Both 'security.ima' and 'security.evm' can contain digital
> > > > signatures.
> > >
> > > But the private key for creating these digital signature needs to be
> > > on the target system?
> > >
> > > Thanks
> > > Vivek
> >
> > Absolutely not. The public key needs to be added to the _ima or _evm
> > keyrings. Roberto Sassu modified dracut and later made equivalent
> > changes to systemd. Both have been upstreamed.
>
> Putting public key in _ima or _evm keyring is not the problem. This is
> just the verification part.
>
> > Dmitry has a package
> > that labels the filesystem called ima-evm-utils, which supports hash
> > (IMA), hmac(EVM) and digital signatures(both).
> >
> > We're hoping that distro's would label all immutable files, not only elf
> > executables, with digital signatures and mutable files with a hash.
>
> So this labeling (digital signing) can happen at build time?

There is nothing inherently preventing it from happening at build time.
Elana Reshetova gave a talk at LSS 2012 on modifying RPM
http://lwn.net/Articles/518265/.

> I suspect you need labeling to happen at system install time? If yes,
> installer does not have the private key to sign anything.

The installed system needs to be labeled, but how that occurs is
dependent on your environment (eg. flash, rpm based install). Neither
of these mechanisms would require the build private key.

On a running system, the package installer, after verifying the package
integrity, would install each file with the associated 'security.ima'
extended attribute. The 'security.evm' digital signature would be
installed with an HMAC, calculated using a system unique key.

> IOW, if distro sign a file, they will most likely put signatures in
> ELF header (something along the lines of signing PE/COFF binaries).

Rusty was definitely against putting the signature in the ELF header for
kernel modules. Why would this be any different?

> But
> I think you need digital signatures to be put in security.ima which are
> stored in xattrs and xattrs are not generated till you put file in
> question on target file system.
>
> Thanks
> Vivek

The 'security.ima' digital signature would be created as part of the
build process and stored as an extended attribute with the file, like
other metadata. On install, the file, extended attributes and other
metadata would be copied to the target file system.

Mimi