class ForemanScapClient::Client
Attributes
tailored[R]
Private Instance Methods
ensure_policy_exists()
click to toggle source
Calls superclass method
ForemanScapClient::BaseClient#ensure_policy_exists
# File lib/foreman_scap_client/client.rb, line 18 def ensure_policy_exists super @tailored = policy_from_config[:tailoring_path] && !policy_from_config[:tailoring_path].empty? end
ensure_scan_file()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 62 def ensure_scan_file ensure_file :content_path, :download_path, "SCAP content" end
ensure_scan_files()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 23 def ensure_scan_files ensure_scan_file ensure_tailoring_file if tailored end
ensure_tailoring_file()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 66 def ensure_tailoring_file ensure_file :tailoring_path, :tailoring_download_path, "Tailoring file" end
local_files_subcommand()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 42 def local_files_subcommand supports_local_file_option? && !config[:fetch_remote_resources] ? '--local-files /root' : '' end
policy_from_config()
click to toggle source
remove when we have made changes to puppet module/ansible role to start namespacing existing ds policies in config
Calls superclass method
ForemanScapClient::BaseClient#policy_from_config
# File lib/foreman_scap_client/client.rb, line 14 def policy_from_config super || @config[policy_id] end
policy_namespace()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 9 def policy_namespace :ds end
scan_command()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 28 def scan_command if config[@policy_id] && config[@policy_id][:profile] && !config[@policy_id][:profile].empty? profile = "--profile #{config[@policy_id][:profile]}" else profile = '' end fetch_remote_resources = if config[:fetch_remote_resources] '--fetch-remote-resources' else '' end "oscap xccdf eval #{fetch_remote_resources} #{local_files_subcommand} #{profile} #{tailoring_subcommand} --results-arf #{results_path} #{config[@policy_id][:content_path]}" end
supports_local_file_option?()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 46 def supports_local_file_option? # OpenSCAP 1.3.6 and newer requires the `--local-files` option to use local copies of remote SDS components version, _stderr, status = Open3.capture3('rpm', '-q', '--qf', '%{version}', 'openscap') return false unless status.success? Gem::Version.new(version) >= Gem::Version.new('1.3.6') end
tailoring_subcommand()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 53 def tailoring_subcommand tailored ? "--tailoring-file #{config[policy_id][:tailoring_path]}" : "" end
upload_uri()
click to toggle source
# File lib/foreman_scap_client/client.rb, line 58 def upload_uri foreman_proxy_uri + "/compliance/arf/#{@policy_id}" end