Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
cookbook-rb-proxy CHANGELOG
===============

## 4.1.3

- Juan Soto
- [133047f] Get flow sensors
- [70a85d7] Send flow sensors to firewall cookbook
- [6372c75] Define flow sensors in the proxies

## 4.1.2

- Pablo Pérez
Expand Down
16 changes: 16 additions & 0 deletions resources/libraries/get_flow_sensors_info.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module RbProxy
module Helpers
def get_flow_sensors_info(sensor_type)
sensors_info = []
begin
sensors = search(:role, 'run_list:role\[proxy-sensor\]')
.map { |role| role.override_attributes['redborder']['sensors_mapping'][sensor_type.to_s] }
.reject { |s_type| s_type.nil? || s_type.empty? }
sensors_info.concat(sensors) unless sensors.empty?
rescue NoMethodError
sensors_info = []
end
sensors_info
end
end
end
2 changes: 1 addition & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email '[email protected]'
license 'AGPL-3.0'
description 'Installs/Configures redborder proxy'
version '4.1.2'
version '4.1.3'

depends 'rb-common'
depends 'rb-selinux'
Expand Down
1 change: 1 addition & 0 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
end

rb_firewall_config 'Configure Firewall' do
flow_sensor_in_proxy_nodes node.run_state['sensors_info_all']['flow-sensor']
vault_sensor_in_proxy_nodes node.run_state['sensors_info_all']['vault-sensor']
if proxy_services['firewall']
action :add
Expand Down
3 changes: 3 additions & 0 deletions resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
# get sensors info full info
node.run_state['sensors_info_all'] = get_sensors_all_info()

# get flow sensors in proxy info
node.run_state['sensors_info_all']['flow-sensor'] = get_flow_sensors_info('flow')

# get namespaces
node.run_state['namespaces'] = get_namespaces

Expand Down