<% content_for :title, "WAF Policies" %>

WAF Policies

High-level firewall policies that automatically generate rules

<%= link_to "🌍 Block Countries", new_country_waf_policies_path, class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700" %> <%= link_to "Create Policy", new_waf_policy_path, class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700" %>
Total Policies
<%= number_with_delimiter(@waf_policies.count) %>
Active Policies
<%= number_with_delimiter(@waf_policies.active.count) %>
Generated Rules
<%= number_with_delimiter(Rule.policy_generated.count) %>
Deny Policies
<%= number_with_delimiter(@waf_policies.where(action: 'deny').count) %>

Firewall Policies

High-level policies that automatically generate specific WAF rules when matching network ranges are discovered.

<% if @waf_policies.any? %>
    <% @waf_policies.each do |policy| %>
  • <% if policy.country_policy? %> 🌍 <% elsif policy.asn_policy? %> 🏢 <% elsif policy.company_policy? %> 🏭 <% elsif policy.network_type_policy? %> 🌐 <% end %>
    <%= link_to policy.name, waf_policy_path(policy), class: "text-sm font-medium text-gray-900 hover:text-blue-600" %> <% if policy.active? %> Active <% else %> Inactive <% end %> <%= policy.action.upcase %>
    <%= policy.policy_type.humanize %> policy targeting <% if policy.targets.length > 3 %> <%= policy.targets.length %> items <% else %> <%= policy.targets.join(', ') %> <% end %> • <%= policy.generated_rules_count %> rules generated
    <% if policy.description.present? %>
    <%= policy.description %>
    <% end %>
    <%= link_to "View", waf_policy_path(policy), class: "inline-flex items-center px-3 py-1 border border-gray-300 shadow-sm text-xs font-medium rounded text-gray-700 bg-white hover:bg-gray-50" %> <% if policy.active? %> <%= link_to "Deactivate", deactivate_waf_policy_path(policy), method: :post, data: { confirm: "Are you sure you want to deactivate this policy?" }, class: "inline-flex items-center px-3 py-1 border border-gray-300 shadow-sm text-xs font-medium rounded text-gray-700 bg-white hover:bg-gray-50" %> <% else %> <%= link_to "Activate", activate_waf_policy_path(policy), method: :post, class: "inline-flex items-center px-3 py-1 border border-transparent shadow-sm text-xs font-medium rounded text-white bg-green-600 hover:bg-green-700" %> <% end %> <%= link_to "Edit", edit_waf_policy_path(policy), class: "inline-flex items-center px-3 py-1 border border-gray-300 shadow-sm text-xs font-medium rounded text-gray-700 bg-white hover:bg-gray-50" %>
  • <% end %>
<% else %>

No policies

Get started by creating your first WAF policy.

<%= link_to "Create Policy", new_waf_policy_path, class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700" %>
<% end %>
<% if @waf_policies.respond_to?(:total_pages) && @waf_policies.total_pages > 1 %>
<%= link_to_previous_page @waf_policies, "Previous", class: "relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" %> <%= link_to_next_page @waf_policies, "Next", class: "ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" %>
<% end %>