Skip to content

Commit

Permalink
Merge pull request #44 from redBorder/development
Browse files Browse the repository at this point in the history
Release 2.1.2
  • Loading branch information
rgomezborder authored Oct 16, 2024
2 parents ca5c693 + 524a8b5 commit f38b9af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.1
2.1.2
21 changes: 11 additions & 10 deletions resources/scripts/rb_init_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def local_tty_warning_wizard
end

opt = Getopt::Std.getopts("hrf")
if opt["h"]
if opt["h"]
printf "rb_init_conf [-r] \n"
printf " -r -> register sensor with manager\n"
printf " -f -> force configure in non local tty\n"
Expand Down Expand Up @@ -167,7 +167,7 @@ def local_tty_warning_wizard
#
list_net_conf = Dir.entries("/etc/sysconfig/network-scripts/").select {|f| !File.directory? f}
list_net_conf.each do |netconf|
next unless netconf.start_with?"ifcfg-b" # We only need the bridges
next unless netconf.start_with?"ifcfg-b" # We only need the bridges
bridge = netconf.gsub("ifcfg-","")

# If the bridge is not in the yaml file of the init_conf
Expand All @@ -189,7 +189,7 @@ def local_tty_warning_wizard
end
end
end

#
# Remove bridges and delete related files
#
Expand All @@ -204,9 +204,9 @@ def local_tty_warning_wizard
# TODO: Check if with checking that start with b is enough to know if is a bridge
if iface.start_with?"b"
puts "Deleting dev bridge #{iface}"
system("ip link del #{iface}")
system("ip link del #{iface}")
end

# Remove the files from /etc/sysconfig/network-scripts directory
File.delete(iface_path_file) if File.exist?(iface_path_file)
end
Expand Down Expand Up @@ -251,7 +251,7 @@ def local_tty_warning_wizard
end
end

# Configure NETWORK
# Configure NETWORK
network['interfaces'].each do |iface|
dev = iface['device']
iface_mode = iface['mode']
Expand Down Expand Up @@ -322,11 +322,12 @@ def local_tty_warning_wizard

#Firewall rules
if !network.nil? #Firewall rules are not needed in cloud environments
#snmp
system('firewall-cmd --permanent --zone=public --add-port=161/udp &>/dev/null')
system('firewall-cmd --permanent --zone=public --add-port=162/udp &>/dev/null')

# Add rules here

# Reload firewalld configuration
#system("firewall-cmd --reload &>/dev/null")
system('firewall-cmd --reload &>/dev/null')

end

Expand Down Expand Up @@ -361,7 +362,7 @@ def local_tty_warning_wizard
puts "Sensor registered to the manager, please wait..."
puts "You can see logs in /var/log/rb-register-common/register.log"
system('/usr/lib/redborder/bin/rb_register_finish.sh > /var/log/rb-register-common/register.log 2>&1')
puts "Registration and configuration finished!"
puts "Registration and configuration finished!"
else
puts "Error: rb_associate_sensor.rb failed with exit status #{$?.exitstatus}. Please review #{INITCONF} file or network configuration..."
end
Expand Down

0 comments on commit f38b9af

Please sign in to comment.