Sha256: 0f969a98e19b8258442701f1d0652e95c46d3c13489bed5f6de3922428aba863

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

#!/usr/bin/env ruby
require 'paloalto'
require 'paloalto/utilities/config_parser'
require 'paloalto/utilities/gem_options'

# Obtain Integration settings from Encrypted Configuration File.
PA_CONFIG_PATH = File.join(File.dirname(__FILE__), 
                          '../lib/paloalto/config/nexpose_paloalto.config')
config_path = File.expand_path(PA_CONFIG_PATH)

# Setup Logging
Paloalto.enable_logging

# Setup CLI Options
GemOptions.create_parser
          .with_banner_and_options('nexpose_paloalto')
          .with_configuration_encryption([config_path])
          .with_help_and_version('Nexpose PaloAlto', Paloalto::VERSION)
          .parse

service_data = ConfigParser.get_config(config_path)

# Setup Logging
Paloalto.enable_logging

# Use ENV instead of configuration options if they are set
nexpose_settings = Paloalto.set_variables(service_data[:nexpose_options])
pan_settings = Paloalto.set_variables(service_data[:pan_options])

nexpose_fields = %i(nexpose_url nexpose_username nexpose_password)
pan_fields= %i(pan_url pan_username pan_password)

if nexpose_fields.any? { |i| nexpose_settings[i].nil? } 
  raise "Must configure Nexpose settings before starting (by Configuration \
    file or Environment variable)"
end
  
if pan_fields.any? { |i| pan_settings[i].nil? }
  raise "Must configure PAN settings before starting (by Configuration \
    file or Environment variable)"
end

if service_data[:options][:dag].empty? && service_data[:options][:sites].empty?
  raise 'Must configure a site or a dag before starting' 
end

nexpose_settings[:dag] = service_data[:options][:dag]
nexpose_settings[:sites] = service_data[:options][:sites]
nexpose_settings[:timeout] = service_data[:options][:report_timeout]

# Start integration with all the parameters.
Paloalto.start_integration(nexpose_settings, pan_settings)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nexpose_paloalto-0.1.3 bin/nexpose_paloalto