-
Notifications
You must be signed in to change notification settings - Fork 28
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
BUG: import the ausearch-test code into a new repo on github.com/linux-audit #10
Comments
I think a good first step would be to unpack the ausearch-test into a personal repository for review before inclusion in the linux-audit organization. Discussions on the mailing list have raised some questions in my mind about these tests. The same applies to #11 and the audit-validation tests. |
That's a good idea. I imported the two available versions (0.5 and 0.6) of https://github.com/WOnder93/ausearch-test What discussion and questions do you have in mind? |
Thanks for unpacking the tests @WOnder93. As far as questions are concerned, this isn't a complete list, but this is what comes to mind quickly:
|
I haven't looked closely at the Correctness is not something I would worry about, since it is just a tool for discovering possible problems. Think of it as a kind of fuzzer for
Well, there is one thing - @stevegrubb, do you have a record collection we could publish? Or how difficult do you think it would be to produce a reasonably complete collection that we could have in the public repository? |
On 2018-05-03 03:33, Ondrej Mosnáček wrote:
> * Once the tests are described somewhere, do we actually agree that these tests are correct and useful?
I haven't looked closely at the `audit-validation` test yet, but `ausearch-test` is definitely useful. It can be used for regression-testing the `ausearch` program as well as for making sure that ausearch can parse newly introduced record types.
Wait, is ausearch-test for testing ausearch, or for testing the current
state of record formats?
> * If the tests are correct and useful, does the tests need any work before we add it to the linux-audit GH organization?
Well, there is one thing - `ausearch-test` requires an `audit.log` file containing a collection of sample records (ideally acquired from real running systems). The tool's documentation expects each user to maintain their own database of records, but I think it would be much better if we have a single 'official' collection maintained inside the repository (then we could e.g. set up Travis CI on `audit-userspace` to check `ausearch` for regressions on each commit). I'm sure @stevegrubb has a personal collection somewhere, maybe he would be willing to share it? One possible problem could be that the records may contain sensitive information so we may either need to either generate some 'safe' collection or somehow filter/sanitize Steve's file if he is collecting the records from some live system(s).
@stevegrubb, do you have a record collection we could publish? Or how difficult do you think it would be to produce a reasonably complete collection that we could have in the public repository?
This would give much more consistent results, I agree, but again, wait,
I realize this is a much bigger job, but a stock test file is going to
go stale fairly quickly, but is a start. A script/program to generate
all possible events to test them for current compliance would actually
test the records rather than ausearch. Understanding the goal of the
test would be a good starting point.
So, if the test fails, does it point to the test itself, ausearch, or
new records as the cause?
|
Well, the idea is (I think):
It may also happen that a test failure uncovers a problem in the kernel or the test, but it is always the responsibility of the one who ran the test to investigate why it happened and what needs to be fixed. |
I don't see any mention of dependencies in the README. A quick inspection of the header files and Makefile would seem to indicate that
Correctness is very important to me; we need to be able to verify that the test is correct if we are going to include this in the linux-audit org here on GH. If we can't trust the test, how do we trust the test results? You bring up another point that @rgbriggs touched upon, and I mentioned too (see above): what is this actually testing? Based on your last comment it looks like this is only testing ausearch's parsing of audit records, not the record format directly? |
I didn't list the packages explicitly, but I did have the dependencies listed in the README (maybe you were looking at na older version). Anyway, I updated the README with the list of Fedora/RHEL packages to install.
OK, I will take a closer look at the code and do a proper review, but then you will still heave to trust me that I did it right :)
Exactly, it is supposed to test whether ausearch parses the records correctly and whether it filters them correctly based on the command line arguments. I guess it could also be used to test regressions in the kernel output, it depends on what you take as the frame of reference. |
So I went through the code and I found no apparent issues. I did try to play with it a bit and it was able to detect a problem when I intentionally broke something in the ausearch parser. Some notes:
|
To see the reason for the conditional, you would need to trigger USER_AVC events which is difficult to do. Examples events would come from passwd or dbus. Additionally, there seems to be no format enforced which means they really can't be searched. |
Well, I do get some on my machine even without doing anything :) Although they are not many and do not vary very much...
I see... In fact I just realized I had tried to run the current ausearch just over one of the events I found in my local trail and now that I ran it over all of them I do get some problems. So for the time being, I'll leave the condition there. I can't see any other quick solution... |
If you do put this in a repo, I have 2 patches to apply. One fixes some shell script warnings and the other adds a new test that checks single shot search options and then cumulative search options. It currently does cumulative. |
@stevegrubb Right now it is in my personal repo (https://github.com/WOnder93/ausearch-test). The plan is it will eventually get cloned into a repo under @linux-audit. I will give you commit rights to the temporary repos so you can work on them until @pcmoore decides to do the transfer. |
Source: https://people.redhat.com/sgrubb/audit/ausearch-test-0.5.tar.gz
The text was updated successfully, but these errors were encountered: