Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/#19198_vault_priorities_incorrect_v…
Browse files Browse the repository at this point in the history
…alues
  • Loading branch information
pperezredborder committed Nov 8, 2024
2 parents 80dda4a + f7dd0cd commit 7d9b0a6
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 13 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
cookbook-rb-manager CHANGELOG
===============

## 4.4.3

- Juan Soto
- [da722bb] Create and pass split_intrusion variables to logstash config (#216)
- Rafael Gomez
- [0fc8265] pump version
- [b0e84e3] Merge branch 'master' into bugfix/#19260_Wrong_check_in_get_sensors_all_info_and_get_sensors_info_on-_sensores_with_parent_id
- Rafa Gómez
- [146cac6] Merge pull request #237 from redBorder/bugfix/#19260_Wrong_check_in_get_sensors_all_info_and_get_sensors_info_on-_sensores_with_parent_id
- jnavarrorb
- [72d2b00] Fix sensors info with all sensors (proxy childs too)
- [87628c7] Fix parent_id to real_parent_id
- [060f5d9] Fix open kafka port for all IPS
- [a9a3efe] check if redborder_parent_id is nil or sensor at redborder_parent_id is not a proxy

## 4.4.2

- jnavarrorb
- [72d2b00] Fix sensors info with all sensors (proxy childs too)
- [87628c7] Fix parent_id to real_parent_id
- [060f5d9] Fix open kafka port for all IPS
- [a9a3efe] check if redborder_parent_id is nil or sensor at redborder_parent_id is not a proxy

## 4.4.1

- JuanSheba
- [8e22478] Add creation of the logrotate file with the template
- [77bbbfb] Create Template

## 4.4.0

- Miguel Negrón
- [48ee415] Merge pull request #232 from redBorder/bugfix/#18169_rename_pmacctd_to_sfacctd_service

## 4.3.0

- Miguel Negron
- [8c6f578] Add rb-workers to service list

## 4.2.0

- manegron
Expand Down
12 changes: 7 additions & 5 deletions resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@

# geoip has been removed because is not a service
default['redborder']['services_group']['full'] = %w(consul chef-server zookeeper memcached rsyslog kafka logstash s3
postgresql redborder-postgresql nginx webui druid-broker
postgresql redborder-postgresql nginx webui rb-workers druid-broker
druid-historical druid-realtime druid-coordinator f2k
redborder-monitor pmacct redborder-dswatcher mongodb
redborder-monitor sfacctd redborder-dswatcher mongodb
redborder-events-counter http2k redborder-mem2incident)

default['redborder']['services_group']['custom'] = %w(consul)
Expand All @@ -114,7 +114,7 @@
default['redborder']['services_group']['middlemanager'] = %w(consul druid-middlemanager)
default['redborder']['services_group']['broker'] = %w(consul druid-broker)
default['redborder']['services_group']['http2k'] = %w(consul http2k)
default['redborder']['services_group']['webui'] = %w(consul nginx webui)
default['redborder']['services_group']['webui'] = %w(consul nginx webui rb-workers)
default['redborder']['services_group']['f2k'] = %w(consul f2k)
default['redborder']['services_group']['s3'] = %w(consul nginx s3)
default['redborder']['services_group']['postgresql'] = %w(consul postgresql redborder-postgresql)
Expand All @@ -139,13 +139,14 @@
default['redborder']['services']['mongodb'] = false
default['redborder']['services']['n2klocd'] = false
default['redborder']['services']['nginx'] = false
default['redborder']['services']['pmacct'] = false
default['redborder']['services']['sfacct'] = false
default['redborder']['services']['postfix'] = true
default['redborder']['services']['postgresql'] = false
default['redborder']['services']['radiusd'] = false
default['redborder']['services']['rb-aioutliers'] = false
default['redborder']['services']['rb-arubacentral'] = false
default['redborder']['services']['rb-logstatter'] = true
default['redborder']['services']['rb-workers'] = false
default['redborder']['services']['redborder-ai'] = false
default['redborder']['services']['redborder-ale'] = false
default['redborder']['services']['redborder-cep'] = false
Expand Down Expand Up @@ -181,13 +182,14 @@
default['redborder']['systemdservices']['mongodb'] = ['mongod']
default['redborder']['systemdservices']['n2klocd'] = ['n2klocd']
default['redborder']['systemdservices']['nginx'] = ['nginx']
default['redborder']['systemdservices']['pmacct'] = ['sfacctd']
default['redborder']['systemdservices']['sfacctd'] = ['sfacctd']
default['redborder']['systemdservices']['postfix'] = ['postfix']
default['redborder']['systemdservices']['postgresql'] = ['postgresql']
default['redborder']['systemdservices']['radiusd'] = ['radiusd']
default['redborder']['systemdservices']['rb-aioutliers'] = ['rb-aioutliers']
default['redborder']['systemdservices']['rb-arubacentral'] = ['rb-arubacentral']
default['redborder']['systemdservices']['rb-logstatter'] = ['rb-logstatter']
default['redborder']['systemdservices']['rb-workers'] = ['rb-workers']
default['redborder']['systemdservices']['redborder-ai'] = ['redborder-ai']
default['redborder']['systemdservices']['redborder-ale'] = ['redborder-ale']
default['redborder']['systemdservices']['redborder-cep'] = ['redborder-cep']
Expand Down
7 changes: 5 additions & 2 deletions resources/libraries/get_sensors_all_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ def get_sensors_all_info
sensor_types = %w(ips-sensor ipsv2-sensor ipscp-sensor ipsg-sensor vault-sensor flow-sensor arubacentral-sensor mse-sensor meraki-sensor cisco-cloudproxy proxy-sensor scanner-sensor mse-sensor meraki-sensor ale-sensor cep-sensor device-sensor)

sensor_types.each do |s_type|
sensors = search(:node, "role:#{s_type} AND -redborder_parent_id:*?").sort # get sensor where parent_id is nil
sensors = search(:node, "role:#{s_type}").sort # get all s_type's sensor

sensors_info[s_type] = []
sensors.each { |s| sensors_info[s_type] << s }

sensors.each do |sensor|
sensors_info[s_type] << sensor
end
end

sensors_info
Expand Down
5 changes: 3 additions & 2 deletions resources/libraries/get_sensors_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def get_sensors_info
ips-sensor ipsv2-sensor ipscp-sensor ipsg-sensor)
locations = node['redborder']['locations']
sensor_types.each do |s_type|
# get sensor where parent_id is nil
sensors = search(:node, "role:#{s_type} AND -redborder_parent_id:*?").sort
# get all s_type's sensor
sensors = search(:node, "role:#{s_type}").sort
sensors_info[s_type] = {}
sensors.each do |s|
info = {}
Expand All @@ -27,6 +27,7 @@ def get_sensors_info

info['locations'][loc] = s['redborder'][loc]
end

sensors_info[s_type][s.name] = info
end
end
Expand Down
2 changes: 1 addition & 1 deletion resources/libraries/open_kafka_port.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module RbManager
module Helpers
def get_ip_of_manager_ips
# IPS in manager mode has the role ips-sensor
sensors = search(:node, 'role:ips-sensor AND -redborder_parent_id:*?').sort
sensors = search(:node, 'role:ips-sensor').sort
sensors.map { |s| { ipaddress: s['ipaddress'] } }
end

Expand Down
2 changes: 1 addition & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
maintainer_email '[email protected]'
license 'AGPL-3.0'
description 'Installs/Configures redborder manager'
version '4.2.0'
version '4.4.3'

depends 'rb-common'
depends 'chef-server'
Expand Down
23 changes: 21 additions & 2 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,20 @@
end
end

pmacct_config 'Configure pmacct' do
if manager_services['pmacct']
if manager_services['sfacctd'] &&
node.run_state['virtual_ips'] &&
node.run_state['virtual_ips']['external'] &&
node.run_state['virtual_ips']['external']['sfacctd'] &&
node.run_state['virtual_ips']['external']['sfacctd']['ip']

sfacctd_ip = '0.0.0.0'
end

pmacct_config 'Configure pmacct (sfacctd)' do
if manager_services['sfacctd']
sensors node.run_state['sensors_info']['flow-sensor']
kafka_hosts node['redborder']['managers_per_services']['kafka']
sfacctd_ip sfacctd_ip || node['ipaddress']
action [:add, :register]
else
action [:remove, :deregister]
Expand All @@ -391,6 +401,14 @@
end
end

if manager_services['logstash']
begin
split_intrusion = data_bag_item('rBglobal', 'splitintrusion')['logstash']
rescue
split_intrusion = false
end
end

logstash_config 'Configure logstash' do
if manager_services['logstash'] && node.run_state['pipelines'] && !node.run_state['pipelines'].empty?
cdomain node['redborder']['cdomain']
Expand All @@ -404,6 +422,7 @@
vault_incidents_priority_filter node['redborder']['vault_incidents_priority_filter']
logstash_pipelines node.run_state['pipelines']
split_traffic_logstash split_traffic
split_intrusion_logstash split_intrusion
action [:add, :register]
else
action [:remove, :deregister]
Expand Down
8 changes: 8 additions & 0 deletions resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
options: node['chef-client']['options'])
end

template '/etc/logrotate.d/logstash' do
source 'logstash_log-rotate.erb'
owner 'root'
group 'root'
mode 0644
retries 2
end

service 'chef-client' do
if node['redborder']['services']['chef-client'] && node.run_state['cluster_installed']
action [:enable, :start]
Expand Down
16 changes: 16 additions & 0 deletions resources/templates/default/logstash_log-rotate.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
###############################################################################
# Generated by Chef for <%= node[:hostname] %>
###############################################################################

/var/log/logstash/*.log {
size=20M
missingok
rotate 5
compress
delaycompress
notifempty
copytruncate
postrotate
rm -f /var/log/logstash/*.gz > /dev/null
endscript
}

0 comments on commit 7d9b0a6

Please sign in to comment.