-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
669 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2) | ||
# Setup for Filebeat_oss | ||
class wazuh::filebeat_oss ( | ||
$filebeat_oss_elasticsearch_ip = 'localhost', | ||
$filebeat_oss_elasticsearch_port = '9200', | ||
$elasticsearch_server_ip = "\"${filebeat_oss_elasticsearch_ip}:${filebeat_oss_elasticsearch_port}\"", | ||
|
||
$filebeat_oss_package = 'filebeat', | ||
$filebeat_oss_service = 'filebeat', | ||
$filebeat_oss_elastic_user = 'admin', | ||
$filebeat_oss_elastic_password = 'admin', | ||
$filebeat_oss_version = '7.8.0', | ||
$wazuh_app_version = '3.13.1_7.8.0', | ||
$wazuh_extensions_version = 'v3.13.1', | ||
$wazuh_filebeat_module = 'wazuh-filebeat-0.1.tar.gz', | ||
){ | ||
|
||
class {'wazuh::repo_elastic_oss':} | ||
|
||
if $::osfamily == 'Debian' { | ||
Class['wazuh::repo_elastic_oss'] -> Class['apt::update'] -> Package[$filebeat_oss_package] | ||
} else { | ||
Class['wazuh::repo_elastic_oss'] -> Package[$filebeat_oss_package] | ||
} | ||
|
||
package { 'filebeat': | ||
ensure => $filebeat_oss_version, | ||
name => $filebeat_oss_package, | ||
} | ||
|
||
file { 'Configure filebeat.yml': | ||
owner => 'root', | ||
path => '/etc/filebeat/filebeat.yml', | ||
group => 'root', | ||
mode => '0644', | ||
notify => Service[$filebeat_oss_service], ## Restarts the service | ||
content => template('wazuh/filebeat_oss_yml.erb'), | ||
require => Package[$filebeat_oss_package] | ||
} | ||
|
||
exec { 'Installing wazuh-template.json...': | ||
path => '/usr/bin', | ||
command => "curl -so /etc/filebeat/wazuh-template.json 'https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json'", | ||
notify => Service[$filebeat_oss_service], | ||
require => Package[$filebeat_oss_package] | ||
} | ||
|
||
exec { 'Installing filebeat module ... Downloading package': | ||
path => '/usr/bin', | ||
command => "curl -o /root/${$wazuh_filebeat_module} https://packages.wazuh.com/3.x/filebeat/${$wazuh_filebeat_module}", | ||
} | ||
|
||
exec { 'Unpackaging ...': | ||
command => '/bin/tar -xzvf /root/wazuh-filebeat-0.1.tar.gz -C /usr/share/filebeat/module', | ||
notify => Service[$filebeat_oss_service], | ||
require => Package[$filebeat_oss_package] | ||
} | ||
|
||
file { '/usr/share/filebeat/module/wazuh': | ||
ensure => 'directory', | ||
mode => '0755', | ||
require => Package[$filebeat_oss_package] | ||
} | ||
|
||
service { 'filebeat': | ||
ensure => running, | ||
enable => true, | ||
require => Package[$filebeat_oss_package] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2) | ||
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2) | ||
# Blank container class | ||
class wazuh { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2) | ||
# Setup for Kibana_od | ||
class wazuh::kibana_od ( | ||
$kibana_od_package = 'opendistroforelasticsearch-kibana', | ||
$kibana_od_service = 'kibana', | ||
$kibana_od_version = '1.9.0', | ||
$kibana_od_elastic_user = 'admin', | ||
$kibana_od_elastic_password = 'admin', | ||
$kibana_od_app_version = '3.13.1_7.8.0', | ||
$kibana_od_elasticsearch_ip = 'localhost', | ||
$kibana_od_elasticsearch_port = '9200', | ||
|
||
$kibana_od_server_port = '5601', | ||
$kibana_od_server_host = '0.0.0.0', | ||
$kibana_od_elasticsearch_server_hosts ="https://${kibana_od_elasticsearch_ip}:${kibana_od_elasticsearch_port}", | ||
$kibana_wazuh_api_credentials = [ { | ||
'id' => 'default', | ||
'url' => 'http://localhost', | ||
'port' => '55000', | ||
'user' => 'foo', | ||
'password' => 'bar', | ||
}, | ||
] | ||
) { | ||
|
||
|
||
# install package | ||
package { 'Installing OD Kibana...': | ||
ensure => $kibana_od_version, | ||
name => $kibana_od_package, | ||
} | ||
|
||
file { 'Configure kibana.yml': | ||
owner => 'kibana', | ||
path => '/etc/kibana/kibana.yml', | ||
group => 'kibana', | ||
mode => '0644', | ||
notify => Service[$kibana_od_service], | ||
content => template('wazuh/kibana_od_yml.erb'), | ||
} | ||
|
||
service { 'kibana': | ||
ensure => running, | ||
enable => true, | ||
hasrestart => true, | ||
} | ||
|
||
exec {'Waiting for opendistro elasticsearch...': | ||
path => '/usr/bin', | ||
command => "curl -u ${kibana_od_user}:${kibana_od_password} -k -s -XGET https://${kibana_od_elasticsearch_ip}:${kibana_od_elasticsearch_port}", | ||
tries => 100, | ||
try_sleep => 3, | ||
} | ||
|
||
file {'Removing old Wazuh Kibana Plugin...': | ||
ensure => absent, | ||
path => '/usr/share/kibana/plugins/wazuh', | ||
recurse => true, | ||
purge => true, | ||
force => true, | ||
notify => Service[$kibana_od_service] | ||
} | ||
|
||
exec {'Installing Wazuh App...': | ||
path => '/usr/bin', | ||
command => "sudo -u ${kibana_od_user}:${kibana_od_password} -u kibana /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-${kibana_od_app_version}.zip", | ||
creates => '/usr/share/kibana/plugins/wazuh/package.json', | ||
notify => Service[$kibana_od_service], | ||
} | ||
|
||
exec {'Removing .wazuh index...': | ||
path => '/usr/bin', | ||
command => "curl -u ${kibana_od_user}:${kibana_od_password} -k -s -XDELETE -sL -I 'https://${kibana_od_elasticsearch_ip}:${kibana_od_elasticsearch_port}/.wazuh' -o /dev/null", | ||
notify => Service[$kibana_od_service], | ||
} | ||
|
||
file { '/usr/share/kibana/plugins/wazuh/wazuh.yml': | ||
owner => 'kibana', | ||
group => 'kibana', | ||
mode => '0644', | ||
content => template('wazuh/wazuh_yml.erb'), | ||
notify => Service[$kibana_od_service] | ||
} | ||
exec { 'Verify Kibana folders owner': | ||
path => '/usr/bin:/bin', | ||
command => "chown -R kibana:kibana /usr/share/kibana/optimize\ | ||
&& chown -R kibana:kibana /usr/share/kibana/plugins", | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.