refactor: remove IP and MAC filter options from Proxmox firewall component, update DHCP and NDP settings for improved security and clarity in configuration
This commit is contained in:
@@ -25,8 +25,6 @@ class Firewall extends Component
|
||||
// Firewall Options (policies, filters)
|
||||
public string $policyIn = 'DROP';
|
||||
public string $policyOut = 'ACCEPT';
|
||||
public bool $ipFilter = true;
|
||||
public bool $macFilter = true;
|
||||
public bool $showPolicyInfoModal = false;
|
||||
|
||||
// Rules Management
|
||||
@@ -368,8 +366,6 @@ class Firewall extends Component
|
||||
$this->firewallEnabled = ($options['enable'] ?? 0) == 1;
|
||||
$this->policyIn = strtoupper($options['policy_in'] ?? 'DROP');
|
||||
$this->policyOut = strtoupper($options['policy_out'] ?? 'ACCEPT');
|
||||
$this->ipFilter = ($options['ipfilter'] ?? 1) == 1;
|
||||
$this->macFilter = ($options['macfilter'] ?? 1) == 1;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Failed to load firewall options: ' . $e->getMessage());
|
||||
@@ -383,14 +379,14 @@ class Firewall extends Component
|
||||
try {
|
||||
$newState = !$this->firewallEnabled;
|
||||
|
||||
// Always force DHCP and NDP (router advertisements) to 0 for security
|
||||
// Always force DHCP disabled and NDP enabled
|
||||
$response = $this->firewallRequest(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/firewall/options',
|
||||
'put',
|
||||
[
|
||||
'enable' => $newState ? 1 : 0,
|
||||
'dhcp' => 0, // Always disabled
|
||||
'ndp' => 0, // Always disabled (prevents router advertisements)
|
||||
'ndp' => 1, // Always enabled (allows router advertisements)
|
||||
]
|
||||
);
|
||||
|
||||
@@ -423,10 +419,8 @@ class Firewall extends Component
|
||||
[
|
||||
'policy_in' => $this->policyIn,
|
||||
'policy_out' => $this->policyOut,
|
||||
'ipfilter' => $this->ipFilter ? 1 : 0,
|
||||
'macfilter' => $this->macFilter ? 1 : 0,
|
||||
'dhcp' => 0, // Always disabled
|
||||
'ndp' => 0, // Always disabled
|
||||
'ndp' => 1, // Always enabled (allows router advertisements)
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
@@ -196,18 +196,7 @@
|
||||
<p class="text-xs text-base/60 mt-1">Default action for outgoing traffic not matching any rule</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between pt-2 border-t border-neutral/20">
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="checkbox" wire:model="ipFilter" id="ipFilter" class="rounded border-neutral">
|
||||
<label for="ipFilter" class="text-sm font-medium">IP Filter</label>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="checkbox" wire:model="macFilter" id="macFilter" class="rounded border-neutral">
|
||||
<label for="macFilter" class="text-sm font-medium">MAC Filter</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" wire:click="updatePolicies" wire:loading.attr="disabled" class="w-full px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors text-sm font-medium">
|
||||
<button type="button" wire:click="updatePolicies" wire:loading.attr="disabled" class="w-full px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors text-sm font-medium mt-4">
|
||||
<span wire:loading.remove wire:target="updatePolicies">Update Policies</span>
|
||||
<span wire:loading wire:target="updatePolicies">Updating...</span>
|
||||
</button>
|
||||
@@ -1210,7 +1199,10 @@
|
||||
<button wire:click="cancelDeleteAlias" class="px-4 py-2 bg-background border border-neutral rounded-lg hover:bg-background-secondary transition-colors text-sm font-medium">
|
||||
Cancel
|
||||
</button>
|
||||
<button wire:click="deleteAlias" wire:loading.attr="disabled" class="px-4 py-2 bg-error text-white rounded-lg hover:bg-error/90 transition-colors text-sm font-medium">
|
||||
<button wire:click="deleteAlias" wire:loading.attr="disabled"
|
||||
style="padding: 0.5rem 1rem; background-color: #ef4444; color: white; border-radius: 0.5rem; transition: all 0.2s; font-size: 0.875rem; font-weight: 500;"
|
||||
onmouseover="this.style.backgroundColor='#dc2626'"
|
||||
onmouseout="this.style.backgroundColor='#ef4444'">
|
||||
<span wire:loading.remove wire:target="deleteAlias">Delete</span>
|
||||
<span wire:loading wire:target="deleteAlias">Deleting...</span>
|
||||
</button>
|
||||
@@ -1279,7 +1271,10 @@
|
||||
<button wire:click="cancelDeleteIPSet" class="px-4 py-2 bg-background border border-neutral rounded-lg hover:bg-background-secondary transition-colors text-sm font-medium">
|
||||
Cancel
|
||||
</button>
|
||||
<button wire:click="deleteIPSet" wire:loading.attr="disabled" class="px-4 py-2 bg-error text-white rounded-lg hover:bg-error/90 transition-colors text-sm font-medium">
|
||||
<button wire:click="deleteIPSet" wire:loading.attr="disabled"
|
||||
style="padding: 0.5rem 1rem; background-color: #ef4444; color: white; border-radius: 0.5rem; transition: all 0.2s; font-size: 0.875rem; font-weight: 500;"
|
||||
onmouseover="this.style.backgroundColor='#dc2626'"
|
||||
onmouseout="this.style.backgroundColor='#ef4444'">
|
||||
<span wire:loading.remove wire:target="deleteIPSet">Delete</span>
|
||||
<span wire:loading wire:target="deleteIPSet">Deleting...</span>
|
||||
</button>
|
||||
@@ -1351,7 +1346,10 @@
|
||||
<button wire:click="cancelDeleteIPSetMember" class="px-4 py-2 bg-background border border-neutral rounded-lg hover:bg-background-secondary transition-colors text-sm font-medium">
|
||||
Cancel
|
||||
</button>
|
||||
<button wire:click="deleteIPSetMember" wire:loading.attr="disabled" class="px-4 py-2 bg-error text-white rounded-lg hover:bg-error/90 transition-colors text-sm font-medium">
|
||||
<button wire:click="deleteIPSetMember" wire:loading.attr="disabled"
|
||||
style="padding: 0.5rem 1rem; background-color: #ef4444; color: white; border-radius: 0.5rem; transition: all 0.2s; font-size: 0.875rem; font-weight: 500;"
|
||||
onmouseover="this.style.backgroundColor='#dc2626'"
|
||||
onmouseout="this.style.backgroundColor='#ef4444'">
|
||||
<span wire:loading.remove wire:target="deleteIPSetMember">Remove</span>
|
||||
<span wire:loading wire:target="deleteIPSetMember">Removing...</span>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user