foreman_scap_client 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee515e83b0f3905864064b90029612792b2c607fa45b2d1e0b8d57739f1724aa
|
4
|
+
data.tar.gz: 62f2894c2f3e40fe977aff6f7b22e04add6c41a177da6be9061ed741432f8a1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz: '
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08dc4cc7aec0dc4fea47b5202ee9b4b79aa409f18a45cf3d9c2602549d1d92ccc30bf1eafd6137f927f02e4fa4beecf3da595c3fc2f8ade50be71c7defe86316'
|
7
|
+
data.tar.gz: 41c69b9e16d6fcb586012fb6f57f581f0088d352176f3c62772ab409258592d4bc698b6f902e44361c3bdd2c4b7dbab4a791d4d554e4d6815bc810ab6616b3c4
|
data/bin/foreman_scap_client
CHANGED
@@ -12,12 +12,11 @@ end
|
|
12
12
|
|
13
13
|
if args.size == 1
|
14
14
|
ForemanScapClient::Client.new.run(args[0].to_i, skip_upload)
|
15
|
+
# Left around for compatibility
|
15
16
|
elsif args.size == 2 && args[0] == 'ds'
|
16
17
|
ForemanScapClient::Client.new.run(args[1].to_i, skip_upload)
|
17
|
-
elsif args.size == 2 && args[0] == 'oval'
|
18
|
-
ForemanScapClient::OvalClient.new.run(args[1].to_i, skip_upload)
|
19
18
|
else
|
20
|
-
puts "Usage: #{$0} [ds
|
19
|
+
puts "Usage: #{$0} [ds] policy_id [--skip-upload]"
|
21
20
|
puts " where policy_id is a key used in config file"
|
22
21
|
exit 2
|
23
22
|
end
|
data/config/config.yaml.example
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rubygems' if RUBY_VERSION.start_with? '1.8'
|
2
1
|
require 'yaml'
|
3
2
|
require 'tmpdir'
|
4
3
|
require 'net/http'
|
@@ -71,17 +70,13 @@ module ForemanScapClient
|
|
71
70
|
puts "DEBUG: running: " + scan_command
|
72
71
|
puts "with ENV vars: #{scan_command_env_vars}" unless scan_command_env_vars.empty?
|
73
72
|
|
74
|
-
|
75
|
-
legacy_run_scan
|
76
|
-
else
|
77
|
-
run_scan
|
78
|
-
end
|
73
|
+
run_scan
|
79
74
|
end
|
80
75
|
|
81
76
|
def run_scan
|
82
77
|
stdout_str, error_str, result = Open3.capture3(scan_command_env_vars, scan_command)
|
83
78
|
if result.success? || result.exitstatus == 2
|
84
|
-
|
79
|
+
error_str.each_line { |item| print item if item.start_with?('WARNING:') || item.start_with?('Downloading') }
|
85
80
|
@report = results_path
|
86
81
|
else
|
87
82
|
puts 'Scan failed'
|
@@ -91,19 +86,6 @@ module ForemanScapClient
|
|
91
86
|
end
|
92
87
|
end
|
93
88
|
|
94
|
-
def legacy_run_scan
|
95
|
-
warn_proxy_not_supported
|
96
|
-
result = `#{scan_command}`
|
97
|
-
|
98
|
-
if $?.success? || $?.exitstatus == 2
|
99
|
-
@report = results_path
|
100
|
-
else
|
101
|
-
puts 'Scan failed'
|
102
|
-
puts result
|
103
|
-
exit(2)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
89
|
def scan_command_env_vars
|
108
90
|
if http_proxy_uri
|
109
91
|
{
|
@@ -130,10 +112,6 @@ module ForemanScapClient
|
|
130
112
|
"#{results_path}.bz2"
|
131
113
|
end
|
132
114
|
|
133
|
-
def warn_proxy_not_supported
|
134
|
-
puts 'Configuration for HTTP(S) proxy found but not supported for ruby 1.8' if http_proxy_uri
|
135
|
-
end
|
136
|
-
|
137
115
|
def bzip_command
|
138
116
|
"/usr/bin/env bzip2 #{results_path}"
|
139
117
|
end
|
data/lib/foreman_scap_client.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_scap_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Hulan
|
8
8
|
- Šimon Lukašík
|
9
9
|
- Shlomi Zadok
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -58,13 +58,12 @@ files:
|
|
58
58
|
- lib/foreman_scap_client.rb
|
59
59
|
- lib/foreman_scap_client/base_client.rb
|
60
60
|
- lib/foreman_scap_client/client.rb
|
61
|
-
- lib/foreman_scap_client/oval_client.rb
|
62
61
|
- lib/foreman_scap_client/version.rb
|
63
62
|
homepage: https://github.com/theforeman/foreman_scap_client
|
64
63
|
licenses:
|
65
64
|
- GPL-3.0
|
66
65
|
metadata: {}
|
67
|
-
post_install_message:
|
66
|
+
post_install_message:
|
68
67
|
rdoc_options: []
|
69
68
|
require_paths:
|
70
69
|
- lib
|
@@ -80,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
79
|
version: '0'
|
81
80
|
requirements:
|
82
81
|
- bzip2
|
83
|
-
rubygems_version: 3.
|
84
|
-
signing_key:
|
82
|
+
rubygems_version: 3.3.26
|
83
|
+
signing_key:
|
85
84
|
specification_version: 4
|
86
85
|
summary: Client script that runs openscap scan and uploads the result to foreman proxy
|
87
86
|
test_files: []
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'foreman_scap_client/base_client'
|
2
|
-
|
3
|
-
module ForemanScapClient
|
4
|
-
class OvalClient < BaseClient
|
5
|
-
private
|
6
|
-
|
7
|
-
def policy_namespace
|
8
|
-
:oval
|
9
|
-
end
|
10
|
-
|
11
|
-
def ensure_scan_files
|
12
|
-
ensure_file :content_path, :download_path, "OVAL content"
|
13
|
-
end
|
14
|
-
|
15
|
-
def upload_uri
|
16
|
-
foreman_proxy_uri + "/compliance/oval_reports/#{@policy_id}"
|
17
|
-
end
|
18
|
-
|
19
|
-
def scan_command
|
20
|
-
"oscap oval eval --results #{results_path} #{policy_from_config[:content_path]}"
|
21
|
-
end
|
22
|
-
|
23
|
-
def print_upload_result(parsed)
|
24
|
-
if parsed['reported_at']
|
25
|
-
puts "Report successfully uploaded at #{parsed['reported_at']}"
|
26
|
-
else
|
27
|
-
puts "Report not uploaded, cause: #{parsed['result']}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|