Skip to content
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

Add a minimum TTL to auditbeat reverse DNS resolution #18709

Closed
ansell opened this issue May 24, 2020 · 5 comments · Fixed by #18986
Closed

Add a minimum TTL to auditbeat reverse DNS resolution #18709

ansell opened this issue May 24, 2020 · 5 comments · Fixed by #18986
Labels
enhancement good first issue Indicates a good issue for first-time contributors libbeat :Processors

Comments

@ansell
Copy link
Contributor

ansell commented May 24, 2020

Describe the enhancement:

I am having an issue with auditbeat performing reverse DNS resolution too often. However, it doesn't look like a bug, as the responses seem to have TTL: 0, and based on the documentation it appears as though that response value is honoured and the responses are never cached by design:

https://www.elastic.co/guide/en/beats/auditbeat/master/processor-dns.html

Describe a specific use case for the enhancement or feature:

It would be very useful for me to be able to configure a minimum TTL for caching successful auditbeat reverse DNS resolutions to allow TTL: 0 responses to be cached for the minimum configured time rather than never cached.

Reverse DNS requests are generally out-of-system requests, so there is also the potential for DoS if malicious users are aware of the use of auditbeat reverse DNS resolution and this issue.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 24, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/siem (Team:SIEM)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label May 25, 2020
@andrewkroh andrewkroh added :Processors enhancement libbeat good first issue Indicates a good issue for first-time contributors labels May 26, 2020
@andrewkroh
Copy link
Member

It's probably a pretty simple enhancement to make if anyone is interested in contributing. It would involve adding a new configuration option to the success cache then update the code to set a minimum bound on the cache TTL value. It would need a test case and docs update too.

// CacheSettings define the caching behavior for an individual cache.
type CacheSettings struct {
// TTL value for items in cache. Not used for success because we use TTL
// from the DNS record.
TTL time.Duration `config:"ttl"`

expires: now.Add(time.Duration(ptr.TTL) * time.Second),

@ansell
Copy link
Contributor Author

ansell commented Jun 4, 2020

@andrewkroh I attempted to make the necessary changes, but not sure how to test them so I am not sure if they are actually working. I have previously been using the dns processor with the auditbeat system socket module that doesn't seem to be open sourced. I have signed the CLA, so feel free to take this commit and complete it:

ansell@b736d97

@andrewkroh
Copy link
Member

hey @ansell, can you please open a PR with that patch? I can take a look at it and try to push in some unit tests to go with it.

@ansell
Copy link
Contributor Author

ansell commented Jun 4, 2020

@andrewkroh PR is at #18986 . I have enabled "Maintainer push access" to the branch.

ansell added a commit to ansell/beats that referenced this issue Jul 16, 2020
ansell added a commit to ansell/beats that referenced this issue Jul 18, 2020
andrewkroh pushed a commit that referenced this issue Aug 10, 2020
An enhancement to add a minimum alternative cache TTL to the libbeat dns processor for successful DNS responses. This ensures that TTL=0 successful reverse DNS responses can be cached to avoid sending the same reverse DNS request again within a short period of time.

The libbeat dns processor is used as a reverse DNS annotator for auditbeat events. Some of these IP addresses respond to reverse DNS requests with TTL=0 in the responses. These were causing load issues for my systems when I had the reverse DNS processor enabled for auditbeat.

The new settings is `success_cache.min_ttl`.

Closes #18709

Signed-off-by: Peter Ansell <[email protected]>
Co-authored-by: Marc Guasch <[email protected]>
andrewkroh pushed a commit to andrewkroh/beats that referenced this issue Aug 10, 2020
An enhancement to add a minimum alternative cache TTL to the libbeat dns processor for successful DNS responses. This ensures that TTL=0 successful reverse DNS responses can be cached to avoid sending the same reverse DNS request again within a short period of time.

The libbeat dns processor is used as a reverse DNS annotator for auditbeat events. Some of these IP addresses respond to reverse DNS requests with TTL=0 in the responses. These were causing load issues for my systems when I had the reverse DNS processor enabled for auditbeat.

The new settings is `success_cache.min_ttl`.

Closes elastic#18709

Signed-off-by: Peter Ansell <[email protected]>
Co-authored-by: Marc Guasch <[email protected]>
(cherry picked from commit 72da5a6)
andrewkroh added a commit that referenced this issue Aug 11, 2020
…esponses (#20525)

* Add success cache minimum TTL for DNS responses (#18986)

An enhancement to add a minimum alternative cache TTL to the libbeat dns processor for successful DNS responses. This ensures that TTL=0 successful reverse DNS responses can be cached to avoid sending the same reverse DNS request again within a short period of time.

The libbeat dns processor is used as a reverse DNS annotator for auditbeat events. Some of these IP addresses respond to reverse DNS requests with TTL=0 in the responses. These were causing load issues for my systems when I had the reverse DNS processor enabled for auditbeat.

The new settings is `success_cache.min_ttl`.

Closes #18709

Signed-off-by: Peter Ansell <[email protected]>
Co-authored-by: Marc Guasch <[email protected]>
(cherry picked from commit 72da5a6)

* Update CHANGELOG.next.asciidoc

Co-authored-by: Peter Ansell <[email protected]>
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this issue Oct 14, 2020
An enhancement to add a minimum alternative cache TTL to the libbeat dns processor for successful DNS responses. This ensures that TTL=0 successful reverse DNS responses can be cached to avoid sending the same reverse DNS request again within a short period of time.

The libbeat dns processor is used as a reverse DNS annotator for auditbeat events. Some of these IP addresses respond to reverse DNS requests with TTL=0 in the responses. These were causing load issues for my systems when I had the reverse DNS processor enabled for auditbeat.

The new settings is `success_cache.min_ttl`.

Closes elastic#18709

Signed-off-by: Peter Ansell <[email protected]>
Co-authored-by: Marc Guasch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Indicates a good issue for first-time contributors libbeat :Processors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants