12-04-21 15:31:16 [ There were error(s) loading the rules: /tmp/rules.debug:64: syntax error - The line in question reads [64]: nat on igb1 inet proto TCP from any port any to any port 22 -> 192.168.1.12 port 22 # qoob_ssh ]
#!/usr/bin/env rubyrequire 'rest-client'require 'json'require 'base64'raise "must provide IP!" unless ARGV.size == 1ip = ARGV[0]KEY = "your API key"SECRET = "your API secret"ALIAS_UUID = "your alias UUID"BASE_URL = "https://192.168.1.1:8443/api/firewall"def empty_alias puts "emptying alias..." response = RestClient::Request.new( method: :post, url: "#{BASE_URL}/alias/setItem/#{ALIAS_UUID}", verify_ssl: OpenSSL::SSL::VERIFY_NONE, headers: { "Authorization" => "Basic " + Base64.strict_encode64("#{KEY}:#{SECRET}"), content_type: :json }, payload: { alias: { name: "server", content: "" } }.to_json ).execute raise "error" unless response.code == 200enddef set_alias_to(ip) puts "setting alias to #{ip} ..." response = RestClient::Request.new( method: :post, url: "#{BASE_URL}/alias_util/add/server", verify_ssl: OpenSSL::SSL::VERIFY_NONE, headers: { "Authorization" => "Basic " + Base64.strict_encode64("#{KEY}:#{SECRET}"), content_type: :json }, payload: { address: ip }.to_json ).execute raise "error" unless response.code == 200enddef apply puts "reconfiguring..." response = RestClient::Request.new( method: :post, url: "#{BASE_URL}/alias/reconfigure", verify_ssl: OpenSSL::SSL::VERIFY_NONE, headers: { "Authorization" => "Basic " + Base64.strict_encode64("#{KEY}:#{SECRET}"), content_type: :json }, payload: {}.to_json ).execute raise "error" unless response.code == 200endempty_aliasset_alias_to(ip)apply()puts "done!"