[lkml]   [2021]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC][PATCH v2 06/12] diglim: Interfaces - digest_list_add, digest_list_del
Hi Roberto,

On Fri, 2021-07-30 at 13:16 +0000, Roberto Sassu wrote:

> The reason of storing the actions performed by IMA on the
> digest lists helps to determine for which purpose they can be
> used. If digest lists are used only for measurement purpose,
> it should be sufficient that digest lists are measured. The
> same applies for appraisal.

Is that assumption correct? How would you know if the digests lists
are only being used one way and not the other. For example, assuming
that the digest lists are stored on protected media, the digest lists
could be measured, but would not necessarily be appraised.

> > Adding the kernel_read_file() "READING_DIGEST_LIST" support in IMA does
> > not seem to be optional. IMA would then be calculating the digest list
> > file hash twice, once in kernel_read_file() and then, again, in
> > ima_measure_critical_data().
> I didn't include also this part: I retrieve the integrity_iint_cache for
> the opened file descriptor and I get the flags from there. If the
> IMA_MEASURED flag is set, it is not necessary to call also
> ima_measure_critical_data().

Right, assuming the file is in policy, the digest would already be
stored in the iint cache.

> > > > I understand that with your changes to ima_measure_critical_data(),
> > > > which are now in next-integrity-testing branch, allow IMA to calculate
> > > > the file data hash.
> > >
> > > Yes, correct. But actually there is another useful use case.
> > > If digest lists are not in the format supported by the kernel,
> > > the user space parser has to convert them before uploading
> > > them to the kernel.
> > >
> > > ima_measure_critical_data() would in this case measure
> > > the converted digest list (it is written directly, without
> > > sending the file path). It is easier to attest the result,
> > > instead of determining whether the user space parser
> > > produced the expected result (by checking the files it
> > > read).
> >
> > The application to properly convert the digest list file data into the
> > appropriate format would need to be trusted. I'm concerned that not
> > requiring the converted data to be signed and the signature verified is
> > introducing a new integrity gap. Perhaps between an LSM policy,
> > limiting which files may be read by the application, and an IMA policy,
> > requiring all files read by this application to be measured and the
> > signature verified, this integrity gap could be averted.
> It is the weakest point in the chain, yes. Relying on existing LSMs
> didn't seem to me a good idea, as:
> - a new policy must be installed
> - we must be sure that the policy is really enforced
> - we need to support different LSMs (SELinux for Fedora,
> Apparmor for SUSE)
> - there might be no LSM we can rely on
> For these reasons, I developed a new LSM. Its purpose is to
> identify the user space parser and for each file it opens, ensure
> that the file has been measured or appraised by IMA. If one of
> these actions are missing, it will not be set in the digest list the
> user space parser uploads to the kernel (which means that IMA
> will ignore the digest list for that specific action).

Properly identifying (all) user space parser(s) would be critical. It
would be simpler and safer to require the converted data be signed.



 \ /
  Last update: 2021-08-02 16:43    [W:0.341 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site