We have configured a router with a public static IP on the WAN interface and would like to restrict SSH access to specific source IP addresses.
OS Version: VyOS 1.4 (March 20, 2024 release)
We created a firewall policy that successfully controls SSH access; however, it is also blocking all other services along with SSH.
Could you please help us understand what might be missing in the policy configuration below? Additionally, please provide sample configurations for:
-
Destination IP and port-based traffic filtering
-
Source IP and port-based traffic filtering
set firewall ipv4 name SSH_BLOCK default-action ‘accept’
set firewall ipv4 name SSH_BLOCK default-log
set firewall ipv4 name SSH_BLOCK rule 10 action ‘accept’
set firewall ipv4 name SSH_BLOCK rule 10 log
set firewall ipv4 name SSH_BLOCK rule 10 protocol ‘all’
set firewall ipv4 name SSH_BLOCK rule 10 state ‘established’
set firewall ipv4 name SSH_BLOCK rule 10 state ‘related’
set firewall ipv4 name SSH_BLOCK rule 20 action ‘drop’
set firewall ipv4 name SSH_BLOCK rule 20 destination port ‘22’
set firewall ipv4 name SSH_BLOCK rule 20 protocol ‘tcp’
set firewall ipv4 name SSH_BLOCK rule 20 source address ‘!49.248.84.136/29’
set firewall zone GLOBAL default-action ‘drop’
set firewall zone GLOBAL from LOCAL firewall name ‘ALLOW_ALL’
set firewall zone GLOBAL interface ‘eth0’
set firewall zone LOCAL default-action ‘drop’
set firewall zone LOCAL from GLOBAL firewall name ‘SSH_BLOCK’
set firewall zone LOCAL local-zone