Skip to content

Fix Filebeat_oss hardcoded sources #1465

@pearsondavid

Description

@pearsondavid

Fix hardcoded sources for wazuh-template.json & filebeat module, the manifest does not allow flexibility for these files to be downloaded from alternative location in air-gapped environments.

https://github.com/wazuh/wazuh-puppet/blob/main/manifests/filebeat_oss.pp#L48
https://github.com/wazuh/wazuh-puppet/blob/main/manifests/filebeat_oss.pp#L56

https://github.com/wazuh/wazuh-puppet/blob/main/manifests/filebeat_oss.pp#L63

Can be fixed by adding class parameters and updating resources:

  String $wazuh_filebeat_module_location = "https://packages.wazuh.com/4.x/filebeat/${wazuh_filebeat_module}",
  String $wazuh_filebeat_template_source = "https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json",
  exec { 'cleanup /etc/filebeat/wazuh-template.json':
    path    => ['/usr/bin', '/bin', '/usr/sbin', '/sbin'],
    command => 'rm -f /etc/filebeat/wazuh-template.json',
    onlyif  => 'test -f /etc/filebeat/wazuh-template.json',
    unless  => "curl -s ${$wazuh_filebeat_template_source} | cmp -s '/etc/filebeat/wazuh-template.json'",
  }

  -> file { '/etc/filebeat/wazuh-template.json':
    owner   => 'root',
    group   => 'root',
    mode    => '0440',
    replace => false,  # only copy content when file not exist
    source  => $wazuh_filebeat_template_source,
    notify  => Service['filebeat'],
    require => Package['filebeat'],
  }

  archive { "/tmp/${$wazuh_filebeat_module}":
    ensure       => present,
    source       => $wazuh_filebeat_module_location,
    extract      => true,
    extract_path => '/usr/share/filebeat/module',
    creates      => '/usr/share/filebeat/module/wazuh',
    cleanup      => true,
    notify       => Service['filebeat'],
    require      => Package['filebeat'],
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions