beats icon indicating copy to clipboard operation
beats copied to clipboard

[Filebeat] Do not run `o365audit` input and `o365` module in FIPS builds

Open ycombinator opened this issue 6 months ago • 10 comments

Proposed commit message

This PR ensures that the Filebeat o365audit input will not start in FIPS-capable distributions of Filebeat, as the input indirectly depends on code that is not FIPS-compliant. Specifically, the o365audit input depends on the github.com/Azure/azure-sdk-for-go/sdk/azidentity package. This package, in turn, depends on the golang.org/x/crypto/pkcs12 package, which is not FIPS-compliant. Further, the SDK doesn't plan to offer a way to disable the use of this package at compile time (see https://github.com/Azure/azure-sdk-for-go/issues/24336).

In addition to the o365audit input, the o365 module will also not start in FIPS-capable distributions of Filebeat, as this module uses the o365audit input.

Attempting to run a FIPS-capable distribution of Filebeat with either the o365audit input or the o365 module configured will result in Filebeat not starting up and an error in the Filebeat logs like so:

{"log.level":"error","@timestamp":"2025-06-24T15:41:43.799-0700","log.origin":{"function":"github.com/elastic/beats/v7/libbeat/cmd/instance.handleError","file.name":"instance/beat.go","file.line":1355},"message":"Exiting: Failed to start crawler: starting input failed: running a FIPS-capable distribution but input [o365audit] is not FIPS capable","service.name":"filebeat","ecs.version":"1.6.0"}

The o365audit input declares itself as not being FIPS-capable by implementing the FIPSAwareInput interface and making its IsFIPSCapable() method return false (see also: https://github.com/elastic/beats/pull/44920).

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [ ] ~I have made corresponding change to the default configuration files~
  • [ ] ~I have added tests that prove my fix is effective or that my feature works~
  • [ ] ~I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.~

Disruptive User Impact

FIPS-capable artifacts of Filebeat will not start the o365 module or the o365audit input.

$ mage clean && FIPS=true mage build
$ cat <<EOF > filebeat-test-input.yml
filebeat.inputs:
- type: o365audit
  id: id-nofips
  enabled: true
  application_id: foo
  tenant_id: bar
  client_secret: qux

output.console:
  enabled: true
EOF
$ ./filebeat -c ./filebeat-test-input.yml -e
$ cat <<EOF > filebeat-test-module.yml
filebeat.modules:
- module: o365
  audit:
    enabled: true
    var.application_id: "<MyApplicationID>"
    var.tenants:
     - id: "<MyTenantID>"
       name: "mytenant.onmicrosoft.com"
    var.client_secret: "<YourClientSecretHere>"

output.console:
  enabled: true
EOF
$ ./filebeat -c ./filebeat-test-module.yml -e

ycombinator avatar Jun 18 '25 20:06 ycombinator

:robot: GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

github-actions[bot] avatar Jun 18 '25 20:06 github-actions[bot]

This pull request does not have a backport label. If this is a bug or security fix, could you label this PR @ycombinator? 🙏. For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

mergify[bot] avatar Jun 18 '25 20:06 mergify[bot]

This looks like two PRs, one enabling and one that is what's described on the tin. Could we separate them?

Created https://github.com/elastic/beats/pull/44920 to enable the module exclusion. Will rework this PR here to only be about what's on the tin once the enabling PR is merged.

ycombinator avatar Jun 19 '25 05:06 ycombinator

Also, please include the import path that leads to the concerning import.

Update the PR description. Let me know if that looks good to you.

ycombinator avatar Jun 19 '25 05:06 ycombinator

Let me know if that looks good to you.

Thanks. Crystal clear now.

efd6 avatar Jun 19 '25 05:06 efd6

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

elasticmachine avatar Jun 20 '25 07:06 elasticmachine

@ycombinator Can you update the title and propose commit message to explain how this works?

efd6 avatar Jun 24 '25 22:06 efd6

@ycombinator Can you update the title and propose commit message to explain how this works?

Done. Let me know if you want me to include the implementation notes, i.e. use of the FIPSAwareInput interface, in the commit message too. I left that out as I figured we wanted the message to be more user-facing but happy to add it in if you think it'll be valuable.

ycombinator avatar Jun 24 '25 22:06 ycombinator

I'd like the implementation details there.

efd6 avatar Jun 24 '25 22:06 efd6

I'd like the implementation details there.

Added.

ycombinator avatar Jun 24 '25 23:06 ycombinator

I was testing the changes in this PR again this morning and I'm seeing some flaky behavior. Sometimes Filebeat stops with the "Exiting: Failed to start crawler: starting input failed: running a FIPS-capable distribution but input [o365audit] is not FIPS capable" error message as expected but sometimes it just hangs and never exits. Investigating...

ycombinator avatar Jun 25 '25 14:06 ycombinator

I was testing the changes in this PR again this morning and I'm seeing some flaky behavior. Sometimes Filebeat stops with the "Exiting: Failed to start crawler: starting input failed: running a FIPS-capable distribution but input [o365audit] is not FIPS capable" error message as expected but sometimes it just hangs and never exits. Investigating...

Found a corner-case bug in Filebeat unrelated to this PR: https://github.com/elastic/beats/issues/45034

As such, this PR here is still good to go.

ycombinator avatar Jun 25 '25 21:06 ycombinator

@Mergifyio backport 9.1

ycombinator avatar Jun 28 '25 00:06 ycombinator

backport 9.1

✅ Backports have been created

  • Backport to branch 9.1 not needed, change already in branch 9.1

mergify[bot] avatar Jun 28 '25 00:06 mergify[bot]