Skip to content

Metricbeat can't automatically connect #248

Open
@widhalmt

Description

@widhalmt

When running the collection with defaults (only activating Metricbeat) it fails, because the variable elasticsearch_http_security isn't set for Metricbeat hosts. This looks like it's some legacy code from before we built the collection. It's possible that Auditbeat suffers the same problem.

I'll investigate and I hope I can provide a solution.

Activity

added this to the 1.0.0 milestone on Aug 24, 2023
self-assigned this
on Sep 12, 2023
widhalmt

widhalmt commented on Sep 12, 2023

@widhalmt
MemberAuthor

There is a deeper lying confusion about when to enable TLS in connections to Elasticsearch. If you browse all roles in the collection you will different conditions that will enable TLS for the connection to Elasticsearch. Most only allow TLS when the full stack variable is set.

I think we should allow to have TLS with or without the full stack variable being set (e.g. using managed Elasticsearch). So my idea is to have a local variable in each role to en- or disable TLS. It should default to true/enabled and be set automatically to true when the full stack is used.

added a commit that references this issue on Sep 12, 2023
357865e
linked a pull request that will close this issue on Sep 12, 2023
widhalmt

widhalmt commented on Dec 1, 2023

@widhalmt
MemberAuthor

I guess, I found the culprit: https://github.com/NETWAYS/ansible-collection-elasticstack/blob/main/roles/beats/templates/metricbeat.yml.j2#L18

Here we use a variable for a password that's not set anywhere. We're using the hardcoded user elastic which is bad, security-wise (looks like something that's leftover from a testing environment) with a password that looks like it's somehow generated or read but this happens nowhere.

I hoped for a module for user management before we need to create more users the way we did with Logstash. But it looks, like we need to copy the code from logstash-security.yml and adapt it for Beats. So we can create our own beats user as a makeshift solution. Don't put too much effort into it - we'll replace it with a module anyway.

widhalmt

widhalmt commented on Dec 1, 2023

@widhalmt
MemberAuthor

Part of the solution should also be to make sure, metricbeat setup is only run on a single host and only one that has access to Elasticsearch and Kibana

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

    Participants

    @widhalmt

    Issue actions

      Metricbeat can't automatically connect · Issue #248 · NETWAYS/ansible-collection-elasticstack