foreman_openscap 9.0.5 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_openscap/locale/cs_CZ/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/de/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/en/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/en_GB/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/es/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/fr/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/ka/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/sv_SE/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/zh_CN/foreman_openscap.js +0 -9
- data/app/assets/javascripts/foreman_openscap/locale/zh_TW/foreman_openscap.js +0 -9
- data/app/controllers/api/v2/compliance/scap_contents_controller.rb +2 -0
- data/app/helpers/foreman_openscap_helper.rb +2 -18
- data/db/migrate/20201217161511_add_url_to_oval_content.rb +1 -1
- data/{app/services → lib}/foreman_openscap/bulk_upload.rb +7 -14
- data/lib/foreman_openscap/engine.rb +148 -155
- data/lib/foreman_openscap/version.rb +1 -1
- data/lib/tasks/foreman_openscap_tasks.rake +1 -0
- data/locale/cs_CZ/foreman_openscap.edit.po +1443 -0
- data/locale/cs_CZ/foreman_openscap.po +0 -9
- data/locale/cs_CZ/foreman_openscap.po.time_stamp +0 -0
- data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/de/foreman_openscap.edit.po +1468 -0
- data/locale/de/foreman_openscap.po +0 -9
- data/locale/de/foreman_openscap.po.time_stamp +0 -0
- data/locale/en/foreman_openscap.edit.po +1443 -0
- data/locale/en/foreman_openscap.po +0 -9
- data/locale/en/foreman_openscap.po.time_stamp +0 -0
- data/locale/en_GB/foreman_openscap.edit.po +1443 -0
- data/locale/en_GB/foreman_openscap.po +0 -9
- data/locale/en_GB/foreman_openscap.po.time_stamp +0 -0
- data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/es/foreman_openscap.edit.po +1463 -0
- data/locale/es/foreman_openscap.po +0 -9
- data/locale/es/foreman_openscap.po.time_stamp +0 -0
- data/locale/foreman_openscap.pot +47 -57
- data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/fr/foreman_openscap.edit.po +1469 -0
- data/locale/fr/foreman_openscap.po +0 -9
- data/locale/fr/foreman_openscap.po.time_stamp +0 -0
- data/locale/gl/foreman_openscap.edit.po +1443 -0
- data/locale/gl/foreman_openscap.po +0 -9
- data/locale/gl/foreman_openscap.po.time_stamp +0 -0
- data/locale/it/foreman_openscap.edit.po +1445 -0
- data/locale/it/foreman_openscap.po +0 -9
- data/locale/it/foreman_openscap.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ja/foreman_openscap.edit.po +1460 -0
- data/locale/ja/foreman_openscap.po +0 -9
- data/locale/ja/foreman_openscap.po.time_stamp +0 -0
- data/locale/ka/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ka/foreman_openscap.edit.po +1449 -0
- data/locale/ka/foreman_openscap.po +0 -9
- data/locale/ka/foreman_openscap.po.time_stamp +0 -0
- data/locale/ko/foreman_openscap.edit.po +1443 -0
- data/locale/ko/foreman_openscap.po +0 -9
- data/locale/ko/foreman_openscap.po.time_stamp +0 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/pt_BR/foreman_openscap.edit.po +1468 -0
- data/locale/pt_BR/foreman_openscap.po +0 -9
- data/locale/pt_BR/foreman_openscap.po.time_stamp +0 -0
- data/locale/ru/foreman_openscap.edit.po +1447 -0
- data/locale/ru/foreman_openscap.po +0 -9
- data/locale/ru/foreman_openscap.po.time_stamp +0 -0
- data/locale/sv_SE/foreman_openscap.edit.po +1443 -0
- data/locale/sv_SE/foreman_openscap.po +0 -9
- data/locale/sv_SE/foreman_openscap.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/zh_CN/foreman_openscap.edit.po +1459 -0
- data/locale/zh_CN/foreman_openscap.po +0 -9
- data/locale/zh_CN/foreman_openscap.po.time_stamp +0 -0
- data/locale/zh_TW/foreman_openscap.edit.po +1444 -0
- data/locale/zh_TW/foreman_openscap.po +0 -9
- data/locale/zh_TW/foreman_openscap.po.time_stamp +0 -0
- data/test/lib/foreman_openscap/bulk_upload_test.rb +4 -3
- data/test/unit/message_cleaner_test.rb +1 -0
- metadata +36 -4
@@ -5,15 +5,6 @@ module ForemanOpenscap
|
|
5
5
|
|
6
6
|
class Engine < ::Rails::Engine
|
7
7
|
engine_name 'foreman_openscap'
|
8
|
-
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
9
|
-
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
10
|
-
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
11
|
-
config.autoload_paths += Dir["#{config.root}/app/models"]
|
12
|
-
config.autoload_paths += Dir["#{config.root}/app/graphql"]
|
13
|
-
config.autoload_paths += Dir["#{config.root}/app/lib"]
|
14
|
-
config.autoload_paths += Dir["#{config.root}/app/services"]
|
15
|
-
config.autoload_paths += Dir["#{config.root}/lib"]
|
16
|
-
config.autoload_paths += Dir["#{config.root}/test/"]
|
17
8
|
|
18
9
|
# Add any db migrations
|
19
10
|
initializer "foreman_openscap.load_app_instance_data" do |app|
|
@@ -47,154 +38,156 @@ module ForemanOpenscap
|
|
47
38
|
end
|
48
39
|
|
49
40
|
initializer 'foreman_openscap.register_plugin', :before => :finisher_hook do |app|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
:resource_type => 'ForemanOpenscap::ScapContent'
|
93
|
-
permission :edit_scap_contents, { :scap_contents => %i[edit update],
|
94
|
-
'api/v2/compliance/scap_contents' => [:update] },
|
95
|
-
:resource_type => 'ForemanOpenscap::ScapContent'
|
96
|
-
permission :create_scap_contents, { :scap_contents => %i[new create],
|
97
|
-
'api/v2/compliance/scap_contents' => %i[create bulk_upload] },
|
98
|
-
:resource_type => 'ForemanOpenscap::ScapContent'
|
99
|
-
permission :destroy_scap_contents, { :scap_contents => [:destroy],
|
100
|
-
'api/v2/compliance/scap_contents' => [:destroy] },
|
101
|
-
:resource_type => 'ForemanOpenscap::ScapContent'
|
102
|
-
permission :edit_hosts, { :hosts => %i[openscap_proxy_changed
|
103
|
-
select_multiple_openscap_proxy
|
104
|
-
update_multiple_openscap_proxy] },
|
105
|
-
:resource_type => "Host"
|
106
|
-
permission :view_hosts, { 'api/v2/hosts' => [:policies_enc] }, :resource_type => 'Host'
|
107
|
-
permission :edit_hostgroups, { :hostgroups => [:openscap_proxy_changed] }, :resource_type => "Hostgroup"
|
108
|
-
permission :create_tailoring_files, { :tailoring_files => %i[create new],
|
109
|
-
'api/v2/compliance/tailoring_files' => [:create] },
|
110
|
-
:resource_type => 'ForemanOpenscap::TailoringFile'
|
111
|
-
permission :view_tailoring_files, { :tailoring_files => %i[index auto_complete_search xml],
|
112
|
-
:policies => [:tailoring_file_selected],
|
113
|
-
'api/v2/compliance/tailoring_files' => %i[show xml index],
|
114
|
-
'api/v2/compliance/policies' => [:tailoring],
|
41
|
+
app.reloader.to_prepare do
|
42
|
+
Foreman::Plugin.register :foreman_openscap do
|
43
|
+
requires_foreman '>= 3.13'
|
44
|
+
register_gettext
|
45
|
+
|
46
|
+
apipie_documented_controllers ["#{ForemanOpenscap::Engine.root}/app/controllers/api/v2/compliance/*.rb"]
|
47
|
+
|
48
|
+
register_custom_status ForemanOpenscap::ComplianceStatus
|
49
|
+
|
50
|
+
# Add permissions
|
51
|
+
security_block :foreman_openscap do
|
52
|
+
permission :view_arf_reports, { :arf_reports => %i[index show parse_html show_html show_log
|
53
|
+
parse_bzip auto_complete_search download_html],
|
54
|
+
'api/v2/compliance/arf_reports' => %i[index show download download_html],
|
55
|
+
:compliance_hosts => [:show] },
|
56
|
+
:resource_type => 'ForemanOpenscap::ArfReport'
|
57
|
+
permission :destroy_arf_reports, { :arf_reports => %i[destroy delete_multiple submit_delete_multiple],
|
58
|
+
'api/v2/compliance/arf_reports' => [:destroy] },
|
59
|
+
:resource_type => 'ForemanOpenscap::ArfReport'
|
60
|
+
permission :create_arf_reports, { 'api/v2/compliance/arf_reports' => [:create] },
|
61
|
+
:resource_type => 'ForemanOpenscap::ArfReport'
|
62
|
+
|
63
|
+
permission :view_policies, { :policies => %i[index show parse auto_complete_search],
|
64
|
+
:policy_dashboard => [:index],
|
65
|
+
:compliance_dashboard => [:index],
|
66
|
+
'api/v2/compliance/policies' => %i[index show content] },
|
67
|
+
:resource_type => 'ForemanOpenscap::Policy'
|
68
|
+
permission :edit_policies, { :policies => %i[edit update scap_content_selected],
|
69
|
+
'api/v2/compliance/policies' => [:update] },
|
70
|
+
:resource_type => 'ForemanOpenscap::Policy'
|
71
|
+
permission :create_policies, { :policies => %i[new create],
|
72
|
+
'api/v2/compliance/policies' => [:create] },
|
73
|
+
:resource_type => 'ForemanOpenscap::Policy'
|
74
|
+
permission :destroy_policies, { :policies => [:destroy],
|
75
|
+
'api/v2/compliance/policies' => [:destroy] },
|
76
|
+
:resource_type => 'ForemanOpenscap::Policy'
|
77
|
+
permission :assign_policies, { :policies => %i[select_multiple_hosts update_multiple_hosts
|
78
|
+
disassociate_multiple_hosts
|
79
|
+
remove_policy_from_multiple_hosts] },
|
80
|
+
:resource_type => 'ForemanOpenscap::Policy'
|
81
|
+
permission :view_scap_contents, { :scap_contents => %i[index show auto_complete_search],
|
82
|
+
'api/v2/compliance/scap_contents' => %i[index show xml],
|
115
83
|
'api/v2/compliance/scap_content_profiles' => %i[index] },
|
116
|
-
|
117
|
-
|
118
|
-
'api/v2/compliance/
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
84
|
+
:resource_type => 'ForemanOpenscap::ScapContent'
|
85
|
+
permission :edit_scap_contents, { :scap_contents => %i[edit update],
|
86
|
+
'api/v2/compliance/scap_contents' => [:update] },
|
87
|
+
:resource_type => 'ForemanOpenscap::ScapContent'
|
88
|
+
permission :create_scap_contents, { :scap_contents => %i[new create],
|
89
|
+
'api/v2/compliance/scap_contents' => %i[create bulk_upload] },
|
90
|
+
:resource_type => 'ForemanOpenscap::ScapContent'
|
91
|
+
permission :destroy_scap_contents, { :scap_contents => [:destroy],
|
92
|
+
'api/v2/compliance/scap_contents' => [:destroy] },
|
93
|
+
:resource_type => 'ForemanOpenscap::ScapContent'
|
94
|
+
permission :edit_hosts, { :hosts => %i[openscap_proxy_changed
|
95
|
+
select_multiple_openscap_proxy
|
96
|
+
update_multiple_openscap_proxy] },
|
97
|
+
:resource_type => "Host"
|
98
|
+
permission :view_hosts, { 'api/v2/hosts' => [:policies_enc] }, :resource_type => 'Host'
|
99
|
+
permission :edit_hostgroups, { :hostgroups => [:openscap_proxy_changed] }, :resource_type => "Hostgroup"
|
100
|
+
permission :create_tailoring_files, { :tailoring_files => %i[create new],
|
101
|
+
'api/v2/compliance/tailoring_files' => [:create] },
|
102
|
+
:resource_type => 'ForemanOpenscap::TailoringFile'
|
103
|
+
permission :view_tailoring_files, { :tailoring_files => %i[index auto_complete_search xml],
|
104
|
+
:policies => [:tailoring_file_selected],
|
105
|
+
'api/v2/compliance/tailoring_files' => %i[show xml index],
|
106
|
+
'api/v2/compliance/policies' => [:tailoring],
|
107
|
+
'api/v2/compliance/scap_content_profiles' => %i[index] },
|
108
|
+
:resource_type => 'ForemanOpenscap::TailoringFile'
|
109
|
+
permission :edit_tailoring_files, { :tailoring_files => %i[edit update],
|
110
|
+
'api/v2/compliance/tailoring_files' => [:update] },
|
111
|
+
:resource_type => 'ForemanOpenscap::TailoringFile'
|
112
|
+
permission :destroy_tailoring_files, { :tailoring_files => [:destroy],
|
113
|
+
'api/v2/compliance/tailoring_files' => [:destroy] },
|
114
|
+
:resource_type => 'ForemanOpenscap::TailoringFile'
|
115
|
+
permission :view_openscap_proxies, { :openscap_proxies => [:openscap_spool] },
|
116
|
+
:resource_type => 'SmartProxy'
|
117
|
+
end
|
118
|
+
|
119
|
+
role "Compliance viewer", %i[view_arf_reports view_policies view_scap_contents view_tailoring_files view_openscap_proxies],
|
120
|
+
"Role granting read permissions to policy configuration, scan results and downloading reports."
|
121
|
+
role "Compliance manager", %i[view_arf_reports view_policies view_scap_contents
|
122
|
+
destroy_arf_reports edit_policies edit_scap_contents assign_policies
|
123
|
+
create_policies create_scap_contents destroy_policies destroy_scap_contents
|
124
|
+
create_tailoring_files view_tailoring_files edit_tailoring_files destroy_tailoring_files
|
125
|
+
view_openscap_proxies],
|
126
|
+
"Role granting all permissions to compliance features to non-admin users."
|
127
|
+
role "Create ARF report", [:create_arf_reports] # special as only Proxy can create
|
128
|
+
|
129
|
+
add_all_permissions_to_default_roles
|
130
|
+
|
131
|
+
# add menu entries
|
132
|
+
divider :top_menu, :caption => N_('Compliance'), :parent => :hosts_menu
|
133
|
+
menu :top_menu, :compliance_policies, :caption => N_('Policies'),
|
134
|
+
:url_hash => { :controller => :policies, :action => :index },
|
135
|
+
:parent => :hosts_menu
|
136
|
+
menu :top_menu, :compliance_contents, :caption => N_('SCAP contents'),
|
137
|
+
:url_hash => { :controller => :scap_contents, :action => :index },
|
138
|
+
:parent => :hosts_menu
|
139
|
+
menu :top_menu, :compliance_reports, :caption => N_('Reports'),
|
140
|
+
:url_hash => { :controller => :arf_reports, :action => :index },
|
143
141
|
:parent => :hosts_menu
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
register_global_js_file 'global'
|
194
|
-
|
195
|
-
describe_host do
|
196
|
-
multiple_actions_provider :compliance_host_multiple_actions
|
197
|
-
overview_buttons_provider :compliance_host_overview_button
|
142
|
+
menu :top_menu, :compliance_files, :caption => N_('Tailoring Files'),
|
143
|
+
:url_hash => { :controller => :tailoring_files, :action => :index },
|
144
|
+
:parent => :hosts_menu
|
145
|
+
|
146
|
+
# add dashboard widget
|
147
|
+
widget 'compliance_host_reports_widget',
|
148
|
+
:name => N_('Latest Compliance Reports'), :sizex => 6, :sizey => 1
|
149
|
+
widget 'compliance_reports_breakdown_widget',
|
150
|
+
:name => N_('Compliance Reports Breakdown'), :sizex => 4, :sizey => 1
|
151
|
+
|
152
|
+
# As 'arf_report_breakdowns' is a view and does not appear in schema.rb, db:test:prepare will not create the view
|
153
|
+
# which will make the following tests fail.
|
154
|
+
tests_to_skip({ "DashboardIntegrationTest" => ["dashboard page", "dashboard link hosts that had performed modifications",
|
155
|
+
"dashboard link hosts in error state", "dashboard link good host reports",
|
156
|
+
"dashboard link hosts that had pending changes", "dashboard link out of sync hosts",
|
157
|
+
"dashboard link hosts with no reports", "dashboard link hosts with alerts disabled",
|
158
|
+
"widgets not in dashboard show up in list"] })
|
159
|
+
# strong params
|
160
|
+
parameter_filter ::Host::Managed, :openscap_proxy_id, :openscap_proxy
|
161
|
+
parameter_filter ::Hostgroup, :openscap_proxy_id, :openscap_proxy
|
162
|
+
parameter_filter Log, :result
|
163
|
+
|
164
|
+
proxy_description = N_('OpenSCAP Proxy to use for fetching SCAP content and uploading ARF reports. Leave blank and override appropriate parameters when using proxy load balancer.')
|
165
|
+
|
166
|
+
smart_proxy_for ::Hostgroup, :openscap_proxy,
|
167
|
+
:feature => 'Openscap',
|
168
|
+
:label => N_('OpenSCAP Proxy'),
|
169
|
+
:description => proxy_description,
|
170
|
+
:api_description => N_('ID of OpenSCAP Proxy')
|
171
|
+
smart_proxy_for Host::Managed, :openscap_proxy,
|
172
|
+
:feature => 'Openscap',
|
173
|
+
:label => N_('OpenSCAP Proxy'),
|
174
|
+
:description => proxy_description,
|
175
|
+
:api_description => N_('ID of OpenSCAP Proxy')
|
176
|
+
|
177
|
+
add_controller_action_scope('Api::V2::HostsController', :index) do |base_scope|
|
178
|
+
base_scope.preload(:policies)
|
179
|
+
end
|
180
|
+
|
181
|
+
add_controller_action_scope('HostsController', :index) do |base_scope|
|
182
|
+
base_scope.preload(:policies)
|
183
|
+
end
|
184
|
+
|
185
|
+
register_global_js_file 'global'
|
186
|
+
|
187
|
+
describe_host do
|
188
|
+
multiple_actions_provider :compliance_host_multiple_actions
|
189
|
+
overview_buttons_provider :compliance_host_overview_button
|
190
|
+
end
|
198
191
|
end
|
199
192
|
end
|
200
193
|
end
|