Skip to main content
  1. Index/

IMA (Integrity Measurement Architecture)

Table of Contents

IMA (Integrity Measurement Architecture) is a Linux kernel subsystem, merged in kernel 2.6.30, that hooks into the kernel’s file access paths — execve(), mmap(), open() — and computes a cryptographic hash of each file’s contents before it is accessed, according to a configurable policy. It is the runtime half of the Linux integrity story: where TPM PCR measurements and Secure Boot cover what was loaded during the boot sequence, IMA covers what happens after the OS is running, hashing executables, libraries, kernel modules, firmware, and configuration files as they are opened, creating a continuously updated record of everything the system has actually used.

IMA operates across four distinct modes, selectable per-rule in its policy. Measurement is the foundational mode: each hash is appended to a kernel-resident measurement log and, if a TPM is present, extended into PCR 10 — the register reserved exclusively for IMA across the Linux TPM PCR allocation. Because PCR registers can only be extended (never reset without a reboot), the aggregate value in PCR 10 accumulates a tamper-evident record of every measured file access across the system’s uptime; any software tampering with the log without also tampering with the TPM would produce a mismatch. Appraisal adds local enforcement: the kernel compares the computed hash against a reference value stored in the file’s security.ima extended attribute, and denies access if they do not match — this is how IMA can prevent execution of files that have been modified since they were last signed. Audit logs measurements to the kernel audit subsystem without enforcing. The fourth mode, protect, is implemented by the companion EVM (Extended Verification Module): EVM computes an HMAC over a file’s security extended attributes (including security.ima, security.selinux, and others) and detects offline tampering with those attributes — closing the attack where an adversary modifies a file and updates its security.ima hash to match while the system is powered off.

The primary operational use case for IMA measurement is remote runtime attestation via Keylime: a lightweight agent running on the attested system periodically produces a TPM quote over PCR 10 and the full measurement log; a remote verifier receives the quote, validates it against the TPM’s endorsement key, replays the log to confirm it matches the PCR value, and checks every entry against a policy-defined allowlist of approved file hashes. Any unexpected binary — a dropped rootkit, a modified library, an unapproved kernel module — appears as an unknown hash and immediately triggers a failed attestation state. This makes IMA the mechanism that extends the TPM’s boot-time attestation guarantee into a continuous, file-level runtime guarantee: the TPM and measured boot stack can prove what was loaded at boot; IMA and Keylime can prove what has been executed since.

Additional Information
#

Related

Keylime

Keylime is a CNCF project, originating at MIT Lincoln Laboratory, that turns the raw cryptographic primitives of the TPM into an operable remote attestation system for fleets of Linux machines. Its mission is narrow but important: given that a TPM can produce a signed quote over PCR values, and that IMA can accumulate a runtime measurement log into PCR 10, Keylime provides the infrastructure to continuously collect those quotes from many machines, verify them against policy, react to failures, and gate secret delivery on attestation success — without requiring operators to understand TPM protocols directly.

Measured Boot

Measured Boot is a boot process architecture in which each component in the boot chain — firmware, bootloader, kernel, initrd, kernel command line — is cryptographically hashed and that hash is recorded into a TPM Platform Configuration Register (PCR) before the component executes. The critical distinction from Secure Boot is in what each mechanism provides: Secure Boot is an enforcement mechanism that prevents unauthorised components from running at all; Measured Boot is a recording mechanism that creates a tamper-evident log of exactly what did run, without necessarily preventing anything. The two are complementary and typically deployed together — Secure Boot enforces a policy at boot time, Measured Boot produces the evidence that the policy was enforced as claimed. A system can have Measured Boot without Secure Boot (it records everything that ran, even unsigned components), but Secure Boot without Measured Boot provides enforcement with no attestable evidence of what was enforced.

AIDE (Advanced Intrusion Detection Environment)

AIDE (Advanced Intrusion Detection Environment) is a host-based intrusion detection tool that implements file integrity monitoring (FIM): it builds a baseline database capturing cryptographic hashes and metadata for every file it is configured to watch, and on subsequent runs compares the live filesystem against that database, reporting anything that has been added, removed, or changed. Its security premise is detection after the fact: AIDE does not prevent modifications (that is the role of fapolicyd, SELinux, and IMA), but it provides a reliable, auditable record that modifications occurred, when a check was run, and which specific attributes changed. An attacker who compromises a system and modifies a binary, a configuration file, a cron job, or an SSH authorized_keys file will leave a fingerprint in the next AIDE check — provided the database has not also been compromised, which is the central operational concern the tool’s deployment model must address.