10.3. Marking files as trusted using an additional source of trust
The fapolicyd framework trusts files contained in the RPM database. You can mark additional files as trusted by modifying sources of trust.
You can modify the /etc/fapolicyd/fapolicyd.trust plain text file or files in the /etc/fapolicyd/trust.d directory, either directly using a text editor or through fapolicyd-cli commands. See the fapolicyd.trust(13) and fapolicyd-cli(8) man pages on your system for more details.
For performance reasons, mark files as trusted using fapolicyd.trust or trust.d/ rather than write custom fapolicyd rules.
Prerequisites
-
The
fapolicydframework is deployed on your system.
Procedure
Copy your custom binary to the required directory, for example:
$ cp /bin/ls /tmp $ /tmp/ls bash: /tmp/ls: Operation not permittedMark your custom binary as trusted, and store the corresponding entry to the
myappfile in/etc/fapolicyd/trust.d/:# fapolicyd-cli --file add /tmp/ls --trust-file myapp-
If you skip the
--trust-fileoption, then the previous command adds the corresponding line to/etc/fapolicyd/fapolicyd.trust. To mark all existing files in a directory as trusted, provide the directory path as an argument of the
--fileoption, for example:# fapolicyd-cli --file add /tmp/my_bin_dir/ --trust-file myapp
-
If you skip the
Update the
fapolicyddatabase:# fapolicyd-cli --update참고Changing the content of a trusted file or directory changes its checksum, and therefore,
fapolicydno longer considers it trusted.To restore trust in the new content, refresh the file trust database by using the
fapolicyd-cli --file updatecommand. If you do not provide any argument, the entire database refreshes. Alternatively, you can specify a path to a specific file or directory. Then, update the database by usingfapolicyd-cli --update.
Verification
Check that you can execute your custom binary, for example:
$ /tmp/ls ls