10장. Blocking and allowing applications by using fapolicyd
Use the fapolicyd framework to implement an application allowlist solution that helps increase system security. Setting and enforcing a policy that either allows or denies application execution based on a rule set efficiently prevents the execution of unknown and potentially malicious software.
10.1. The fapolicyd framework structure 링크 복사링크가 클립보드에 복사되었습니다!
The fapolicyd software framework controls the execution of applications based on a user-defined policy. This is one of the most efficient ways to prevent running untrusted and possibly malicious applications on the system.
- Components and trust
The
fapolicydframework provides the following components:-
fapolicydservice -
fapolicydcommand-line utilities, such as thefapolicyd-clicommand and thefagenrulesscript -
fapolicydRPM plugin
The administrator can define
allowanddenyexecution rules for any application with the option to audit based on a path, hash, MIME type, or trust.The
fapolicydframework introduces the concept of trust. An application is trusted when the system package manager correctly installs it and therefore registered in the system RPM database. Thefapolicyddaemon uses the RPM database as a list of trusted binaries and scripts.The
fapolicydRPM plugin registers any system update that is handled by either the DNF or RPM package manager. The plugin notifies thefapolicyddaemon about changes in this database. Other ways of adding applications require the creation of custom rules and restarting thefapolicydservice.For more information, see the
fapolicyd-related man pages listed by using theman -k fapolicydcommand on your system.-
- Configuration files and directories
The
fapolicydservice configuration is located in the/etc/fapolicyd/directory with the following structure:-
The
/etc/fapolicyd/fapolicyd.trustfile contains a list of trusted files. You can also use multiple trust files in the/etc/fapolicyd/trust.d/directory. -
The
/etc/fapolicyd/rules.d/directory contains files withallowanddenyexecution rules. Thefagenrulesscript merges these component rules files to the/etc/fapolicyd/compiled.rulesfile. -
The
fapolicyd.conffile contains the daemon’s configuration options. This file is useful primarily for performance-tuning purposes.
-
The
- Rules
Rules in
/etc/fapolicyd/rules.d/are organized in several files, each representing a different policy goal. The numbers at the beginning of the corresponding file names determine the order in/etc/fapolicyd/compiled.rules:10
language rules
20
Dracut-related rules
21
rules for updaters
30
patterns
40
ELF rules
41
shared objects rules
42
trusted ELF rules
70
trusted language rules
72
shell rules
90
deny execute rules
95
allow open rules
For more information and examples, see the documentation installed with the
fapolicydpackage in the/usr/share/doc/fapolicyd/directory, the/usr/share/fapolicyd/sample-rules/README-rulesfile, and thefapolicyd.rules(5)andfagenrules(8)man pages on your system.- Integrity checking
You can use one of the following ways for
fapolicydintegrity checking:- File-size checking
- Comparing SHA-256 hashes
- Integrity Measurement Architecture (IMA) subsystem
By default,
fapolicyddoes no integrity checking. Integrity checking based on the file size is fast, but an attacker can replace the content of the file and preserve its byte size. Computing and checking SHA-256 checksums is more secure, but it affects the performance of the system. Theintegrity = imaoption infapolicyd.confrequires support for files' extended attributes (also known asxattr) on all file systems containing executable files.