Join our Newsletter — 33% off our NHI Course
Home› Guides› fapolicyd and Linux Application Allowlisting Guide: Rules, Trust…
Guide Endpoint Security

fapolicyd and Linux Application Allowlisting Guide: Rules, Trust and Safe Enforcement on RHEL

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 27 October 2026 14 min read
On this page

Most Linux servers will run any binary an attacker manages to write to disk, which is why a web shell can so easily become a cryptominer, a scanner or a privilege escalation tool. fapolicyd, the file access policy daemon shipped with Red Hat Enterprise Linux and its derivatives, changes that default: it allows execution only of files the system already trusts, with trust coming mainly from the RPM database. The RHEL 9 DISA STIG requires it, configured as deny-all and permit-by-exception. This guide explains how fapolicyd decides, how to write rules and trust entries, how to roll it out without freezing servers, how to monitor it and where its limits are. It is for Linux engineers and security teams; Windows allowlisting (App Control for Business, AppLocker) and general allowlisting strategy are covered in the Application Allowlisting Guide.

Key takeaways

  • Trust is the package database. Anything installed by DNF or RPM is trusted automatically through the RPM plugin; everything else needs an explicit trust entry or rule, so software deployed by tarball, pip, npm or a vendor installer is blocked by default.
  • Rules are first match wins. Rule files in /etc/fapolicyd/rules.d/ are merged in lexical order by fagenrules, so a custom allow must sort before 90-deny-execute.rules.
  • Integrity checking is off by default. With integrity = none, a trusted path is trusted whatever its contents; set sha256 or ima for real protection against replaced binaries.
  • Permissive first, always. The upstream project warns that it is not hard to deadlock a system; run permissive = 1 and fapolicyd --debug-deny until the denial list is understood.
  • It does not stop root. fapolicyd is designed to stop users and exploited services running unknown code; root can change the rules or stop the daemon, so monitor for exactly that.

How fapolicyd decides

fapolicyd uses the kernel fanotify interface (kernel 4.20 or later, which added the open-for-execute permission event) to receive a permission request whenever a watched file is opened or executed. It looks up the subject (the process) and the object (the file), evaluates the compiled rules from top to bottom, and returns allow or deny before the access completes.

ElementWhere it livesWhat it does
Daemon configuration/etc/fapolicyd/fapolicyd.confPermissive mode, integrity mode, trust back-ends, watched file systems, log format, performance options
Rule units/etc/fapolicyd/rules.d/*.rulesMerged by fagenrules into /etc/fapolicyd/compiled.rules
File trust/etc/fapolicyd/fapolicyd.trust and /etc/fapolicyd/trust.d/Paths (with size and hash) trusted in addition to the RPM database
Trust database/var/lib/fapolicyd/Built from the trust back-ends (default rpmdb,file); do not delete the directory
RPM pluginInstalled with the packageTells the daemon about package installs and updates so trust stays current
Administrationfapolicyd-cli, fagenrulesTrust management, rule listing and reload, configuration checks

Default policies

Upstream ships rule units that combine into two policies. The default known-libs policy blocks execution through the dynamic loader (ld.so), requires anything executed to be trusted, and requires libraries and interpreted applications and modules to be trusted. The restrictive policy allows only ELF binaries, Python and shell scripts for trusted applications, with other languages (Perl, PHP, Ruby, Lua, OCaml) disabled unless their optional units are added. The shipped policy prevents execution from /tmp, /var/tmp and home directories because no package installs software there.

PrefixRule unit purpose (RHEL 9)
10Language definitions (MIME types treated as code)
20 and 21Dracut and updater rules so the system can still be maintained
30Patterns, such as denying execution through the runtime linker (pattern=ld_so)
40, 41, 42ELF rules, shared object rules, trusted ELF rules
70 and 72Trusted language rules and shell rules
80 (your own)Site-specific allow rules, placed before the deny rules
90Deny execute rules (90-deny-execute.rules)
95Allow open rules for non-executable access

Writing rules and trust entries

Rules take the form decision perm=<execute|open|any> <subject> : <object>, where the decision is allow, deny or an auditing variant such as deny_audit or deny_log. Subject attributes include exe, uid, auid, comm, pid, trust and pattern; object attributes include path, dir (a trailing slash makes it recursive), ftype (MIME type), trust, device and sha256hash. Paths can use glob: patterns for variable components.

Trust entry or rule?

NeedUseWhy
A vendor application installed outside RPM in /opt/vendorfapolicyd-cli --file add /opt/vendor/ --trust-file vendor then fapolicyd-cli --updateRed Hat states trust entries perform better than custom rules, and the entry records size and hash
An in-house build pipeline that deploys new binaries weeklyPackage the software as RPM where possibleThe RPM plugin keeps trust current with no manual step
Allow one interpreter to run scripts from one directoryA rule in 80-myapps.rules, for example allowing a named exe to open ftype=text/x-python in a specific dirTrust alone does not express "only this program may run these files"
Block a specific trusted but unwanted binaryA deny rule with path= or sha256hash= placed earlyRemoves execution without removing the package
Container runtimesA 25-runc.rules unit allowing runc and the loader, as Red Hat documentsContainer layers are not in the host RPM database
  • After any rule change: run fagenrules --check to see whether rules.d differs from the compiled policy, then fagenrules --load (or fapolicyd-cli --reload-rules), and confirm the order with fapolicyd-cli --list.
  • After a trusted file changes: it loses trust until refreshed with fapolicyd-cli --file update <path>. Use fapolicyd-cli --check-trustdb to find mismatches between trust entries and files on disk.
  • Configuration hygiene: fapolicyd-cli --check-config finds syntax errors and --check-watch_fs finds file systems holding executables that are not watched.
  • Keep trust narrow: trusting a whole writable directory (for example a shared application data folder) means anything written there becomes executable. Trust the binaries, not the data paths.

Integrity modes and hardening options

integrity =CheckStrengthCost and prerequisites
none (default)None: trusted path and identity are enoughWeak against a replaced trusted fileNone
sizeFile size against the trust databaseCatches accidental overwrites; upstream notes an attacker can match the sizeEffectively free
sha256fapolicyd computes SHA-256 and compares it with the trust database, plus sizeStrongCPU cost on first access to each file
imaUses the hash the kernel IMA subsystem stores in extended attributes, plus sizeStrong and cheap at run timeIMA must be configured; every file system holding code needs extended attributes and i_version support (default on XFS, iversion mount option elsewhere)
  • rpm_sha256_only = 1: forces RPM trust entries to use SHA-256 or stronger and ignores older SHA-1 or MD5 package digests. Use it with sha256 or ima integrity; the default is 0.
  • watch_fs: defaults to ext4, xfs and tmpfs. Add any other file system that can hold executables. Red Hat notes that removing tmpfs to help containers lowers security.
  • ignore_mounts (fapolicyd 1.3.8 and later): removes busy mount points from monitoring for performance; each must be mounted noexec, and upstream warns that trusted interpreters can still read and act on files there. Use it sparingly.
  • syslog_format: controls the fields in each decision log line, for example rule,dec,perm,auid,pid,exe,:,path,ftype,trust; events are limited to 512 bytes and more fields cost performance.
  • report_interval: writes daemon state and metrics files at a fixed interval, useful for health monitoring.

The ima integrity mode ties fapolicyd to the kernel integrity subsystem. See the Linux File Integrity Monitoring Guide.

Rolling out fapolicyd safely

  1. Inventory software sources: on each server role, list what runs from outside RPM: vendor agents in /opt, Python virtual environments, Node.js applications, Java application servers, scripts in home directories and container runtimes. These are the denials you will see.
  2. Install in permissive mode: deploy with configuration management (the redhat.rhel_system_roles.fapolicyd role exposes fapolicyd_setup_permissive, fapolicyd_setup_integrity, fapolicyd_setup_trust and fapolicyd_add_trusted_file) with permissive = 1.
  3. Collect denials for a full business cycle: include month-end jobs, backups and patching. Review with ausearch -ts recent -m fanotify or a summary such as ausearch --start today -m fanotify --raw | aureport --file --summary, and in a test window with fapolicyd --debug-deny --permissive.
  4. Fix by packaging, then trust, then rules: convert in-house software to RPM where you can, add trust files for vendor software, and write narrow 80- rules only for what trust cannot express.
  5. Turn on integrity: move to integrity = sha256 (or ima if IMA is already deployed) and rpm_sha256_only = 1 while still permissive, and check for new denials.
  6. Enforce in rings: set permissive = 0 on a pilot ring, then internet-facing servers, then the rest. Confirm the last rule is the catch-all deny (the STIG check expects a rule such as deny perm=any all : all, and accepts deny_audit or deny_log forms).
  7. Update deployment pipelines: any install done with rpm -i outside DNF needs fapolicyd-cli --update afterwards; Red Hat warns that skipping this can freeze the system. Non-RPM deployments must update trust in the same job.
  8. Rollback: set permissive = 1 and restart the service, or stop the service from the console. If the daemon locks up, Red Hat documents removing /var/run/fapolicyd/fapolicyd.fifo; for a corrupt trust database, stop the service, run fapolicyd-cli --delete-db and restart. Never strace the daemon: upstream warns it will deadlock the system.

Decision guidance

  • Which servers first: internet-facing web and application servers, jump hosts and servers that run few non-RPM components get the most value for the least tuning.
  • known-libs or restrictive: keep the default known-libs policy for general servers; use restrictive on appliance-like systems where you can enumerate every interpreter.
  • Developer and build hosts: pip, npm and compiler output make strict enforcement painful. Keep them permissive with alerting, and enforce on the production hosts the builds deploy to.
  • Small vs large estates: a small team can enforce on a handful of internet-facing servers with hand-maintained trust files; a large estate needs RPM packaging of internal software and trust updates built into deployment tooling, or the exception list will grow without control.

Monitoring and detection

SignalSourceWhy it matters
Denied execution in enforcing modefanotify audit events, or syslog lines with dec=denyEither a deployment that skipped trust or an intruder's tool, for example a downloaded miner (T1105 Ingress Tool Transfer) or a script dropped by a web shell
Denied ld.so executionRule hits on pattern=ld_soAttempt to run an untrusted binary through the loader to bypass the check
Changes to /etc/fapolicyd/auditd watch, for example -w /etc/fapolicyd/ -p wa -k fapolicyd_changesNew trust entries or rules are the quiet way to allow a tool
Service stopped or set permissivesystemd journal, configuration management drift reportsMaps to ATT&CK T1685 Disable or Modify Tools
Trust database mismatchesfapolicyd-cli --check-trustdb run on a scheduleTrusted files changed on disk outside the package manager

See the Linux Logging and auditd for Defenders Guide.

Metrics

  • Enforcement coverage: percentage of in-scope servers with fapolicyd running and permissive = 0 (target 100 percent for internet-facing servers).
  • Integrity coverage: percentage of enforcing servers with integrity set to sha256 or ima.
  • Denials investigated: percentage of production denials triaged within one working day (target 100 percent).
  • Exception growth: number of trust entries and custom rules outside the RPM database per server role, tracked month on month.
  • Drift: number of servers where configuration management found fapolicyd stopped, permissive or with unmanaged rule files (target zero).

Limits, identity and framework mapping

  • Root and service accounts: upstream is explicit that fapolicyd does not stop root, who can change rules or stop the daemon. It is most effective at containing exploited services that run as unprivileged service accounts, which is another reason to keep services off root. See the Linux Service Accounts and Keytab Management Guide and the Linux Privilege Escalation Techniques Guide.
  • Interpreters: a trusted interpreter can still run commands typed into it, and upstream notes that interpreters which read scripts lazily can run content added after the check if file permissions allow modification. Keep trusted scripts non-writable by service accounts. ATT&CK T1059.004 Unix Shell and T1059.006 Python remain relevant.
  • Complements, not replaces, SELinux: upstream describes SELinux as modelling how an application behaves, and fapolicyd as deciding whether the application is known. Run both. See the SELinux Guide.
  • Supply chain: a malicious package installed through the trusted repository is trusted by design. Repository and signing controls cover that gap. See the Linux Package Signing and Repository Trust Guide.
FrameworkReferenceHow fapolicyd meets it
DISA RHEL 9 STIG (V2R9 as tracked by ComplianceAsCode)RHEL-09-433010 installed, RHEL-09-433015 enabled, RHEL-09-433016 deny-all, permit-by-exceptionPackage, service and a final catch-all deny rule
NIST SP 800-53 Rev 5CM-7(2) Prevent Program Execution, CM-7(5) Authorized Software: Allow-by-exception, CM-6 Configuration SettingsTrust database plus deny rules
NIST CSF 2.0PR.PS-05 Installation and execution of unauthorized software are preventedEnforcing mode
CIS Controls v8.1Safeguards 2.5 Allowlist Authorized Software, 2.6 Allowlist Authorized Libraries, 2.7 Allowlist Authorized ScriptsELF, shared object and language rules
ISO/IEC 27001:2022 Annex AA.8.19 Installation of software on operational systemsOnly packaged or explicitly trusted software runs
MITRE D3FENDD3-EAL Executable AllowlistingThe core function
NIST SP 800-167Guide to Application WhitelistingPlanning and lifecycle guidance

Common failure patterns

  • Enforcing on day one: switching straight to enforcing breaks vendor agents, backup clients and monitoring tools, and the next incident call ends with fapolicyd disabled fleet-wide.
  • Leaving integrity at none: teams believe trusted binaries are protected, but a replaced file at a trusted path still runs. Use sha256 or ima.
  • Allow rules after the deny: a rule file named 99-myapp.rules never matches because 90-deny-execute.rules wins first; check with fapolicyd-cli --list.
  • Trusting writable directories: adding an upload, cache or home directory to the trust file makes every file dropped there executable, recreating the gap fapolicyd was meant to close.
  • Manual RPM installs without a trust update: rpm -i outside DNF without fapolicyd-cli --update leaves the database stale and, as Red Hat warns, can freeze the system.
  • No alerting on denials or on the daemon itself: enforcement without monitoring blocks tools silently and misses the attacker who simply stops the service.

Lessons from incidents

Commodity Linux intrusions very often end in a downloaded binary, and supply chain incidents can deliver one too: the malicious Ultralytics PyPI releases downloaded and ran the XMRig miner on machines that installed them. On a server enforcing the default fapolicyd policy, a freshly downloaded binary that is not in the RPM database or a trust file would be denied execution unless it landed in a trusted location, and the denial would be the alert. The same incident also shows the limit: the Python package itself came through a legitimate channel, and if a team had trusted its virtual environment directory wholesale, any binary written there would run. Trust installed code by package and hash, not by directory.

Practitioner checklist

  • Install fapolicyd on all RHEL-family servers in scope and enable the service (RHEL-09-433010 and RHEL-09-433015).
  • Run in permissive mode for a full business cycle and review every denial.
  • Package in-house software as RPM, add trust files for vendor software, and keep custom rules in an 80- unit.
  • Set integrity = sha256 or ima and rpm_sha256_only = 1 before enforcing.
  • Confirm the final rule is a catch-all deny and enforce in rings, starting with internet-facing servers.
  • Add fapolicyd-cli --update or trust updates to every deployment path outside DNF.
  • Audit /etc/fapolicyd/ with auditd and alert on service stops and permissive mode.
  • Forward denials to the SIEM with a syslog_format that includes rule, decision, user, executable and path.
  • Run fapolicyd-cli --check-trustdb and --check-watch_fs on a schedule.
  • Document the rollback steps and test them on a pilot server.

Standards and references

Related NHI Mgmt Group resources: Application Allowlisting Guide · Red Hat Enterprise Linux Security Hardening Guide · Linux Server Hardening Guide · Linux File Integrity Monitoring Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 27 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.