Skip to content

Commit

Permalink
release Wazuh indexer and dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
vcerenu committed Jan 17, 2022
1 parent 6a63dbc commit 9d176ef
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 228 deletions.
26 changes: 0 additions & 26 deletions manifests/params_wazuh-indexer.pp

This file was deleted.

14 changes: 7 additions & 7 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# apt-key added by issue #34
apt::key { 'wazuh':
id => '0DCFCA5547B19D2A6099506096B3EE5F29111145',
source => 'https://packages.wazuh.com/key/GPG-KEY-WAZUH',
source => 'https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH',
server => 'pgp.mit.edu'
}
case $::lsbdistcodename {
Expand All @@ -21,8 +21,8 @@
apt::source { 'wazuh':
ensure => present,
comment => 'This is the WAZUH Ubuntu repository',
location => 'https://packages.wazuh.com/4.x/apt',
release => 'stable',
location => 'https://packages-dev.wazuh.com/trash/apt',
release => 'unstable',
repos => 'main',
include => {
'src' => false,
Expand All @@ -37,11 +37,11 @@
case $::os[name] {
/^(CentOS|RedHat|OracleLinux|Fedora|Amazon)$/: {
if ( $::operatingsystemrelease =~ /^5.*/ ) {
$baseurl = 'https://packages.wazuh.com/4.x/yum/5/'
$gpgkey = 'http://packages.wazuh.com/key/GPG-KEY-WAZUH-5'
$baseurl = 'https://packages-dev.wazuh.com/trash/yum/5/'
$gpgkey = 'http://packages-dev.wazuh.com/key/GPG-KEY-WAZUH'
} else {
$baseurl = 'https://packages.wazuh.com/4.x/yum/'
$gpgkey = 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
$baseurl = 'https://packages-dev.wazuh.com/trash/yum/'
$gpgkey = 'https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH'
}
}
default: { fail('This ossec module has not been tested on your distribution.') }
Expand Down
57 changes: 6 additions & 51 deletions manifests/wazuh_dashboard.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
class wazuh::wazuh_dashboard (
$wazuh_dashboard_package = 'wazuh-dashboard',
$wazuh_dashboard_service = 'wazuh-dashboard',
$wazuh_dashboard_version = '1.13.2',
$wazuh_dashboard_version = '4.3.0-0.0.0.todelete',
$wazuh_dashboard_elastic_user = 'admin',
$wazuh_dashboard_elastic_password = 'admin',
$wazuh_dashboard_app_version = '4.3.0_7.10.2',
$wazuh_dashboard_app_version = '4.3.0-0.0.0.todelete',
$wazuh_dashboard_elasticsearch_ip = 'localhost',
$wazuh_dashboard_elasticsearch_port = '9200',
$wazuh_dashboard_elasticsearch_port = '9700',

$wazuh_dashboard_server_port = '5601',
$wazuh_dashboard_server_host = '0.0.0.0',
Expand All @@ -23,68 +23,23 @@
]
) {


# install package
package { 'Installing OD Kibana...':
package { 'Installing Wazuh-dashboard...':
ensure => $wazuh_dashboard_version,
name => $wazuh_dashboard_package,
}

file { 'Configure opensearch_dashboards.ym':
owner => 'kibana',
path => '/etc/wazuh-dashboard/opensearch_dashboards.ym',
group => 'kibana',
mode => '0644',
notify => Service[$wazuh_dashboard_service],
content => template('wazuh/wazuh_dashboard_yml.erb'),
}

service { 'kibana':
service { 'wazuh-dashboard':
ensure => running,
enable => true,
hasrestart => true,
}

exec {'Waiting for opendistro elasticsearch...':
exec {'Waiting for Wazuh indexer...':
path => '/usr/bin',
command => "curl -u ${wazuh_dashboard_elastic_user}:${wazuh_dashboard_elastic_password} -k -s -XGET https://${wazuh_dashboard_elasticsearch_ip}:${wazuh_dashboard_elasticsearch_port}",
tries => 100,
try_sleep => 3,
}

file {'Removing old Wazuh Kibana Plugin...':
ensure => absent,
path => '/usr/share/wazuh-dashboard/plugins/wazuh',
recurse => true,
purge => true,
force => true,
notify => Service[$wazuh_dashboard_service]
}

exec {'Installing Wazuh App...':
path => '/usr/bin',
command => "curl -u ${wazuh_dashboard_elastic_user}:${wazuh_dashboard_elastic_password} -u kibana /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-${wazuh_dashboard_app_version}.zip",
creates => '/usr/share/kibana/plugins/wazuh/package.json',
notify => Service[$wazuh_dashboard_service],
}

exec {'Removing .wazuh index...':
path => '/usr/bin',
command => "curl -u ${wazuh_dashboard_elastic_user}:${wazuh_dashboard_elastic_password} -k -s -XDELETE -sL -I 'https://${wazuh_dashboard_elasticsearch_ip}:${wazuh_dashboard_elasticsearch_port}/.wazuh' -o /dev/null",
notify => Service[$wazuh_dashboard_service],
}

file { '/usr/share/kibana/plugins/wazuh/wazuh.yml':
owner => 'kibana',
group => 'kibana',
mode => '0644',
content => template('wazuh/wazuh_yml.erb'),
notify => Service[$wazuh_dashboard_service]
}
exec { 'Verify Kibana folders owner':
path => '/usr/bin:/bin',
command => "chown -R kibana:kibana /usr/share/wazuh-dashboard/plugins",

}

}
80 changes: 25 additions & 55 deletions manifests/wazuh_indexer.pp
Original file line number Diff line number Diff line change
@@ -1,87 +1,57 @@
# Wazuh App Copyright (C) 2021 Wazuh Inc. (License GPLv2)
# Setup for wazuh-indexer
class wazuh::wazuh-indexer (
# Elasticsearch.yml configuration
class wazuh::wazuh_indexer (
# opensearch.yml configuration

$wazuh-indexer_cluster_name = 'es-wazuh',
$wazuh-indexer_node_name = 'node-01',
$wazuh-indexer_node_master = true,
$wazuh-indexer_node_data = true,
$wazuh-indexer_node_ingest = true,
$wazuh-indexer_node_max_local_storage_nodes = '1',
$wazuh-indexer_service = 'elasticsearch',
$wazuh-indexer_package = 'wazuh-indexer',
$wazuh-indexer_version = '0.0.0',
$wazuh_indexer_cluster_name = 'es-wazuh',
$wazuh_indexer_node_name = 'node-01',
$wazuh_indexer_node_master = true,
$wazuh_indexer_node_data = true,
$wazuh_indexer_node_ingest = true,
$wazuh_indexer_node_max_local_storage_nodes = '1',
$wazuh_indexer_service = 'wazuh-indexer',
$wazuh_indexer_package = 'wazuh-indexer',
$wazuh_indexer_version = '4.3.0-0.0.0.todelete',

$wazuh-indexer_path_data = '/var/lib/elasticsearch',
$wazuh-indexer_path_logs = '/var/log/elasticsearch',
$wazuh_indexer_path_data = '/var/lib/wazuh-indexer',
$wazuh_indexer_path_logs = '/var/log/wazuh-indexer',


$wazuh-indexer_ip = 'localhost',
$wazuh-indexer_port = '9200',
$wazuh-indexer_discovery_option = 'discovery.type: single-node',
$wazuh-indexer_cluster_initial_master_nodes = "#cluster.initial_master_nodes: ['node-01']",
$wazuh_indexer_ip = 'localhost',
$wazuh_indexer_port = '9700',
$wazuh_indexer_discovery_option = 'discovery.type: single-node',
$wazuh_indexer_cluster_initial_master_nodes = "#cluster.initial_master_nodes: ['node-01']",

# JVM options
$jvm_options_memmory = '1g',

){

class {'wazuh::repo_wazuh-indexer':}
class {'wazuh::repo':}


if $::osfamily == 'Debian' {
Class['wazuh::repo_wazuh-indexer'] -> Class['apt::update'] -> Package['wazuh-indexer']
Class['wazuh::repo'] -> Class['apt::update'] -> Package['wazuh-indexer']
} else {
Class['wazuh::repo_wazuh-indexer'] -> Package['wazuh-indexer']
Class['wazuh::repo'] -> Package['wazuh-indexer']
}

# install package
package { 'wazuh-indexer':
ensure => $wazuh-indexer_version,
name => $wazuh-indexer_package,
}

file { 'Configure opensearch.yml':
owner => 'wazuh-indexer',
path => '/etc/wazuh-indexer/opensearch.yml',
group => 'wazuh-indexer',
mode => '0644',
notify => Service[$wazuh-indexer_service], ## Restarts the service
content => template('wazuh/opensearch_yml.erb'),
require => Package[$wazuh-indexer_package],
}

file { 'Configure disabledlog4j.options':
owner => 'root',
path => '/etc/wazuh-indexer/jvm.options.d/disabledlog4j.options',
group => 'wazuh-indexer',
mode => '2750',
notify => Service[$wazuh-indexer_service], ## Restarts the service
content => template('wazuh/disabledlog4j_options.erb'),
require => Package[$wazuh-indexer_package],
}

file { 'Configure jvm.options':
owner => 'wazuh-indexer',
path => '/etc/wazuh-indexer/jvm.options',
group => 'wazuh-indexer',
mode => '0660',
notify => Service[$wazuh-indexer_service], ## Restarts the service
content => template('wazuh/jvm_options.erb'),
require => Package[$wazuh-indexer_package],
ensure => $wazuh_indexer_version,
name => $wazuh_indexer_package,
}

service { 'wazuh-indexer':
ensure => running,
enable => true,
require => Package[$wazuh-indexer_package],
require => Package[$wazuh_indexer_package],
}

exec { 'Insert line limits':
path => '/usr/bin:/bin/',
command => "echo 'elasticsearch - nofile 65535\nelasticsearch - memlock unlimited' >> /etc/security/limits.conf",
require => Package[$wazuh-indexer_package],
require => Package[$wazuh_indexer_package],

}

Expand All @@ -90,7 +60,7 @@
command => "chown wazuh-indexer:wazuh-indexer -R /etc/wazuh-indexer\
&& chown wazuh-indexer:wazuh-indexer -R /usr/share/wazuh-indexer\
&& chown wazuh-indexer:wazuh-indexer -R /var/lib/wazuh-indexer",
require => Package[$wazuh-indexer_package],
require => Package[$wazuh_indexer_package],

}

Expand Down
2 changes: 2 additions & 0 deletions pdk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
ignore: []
89 changes: 0 additions & 89 deletions templates/opensearch_yml.erb

This file was deleted.

0 comments on commit 9d176ef

Please sign in to comment.