foreman_openscap 0.4.3 → 0.5.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.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_openscap/load_report.js +1 -1
  3. data/app/assets/javascripts/foreman_openscap/policy_edit.js +0 -2
  4. data/app/controllers/api/v2/compliance/arf_reports_controller.rb +7 -22
  5. data/app/controllers/api/v2/compliance/policies_controller.rb +5 -5
  6. data/app/controllers/api/v2/compliance/scap_contents_controller.rb +3 -3
  7. data/app/controllers/arf_reports_controller.rb +62 -0
  8. data/app/controllers/{scaptimony_dashboard_controller.rb → compliance_dashboard_controller.rb} +1 -1
  9. data/app/controllers/compliance_hosts_controller.rb +5 -0
  10. data/app/controllers/{scaptimony_policies_controller.rb → policies_controller.rb} +13 -13
  11. data/app/controllers/{scaptimony_policy_dashboard_controller.rb → policy_dashboard_controller.rb} +3 -3
  12. data/app/controllers/{scaptimony_scap_contents_controller.rb → scap_contents_controller.rb} +11 -11
  13. data/app/helpers/{scaptimony_report_dashboard_helper.rb → arf_report_dashboard_helper.rb} +3 -5
  14. data/app/helpers/arf_reports_helper.rb +21 -0
  15. data/app/helpers/compliance_hosts_helper.rb +25 -0
  16. data/app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb +2 -32
  17. data/app/helpers/{scaptimony_policies_helper.rb → policies_helper.rb} +6 -2
  18. data/app/helpers/{scaptimony_policy_dashboard_helper.rb → policy_dashboard_helper.rb} +8 -8
  19. data/app/lib/proxy_api/available_proxy.rb +26 -0
  20. data/app/lib/proxy_api/openscap.rb +40 -0
  21. data/app/mailers/foreman_openscap/policy_mailer.rb +42 -0
  22. data/app/models/concerns/foreman_openscap/compliance_status_scoped_search.rb +91 -0
  23. data/app/models/concerns/foreman_openscap/host_extensions.rb +73 -17
  24. data/app/models/concerns/foreman_openscap/hostgroup_extensions.rb +3 -5
  25. data/app/models/foreman_openscap/arf_report.rb +165 -0
  26. data/app/models/foreman_openscap/asset.rb +27 -0
  27. data/app/models/foreman_openscap/asset_policy.rb +6 -0
  28. data/app/models/foreman_openscap/compliance_status.rb +50 -0
  29. data/app/models/{concerns/foreman_openscap/policy_extensions.rb → foreman_openscap/policy.rb} +72 -45
  30. data/app/models/foreman_openscap/policy_arf_report.rb +8 -0
  31. data/app/models/foreman_openscap/policy_revision.rb +6 -0
  32. data/app/models/foreman_openscap/scap_content.rb +112 -0
  33. data/app/models/foreman_openscap/scap_content_profile.rb +6 -0
  34. data/app/overrides/hosts/overview/host_compliance_status.rb +4 -4
  35. data/app/services/foreman_openscap/arf_report_status_calculator.rb +45 -0
  36. data/app/services/{scaptimony → foreman_openscap}/host_report_dashboard/data.rb +12 -6
  37. data/app/services/{scaptimony → foreman_openscap}/policy_dashboard/data.rb +5 -5
  38. data/app/services/{scaptimony → foreman_openscap}/report_dashboard/data.rb +4 -4
  39. data/app/views/api/v2/compliance/policies/create.json.rabl +3 -0
  40. data/app/views/{scaptimony_arf_reports → arf_reports}/_list.html.erb +4 -4
  41. data/app/views/arf_reports/_metrics.html.erb +37 -0
  42. data/app/views/arf_reports/_output.html.erb +23 -0
  43. data/app/views/{scaptimony_arf_reports → arf_reports}/index.html.erb +0 -0
  44. data/app/views/arf_reports/show.html.erb +14 -0
  45. data/app/views/{scaptimony_arf_reports/show.html.erb → arf_reports/show_html.html.erb} +2 -3
  46. data/app/views/compliance_hosts/_compliance_status.erb +6 -0
  47. data/app/views/{scaptimony_hosts → compliance_hosts}/show.html.erb +9 -2
  48. data/app/views/dashboard/{_foreman_openscap_host_reports_widget.html.erb → _compliance_host_reports_widget.html.erb} +3 -3
  49. data/app/views/dashboard/{_foreman_openscap_reports_breakdown_widget.html.erb → _compliance_reports_breakdown_widget.html.erb} +1 -1
  50. data/app/views/foreman_openscap/policy_mailer/_dashboard.erb +21 -0
  51. data/app/views/foreman_openscap/policy_mailer/_hosts.erb +44 -0
  52. data/app/views/foreman_openscap/policy_mailer/_list.erb +10 -0
  53. data/app/views/foreman_openscap/policy_mailer/_policy.erb +7 -0
  54. data/app/views/foreman_openscap/policy_mailer/policy_summary.erb +19 -0
  55. data/app/views/{scaptimony_policies → policies}/_form.html.erb +2 -8
  56. data/app/views/{scaptimony_policies → policies}/_list.html.erb +5 -5
  57. data/app/views/policies/_scap_content_results.html.erb +3 -0
  58. data/app/views/policies/create.html.erb +2 -0
  59. data/app/views/{scaptimony_policies → policies}/disassociate_multiple_hosts.html.erb +2 -2
  60. data/app/views/{scaptimony_policies → policies}/edit.html.erb +0 -0
  61. data/app/views/{scaptimony_policies → policies}/index.html.erb +1 -1
  62. data/app/views/policies/new.html.erb +2 -0
  63. data/app/views/{scaptimony_policies → policies}/select_multiple_hosts.html.erb +2 -2
  64. data/app/views/{scaptimony_policies → policies}/show.html.erb +1 -1
  65. data/app/views/{scaptimony_policies → policies}/steps/_create_policy_form.html.erb +0 -0
  66. data/app/views/{scaptimony_policies → policies}/steps/_hostgroups_form.html.erb +0 -0
  67. data/app/views/{scaptimony_policies → policies}/steps/_locations_form.html.erb +0 -0
  68. data/app/views/{scaptimony_policies → policies}/steps/_organizations_form.html.erb +0 -0
  69. data/app/views/policies/steps/_scap_content_form.html.erb +9 -0
  70. data/app/views/{scaptimony_policies → policies}/steps/_schedule_form.html.erb +1 -1
  71. data/app/views/{scaptimony_policies → policies}/steps/_step_form.html.erb +3 -3
  72. data/app/views/{scaptimony_policies → policies}/welcome.html.erb +2 -2
  73. data/app/views/{scaptimony_policy_dashboard → policy_dashboard}/_policy_chart_widget.html.erb +0 -0
  74. data/app/views/{scaptimony_policy_dashboard → policy_dashboard}/_policy_reports.html.erb +2 -2
  75. data/app/views/{scaptimony_policy_dashboard → policy_dashboard}/_policy_status_widget.html.erb +3 -3
  76. data/app/views/{scaptimony_policy_dashboard → policy_dashboard}/index.html.erb +0 -0
  77. data/app/views/{scaptimony_scap_contents → scap_contents}/_form.html.erb +5 -6
  78. data/app/views/{scaptimony_scap_contents → scap_contents}/_list.html.erb +3 -3
  79. data/app/views/{scaptimony_scap_contents → scap_contents}/edit.html.erb +0 -0
  80. data/app/views/{scaptimony_scap_contents → scap_contents}/index.html.erb +1 -1
  81. data/app/views/{scaptimony_scap_contents → scap_contents}/new.html.erb +0 -0
  82. data/app/views/{scaptimony_scap_contents → scap_contents}/welcome.html.erb +2 -2
  83. data/config/routes.rb +15 -11
  84. data/db/migrate/20141013172051_create_scaptimony_policies.rb +9 -0
  85. data/db/migrate/20141014105333_create_scaptimony_assets.rb +10 -0
  86. data/db/migrate/20141015092642_create_scaptimony_arf_reports.rb +13 -0
  87. data/db/migrate/20141015115511_add_arf_report_unique_constraint.rb +6 -0
  88. data/db/migrate/20141104164201_create_scaptimony_scap_contents.rb +7 -0
  89. data/db/migrate/20141104171545_create_scaptimony_policy_revisions.rb +14 -0
  90. data/db/migrate/20141105174625_add_description_to_scaptimony_policy_revisions.rb +5 -0
  91. data/db/migrate/20141105174834_add_columns_to_scaptimony_policies.rb +12 -0
  92. data/db/migrate/20141107091756_add_columns_to_scaptimony_scap_contents.rb +8 -0
  93. data/db/migrate/20141111104519_add_constraint_to_scaptimony_scap_contents.rb +5 -0
  94. data/db/migrate/20141113221054_create_scaptimony_scap_content_profiles.rb +12 -0
  95. data/db/migrate/20141116170632_remove_xccdf_profile_from_scaptimony_policies.rb +5 -0
  96. data/db/migrate/20141116171305_add_profile_to_scaptimony_policies.rb +6 -0
  97. data/db/migrate/20141118142954_add_constraint_to_scaptimony_policies.rb +5 -0
  98. data/db/migrate/20141119164918_create_scaptimony_xccdf_results.rb +8 -0
  99. data/db/migrate/20141119175434_create_scaptimony_xccdf_rules.rb +8 -0
  100. data/db/migrate/20141119182606_create_scaptimony_xccdf_rule_results.rb +9 -0
  101. data/db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb +24 -0
  102. data/db/migrate/20141121164042_replace_arf_report_breakdown_view.rb +25 -0
  103. data/db/migrate/20141206211151_create_scaptimony_assets_policies.rb +9 -0
  104. data/db/migrate/20141214112917_add_scap_file_to_scap_content.rb +5 -0
  105. data/db/migrate/20141216154502_rename_scaptimony_asset_policies.rb +5 -0
  106. data/db/migrate/20150111085317_polymorph_asset.rb +8 -0
  107. data/db/migrate/20150112152944_create_scaptimony_arf_report_raws.rb +10 -0
  108. data/db/migrate/20150114210634_rename_scaptimony_arf_report_raw_raw.rb +5 -0
  109. data/db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb +21 -0
  110. data/db/migrate/20150116083129_add_day_of_month_and_cron_line_to_scaptimony_policy.rb +6 -0
  111. data/db/migrate/20150821100137_migrate_from_scaptimony.rb +59 -0
  112. data/db/migrate/20150827123826_remove_scaptimony_permissions.rb +21 -0
  113. data/db/migrate/20150925124959_create_policy_arf_reports.rb +13 -0
  114. data/db/migrate/20150929124853_add_result_to_logs.rb +9 -0
  115. data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +179 -0
  116. data/db/migrate/20151023131950_link_arf_report_directly_to_host.rb +17 -0
  117. data/db/seeds.d/openscap_policy_notification.rb +9 -0
  118. data/lib/foreman_openscap/bulk_upload.rb +3 -1
  119. data/lib/foreman_openscap/engine.rb +53 -42
  120. data/lib/foreman_openscap/helper.rb +8 -0
  121. data/lib/foreman_openscap/version.rb +1 -1
  122. data/lib/tasks/foreman_openscap_tasks.rake +14 -0
  123. data/test/factories/arf_report_factory.rb +9 -6
  124. data/test/factories/asset_factory.rb +1 -1
  125. data/test/factories/compliance_host_factory.rb +9 -0
  126. data/test/factories/compliance_log_factory.rb +11 -0
  127. data/test/factories/policy_arf_report_factory.rb +6 -0
  128. data/test/factories/policy_factory.rb +3 -2
  129. data/test/factories/scap_content_related.rb +2 -2
  130. data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +4 -3
  131. data/test/functional/api/v2/compliance/policies_controller_test.rb +2 -2
  132. data/test/functional/api/v2/compliance/scap_contents_controller_test.rb +3 -1
  133. data/test/lib/foreman_openscap/bulk_upload_test.rb +1 -1
  134. data/test/test_plugin_helper.rb +30 -0
  135. data/test/unit/arf_report_status_calculator_test.rb +11 -0
  136. data/test/unit/arf_report_test.rb +148 -0
  137. data/test/unit/compliance_status_test.rb +71 -0
  138. data/test/unit/openscap_host_test.rb +38 -7
  139. data/test/unit/policy_mailer_test.rb +38 -0
  140. data/test/unit/scap_content_test.rb +32 -0
  141. metadata +130 -74
  142. data/app/controllers/scaptimony_arf_reports_controller.rb +0 -34
  143. data/app/controllers/scaptimony_hosts_controller.rb +0 -5
  144. data/app/models/concerns/foreman_openscap/arf_report_extensions.rb +0 -50
  145. data/app/models/concerns/foreman_openscap/asset_extensions.rb +0 -34
  146. data/app/models/concerns/foreman_openscap/scap_content_extensions.rb +0 -40
  147. data/app/overrides/hosts/index/host_arf_report.rb +0 -5
  148. data/app/views/scaptimony_arf_reports/_host_report.html.erb +0 -8
  149. data/app/views/scaptimony_hosts/_host_status.html.erb +0 -17
  150. data/app/views/scaptimony_policies/_scap_content_results.html.erb +0 -7
  151. data/app/views/scaptimony_policies/create.html.erb +0 -2
  152. data/app/views/scaptimony_policies/new.html.erb +0 -2
  153. data/app/views/scaptimony_policies/steps/_scap_content_form.html.erb +0 -17
@@ -1,7 +1,7 @@
1
1
  <%= javascript 'foreman_openscap/policy_edit' %>
2
2
  <%= javascript 'foreman_openscap/period_selector' %>
3
3
  <%= form_for @policy,
4
- :url => (@policy.id? ? scaptimony_policy_path(:id => @policy.id) : scaptimony_policies_path) do |f| %>
4
+ :url => (@policy.id? ? policy_path(:id => @policy.id) : policies_path) do |f| %>
5
5
  <%= base_errors_for @policy %>
6
6
 
7
7
  <ul class="nav nav-tabs" data-tabs="tabs">
@@ -26,18 +26,12 @@
26
26
  <span id="scap_content_profile_select">
27
27
  <%= scap_content_profile_selector(f) %>
28
28
  </span>
29
- <div class="alert alert-info">
30
- <%= icon_text("info-sign", _('Notice: Ensure the selected SCAP content exists on your hosts.')) %>
31
- <div id="file-location">
32
- <b><%= _('SCAP content file should be /var/lib/openscap/content/%s.xml on your clients.') % @policy.scap_content.digest %></b>
33
- </div>
34
- </div>
35
29
  </div>
36
30
  <div class="tab-pane" id="scap_schedule">
37
31
  <%= select_f(f, :period, %w[Weekly Monthly Custom], :downcase, :to_s,
38
32
  { :include_blank => _('Choose period') },
39
33
  { :onchange => 'period_selected(this)' }) %>
40
- <%= select_f(f, :weekday, Date::DAYNAMES, :downcase, :to_s, :include_blank => _('Choose weekday')) %>
34
+ <%= select_f(f, :weekday, days_of_week_hash, :first, :last, :include_blank => _('Choose weekday')) %>
41
35
  <%= text_f(f, :day_of_month, :help_inline => _('Number of a day in month, note that not all months have same count of days')) %>
42
36
  <%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space')) %>
43
37
  </div>
@@ -8,12 +8,12 @@
8
8
  <% for policy in @policies %>
9
9
  <tr>
10
10
  <td>
11
- <%= link_to_if_authorized(policy.name.to_s, hash_for_scaptimony_policy_dashboard_scaptimony_policy_path(:id => policy.id)) %>
11
+ <%= link_to_if_authorized(policy.name.to_s, hash_for_policy_dashboard_policy_path(:id => policy.id)) %>
12
12
  </td>
13
13
  <td>
14
14
  <% if !policy.scap_content.nil? %>
15
15
  <%= link_to_if_authorized policy.scap_content.title,
16
- hash_for_edit_scaptimony_scap_content_path(:id => policy.scap_content) %>
16
+ hash_for_edit_scap_content_path(:id => policy.scap_content) %>
17
17
  <% end %>
18
18
  </td>
19
19
  <td>
@@ -21,9 +21,9 @@
21
21
  </td>
22
22
  <td>
23
23
  <%= action_buttons(
24
- display_link_if_authorized(_("Show Guide"), hash_for_scaptimony_policy_path(:id => policy.id)),
25
- display_link_if_authorized(_("Edit"), hash_for_edit_scaptimony_policy_path(:id => policy.id)),
26
- display_delete_if_authorized(hash_for_scaptimony_policy_path(:id => policy.id),
24
+ display_link_if_authorized(_("Show Guide"), hash_for_policy_path(:id => policy.id)),
25
+ display_link_if_authorized(_("Edit"), hash_for_edit_policy_path(:id => policy.id)),
26
+ display_delete_if_authorized(hash_for_policy_path(:id => policy.id),
27
27
  :confirm => _("Delete compliance policy %s with all the reports?") % policy.name)
28
28
  ) %>
29
29
  </td>
@@ -0,0 +1,3 @@
1
+ <%= fields_for @policy do |f| %>
2
+ <%= scap_content_profile_selector(f) %>
3
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <% title _("New Compliance Policy") %>
2
+ <%= render :partial => "policies/steps/step_form" %>
@@ -1,7 +1,7 @@
1
1
  <%= render 'hosts/selected_hosts', :hosts => @hosts %>
2
2
  <%= form_for :policy,
3
- :url => remove_policy_from_multiple_hosts_scaptimony_policies_path(:host_ids => params[:host_ids]) do |f| %>
3
+ :url => remove_policy_from_multiple_hosts_policies_path(:host_ids => params[:host_ids]) do |f| %>
4
4
  <%= selectable_f f, :id, [[_('Select Compliance Policy'), 'disabled'],
5
- ] + Scaptimony::Policy.all.map{|e| [e.name, e.id]},{},
5
+ ] + ForemanOpenscap::Policy.all.map{|e| [e.name, e.id]},{},
6
6
  :onchange => 'toggle_multiple_ok_button(this)' %>
7
7
  <% end %>
@@ -2,7 +2,7 @@
2
2
  <% title _("Compliance Policies") %>
3
3
 
4
4
  <% title_actions(
5
- display_link_if_authorized(_("New Compliance Policy"), hash_for_new_scaptimony_policy_path),
5
+ display_link_if_authorized(_("New Compliance Policy"), hash_for_new_policy_path),
6
6
  link_to(_("Help"), :action => "welcome")
7
7
  ) %>
8
8
 
@@ -0,0 +1,2 @@
1
+ <% title _("New Compliance Policy") %>
2
+ <%= render :partial => "policies/steps/step_form" %>
@@ -1,8 +1,8 @@
1
1
  <%= render 'hosts/selected_hosts', :hosts => @hosts %>
2
2
 
3
3
  <%= form_for :policy,
4
- :url => update_multiple_hosts_scaptimony_policies_path(:host_ids => params[:host_ids]) do |f| %>
4
+ :url => update_multiple_hosts_policies_path(:host_ids => params[:host_ids]) do |f| %>
5
5
  <%= selectable_f f, :id, [[_("Select Compliance Policy"), "disabled"],
6
- ] + Scaptimony::Policy.all.map{|e| [e.name, e.id]},{},
6
+ ] + ForemanOpenscap::Policy.all.map{|e| [e.name, e.id]},{},
7
7
  :onchange => "toggle_multiple_ok_button(this)" %>
8
8
  <% end %>
@@ -1,3 +1,3 @@
1
1
  <div class="row">
2
- <iframe style="min-height: 800px" height="100%" width="100%" frameborder="0" src="<%= parse_scaptimony_policy_path(@policy) %>"></iframe>
2
+ <iframe style="min-height: 800px" height="100%" width="100%" frameborder="0" src="<%= parse_policy_path(@policy) %>"></iframe>
3
3
  </div>
@@ -0,0 +1,9 @@
1
+ <div class="tab-pane <%= show_partial_wizard(step) %>" id="scap_content">
2
+ <%= wizard_header @policy.step_index, *@policy.steps %>
3
+
4
+ <%= scap_content_selector(f) %>
5
+ <span id="scap_content_profile_select">
6
+ <%= scap_content_profile_selector(f) %>
7
+ </span>
8
+ </div>
9
+
@@ -5,7 +5,7 @@
5
5
  <%= select_f(f, :period, %w[Weekly Monthly Custom], :downcase, :to_s,
6
6
  { :include_blank => _('Choose period') },
7
7
  { :onchange => 'period_selected(this)' }) %>
8
- <%= select_f(f, :weekday, Date::DAYNAMES, :downcase, :to_s, :include_blank => _('Choose weekday')) %>
8
+ <%= select_f(f, :weekday, days_of_week_hash, :first, :last, :include_blank => _('Choose weekday')) %>
9
9
  <%= text_f(f, :day_of_month, :help_inline => _('Number of a day in month, note that not all months have same count of days')) %>
10
10
  <%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space')) %>
11
11
  </div>
@@ -1,11 +1,11 @@
1
1
  <%= javascript 'foreman_openscap/policy_edit' %>
2
2
  <%= stylesheet 'foreman_openscap/policy' %>
3
3
  <%= form_for @policy,
4
- :url => (@policy.id? ? scaptimony_policy_path(:id => @policy.id) : scaptimony_policies_path) do |f| %>
4
+ :url => (@policy.id? ? policy_path(:id => @policy.id) : policies_path) do |f| %>
5
5
  <%= base_errors_for @policy %>
6
6
  <%= f.hidden_field(:current_step, :value => @policy.next_step) unless @policy.current_step.blank? %>
7
7
  <% @policy.steps.each do | step | %>
8
- <%= render :partial => "scaptimony_policies/steps/#{step.downcase.tr(' ', '_')}_form", :locals => {:f => f, :step => step} %>
8
+ <%= render :partial => "policies/steps/#{step.downcase.tr(' ', '_')}_form", :locals => {:f => f, :step => step} %>
9
9
  <% end %>
10
10
  <%= submit_or_cancel_policy(f, (_('Next') unless @policy.last_step?) ) %>
11
- <% end %>
11
+ <% end %>
@@ -1,4 +1,4 @@
1
- <% title_actions display_link_if_authorized(_("New Compliance policy"), hash_for_new_scaptimony_policy_path) %>
1
+ <% title_actions display_link_if_authorized(_("New Compliance policy"), hash_for_new_policy_path) %>
2
2
 
3
3
  <% title _("Compliance policy configuration") %>
4
4
  <div id="welcome">
@@ -9,6 +9,6 @@
9
9
  </p>
10
10
  <p>
11
11
  <%= (_('In Foreman, a compliance policy checklist is defined via %s, once SCAP content is present, you can create a policy,
12
- assign select hostgroups and schedule to run.') % link_to(_('SCAP content'), scaptimony_scap_contents_path)).html_safe %>
12
+ assign select hostgroups and schedule to run.') % link_to(_('SCAP content'), scap_contents_path)).html_safe %>
13
13
  </p>
14
14
  </div>
@@ -10,13 +10,13 @@
10
10
  <% for arf_report in @policy.arf_reports.latest %>
11
11
  <tr>
12
12
  <td><%= name_column(arf_report.host) %></td>
13
- <td><%= _("%s ago") % time_ago_in_words(arf_report.date) %></td>
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
- link_to(_("View Report"), hash_for_scaptimony_arf_report_path(:id => arf_report.id))
19
+ link_to(_("View Report"), hash_for_arf_report_path(:id => arf_report.id))
20
20
  ) %>
21
21
  </td>
22
22
  </tr>
@@ -1,9 +1,9 @@
1
1
  <div id='status-table'>
2
2
  <h4 class="header"><%= _('Hosts Breakdown') %></h4>
3
3
  <ul>
4
- <%= status_link _('Compliant with the policy'), :compliant_hosts, scaptimony_arf_reports_path(:search => "comply_with = #{@policy.name}") %>
5
- <%= status_link _('Not compliant with the policy'), :incompliant_hosts, scaptimony_arf_reports_path(:search => "not_comply_with = #{@policy.name}") %>
6
- <%= status_link _('Inconclusive results'), :inconclusive_hosts, scaptimony_arf_reports_path(:search => " inconclusive_with = #{@policy.name}") %>
4
+ <%= status_link _('Compliant with the policy'), :compliant_hosts, arf_reports_path(:search => "comply_with = #{@policy.name}") %>
5
+ <%= status_link _('Not compliant with the policy'), :incompliant_hosts, arf_reports_path(:search => "not_comply_with = #{@policy.name}") %>
6
+ <%= status_link _('Inconclusive results'), :inconclusive_hosts, arf_reports_path(:search => " inconclusive_with = #{@policy.name}") %>
7
7
  <%= status_link _('Never audited'), :report_missing, hosts_path(:search => "compliance_report_missing_for = #{@policy.name}") %>
8
8
  <h4 class="total">
9
9
  <%= link_to(_("Total hosts: %s") % @report[:assigned_hosts], hosts_path(:search => "compliance_policy = #{@policy.name}")) %>
@@ -1,9 +1,9 @@
1
- <%= form_for @scaptimony_scap_content,
2
- :url => (@scaptimony_scap_content.id? ?
3
- scaptimony_scap_content_path(:id => @scaptimony_scap_content.id) : scaptimony_scap_contents_path),
1
+ <%= form_for @scap_content,
2
+ :url => (@scap_content.id? ?
3
+ scap_content_path(:id => @scap_content.id) : scap_contents_path),
4
4
  :html => { :multipart => true } do |f| %>
5
5
 
6
- <%= base_errors_for @scaptimony_scap_content %>
6
+ <%= base_errors_for @scap_content %>
7
7
 
8
8
  <ul class="nav nav-tabs" data-tabs="tabs">
9
9
  <li class="active"><a href="#primary" data-toggle="tab"><%= _("File Upload") %></a></li>
@@ -18,9 +18,8 @@
18
18
  <div class="tab-pane active" id="primary">
19
19
  <%= text_f(f, :title) %>
20
20
  <%= file_field_f f, :scap_file, :help_block => _("Upload SCAP DataStream file") %>
21
- <p class="alert alert-info"><%= (_('Notice: You need to %s OpenSCAP on your hosts, and upload this content to the hosts as well.') % link_to(_('install'), 'http://www.open-scap.org/page/Documentation#Installation', :target => '_blank')).html_safe %></p>
22
21
  </div>
23
- <%= render 'taxonomies/loc_org_tabs', :f => f, :obj => @scaptimony_scap_content %>
22
+ <%= render 'taxonomies/loc_org_tabs', :f => f, :obj => @scap_content %>
24
23
  <%= submit_or_cancel f %>
25
24
  </div>
26
25
  <% end %>
@@ -18,9 +18,9 @@
18
18
  </td>
19
19
  <td>
20
20
  <%= action_buttons(
21
- display_link_if_authorized(_("Edit"), hash_for_edit_scaptimony_scap_content_path(:id => content.id)),
22
- display_link_if_authorized(_("Download"), hash_for_scaptimony_scap_content_path(:id => content.id)),
23
- display_delete_if_authorized(hash_for_scaptimony_scap_content_path(:id => content.id),
21
+ display_link_if_authorized(_("Edit"), hash_for_edit_scap_content_path(:id => content.id)),
22
+ display_link_if_authorized(_("Download"), hash_for_scap_content_path(:id => content.id)),
23
+ display_delete_if_authorized(hash_for_scap_content_path(:id => content.id),
24
24
  :confirm => _("Delete compliance policy %s with all the reports?") % content.title)
25
25
  ) %>
26
26
  </td>
@@ -1,6 +1,6 @@
1
1
  <% title _("SCAP Contents") %>
2
2
 
3
- <% title_actions(display_link_if_authorized(_("Upload New SCAP Content"), hash_for_new_scaptimony_scap_content_path),
3
+ <% title_actions(display_link_if_authorized(_("Upload New SCAP Content"), hash_for_new_scap_content_path),
4
4
  link_to(_("Help"), :action => "welcome")) %>
5
5
 
6
6
  <%= render :partial => 'list' %>
@@ -1,4 +1,4 @@
1
- <% title_actions display_link_if_authorized(_("New SCAP content"), hash_for_new_scaptimony_scap_content_path) %>
1
+ <% title_actions display_link_if_authorized(_("New SCAP content"), hash_for_new_scap_content_path) %>
2
2
 
3
3
  <% title _("SCAP content configuration") %>
4
4
  <div id="welcome">
@@ -10,6 +10,6 @@
10
10
  </p>
11
11
  <p>
12
12
  <%= (_("In Foreman, scap_contents represent the SCAP security guides on your hosts, and create SCAP profiles for you to assign to hosts / hostgroups
13
- via %s") % link_to('compliance policies', scaptimony_policies_path)).html_safe %>
13
+ via %s") % link_to('compliance policies', policies_path)).html_safe %>
14
14
  </p>
15
15
  </div>
data/config/routes.rb CHANGED
@@ -1,21 +1,24 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
3
  scope '/compliance' do
4
- resources :arf_reports, :only => [:index, :show, :destroy],
5
- :as => :scaptimony_arf_reports, :controller => :scaptimony_arf_reports do
4
+
5
+ resources :arf_reports, :only => [:index, :show, :destroy] do
6
6
  member do
7
- match 'parse', :to => 'scaptimony_arf_reports#parse'
7
+ get 'show_html'
8
+ get 'parse_html'
9
+ get 'parse_bzip'
8
10
  end
9
11
  collection do
10
12
  get 'auto_complete_search'
11
13
  end
12
14
  end
13
- match 'dashboard', :to => 'scaptimony_dashboard#index', :as => "scaptimony_dashboard"
14
- resources :policies, :only => [:index, :new, :show, :create, :edit, :update, :destroy],
15
- :as => :scaptimony_policies, :controller => :scaptimony_policies do
15
+
16
+ match 'dashboard', :to => 'compliance_dashboard#index', :as => "compliance_dashboard"
17
+
18
+ resources :policies, :only => [:index, :new, :show, :create, :edit, :update, :destroy] do
16
19
  member do
17
- match 'parse', :to => 'scaptimony_policies#parse'
18
- match 'dashboard', :to => 'scaptimony_policy_dashboard#index', :as => 'scaptimony_policy_dashboard'
20
+ # match 'parse', :to => 'policies#parse'
21
+ match 'dashboard', :to => 'policy_dashboard#index', :as => 'policy_dashboard'
19
22
  end
20
23
  collection do
21
24
  get 'auto_complete_search'
@@ -26,13 +29,14 @@ Rails.application.routes.draw do
26
29
  post 'remove_policy_from_multiple_hosts'
27
30
  end
28
31
  end
29
- resources :scap_contents,
30
- :as => :scaptimony_scap_contents, :controller => :scaptimony_scap_contents do
32
+
33
+ resources :scap_contents do
31
34
  collection do
32
35
  get 'auto_complete_search'
33
36
  end
34
37
  end
35
- resources :hosts, :only => [:show], :as => :scaptimony_hosts, :controller => :scaptimony_hosts
38
+
39
+ resources :hosts, :only => [:show], :as => :compliance_hosts, :controller => :compliance_hosts
36
40
  end
37
41
 
38
42
  namespace :api do
@@ -0,0 +1,9 @@
1
+ class CreateScaptimonyPolicies < ActiveRecord::Migration
2
+ def change
3
+ create_table :scaptimony_policies do |t|
4
+ t.string :name, limit: 80
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateScaptimonyAssets < ActiveRecord::Migration
2
+ def change
3
+ create_table :scaptimony_assets do |t|
4
+ t.string :name, limit: 255
5
+
6
+ t.timestamps
7
+ end
8
+ add_index :scaptimony_assets, :name, unique: true
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ class CreateScaptimonyArfReports < ActiveRecord::Migration
2
+ def change
3
+ create_table :scaptimony_arf_reports do |t|
4
+ t.references :asset, index: true
5
+ t.references :policy, index: true
6
+ t.datetime :date
7
+ t.string :digest, limit: 128
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :scaptimony_arf_reports, :digest, unique: true
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ class AddArfReportUniqueConstraint < ActiveRecord::Migration
2
+ def change
3
+ add_index :scaptimony_arf_reports, [:asset_id, :policy_id, :date, :digest],
4
+ :unique => true, :name => :index_scaptimony_arf_reports_unique_set
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ class CreateScaptimonyScapContents < ActiveRecord::Migration
2
+ def change
3
+ create_table :scaptimony_scap_contents do |t|
4
+ t.timestamps
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,14 @@
1
+ class CreateScaptimonyPolicyRevisions < ActiveRecord::Migration
2
+ def change
3
+ create_table :scaptimony_policy_revisions do |t|
4
+ t.references :policy, index: true
5
+ t.references :scap_content, index: true
6
+ t.string :xccdf_profile
7
+ t.string :period
8
+ t.string :weekday
9
+ t.timestamp :active_until
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class AddDescriptionToScaptimonyPolicyRevisions < ActiveRecord::Migration
2
+ def change
3
+ add_column :scaptimony_policy_revisions, :description, :string
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ class AddColumnsToScaptimonyPolicies < ActiveRecord::Migration
2
+ def change
3
+ add_column :scaptimony_policies, :xccdf_profile, :string
4
+ add_column :scaptimony_policies, :period, :string
5
+ add_column :scaptimony_policies, :weekday, :string
6
+ add_column :scaptimony_policies, :description, :string
7
+
8
+ # This works only with rails-4, I want to support rails-3 too
9
+ # add_reference :scaptimony_policies, :scap_content, index: true
10
+ add_column :scaptimony_policies, :scap_content_id, :integer, references: :scap_content
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ class AddColumnsToScaptimonyScapContents < ActiveRecord::Migration
2
+ def change
3
+ add_column :scaptimony_scap_contents, :title, :string
4
+ add_column :scaptimony_scap_contents, :original_filename, :string
5
+ add_index :scaptimony_scap_contents, :title
6
+ add_index :scaptimony_scap_contents, :original_filename
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddConstraintToScaptimonyScapContents < ActiveRecord::Migration
2
+ def change
3
+ change_column :scaptimony_scap_contents, :title, :string, :null => false
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ class CreateScaptimonyScapContentProfiles < ActiveRecord::Migration
2
+ def change
3
+ create_table :scaptimony_scap_content_profiles do |t|
4
+ t.references :scap_content, index: true
5
+ t.string :profile_id
6
+ t.string :title
7
+
8
+ end
9
+ add_index :scaptimony_scap_content_profiles, [:scap_content_id, :profile_id],
10
+ :unique => true, :name => :index_scaptimony_scap_content_profiles_scipi
11
+ end
12
+ end