mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-21 11:18:06 +00:00
Fixing unescaped ' characters breaking strings in message actioner command generation
This commit is contained in:
@@ -15,9 +15,9 @@ class MessageActioner < CommandActioner
|
||||
|
||||
# Return [Array] of command strings
|
||||
def command_strings
|
||||
["DISPLAY=:0 /usr/bin/notify-send '#{self.message_header}' '#{self.message_subtext}' --icon=dialog-information",
|
||||
"/usr/bin/wall #{self.username == 'root' ? '-n ' : ''}'#{self.message_header}' '#{self.message_subtext}'", # wall -n requires root
|
||||
"/bin/echo '#{self.message_subtext}' | /usr/bin/mail -s '#{self.message_header}' #{self.recipient}"]
|
||||
["DISPLAY=:0 /usr/bin/notify-send \"#{self.message_header}\" \"#{self.message_subtext}\" --icon=dialog-information",
|
||||
"/usr/bin/wall #{self.username == 'root' ? '-n ' : ''}\"#{self.message_header}\" \"#{self.message_subtext}\"", # wall -n requires root
|
||||
"/bin/echo \"#{self.message_subtext}\" | /usr/bin/mail -s \"#{self.message_header}\" #{self.recipient}"]
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -202,11 +202,17 @@ end
|
||||
|
||||
def test_actions(opts)
|
||||
db_conn = PG::Connection.open(:dbname => 'alert_events')
|
||||
alert_name = opts[:alert_to_test]
|
||||
Print.info("Testing actions associated with: #{alert_name}")
|
||||
|
||||
load_configs
|
||||
run_alert_actions(db_conn, alert_name)
|
||||
|
||||
if opts[:alert_to_test]
|
||||
alert_name = opts[:alert_to_test]
|
||||
Print.info("Testing actions associated with: #{alert_name}")
|
||||
run_alert_actions(db_conn, alert_name)
|
||||
else
|
||||
@alert_actioners.each do |actioner|
|
||||
run_alert_actions(db_conn, actioner.alert_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_db
|
||||
@@ -291,4 +297,5 @@ else
|
||||
end
|
||||
rescue Exception => e
|
||||
Print.err e.to_s, logger
|
||||
Print.err e.backtrace, logger
|
||||
end
|
||||
Reference in New Issue
Block a user