Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/incident response #171

Merged
merged 7 commits into from
Jul 16, 2024
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
79 changes: 41 additions & 38 deletions resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
default['redborder']['memory_services']['n2klocd'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['redborder-cep'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['rb-aioutliers'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['redborder-mem2incident'] = { 'count': 5, 'memory': 0 }

# exclude mem services, setting memory to 0 for each.
default['redborder']['excluded_memory_services'] = %w(chef-client)
Expand All @@ -108,7 +109,7 @@
postgresql redborder-postgresql nginx webui druid-broker
druid-historical druid-realtime druid-coordinator f2k
redborder-monitor pmacct redborder-dswatcher
redborder-events-counter http2k)
redborder-events-counter http2k redborder-mem2incident)

default['redborder']['services_group']['custom'] = []
default['redborder']['services_group']['core'] = %w(consul zookeeper druid-coordinator druid-overlord hadoop-resourcemanager) # consul server
Expand Down Expand Up @@ -170,44 +171,46 @@
default['redborder']['services']['postfix'] = true
default['redborder']['services']['keepalived'] = false
default['redborder']['services']['clamav'] = true

default['redborder']['systemdservices']['chef-client'] = ['chef-client']
default['redborder']['systemdservices']['chef-server'] = ['opscode-erchef']
default['redborder']['systemdservices']['consul'] = ['consul']
default['redborder']['systemdservices']['consul-client'] = ['consul']
default['redborder']['systemdservices']['druid-realtime'] = ['druid-realtime']
default['redborder']['systemdservices']['druid-coordinator'] = ['druid-coordinator']
default['redborder']['systemdservices']['druid-historical'] = ['druid-historical']
default['redborder']['systemdservices']['druid-broker'] = ['druid-broker']
default['redborder']['systemdservices']['kafka'] = ['kafka']
default['redborder']['systemdservices']['zookeeper'] = ['zookeeper']
default['redborder']['systemdservices']['webui'] = ['webui']
default['redborder']['systemdservices']['postgresql'] = ['postgresql']
default['redborder']['systemdservices']['redborder-postgresql'] = ['redborder-postgresql']
default['redborder']['systemdservices']['nginx'] = ['nginx']
default['redborder']['systemdservices']['redborder-cep'] = ['redborder-cep']
default['redborder']['systemdservices']['rb-aioutliers'] = ['rb-aioutliers']
default['redborder']['systemdservices']['rb-logstatter'] = ['rb-logstatter']
default['redborder']['systemdservices']['rb-arubacentral'] = ['rb-arubacentral']
default['redborder']['systemdservices']['memcached'] = ['memcached']
default['redborder']['systemdservices']['s3'] = ['minio']
default['redborder']['systemdservices']['mongodb'] = ['mongod']
default['redborder']['systemdservices']['redborder-monitor'] = ['redborder-monitor']
default['redborder']['systemdservices']['redborder-scanner'] = ['redborder-scanner']
default['redborder']['systemdservices']['snmp'] = ['snmpd']
default['redborder']['systemdservices']['f2k'] = ['f2k']
default['redborder']['systemdservices']['logstash'] = ['logstash']
default['redborder']['systemdservices']['pmacct'] = ['sfacctd']
default['redborder']['systemdservices']['redborder-dswatcher'] = ['redborder-dswatcher']
default['redborder']['services']['mem2incident'] = false

default['redborder']['systemdservices']['chef-client'] = ['chef-client']
default['redborder']['systemdservices']['chef-server'] = ['opscode-erchef']
default['redborder']['systemdservices']['consul'] = ['consul']
default['redborder']['systemdservices']['consul-client'] = ['consul']
default['redborder']['systemdservices']['druid-realtime'] = ['druid-realtime']
default['redborder']['systemdservices']['druid-coordinator'] = ['druid-coordinator']
default['redborder']['systemdservices']['druid-historical'] = ['druid-historical']
default['redborder']['systemdservices']['druid-broker'] = ['druid-broker']
default['redborder']['systemdservices']['kafka'] = ['kafka']
default['redborder']['systemdservices']['zookeeper'] = ['zookeeper']
default['redborder']['systemdservices']['webui'] = ['webui']
default['redborder']['systemdservices']['postgresql'] = ['postgresql']
default['redborder']['systemdservices']['redborder-postgresql'] = ['redborder-postgresql']
default['redborder']['systemdservices']['nginx'] = ['nginx']
default['redborder']['systemdservices']['redborder-cep'] = ['redborder-cep']
default['redborder']['systemdservices']['rb-aioutliers'] = ['rb-aioutliers']
default['redborder']['systemdservices']['rb-logstatter'] = ['rb-logstatter']
default['redborder']['systemdservices']['rb-arubacentral'] = ['rb-arubacentral']
default['redborder']['systemdservices']['memcached'] = ['memcached']
default['redborder']['systemdservices']['s3'] = ['minio']
default['redborder']['systemdservices']['mongodb'] = ['mongod']
default['redborder']['systemdservices']['redborder-monitor'] = ['redborder-monitor']
default['redborder']['systemdservices']['redborder-scanner'] = ['redborder-scanner']
default['redborder']['systemdservices']['snmp'] = ['snmpd']
default['redborder']['systemdservices']['f2k'] = ['f2k']
default['redborder']['systemdservices']['logstash'] = ['logstash']
default['redborder']['systemdservices']['pmacct'] = ['sfacctd']
default['redborder']['systemdservices']['redborder-dswatcher'] = ['redborder-dswatcher']
default['redborder']['systemdservices']['redborder-events-counter'] = ['redborder-events-counter']
default['redborder']['systemdservices']['http2k'] = ['http2k']
default['redborder']['systemdservices']['rsyslog'] = ['rsyslog']
default['redborder']['systemdservices']['redborder-nmsp'] = ['redborder-nmsp']
default['redborder']['systemdservices']['redborder-ale'] = ['redborder-ale']
default['redborder']['systemdservices']['n2klocd'] = ['n2klocd']
default['redborder']['systemdservices']['radiusd'] = ['radiusd']
default['redborder']['systemdservices']['postfix'] = ['postfix']
default['redborder']['systemdservices']['keepalived'] = ['keepalived']
default['redborder']['systemdservices']['http2k'] = ['http2k']
default['redborder']['systemdservices']['rsyslog'] = ['rsyslog']
default['redborder']['systemdservices']['redborder-nmsp'] = ['redborder-nmsp']
default['redborder']['systemdservices']['redborder-ale'] = ['redborder-ale']
default['redborder']['systemdservices']['n2klocd'] = ['n2klocd']
default['redborder']['systemdservices']['radiusd'] = ['radiusd']
default['redborder']['systemdservices']['postfix'] = ['postfix']
default['redborder']['systemdservices']['keepalived'] = ['keepalived']
default['redborder']['systemdservices']['redborder-mem2incident'] = ['redborder-mem2incident']

default['redborder']['manager']['balanced'] = [ { port: 443, protocol: 'tcp', name: 'redborder webui', service: 'webui', redirected_service: 'nginx', persistence_timeout: 9600 }, { port: 2055, protocol: 'udp', name: 'netflow,ipfix/sflow daemon', service: 'f2k', redirected_service: 'f2k', persistence_timeout: 30 }, { port: 6343, protocol: 'udp', name: 'sflow daemon', service: 'sfacctd', redirected_service: 'sfacctd', persistence_timeout: 30 }, { port: 9092, protocol: 'tcp', name: 'kafka', service: 'kafka', redirected_service: 'kafka', persistence_timeout: 30 } ]

Expand Down
9 changes: 9 additions & 0 deletions resources/libraries/get_api_auth_token.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module RbManager
module Helpers
# TODO: find a good way of doing this
# Gets the first user api token
def get_api_auth_token
`echo "SELECT authentication_token FROM users WHERE id = 1;" | rb_psql redborder | awk 'NR==3 {print $1}' | tr -d '\n'`
end
end
end
1 change: 1 addition & 0 deletions resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
depends 'rb-postfix'
depends 'rb-clamav'
depends 'keepalived'
depends 'mem2incident'
11 changes: 11 additions & 0 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,17 @@
end
end

mem2incident_config 'Configure redborder-mem2incident' do
cdomain node['redborder']['cdomain']
memcached_servers node['redborder']['managers_per_services']['memcached'].map { |s| "#{s}:#{node['redborder']['memcached']['port']}" }
auth_token node.run_state['auth_token']
if manager_services['redborder-mem2incident']
action [:add, :register]
else
action [:remove, :deregister]
end
end

rb_postfix_config 'Configure postfix' do
if node['redborder']['services']['postfix']
action :add
Expand Down
1 change: 1 addition & 0 deletions resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
# set webui hosts
webui_hosts = node['redborder']['managers_per_services']['webui'].map { |z| "#{z}.node" }
node.default['redborder']['webui']['hosts'] = webui_hosts
node.run_state['auth_token'] = get_api_auth_token

# set kafka host index if kafka is enabled in this host
if node['redborder']['managers_per_services']['kafka'].include?(node.name)
Expand Down
Loading