add IP allowlist link to superadmin nav, rename whitelist/blacklist to allowlist/denylist
This commit is contained in:
parent
f2cd3488ee
commit
f53332672b
3 changed files with 27 additions and 18 deletions
|
|
@ -711,6 +711,12 @@ defmodule ToweropsWeb.Layouts do
|
|||
>
|
||||
Organizations
|
||||
</.link>
|
||||
<.link
|
||||
navigate={~p"/admin/security"}
|
||||
class="inline-flex items-center px-1 pt-1 pb-4 text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white"
|
||||
>
|
||||
IP Allowlist
|
||||
</.link>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-1 sm:gap-2">
|
||||
|
|
@ -735,6 +741,9 @@ defmodule ToweropsWeb.Layouts do
|
|||
<.mobile_nav_link navigate={~p"/admin/organizations"} active={false}>
|
||||
<.icon name="hero-building-office-2" class="size-5" /> Organizations
|
||||
</.mobile_nav_link>
|
||||
<.mobile_nav_link navigate={~p"/admin/security"} active={false}>
|
||||
<.icon name="hero-shield-check" class="size-5" /> IP Allowlist
|
||||
</.mobile_nav_link>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ defmodule ToweropsWeb.Admin.SecurityLive.Index do
|
|||
Admin page for managing IP-based brute force protection.
|
||||
|
||||
Provides two main functions:
|
||||
1. Whitelist management - Add/remove IPs and CIDR ranges that bypass protection
|
||||
2. Block management - View and manually unblock banned IPs
|
||||
1. Allowlist management - Add/remove IPs and CIDR ranges that bypass protection
|
||||
2. Denylist management - View and manually unblock banned IPs
|
||||
"""
|
||||
use ToweropsWeb, :live_view
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ defmodule ToweropsWeb.Admin.SecurityLive.Index do
|
|||
|
||||
{:ok,
|
||||
socket
|
||||
|> assign(:page_title, "Security - Brute Force Protection")
|
||||
|> assign(:page_title, "Security - IP Access Control")
|
||||
|> assign(:current_tab, "whitelist")}
|
||||
end
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ defmodule ToweropsWeb.Admin.SecurityLive.Index do
|
|||
{:ok, _entry} ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "IP/CIDR added to whitelist")
|
||||
|> put_flash(:info, "IP/CIDR added to allowlist")
|
||||
|> assign(:show_whitelist_form, false)
|
||||
|> load_data()}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ defmodule ToweropsWeb.Admin.SecurityLive.Index do
|
|||
{:noreply,
|
||||
socket
|
||||
|> assign(:whitelist_form, to_form(Map.put(changeset, :action, :validate)))
|
||||
|> put_flash(:error, "Failed to add to whitelist")}
|
||||
|> put_flash(:error, "Failed to add to allowlist")}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -81,11 +81,11 @@ defmodule ToweropsWeb.Admin.SecurityLive.Index do
|
|||
:ok ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "Removed from whitelist")
|
||||
|> put_flash(:info, "Removed from allowlist")
|
||||
|> load_data()}
|
||||
|
||||
{:error, _} ->
|
||||
{:noreply, put_flash(socket, :error, "Failed to remove from whitelist")}
|
||||
{:noreply, put_flash(socket, :error, "Failed to remove from allowlist")}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<Layouts.admin flash={@flash} timezone={@timezone}>
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-gray-900 dark:text-white">Brute Force Protection</h1>
|
||||
<h1 class="text-2xl font-bold text-gray-900 dark:text-white">IP Access Control</h1>
|
||||
<p class="text-gray-600 dark:text-gray-400">
|
||||
Manage IP whitelist and view blocked IPs
|
||||
Manage IP allowlist and view denied IPs
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
)
|
||||
]}
|
||||
>
|
||||
Whitelist
|
||||
Allowlist
|
||||
</button>
|
||||
|
||||
<button
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
)
|
||||
]}
|
||||
>
|
||||
Blocked IPs
|
||||
Denylist
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
|
@ -47,10 +47,10 @@
|
|||
<div class="space-y-4">
|
||||
<div class="flex justify-between items-center">
|
||||
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">
|
||||
Whitelisted IPs and CIDR Ranges
|
||||
Allowed IPs and CIDR Ranges
|
||||
</h2>
|
||||
<.button phx-click="show_whitelist_form">
|
||||
<.icon name="hero-plus" class="w-4 h-4 mr-1" /> Add to Whitelist
|
||||
<.icon name="hero-plus" class="w-4 h-4 mr-1" /> Add to Allowlist
|
||||
</.button>
|
||||
</div>
|
||||
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
</div>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<.button type="submit">Add to Whitelist</.button>
|
||||
<.button type="submit">Add to Allowlist</.button>
|
||||
<.button type="button" phx-click="hide_whitelist_form">
|
||||
Cancel
|
||||
</.button>
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
<div class="bg-white dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-white/10">
|
||||
<%= if Enum.empty?(@whitelist) do %>
|
||||
<div class="p-8 text-center text-gray-500 dark:text-gray-400">
|
||||
No whitelisted IPs or CIDR ranges
|
||||
No allowed IPs or CIDR ranges
|
||||
</div>
|
||||
<% else %>
|
||||
<.table id="whitelist" rows={@whitelist}>
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
<button
|
||||
phx-click="remove_whitelist"
|
||||
phx-value-id={entry.id}
|
||||
data-confirm="Remove this IP/CIDR from the whitelist?"
|
||||
data-confirm="Remove this IP/CIDR from the allowlist?"
|
||||
class="text-sm text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300"
|
||||
>
|
||||
Remove
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
<div class="space-y-4">
|
||||
<div class="flex justify-between items-center">
|
||||
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">
|
||||
Blocked IP Addresses
|
||||
Denied IP Addresses
|
||||
</h2>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
|
|
@ -147,7 +147,7 @@
|
|||
<div class="bg-white dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-white/10">
|
||||
<%= if Enum.empty?(@blocked_ips) do %>
|
||||
<div class="p-8 text-center text-gray-500 dark:text-gray-400">
|
||||
No blocked IPs
|
||||
No denied IPs
|
||||
</div>
|
||||
<% else %>
|
||||
<.table id="blocked_ips" rows={@blocked_ips}>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue