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
Compat DNS logging - v6 #3287
Closed
Closed
Compat DNS logging - v6 #3287
Conversation
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 patch adds a new configuration for dns, introducing a "version" that permits to switch between the new and old format to provide backward compatibility. The new configuration is made up of these new fields: - version - requests (query) - response (answer) - types (custom)
This adds two new output formats that permits to reduce the number of line logged for a dns answer because actually an event is logged for each answer. With this patch, only an event that contains all the answers is logged. The formats are named 'detailed' and 'grouped'. The first format provides a list of answers with the following fields: - rrname - rrdata - ttl - rdata The second format provides a list of record data grouped by their type. The output below is an example of the formats: { "timestamp": "2017-11-29T10:27:18.148282+0100", "flow_id": 268864910185905, "in_iface": "wlp2s0", "event_type": "dns", "src_ip": "192.168.1.254", "src_port": 53, "dest_ip": "192.168.1.176", "dest_port": 52609, "proto": "UDP", "dns": { "type": "answer", "id": 3654, "rcode": "NOERROR", "answers": [ { "rrname": "wordpress.org", "rrtype": "A", "ttl": 544, "rdata": "66.155.40.249" }, { "rrname": "wordpress.org", "rrtype": "A", "ttl": 544, "rdata": "66.155.40.250" } ], "grouped": { "A": [ "66.155.40.249", "66.155.40.250" ] } } }
This adds some public functions needed to add dns information when an alert is logged.
This changes LogQuery and LogAnswer functions returning a json object instead of writing it in a log file. In this way it's possible to reuse them to add dns info into an alert. The following is an alert record with dns: { "timestamp": "2017-07-31T15:01:17.885281+0200", "event_type": "alert", "src_ip": "8.8.8.8", ... "dns": { "query": [ { "type": "query", "id": 25394, "rrname": "notifications.google.com", "rrtype": "A", "tx_id": 0 } ], "answer": { "type": "answer", "id": 25394, "rcode": "NOERROR", "answers": [ { "rrname": "notifications.google.com", "rrtype": "CNAME", "ttl": 3599, "rdata": "plus.l.google.com" }, { "rrname": "plus.l.google.com", "rrtype": "A", "ttl": 299, "rdata": "216.58.205.174" } ] } } }
Log the authorities just like the answers, as a list under the authorities key.
This changes the logic a bit for v2, checking the rrtype of the query to see if the response should be logged.
jasonish
approved these changes
Mar 14, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good addition.
|
Merged
Merged in #3288 with a small commit message typo fix. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As #3212, changing: