foreman_openscap 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_openscap/load_report.js +1 -1
- data/app/assets/javascripts/foreman_openscap/policy_edit.js +0 -2
- data/app/controllers/api/v2/compliance/arf_reports_controller.rb +7 -22
- data/app/controllers/api/v2/compliance/policies_controller.rb +5 -5
- data/app/controllers/api/v2/compliance/scap_contents_controller.rb +3 -3
- data/app/controllers/arf_reports_controller.rb +62 -0
- data/app/controllers/{scaptimony_dashboard_controller.rb → compliance_dashboard_controller.rb} +1 -1
- data/app/controllers/compliance_hosts_controller.rb +5 -0
- data/app/controllers/{scaptimony_policies_controller.rb → policies_controller.rb} +13 -13
- data/app/controllers/{scaptimony_policy_dashboard_controller.rb → policy_dashboard_controller.rb} +3 -3
- data/app/controllers/{scaptimony_scap_contents_controller.rb → scap_contents_controller.rb} +11 -11
- data/app/helpers/{scaptimony_report_dashboard_helper.rb → arf_report_dashboard_helper.rb} +3 -5
- data/app/helpers/arf_reports_helper.rb +21 -0
- data/app/helpers/compliance_hosts_helper.rb +25 -0
- data/app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb +2 -32
- data/app/helpers/{scaptimony_policies_helper.rb → policies_helper.rb} +6 -2
- data/app/helpers/{scaptimony_policy_dashboard_helper.rb → policy_dashboard_helper.rb} +8 -8
- data/app/lib/proxy_api/available_proxy.rb +26 -0
- data/app/lib/proxy_api/openscap.rb +40 -0
- data/app/mailers/foreman_openscap/policy_mailer.rb +42 -0
- data/app/models/concerns/foreman_openscap/compliance_status_scoped_search.rb +91 -0
- data/app/models/concerns/foreman_openscap/host_extensions.rb +73 -17
- data/app/models/concerns/foreman_openscap/hostgroup_extensions.rb +3 -5
- data/app/models/foreman_openscap/arf_report.rb +165 -0
- data/app/models/foreman_openscap/asset.rb +27 -0
- data/app/models/foreman_openscap/asset_policy.rb +6 -0
- data/app/models/foreman_openscap/compliance_status.rb +50 -0
- data/app/models/{concerns/foreman_openscap/policy_extensions.rb → foreman_openscap/policy.rb} +72 -45
- data/app/models/foreman_openscap/policy_arf_report.rb +8 -0
- data/app/models/foreman_openscap/policy_revision.rb +6 -0
- data/app/models/foreman_openscap/scap_content.rb +112 -0
- data/app/models/foreman_openscap/scap_content_profile.rb +6 -0
- data/app/overrides/hosts/overview/host_compliance_status.rb +4 -4
- data/app/services/foreman_openscap/arf_report_status_calculator.rb +45 -0
- data/app/services/{scaptimony → foreman_openscap}/host_report_dashboard/data.rb +12 -6
- data/app/services/{scaptimony → foreman_openscap}/policy_dashboard/data.rb +5 -5
- data/app/services/{scaptimony → foreman_openscap}/report_dashboard/data.rb +4 -4
- data/app/views/api/v2/compliance/policies/create.json.rabl +3 -0
- data/app/views/{scaptimony_arf_reports → arf_reports}/_list.html.erb +4 -4
- data/app/views/arf_reports/_metrics.html.erb +37 -0
- data/app/views/arf_reports/_output.html.erb +23 -0
- data/app/views/{scaptimony_arf_reports → arf_reports}/index.html.erb +0 -0
- data/app/views/arf_reports/show.html.erb +14 -0
- data/app/views/{scaptimony_arf_reports/show.html.erb → arf_reports/show_html.html.erb} +2 -3
- data/app/views/compliance_hosts/_compliance_status.erb +6 -0
- data/app/views/{scaptimony_hosts → compliance_hosts}/show.html.erb +9 -2
- data/app/views/dashboard/{_foreman_openscap_host_reports_widget.html.erb → _compliance_host_reports_widget.html.erb} +3 -3
- data/app/views/dashboard/{_foreman_openscap_reports_breakdown_widget.html.erb → _compliance_reports_breakdown_widget.html.erb} +1 -1
- data/app/views/foreman_openscap/policy_mailer/_dashboard.erb +21 -0
- data/app/views/foreman_openscap/policy_mailer/_hosts.erb +44 -0
- data/app/views/foreman_openscap/policy_mailer/_list.erb +10 -0
- data/app/views/foreman_openscap/policy_mailer/_policy.erb +7 -0
- data/app/views/foreman_openscap/policy_mailer/policy_summary.erb +19 -0
- data/app/views/{scaptimony_policies → policies}/_form.html.erb +2 -8
- data/app/views/{scaptimony_policies → policies}/_list.html.erb +5 -5
- data/app/views/policies/_scap_content_results.html.erb +3 -0
- data/app/views/policies/create.html.erb +2 -0
- data/app/views/{scaptimony_policies → policies}/disassociate_multiple_hosts.html.erb +2 -2
- data/app/views/{scaptimony_policies → policies}/edit.html.erb +0 -0
- data/app/views/{scaptimony_policies → policies}/index.html.erb +1 -1
- data/app/views/policies/new.html.erb +2 -0
- data/app/views/{scaptimony_policies → policies}/select_multiple_hosts.html.erb +2 -2
- data/app/views/{scaptimony_policies → policies}/show.html.erb +1 -1
- data/app/views/{scaptimony_policies → policies}/steps/_create_policy_form.html.erb +0 -0
- data/app/views/{scaptimony_policies → policies}/steps/_hostgroups_form.html.erb +0 -0
- data/app/views/{scaptimony_policies → policies}/steps/_locations_form.html.erb +0 -0
- data/app/views/{scaptimony_policies → policies}/steps/_organizations_form.html.erb +0 -0
- data/app/views/policies/steps/_scap_content_form.html.erb +9 -0
- data/app/views/{scaptimony_policies → policies}/steps/_schedule_form.html.erb +1 -1
- data/app/views/{scaptimony_policies → policies}/steps/_step_form.html.erb +3 -3
- data/app/views/{scaptimony_policies → policies}/welcome.html.erb +2 -2
- data/app/views/{scaptimony_policy_dashboard → policy_dashboard}/_policy_chart_widget.html.erb +0 -0
- data/app/views/{scaptimony_policy_dashboard → policy_dashboard}/_policy_reports.html.erb +2 -2
- data/app/views/{scaptimony_policy_dashboard → policy_dashboard}/_policy_status_widget.html.erb +3 -3
- data/app/views/{scaptimony_policy_dashboard → policy_dashboard}/index.html.erb +0 -0
- data/app/views/{scaptimony_scap_contents → scap_contents}/_form.html.erb +5 -6
- data/app/views/{scaptimony_scap_contents → scap_contents}/_list.html.erb +3 -3
- data/app/views/{scaptimony_scap_contents → scap_contents}/edit.html.erb +0 -0
- data/app/views/{scaptimony_scap_contents → scap_contents}/index.html.erb +1 -1
- data/app/views/{scaptimony_scap_contents → scap_contents}/new.html.erb +0 -0
- data/app/views/{scaptimony_scap_contents → scap_contents}/welcome.html.erb +2 -2
- data/config/routes.rb +15 -11
- data/db/migrate/20141013172051_create_scaptimony_policies.rb +9 -0
- data/db/migrate/20141014105333_create_scaptimony_assets.rb +10 -0
- data/db/migrate/20141015092642_create_scaptimony_arf_reports.rb +13 -0
- data/db/migrate/20141015115511_add_arf_report_unique_constraint.rb +6 -0
- data/db/migrate/20141104164201_create_scaptimony_scap_contents.rb +7 -0
- data/db/migrate/20141104171545_create_scaptimony_policy_revisions.rb +14 -0
- data/db/migrate/20141105174625_add_description_to_scaptimony_policy_revisions.rb +5 -0
- data/db/migrate/20141105174834_add_columns_to_scaptimony_policies.rb +12 -0
- data/db/migrate/20141107091756_add_columns_to_scaptimony_scap_contents.rb +8 -0
- data/db/migrate/20141111104519_add_constraint_to_scaptimony_scap_contents.rb +5 -0
- data/db/migrate/20141113221054_create_scaptimony_scap_content_profiles.rb +12 -0
- data/db/migrate/20141116170632_remove_xccdf_profile_from_scaptimony_policies.rb +5 -0
- data/db/migrate/20141116171305_add_profile_to_scaptimony_policies.rb +6 -0
- data/db/migrate/20141118142954_add_constraint_to_scaptimony_policies.rb +5 -0
- data/db/migrate/20141119164918_create_scaptimony_xccdf_results.rb +8 -0
- data/db/migrate/20141119175434_create_scaptimony_xccdf_rules.rb +8 -0
- data/db/migrate/20141119182606_create_scaptimony_xccdf_rule_results.rb +9 -0
- data/db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb +24 -0
- data/db/migrate/20141121164042_replace_arf_report_breakdown_view.rb +25 -0
- data/db/migrate/20141206211151_create_scaptimony_assets_policies.rb +9 -0
- data/db/migrate/20141214112917_add_scap_file_to_scap_content.rb +5 -0
- data/db/migrate/20141216154502_rename_scaptimony_asset_policies.rb +5 -0
- data/db/migrate/20150111085317_polymorph_asset.rb +8 -0
- data/db/migrate/20150112152944_create_scaptimony_arf_report_raws.rb +10 -0
- data/db/migrate/20150114210634_rename_scaptimony_arf_report_raw_raw.rb +5 -0
- data/db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb +21 -0
- data/db/migrate/20150116083129_add_day_of_month_and_cron_line_to_scaptimony_policy.rb +6 -0
- data/db/migrate/20150821100137_migrate_from_scaptimony.rb +59 -0
- data/db/migrate/20150827123826_remove_scaptimony_permissions.rb +21 -0
- data/db/migrate/20150925124959_create_policy_arf_reports.rb +13 -0
- data/db/migrate/20150929124853_add_result_to_logs.rb +9 -0
- data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +179 -0
- data/db/migrate/20151023131950_link_arf_report_directly_to_host.rb +17 -0
- data/db/seeds.d/openscap_policy_notification.rb +9 -0
- data/lib/foreman_openscap/bulk_upload.rb +3 -1
- data/lib/foreman_openscap/engine.rb +53 -42
- data/lib/foreman_openscap/helper.rb +8 -0
- data/lib/foreman_openscap/version.rb +1 -1
- data/lib/tasks/foreman_openscap_tasks.rake +14 -0
- data/test/factories/arf_report_factory.rb +9 -6
- data/test/factories/asset_factory.rb +1 -1
- data/test/factories/compliance_host_factory.rb +9 -0
- data/test/factories/compliance_log_factory.rb +11 -0
- data/test/factories/policy_arf_report_factory.rb +6 -0
- data/test/factories/policy_factory.rb +3 -2
- data/test/factories/scap_content_related.rb +2 -2
- data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +4 -3
- data/test/functional/api/v2/compliance/policies_controller_test.rb +2 -2
- data/test/functional/api/v2/compliance/scap_contents_controller_test.rb +3 -1
- data/test/lib/foreman_openscap/bulk_upload_test.rb +1 -1
- data/test/test_plugin_helper.rb +30 -0
- data/test/unit/arf_report_status_calculator_test.rb +11 -0
- data/test/unit/arf_report_test.rb +148 -0
- data/test/unit/compliance_status_test.rb +71 -0
- data/test/unit/openscap_host_test.rb +38 -7
- data/test/unit/policy_mailer_test.rb +38 -0
- data/test/unit/scap_content_test.rb +32 -0
- metadata +130 -74
- data/app/controllers/scaptimony_arf_reports_controller.rb +0 -34
- data/app/controllers/scaptimony_hosts_controller.rb +0 -5
- data/app/models/concerns/foreman_openscap/arf_report_extensions.rb +0 -50
- data/app/models/concerns/foreman_openscap/asset_extensions.rb +0 -34
- data/app/models/concerns/foreman_openscap/scap_content_extensions.rb +0 -40
- data/app/overrides/hosts/index/host_arf_report.rb +0 -5
- data/app/views/scaptimony_arf_reports/_host_report.html.erb +0 -8
- data/app/views/scaptimony_hosts/_host_status.html.erb +0 -17
- data/app/views/scaptimony_policies/_scap_content_results.html.erb +0 -7
- data/app/views/scaptimony_policies/create.html.erb +0 -2
- data/app/views/scaptimony_policies/new.html.erb +0 -2
- data/app/views/scaptimony_policies/steps/_scap_content_form.html.erb +0 -17
@@ -1,4 +1,4 @@
|
|
1
|
-
Deface::Override.new(:virtual_path
|
2
|
-
:name
|
3
|
-
:
|
4
|
-
:partial
|
1
|
+
Deface::Override.new(:virtual_path => "hosts/show",
|
2
|
+
:name => "add_compliance_link_to_host",
|
3
|
+
:insert_bottom => 'td:last',
|
4
|
+
:partial => 'compliance_hosts/compliance_status')
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module ForemanOpenscap
|
2
|
+
class ArfReportStatusCalculator
|
3
|
+
|
4
|
+
def initialize(options = {})
|
5
|
+
@counters = options[:counters] || {}
|
6
|
+
@raw_status = options[:bit_field] || 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def calculate
|
10
|
+
@raw_status = 0
|
11
|
+
counters.each do |type, value|
|
12
|
+
value = value.to_i
|
13
|
+
value = ArfReport::MAX if value > ArfReport::MAX
|
14
|
+
@raw_status |= value << (ArfReport::BIT_NUM * ArfReport::METRIC.index(type))
|
15
|
+
end
|
16
|
+
raw_status
|
17
|
+
end
|
18
|
+
|
19
|
+
def status
|
20
|
+
@status ||= begin
|
21
|
+
calculate if raw_status == 0
|
22
|
+
counters = Hash.new(0)
|
23
|
+
ArfReport::METRIC.each do |m|
|
24
|
+
counters[m] = (raw_status || 0) >> (ArfReport::BIT_NUM * ArfReport::METRIC.index(m)) & ArfReport::MAX
|
25
|
+
end
|
26
|
+
counters
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def status_of(counter)
|
31
|
+
fail(Foreman::Exception.new(N_("invalid type %s"), counter)) unless ArfReport::METRIC.include?(counter)
|
32
|
+
status[counter]
|
33
|
+
end
|
34
|
+
|
35
|
+
ArfReport::METRIC.each do |method|
|
36
|
+
define_method method do
|
37
|
+
status_of(method)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
attr_accessor :raw_status, :counters
|
44
|
+
end
|
45
|
+
end
|
@@ -1,13 +1,19 @@
|
|
1
|
-
module
|
1
|
+
module ForemanOpenscap::HostReportDashboard
|
2
2
|
class Data
|
3
3
|
attr_reader :report
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@latest_report =
|
5
|
+
def initialize(policy, host)
|
6
|
+
@latest_report = ::ForemanOpenscap::ArfReport.latest_of_policy(policy)
|
7
|
+
.where(:host_id => host.id)
|
8
|
+
.order('created_at DESC').first
|
7
9
|
@report = {}
|
8
10
|
fetch_data
|
9
11
|
end
|
10
12
|
|
13
|
+
def has_data?
|
14
|
+
latest_report.present?
|
15
|
+
end
|
16
|
+
|
11
17
|
private
|
12
18
|
attr_writer :report
|
13
19
|
attr_accessor :latest_report
|
@@ -23,15 +29,15 @@ module Scaptimony::HostReportDashboard
|
|
23
29
|
end
|
24
30
|
|
25
31
|
def report_passed
|
26
|
-
@latest_report.passed
|
32
|
+
has_data? ? @latest_report.passed : 0
|
27
33
|
end
|
28
34
|
|
29
35
|
def report_failed
|
30
|
-
@latest_report.failed
|
36
|
+
has_data? ? @latest_report.failed : 0
|
31
37
|
end
|
32
38
|
|
33
39
|
def report_othered
|
34
|
-
@latest_report.othered
|
40
|
+
has_data? ? @latest_report.othered : 0
|
35
41
|
end
|
36
42
|
|
37
43
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module ForemanOpenscap::PolicyDashboard
|
2
2
|
class Data
|
3
3
|
attr_reader :report
|
4
4
|
|
@@ -18,10 +18,10 @@ module Scaptimony::PolicyDashboard
|
|
18
18
|
|
19
19
|
def fetch_data
|
20
20
|
report.update(
|
21
|
-
{:compliant_hosts =>
|
22
|
-
:incompliant_hosts =>
|
23
|
-
:inconclusive_hosts =>
|
24
|
-
:report_missing =>
|
21
|
+
{:compliant_hosts => Host::Managed.comply_with(@policy).count,
|
22
|
+
:incompliant_hosts => Host::Managed.incomply_with(@policy).count,
|
23
|
+
:inconclusive_hosts => Host::Managed.inconclusive_with(@policy).count,
|
24
|
+
:report_missing => Host::Managed.policy_reports_missing(@policy).count,
|
25
25
|
:assigned_hosts => @policy.assets.hosts.count,
|
26
26
|
:unassigned_hosts => hosts.count - @policy.assets.hosts.count
|
27
27
|
})
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module ForemanOpenscap::ReportDashboard
|
2
2
|
class Data
|
3
3
|
attr_reader :report
|
4
4
|
|
@@ -23,15 +23,15 @@ module Scaptimony::ReportDashboard
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def passed_breakdowns
|
26
|
-
|
26
|
+
Log.where(:result => 'pass').joins("INNER JOIN reports ON reports.id = report_id").count(:id).to_f
|
27
27
|
end
|
28
28
|
|
29
29
|
def failed_breakdowns
|
30
|
-
|
30
|
+
Log.where(:result => 'fail').joins("INNER JOIN reports ON reports.id = report_id").count(:id).to_f
|
31
31
|
end
|
32
32
|
|
33
33
|
def othered_breakdowns
|
34
|
-
(::
|
34
|
+
Log.where(:result => ForemanOpenscap::ArfReport::RESULT[2..-1]).joins("INNER JOIN reports ON reports.id = report_id").count(:id).to_f
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<table class="table table-bordered table-striped ellipsis">
|
2
2
|
<tr>
|
3
3
|
<th><%= sort :host %></th>
|
4
|
-
<th><%= sort :
|
4
|
+
<th><%= sort :reported_at, :as => _("Reported At") %></th>
|
5
5
|
<th><%= sort :passed, :as => _("Passed") %></th>
|
6
6
|
<th><%= sort :failed, :as => _("Failed") %></th>
|
7
7
|
<th><%= sort :othered, :as => _("Other") %></th>
|
@@ -10,14 +10,14 @@
|
|
10
10
|
<% for arf_report in @arf_reports %>
|
11
11
|
<tr>
|
12
12
|
<td><%= name_column(arf_report.host) %></td>
|
13
|
-
<td><%= _("%s ago") % time_ago_in_words(arf_report.
|
13
|
+
<td><%= _("%s ago") % time_ago_in_words(arf_report.reported_at) %></td>
|
14
14
|
<td><%= report_arf_column(arf_report.passed, "label-info") %></th>
|
15
15
|
<td><%= report_arf_column(arf_report.failed, "label-danger") %></th>
|
16
16
|
<td><%= report_arf_column(arf_report.othered, "label-warning") %></th>
|
17
17
|
<td>
|
18
18
|
<%= action_buttons(
|
19
|
-
display_link_if_authorized(_("View Report"),
|
20
|
-
display_delete_if_authorized(
|
19
|
+
display_link_if_authorized(_("View Report"), hash_for_arf_report_path(:id => arf_report.id)),
|
20
|
+
display_delete_if_authorized(hash_for_arf_report_path(:id => arf_report.id),
|
21
21
|
:confirm => _("Delete compliance report for %s?") % arf_report.asset.host)
|
22
22
|
) %>
|
23
23
|
</td>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-md-4">
|
3
|
+
<div class="stats-well">
|
4
|
+
<h4 class="ca" ><%= _('Report Metrics') %></h4>
|
5
|
+
<div style="margin-top:50px;padding-bottom: 40px;">
|
6
|
+
<%= reports_breakdown_chart(metrics, :class => 'statistics-pie small') %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<div class="col-md-4">
|
11
|
+
<div class="stats-well">
|
12
|
+
<h4 class="ca" ><%= _('Report Status') %></h4>
|
13
|
+
<%= flot_bar_chart("status" ,"", _("Number of Events"), status, :class => "statistics-bar")%>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="col-md-4">
|
17
|
+
<table class='table table-bordered table-striped'>
|
18
|
+
<tbody>
|
19
|
+
<% metrics.sort.each do |title, value|%>
|
20
|
+
<tr>
|
21
|
+
<td>
|
22
|
+
<%= title %>
|
23
|
+
</td>
|
24
|
+
<td>
|
25
|
+
<%= value %>
|
26
|
+
</td>
|
27
|
+
</tr>
|
28
|
+
<% end %>
|
29
|
+
</tbody>
|
30
|
+
<tfoot>
|
31
|
+
<tr>
|
32
|
+
<th><%= _("Total") %></th><th><%= @arf_report.rules_count %></th>
|
33
|
+
</tr>
|
34
|
+
</tfoot>
|
35
|
+
</table>
|
36
|
+
</div>
|
37
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<table id='report_log' class="table table-bordered table-striped">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th><%= _("Level") %></th>
|
5
|
+
<th><%= _("Resource") %></th>
|
6
|
+
<th><%= _("Message") %></th>
|
7
|
+
<th><%= _("Result") %></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<% logs.each do |log| %>
|
12
|
+
<tr>
|
13
|
+
<td><span <%= report_tag log.level %>><%= h log.level %></span></td>
|
14
|
+
<td><%= h log.source %></td>
|
15
|
+
<td><%= h log.message %></td>
|
16
|
+
<td><span <%= result_tag log.result %>><%= h log.result %></span></td>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
<tr id='ntsh' <%= "style='display: none;'".html_safe if logs.size > 0%>><td colspan="3">
|
20
|
+
<%= _("Nothing to show") %>
|
21
|
+
</td></tr>
|
22
|
+
</tbody>
|
23
|
+
</table>
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<% title "#{@arf_report.host}" %>
|
2
|
+
<p class='ra'> <%= _("Reported at %s ") % @arf_report.reported_at %> </p>
|
3
|
+
|
4
|
+
<% content_for(:search_bar) {show_logs} %>
|
5
|
+
|
6
|
+
<%= render 'output', :logs => @arf_report.logs%>
|
7
|
+
<%= render 'metrics', :status => @arf_report.status, :metrics => @arf_report.metrics %>
|
8
|
+
|
9
|
+
<%= title_actions link_to(_('Back'), :back),
|
10
|
+
display_delete_if_authorized(hash_for_arf_report_path(:id => @arf_report), :class=> "btn btn-danger"),
|
11
|
+
link_to(_("Host details"), @arf_report.host),
|
12
|
+
link_to(_("View full report"), show_html_arf_report_path(:id => @arf_report.id)),
|
13
|
+
link_to(_("Download XML in bzip"), parse_bzip_arf_report_path(:id => @arf_report.id))
|
14
|
+
%>
|
@@ -1,6 +1,5 @@
|
|
1
1
|
<%= javascript 'foreman_openscap/load_report'%>
|
2
2
|
<div class="row">
|
3
|
-
|
4
3
|
<div id="loading">
|
5
4
|
<div class="col-md-4"></div>
|
6
5
|
<div class="col-md-4">
|
@@ -8,5 +7,5 @@
|
|
8
7
|
<%= _('Loading...') %>
|
9
8
|
</div>
|
10
9
|
</div>
|
11
|
-
<iframe id="frame" style="display: none" height="100%" width="100%" frameborder="0" src="<%=
|
12
|
-
</div>
|
10
|
+
<iframe id="frame" style="display: none" height="100%" width="100%" frameborder="0" src="<%= parse_html_arf_report_path(@arf_report) %>"></iframe>
|
11
|
+
</div>
|
@@ -1,13 +1,15 @@
|
|
1
1
|
<%= javascript 'dashboard', 'foreman_openscap/scap_hosts_show' %>
|
2
2
|
|
3
3
|
<% title _("%s compliance reports by policy") % @host.to_label %>
|
4
|
-
<% @host.
|
4
|
+
<% @host.combined_policies.each do |policy| %>
|
5
5
|
<h2 class="center-block"><%= _('Policy %s') % policy %></h2>
|
6
6
|
<div class="row">
|
7
|
+
<% data = ForemanOpenscap::HostReportDashboard::Data.new(policy, @host) %>
|
8
|
+
<% if data.has_data? %>
|
7
9
|
<div class="col-md-4">
|
8
10
|
<div class="stats-well">
|
9
11
|
<h4 class="header ca"><%= _('%s latest report') % policy.name %></h4>
|
10
|
-
<% report =
|
12
|
+
<% report = data.report %>
|
11
13
|
<%= host_policy_breakdown_chart(report, :class => 'statistics-pie small') %>
|
12
14
|
</div>
|
13
15
|
</div>
|
@@ -18,6 +20,11 @@
|
|
18
20
|
<%= flot_chart('resource_graph', '', '', host_arf_reports_chart(policy.id)) %>
|
19
21
|
</div>
|
20
22
|
</div>
|
23
|
+
<% else %>
|
24
|
+
<div class="col-md-4">
|
25
|
+
<h4 class="header ca"><%= _('No report for this policy') %></h4>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
21
28
|
</div>
|
22
29
|
<hr style="border: 1px solid #eeeeee"/>
|
23
30
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<h4 class="ca"><%= _('Latest compliance reports') %></h4>
|
2
|
-
<% latest_reports =
|
2
|
+
<% latest_reports = ForemanOpenscap::ArfReport.latest %>
|
3
3
|
<% if latest_reports.empty? %>
|
4
4
|
<p class="ca"><%= _("No reports available") %></p>
|
5
5
|
<% else %>
|
@@ -13,8 +13,8 @@
|
|
13
13
|
</tr>
|
14
14
|
<% latest_reports.each do |report| %>
|
15
15
|
<tr>
|
16
|
-
<td><%= link_to h(report.host.nil? ? _('Host does not exist anymore') : report.host.name),
|
17
|
-
<td><%= link_to h(report.policy.name),
|
16
|
+
<td><%= link_to h(report.host.nil? ? _('Host does not exist anymore') : report.host.name), arf_report_path(report) %></td>
|
17
|
+
<td><%= link_to h(report.policy.name), policy_dashboard_policy_path(report.policy) %></td>
|
18
18
|
<td><%= report_event_column(report.passed, "label-success") %></td>
|
19
19
|
<td><%= report_event_column(report.failed, "label-danger") %></td>
|
20
20
|
<td><%= report_event_column(report.othered, "label-info") %></td>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<h4 class="header ca"><%= _('Compliance reports breakdown') %></h4>
|
2
|
-
<% report =
|
2
|
+
<% report = ForemanOpenscap::ReportDashboard::Data.new().report %>
|
3
3
|
<%= reports_breakdown_chart(report, :class => 'statistics-pie small') %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% td_style = "font-size: 125%; width: 33%; padding: 5px; border: 1px solid #ccc;" %>
|
2
|
+
<% p_style = "font-weight: bold; margin: 5px; padding: 0px;" %>
|
3
|
+
<% b_style = "color: #6bb5df;" %>
|
4
|
+
<table style="border: 1px solid #cccccc; padding: 5px; background-color: #ffffff; border-collapse: collapse; text-align: center; width: 100%">
|
5
|
+
<tbody>
|
6
|
+
<tr>
|
7
|
+
<td style="<%= td_style %>">
|
8
|
+
<b style="<%= b_style %>"><%= (changed_hosts.length.to_s).html_safe %></b>
|
9
|
+
<p style="<%= p_style %>"><%= _('Changed').html_safe %></p>
|
10
|
+
</td>
|
11
|
+
<td style="<%= td_style %>">
|
12
|
+
<b style="<%= b_style %>"><%= (compliant_hosts.length.to_s).html_safe %></b>
|
13
|
+
<p style="<%= p_style %>"><%= _('Compliant').html_safe %></p>
|
14
|
+
</td>
|
15
|
+
<td style="<%= td_style %>">
|
16
|
+
<b style="<%= b_style %>"><%= (incompliant_hosts.length.to_s).html_safe %></b>
|
17
|
+
<p style="<%= p_style %>"><%= _('Incompliant').html_safe %></p>
|
18
|
+
</td>
|
19
|
+
</tr>
|
20
|
+
</tbody>
|
21
|
+
</table>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<% th_style = "text-align: left; border-collapse: collapse; background: #f5f5f5; background: linear-gradient(#f5f5f5, #e8e8e8); padding: 4px; border: 1px solid #cccccc;" %>
|
2
|
+
<% td_style = "text-align: left; border-collapse: collapse; background-color: #FFFFFF; padding: 4px; border: 1px solid #cccccc;" %>
|
3
|
+
<tr>
|
4
|
+
<th style="<%= th_style %>">
|
5
|
+
<%= _('Hostname') %>
|
6
|
+
</th>
|
7
|
+
<th style="<%= th_style %>">
|
8
|
+
<%= _('Passed') %>
|
9
|
+
</th>
|
10
|
+
<th style="<%= th_style %>">
|
11
|
+
<%= _('Failed') %>
|
12
|
+
</th>
|
13
|
+
<th style="<%= th_style %>">
|
14
|
+
<%= _('Other') %>
|
15
|
+
</th>
|
16
|
+
<th style="<%= th_style %>">
|
17
|
+
<%= _('Changed?') %>
|
18
|
+
</th>
|
19
|
+
</tr>
|
20
|
+
<% hosts.each do |host| %>
|
21
|
+
<tr>
|
22
|
+
<% last_report = host.reports_for_policy(policy, 1).first %>
|
23
|
+
|
24
|
+
<%= render "host_mailer/link_to_host", :host => host %>
|
25
|
+
<% if last_report %>
|
26
|
+
<td style="<%= td_style %>">
|
27
|
+
<%= last_report.passed %>
|
28
|
+
</td>
|
29
|
+
<td style="<%= td_style %>">
|
30
|
+
<%= last_report.failed %>
|
31
|
+
</td>
|
32
|
+
<td style="<%= td_style %>">
|
33
|
+
<%= last_report.othered %>
|
34
|
+
</td>
|
35
|
+
<td style="<%= td_style %>">
|
36
|
+
<%= host.scap_status_changed?(policy) ? _('Yes') : _('No') %>
|
37
|
+
</td>
|
38
|
+
<% else %>
|
39
|
+
<td style="<%= td_style %> border-right: 0px;">
|
40
|
+
<%= _('No ARF reports for this policy') %>
|
41
|
+
</td>
|
42
|
+
<% end %>
|
43
|
+
</tr>
|
44
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<h3><%= policy.name %></h3>
|
2
|
+
<table style="border: 1px solid #cccccc; padding: 5px; background-color: #ffffff; border-collapse: collapse; text-align: justify; width: 100%;" bgcolor="#ffffff">
|
3
|
+
<tbody>
|
4
|
+
<%= render :partial => "hosts", :locals => { :hosts => policy.hosts, :policy => policy } %>
|
5
|
+
</tbody>
|
6
|
+
</table>
|
7
|
+
<p style="background-color: #e1e2e3; margin: 5px 0px; padding: 0px; line-height: 24px;"><%= n_('Total of one host', 'Total of %{hosts} hosts', policy.hosts.size) % {:hosts => policy.hosts.size} %></p>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
6
|
+
<title> Summary report for OpenScap from Foreman </title>
|
7
|
+
</head>
|
8
|
+
<body style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #3f3f3f; background-color: #f1f1f1; padding: 10px 24px">
|
9
|
+
<h2 style="font-weight: normal; text-transform: uppercase; font-size: 120%;"><%= _("<b>Foreman</b> OpenScap summary").html_safe %></h2>
|
10
|
+
<h2 style="margin: 5px 0px;"><%= _("Summary from %{time} ago to now") % {:time => distance_of_time_in_words(Time.now - @time)} %></h2>
|
11
|
+
<h3 style="margin: 0px;"><%= _("Summary report from Foreman server at %{foreman_url}") % {:foreman_url => Setting[:foreman_url]} %></h3>
|
12
|
+
<div style="background: #e1e2e3; padding: 20px 40px; margin: 5px 0px 10px;">
|
13
|
+
<%= render :partial => 'dashboard', :locals => {:changed_hosts => @changed_hosts, :compliant_hosts => @compliant_hosts, :incompliant_hosts => @incompliant_hosts} %>
|
14
|
+
</div>
|
15
|
+
<div style="background: #fff; padding: 10px 20px; border: 1px solid #e1e2e3">
|
16
|
+
<%= render :partial => 'list', :locals => {:title => _("Policies with hosts:"), :list => @policies} %>
|
17
|
+
</div>
|
18
|
+
</body>
|
19
|
+
</html>
|