forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Auditbeat] Determine event.action based on diff against state (elast…
…ic#22170) Rather than using an event.action that is derived from the OS flags provided in the file notification event the FIM module will determine the event.action based on the diff between the stored state for the path and the new state. ---- Update the file-state tracking to support the case where we receive a DELETE event but we observe the file as already re-created (event.Info is not nil and hashes are likely populated). Before this change, we would report a deletion but at the same store the hashes and file info. Then, a following CREATION event would be ignored because the diff-ing logic doesn't take the previous action into account (in this case prev.action==Deleted). The best is to ignore the deletion and report on the observed file changes (if any). Otherwise we have to deal with complex logic in the cases where the OS event includes multiple actions ( ...|DELETED|...). Co-authored-by: Adrian Serrano <adrisr83@gmail.com> (cherry picked from commit 4a44fac)
- Loading branch information
1 parent
7fc2b2a
commit 5928f59
Showing
12 changed files
with
1,034 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
// +build !windows | ||
|
||
package file_integrity | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
func makeFileNonReadable(t testing.TB, path string) { | ||
if err := os.Chmod(path, 0); err != nil { | ||
t.Fatal(err) | ||
} | ||
} |
Oops, something went wrong.