|  | 
| 4 | 4 |   $dashboard_package = 'wazuh-dashboard', | 
| 5 | 5 |   $dashboard_service = 'wazuh-dashboard', | 
| 6 | 6 |   $dashboard_version = '4.4.0', | 
| 7 |  | -  $dashboard_user = 'admin', | 
| 8 |  | -  $dashboard_password = 'admin', | 
| 9 | 7 |   $indexer_server_ip = 'localhost', | 
| 10 | 8 |   $indexer_server_port = '9200', | 
| 11 | 9 |   $dashboard_path_certs = '/etc/wazuh-dashboard/certs', | 
|  | 
| 14 | 12 | 
 | 
| 15 | 13 |   $dashboard_server_port = '443', | 
| 16 | 14 |   $dashboard_server_host = '0.0.0.0', | 
| 17 |  | -  $dashboard_server_hosts = "https://${indexer_server_ip}:${indexer_server_port}", | 
|  | 15 | +  $indexer_server_host = "https://${indexer_server_ip}:${indexer_server_port}", | 
| 18 | 16 |   $dashboard_wazuh_api_credentials = [ | 
| 19 | 17 |     { | 
| 20 | 18 |       'id'       => 'default', | 
| 21 | 19 |       'url'      => 'https://localhost', | 
| 22 | 20 |       'port'     => '55000', | 
| 23 |  | -      'user'     => 'foo', | 
| 24 |  | -      'password' => 'bar', | 
|  | 21 | +      'user'     => 'wazuh-wui', | 
|  | 22 | +      'password' => 'wazuh-wui', | 
| 25 | 23 |     }, | 
| 26 | 24 |   ], | 
| 27 | 25 | 
 | 
| 28 | 26 |   $manage_repos = false, # Change to true when manager is not present. | 
| 29 | 27 | ) { | 
|  | 28 | + | 
| 30 | 29 |   if $manage_repos { | 
| 31 | 30 |     include wazuh::repo | 
| 32 | 31 | 
 | 
|  | 
| 84 | 83 |   } | 
| 85 | 84 | 
 | 
| 86 | 85 |   # TODO: Fully manage the opensearch_dashboards.yml and a template file resource | 
| 87 |  | -  file_line { 'Setting host for wazuh-dashboard': | 
| 88 |  | -    path    => '/etc/wazuh-dashboard/opensearch_dashboards.yml', | 
| 89 |  | -    line    => "server.host: ${dashboard_server_host}", | 
| 90 |  | -    match   => "^server.host:\s", | 
|  | 86 | +  file { '/etc/wazuh-dashboard/opensearch_dashboards.yml': | 
|  | 87 | +    owner   => 'wazuh-dashboard', | 
|  | 88 | +    group   => 'wazuh-dashboard', | 
|  | 89 | +    mode    => '0640', | 
|  | 90 | +    content => template('wazuh/opensearch_dashboards_yml.erb'), | 
| 91 | 91 |     require => Package['wazuh-dashboard'], | 
| 92 |  | -    notify  => Service['wazuh-dashboard'], | 
| 93 |  | -  } | 
| 94 |  | -  file_line { 'Setting port for wazuh-dashboard': | 
| 95 |  | -    path    => '/etc/wazuh-dashboard/opensearch_dashboards.yml', | 
| 96 |  | -    line    => "server.port: ${dashboard_server_port}", | 
| 97 |  | -    match   => "^server.port:\s", | 
| 98 |  | -    require => Package['wazuh-dashboard'], | 
| 99 |  | -    notify  => Service['wazuh-dashboard'], | 
|  | 92 | +    notify  => Service['wazuh-dashboard'] | 
| 100 | 93 |   } | 
| 101 | 94 | 
 | 
| 102 | 95 |   service { 'wazuh-dashboard': | 
|  | 
| 105 | 98 |     hasrestart => true, | 
| 106 | 99 |     name       => $dashboard_service, | 
| 107 | 100 |   } | 
|  | 101 | + | 
|  | 102 | +  file { ['/usr/share/wazuh-dashboard/data/wazuh/', | 
|  | 103 | +  '/usr/share/wazuh-dashboard/data/wazuh/config/']: | 
|  | 104 | +    ensure => 'directory', | 
|  | 105 | +    owner   => 'wazuh-dashboard', | 
|  | 106 | +    group   => 'wazuh-dashboard', | 
|  | 107 | +    mode    => '0600', | 
|  | 108 | +    require => Package['wazuh-dashboard'], | 
|  | 109 | +    notify  => Service['wazuh-dashboard'], | 
|  | 110 | +  } | 
|  | 111 | + | 
|  | 112 | +  file { '/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml': | 
|  | 113 | +    owner   => 'wazuh-dashboard', | 
|  | 114 | +    group   => 'wazuh-dashboard', | 
|  | 115 | +    mode    => '0600', | 
|  | 116 | +    content => template('wazuh/wazuh_yml.erb'), | 
|  | 117 | +    require => Package['wazuh-dashboard'], | 
|  | 118 | +    notify  => Service['wazuh-dashboard'], | 
|  | 119 | +  } | 
| 108 | 120 | } | 
0 commit comments