Skip to content

[AI-5055] DDS: OpenVPN Integration V1.0.0 #19811

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

Merged
merged 16 commits into from
May 5, 2025

Conversation

ankitarajput-crest
Copy link
Contributor

What does this PR do?

PR for a new integration OpenVPN 1.0.0

Additional Notes

-- OOTB detection rules JSON would be shared separately with the required teams as a part of separate repository .
-- Since during the standard attribute remapping we are not preserving the source attributes as per suggested best practices, it would result in filters using these standard attributes populating the values of other integrations as well as per current datadog behavior.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Changelog entries must be created for modifications to shipped code
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/ label to the PR and it will automatically open a backport PR once this one is merged

iliakur
iliakur previously approved these changes Apr 2, 2025
@temporal-github-worker-1 temporal-github-worker-1 bot dismissed iliakur’s stale review April 7, 2025 13:00

Review from iliakur is dismissed. Related teams and files:

  • agent-integrations
    • openvpn/assets/dashboards/openvpn_overview.json
rule3 %{regex("(.*?)(?=:)")}:(\s+)?\'%{notSpace} %{notSpace} %{regex("Web login authentication failed"):log_type}: \{\\'status\\': %{integer:status}, \\'user\\': \\'%{regex("(.*)(?=\\\\')"):user}\\', \\'reason\\': "%{regex("(.*)(?=\")"):reason}", \\'auth method\\': \\'%{regex("(.*?)(?=\\\\')"):auth_method}\\'}'


rule4 %{regex("(.*?)(?=:)")}:(\s+)?\'%{notSpace} %{notSpace} %{regex("Web login authentication failed"):log_type}: \{\\'status\\': %{integer:status}, \\'user\\': \\'%{regex("(.*)(?=\\\\')"):user}\\', \\'reason\\': "%{regex("(.*)(?=\")"):reason}"}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These rules have some significant overlap and could lead to fully parsing the logs multiple times. Can you reduce this redundancy?

Also, some of these seem to be JSON or keyvalue based, for example the status and user fields in rule3. Could those be extracted and remapped into the expected log fields rather than using complex parsers and regex?

Copy link
Contributor Author

@ankitarajput-crest ankitarajput-crest Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are checking on this and will update soon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • We have created two Grok parsers to handle the parsing of web authentication logs—one for the headers and another for key-value format. This separation helps eliminate overlap and reduces redundant parsing.
  • For auth method field, we observed that keys containing spaces were not correctly extracted by the data::keyvalue parser. To address this, we created static parsing rules.
  • Additionally, fields such as user and status were escaped as 'user', which prevented them from being parsed correctly by the data::keyvalue parser. To handle this, we added static rules specifically to extract these escaped fields.

matchRules: >-
rule1 \[%{regex("(.*?)(?=])")}\](\s+)?%{regex("AUTH
SUCCESS"):log_type}\s+\{%{data::keyvalue(": ",", ")}, 'auth
method': '%{regex("(.*?)(?=\\')"):auth_method}',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here - it looks like 'auth method' is a key in a JSON-like structure. Could this be parsed out into an object and then extract the value for the key you're interested in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please help us understand this comment better?

@ankitarajput-crest
Copy link
Contributor Author

@gunterd We were not able to access this PR yesterday. Let me have a look at the comments and get back to you.

grok:
supportRules: ""
matchRules: >-
rule1 \[%{regex("(.*?)(?=])")}\](\s+)?%{regex("AUTH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reduce some of the regex burden here, can you replace \[%{regex("(.*?)(?=])")}\] with (\[\-\])?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have used [%{regex("(.*?)(?=])")}] as a safekeeping to ensure that grok parser doesn't fail if different value comes in between [].
Based on our testing, we have only observed [-] hence we have updated regex to ([-]) for better efficiency.

authentication failed: {'status': 1, 'user': 'openvpn', 'reason':
'local auth failed: password verification failed'}\""
- "[-] [WEB] OUT: '2025-03-11T12:59:46+0000 [stdout#info] Web login
authentication failed: {\\'status\\': 2, \\'user\\': \\'abc\\',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these logs come in with the backslashes escaped?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we are getting those logs with backslashes escaped.

Copy link

PR Security Update

All commits in this PR up to and including b9cc37b have been reviewed and marked safe by SDLC security. For any questions, please reach out to #ci-for-external-contributors-collab on Slack.

@iliakur iliakur added this pull request to the merge queue May 5, 2025
Merged via the queue into DataDog:master with commit 0b4ffe8 May 5, 2025
47 of 48 checks passed
github-actions bot pushed a commit that referenced this pull request May 5, 2025
* Add: OpenVPN integration

* Update: labeler for openvpn

* Updated tests yaml file

* updated test yaml file

* Updated changelog number

* Updated minor changes

* Updated as per PR comments

* Update: address review comments

* Update: address review comments

* Update: minor changes and move openvpn logo

* Update: remove filter from Datadog Cloud SIEM group

* Update: CODEOWNERS

* Update: CODEOWNER add tag

* Update: address review comments

* Update: logs sample

* Update: Address review comments

---------

Co-authored-by: manan-crest <[email protected]> 0b4ffe8
Copy link

@jnhunsberger jnhunsberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need an update on the copy of the dashboard. Comment added.

"id": 6980405278649262,
"definition": {
"type": "note",
"content": "OpenVPN is a free, open-source protocol that creates secure connections between devices over the internet. It's used to create virtual private networks (VPNs).\n\n\nThe OpenVPN Overview dashboard provides an overall insights of the logs generated by OpenVPN.\n\n\nFor more information, see the [OpenVPN Integration Documentation](https://docs.datadoghq.com/integrations/openvpn/).\n\n**Tips**\n- Use the timeframe selector in the top right of the dashboard to change the default timeframe.\n- Clone this dashboard to rearrange, modify and add widgets and visualizations. ",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update copy here.
Current: The OpenVPN Overview dashboard provides an overall insights of the logs generated by OpenVPN.
Proposed: The OpenVPN Overview dashboard provides insights into the logs generated by OpenVPN.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jnhunsberger Have made the suggested changes in below raised PR.
PR Link: <link>

@shubhamvekariya-crest shubhamvekariya-crest mentioned this pull request May 16, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants