-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fapolicyd-cli --ftype should also be able to print out the filename #292
Comments
... along with the file type. Solves issue linux-application-whitelisting#292. Signed-off-by: Bernd Finger <[email protected]>
I personally would not want automatic insertion without review. What I do is something more like (where $d is the directory to descend):
The output of this can be further processed to compare the list against the trust database. The point is, fapolicyd-cli --ftype has to be passed the full path to the file. The information should be readily available if you write the script in a way that makes it available. |
@stevegrubb - Right, my main point here is to make it easier to add new files into the fapolicyd trust file. The automatic insertion is just one (valid) use case, see below. A usual way for displaying file information would be to display the file name along with the required additional information in one line - just like the commands Then the output of
|
Displaying the file name along with the file type should rather be the default when displaying the file type, but this would be a breaking change. This was the only reason why I am proposing a new option to Or we provide a new command, like |
We could also just search for the pattern In this case, the list of executable files reported by Note: There are some differences in the outputs when checking for detailed patterns. For example, on a RHEL 9.2 test system, for a binary file, the two commands display the following: And for a Python file, the two commands display the following: |
Just a note that fapolicyd-cli should be preferred over file because it shows you how the daemon will detect the file. Although they use the same magic database there are multiple differences there like overrides in python detection and .elf parser implementation. |
Yes, there are differences where fapolicyd-cli should be preferred. When "file" suddenly added x-pie-executable when the same file was reported as x-executable in the previous release, it was decided that for consistency across a range of "file" releases, we need to do our own detection so that there are no surprises where types change on upgrade and now it doesn't work. We also do whole system scans looking for things reported as text/plain and application/octet-stream to see if they need some logic for detection. If so, we send the patch to upstream "file" and patch our database. Therefore, on older systems, we have the better detection since the upstream patch won't be available until some future "file" release. |
Relates to linux-application-whitelisting#292. Signed-off-by: Bernd Finger <[email protected]>
For finding out which files in a directory tree are candidates to be included in the fapolicyd trust file, the
fapolicyd-cli
command with the option-t
or--ftype
can be used. The problem is that the output only contains the file type but not the file name so it requires additional processing to construct the commandfapolicyd-cli --file add <FILE> --trust-file <TRUSTFILE>
.One way of adding only executables to the fapolicyd trust file is shown in this task.
A command sequence for constructing the necessary
fapolicyd-cli --file add
commands would require joining each two output lines from afind
command (the lines with odd line numbers displaying the file type and the even ones displaying the file name), like:If the command
fapolicyd-cli
was able to also display the file name in the same line as the file type, similar to thefile
command, the processing of the output for constructing thefapolicyd-cli --file add
commands could be simplified to:Maybe identifying candidates for adding to the fapolicyd trust file and actually adding them could also be done inside the fapolicyd command (e.g. using a command option for adding all executables in a directory tree) but maybe this needs to be discussed in depth elsewhere.
The text was updated successfully, but these errors were encountered: