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

[Filebeat] Add base64 function to template engine #27610

Closed
andrewkroh opened this issue Aug 26, 2021 · 2 comments · Fixed by #27681
Closed

[Filebeat] Add base64 function to template engine #27610

andrewkroh opened this issue Aug 26, 2021 · 2 comments · Fixed by #27681
Assignees

Comments

@andrewkroh
Copy link
Member

andrewkroh commented Aug 26, 2021

Describe the enhancement:

Add a base64 function to the template engine for httpjson.

Describe a specific use case for the enhancement or feature:

To be able to base64 encoding a string that is added to a header. Specifically this base64 will be used encode part of an Authorization header.

- type: httpjson
  request.transforms:
    - set:
        target: header.Date
        value: '[[ formatDate (now) ""Mon, 02 Jan 2006 15:04:05 -0700"" ]]'
    - set:
        target: header.Authorization
        value: 'Basic [[ base64 (printf "%s:%s" .IntegrationKey (hmac "sha1" .SecretKey .header.Date "\n" .request.Method "\n" .url.Host "\n" .url.Path "\n" .url.Query)) ]]'

In this example I doubt the keys I referenced in the HMAC are correct for the httpjson input, but those are the pieces of data that need to be include in the hash.

https://duo.com/docs/adminapi#authentication describes the format of the authorization header above and provides a python example.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@P1llus P1llus self-assigned this Aug 30, 2021
@P1llus
Copy link
Member

P1llus commented Aug 30, 2021

I will work on this together with Sai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants