Skip to content

ima: larger digests and extensible template support

Mimi Zohar lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest23 patches 7 repliesIn review
  2. v1 RFC20 patches 0 repliesSuperseded

Changelog from the cover letter

- fix lindent, sparse, checkpath warnings/errors
- define a new extended attribute type, which includes the file data hash algorithm.
- template changes:
- simplify walking the binary measurement list
- simplify calculating the template data hash
- simplify parsing measurement entries by always prefixing the template data hash with the hash algorithm.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23crypto: provide single place for hash algo informationcrypto/Kconfig crypto/Makefile crypto/hash_info.c +2 more+137 -07 replies
2/23keys: change asymmetric keys to use common hash definitionscrypto/asymmetric_keys/Kconfig crypto/asymmetric_keys/public_key.c crypto/asymmetric_keys/rsa.c +5 more+28 -480 replies
3/23ima: provide support for arbitrary hash algorithmscrypto/asymmetric_keys/x509_parser.h crypto/asymmetric_keys/x509_public_key.c security/integrity/ima/Kconfig +6 more+100 -350 replies
4/23ima: read and use signature hash algorithmsecurity/integrity/digsig_asymmetric.c security/integrity/ima/ima.h security/integrity/ima/ima_api.c +3 more+94 -250 replies
5/23ima: pass full xattr with the signaturesecurity/integrity/digsig.c security/integrity/evm/evm_main.c security/integrity/ima/ima_appraise.c +1 more+7 -50 replies
6/23ima: use dynamically allocated hash storagesecurity/integrity/iint.c security/integrity/ima/ima_api.c security/integrity/ima/ima_appraise.c +1 more+49 -300 replies
7/23ima: differentiate between template hash and file data hash sizessecurity/integrity/ima/ima.h security/integrity/ima/ima_api.c security/integrity/ima/ima_crypto.c +3 more+12 -120 replies
8/23ima: provide dedicated hash algo allocation functionsecurity/integrity/ima/ima_crypto.c+29 -140 replies
9/23ima: support arbitrary hash algorithms in ima_calc_buffer_hashsecurity/integrity/ima/ima_api.c security/integrity/ima/ima_crypto.c+25 -60 replies
10/23ima: ima_calc_boot_agregate must use SHA1security/integrity/ima/ima.h security/integrity/ima/ima_crypto.c security/integrity/ima/ima_init.c+31 -50 replies
11/23ima: pass the file descriptor to ima_add_violation()security/integrity/ima/ima.h security/integrity/ima/ima_api.c security/integrity/ima/ima_main.c+5 -50 replies
12/23ima: pass the filename argument up to ima_add_template_entry()security/integrity/ima/ima.h security/integrity/ima/ima_api.c security/integrity/ima/ima_init.c +1 more+13 -100 replies
13/23ima: define new function ima_alloc_init_template() to APIsecurity/integrity/ima/ima.h security/integrity/ima/ima_api.c security/integrity/ima/ima_init.c+76 -390 replies
14/23ima: new templates management mechanismDocumentation/security/00-INDEX Documentation/security/IMA-templates.txt security/integrity/ima/Makefile +3 more+235 -10 replies
15/23ima: define template fields library and new helperssecurity/integrity/ima/Makefile security/integrity/ima/ima.h security/integrity/ima/ima_fs.c +3 more+242 -80 replies
16/23ima: define new template ima-ng and template fields d-ng and n-ngsecurity/integrity/ima/ima_template.c security/integrity/ima/ima_template_lib.c security/integrity/ima/ima_template_lib.h+150 -170 replies
17/23ima: switch to new template management mechanismsecurity/integrity/ima/ima.h security/integrity/ima/ima_api.c security/integrity/ima/ima_crypto.c +2 more+107 -970 replies
18/23ima: add audit log support for larger hashessecurity/integrity/ima/ima_api.c+6 -00 replies
19/23ima: defer determining the appraisal hash algorithm for 'ima' templatesecurity/integrity/ima/ima_main.c+5 -10 replies
20/23ima: add Kconfig default measurement list templatesecurity/integrity/ima/Kconfig security/integrity/ima/ima_template.c+27 -20 replies
21/23ima: define kernel parameter 'ima_template=' to change configured defaultDocumentation/kernel-parameters.txt security/integrity/ima/ima_template.c+36 -00 replies
22/23ima: enable support for larger default filedata hash algorithmsDocumentation/kernel-parameters.txt security/integrity/ima/Kconfig security/integrity/ima/ima_main.c+64 -30 replies
23/23ima: provide hash algo info in the xattrsecurity/integrity/ima/ima_appraise.c security/integrity/integrity.h+59 -150 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/23] ima: larger digests and extensible template support

This patch set adds support for additional hash algorithms with larger digests, as well as support for additional file metadata in the IMA measurement list. The existing IMA measurement list entries, which are exposed to userspace via the securityfs ascii/binary_runtime_measurement lists, are fixed length, containing a file data hash, limited to a 20 byte digest, and a pathname, limited to 255 characters. Adding larger digest support for signature verification, without the template changes, would result in hashing the file twice, once for appraising the file signature and, again, for the measurement list.

This patch set defines an extensible template architecture with support for larger hash algorithms. A description of the new template architecture is described in the "ima: new templates management mechanism" patch description and, with more detail, in Documentation/security/IMA-templates.txt. The two initial templates defined are: the original 'ima', for backwards compatibility, and 'ima-ng', which eliminates the digest and pathname size limitations. Additional templates, that include other file metadata (eg. uid/gid, LSM subject/object labels, file data signatures) will be posted separately.

Two changes were made, since posting this patch set back in July
http://marc.info/?l=linux-security-module&m=137410629309961&w=2. Namely, the measurement list can now be walked and verified, without understanding the template field data specifics; and "mutable" files can be labeled based on different hash algorithms. Walking and verifying the measurement list without understanding the template field data specifics, will allow new templates to be defined in the kernel, without breaking userspace applications. Defining a new extended attribute format, which includes the file hash algorithm, eliminates the need for relabeling "mutable" files.

Changelog:
- fix lindent, sparse, checkpath warnings/errors
- define a new extended attribute type, which includes the file data hash algorithm.
- template changes:
- simplify walking the binary measurement list
- simplify calculating the template data hash
- simplify parsing measurement entries by always prefixing the template data hash with the hash algorithm.

Mimi

Dmitry Kasatkin (10):
crypto: provide single place for hash algo information
keys: change asymmetric keys to use common hash definitions
ima: provide support for arbitrary hash algorithms
ima: read and use signature hash algorithm
ima: pass full xattr with the signature
ima: use dynamically allocated hash storage
ima: provide dedicated hash algo allocation function
ima: support arbitrary hash algorithms in ima_calc_buffer_hash
ima: ima_calc_boot_agregate must use SHA1
ima: provide hash algo info in the xattr

Mimi Zohar (4):
ima: differentiate between template hash and file data hash sizes
ima: add audit log support for larger hashes
ima: add Kconfig default measurement list template
ima: enable support for larger default filedata hash algorithms

Roberto Sassu (9):
ima: pass the file descriptor to ima_add_violation()
ima: pass the filename argument up to ima_add_template_entry()
ima: define new function ima_alloc_init_template() to API
ima: new templates management mechanism
ima: define template fields library and new helpers
ima: define new template ima-ng and template fields d-ng and n-ng
ima: switch to new template management mechanism
ima: defer determining the appraisal hash algorithm for 'ima' template
ima: define kernel parameter 'ima_template=' to change configured
default

 Documentation/kernel-parameters.txt       |  11 +-
 Documentation/security/00-INDEX           |   2 +
 Documentation/security/IMA-templates.txt  |  87 +++++++++
 crypto/Kconfig                            |   3 +
 crypto/Makefile                           |   1 +
 crypto/asymmetric_keys/Kconfig            |   1 +
 crypto/asymmetric_keys/public_key.c       |  12 --
 crypto/asymmetric_keys/rsa.c              |  14 +-
 crypto/asymmetric_keys/x509_cert_parser.c |  12 +-
 crypto/asymmetric_keys/x509_public_key.c  |   6 +-
 crypto/hash_info.c                        |  56 ++++++
 include/crypto/hash_info.h                |  40 ++++
 include/crypto/public_key.h               |  18 +-
 include/uapi/linux/hash_info.h            |  37 ++++
 kernel/module_signing.c                   |   8 +-
 security/integrity/digsig.c               |   5 +-
 security/integrity/digsig_asymmetric.c    |  11 --
 security/integrity/evm/evm_main.c         |   4 +-
 security/integrity/iint.c                 |   2 +
 security/integrity/ima/Kconfig            |  61 ++++++
 security/integrity/ima/Makefile           |   2 +-
 security/integrity/ima/ima.h              |  95 +++++++--
 security/integrity/ima/ima_api.c          | 129 ++++++++----
 security/integrity/ima/ima_appraise.c     | 100 ++++++++--
 security/integrity/ima/ima_crypto.c       | 134 +++++++++++--
 security/integrity/ima/ima_fs.c           |  64 +++---
 security/integrity/ima/ima_init.c         |  37 ++--
 security/integrity/ima/ima_main.c         |  50 ++++-
 security/integrity/ima/ima_queue.c        |  10 +-
 security/integrity/ima/ima_template.c     | 175 +++++++++++++++++
 security/integrity/ima/ima_template_lib.c | 313 ++++++++++++++++++++++++++++++
 security/integrity/ima/ima_template_lib.h |  39 ++++
 security/integrity/integrity.h            |  38 +++-
 33 files changed, 1368 insertions(+), 209 deletions(-)
 create mode 100644 Documentation/security/IMA-templates.txt
 create mode 100644 crypto/hash_info.c
 create mode 100644 include/crypto/hash_info.h
 create mode 100644 include/uapi/linux/hash_info.h
 create mode 100644 security/integrity/ima/ima_template.c
 create mode 100644 security/integrity/ima/ima_template_lib.c
 create mode 100644 security/integrity/ima/ima_template_lib.h
Signature · 1 line
1.8.1.4