Hello everyone, I am beginner to vyos.
I am designing a firewall for a network, mounted on a VyOS 1.1.8 (I cannot change it to a new version at the moment due to bureaucratic issues) and I’m running into some problems.
The idea of the firewall is:
- Block everything.
- Allow only specific ports for general or specific users by list.
Example:
- Allow HTTP/HTTPS to all users.
- Allow SSH/FTP to specific users.
- Block the rest.
My main problem is in the services that use the ports of the listening type (49152-65535), FTP example.
My example code:
set firewall name <<FW-FIREWALL>> default-action 'reject'
set firewall name <<FW-FIREWALL>> rule 10 action 'accept'
set firewall name <<FW-FIREWALL>> rule 10 state established 'enable'
set firewall name <<FW-FIREWALL>> rule 10 state related 'enable'
set firewall name <<FW-FIREWALL>> rule 11 action 'reject'
set firewall name <<FW-FIREWALL>> rule 11 state invalid 'enable'
set firewall name <<FW-FIREWALL>> rule 2100 action 'accept'
set firewall name <<FW-FIREWALL>> rule 2100 destination port '20,21'
set firewall name <<FW-FIREWALL>> rule 2100 source group address-group 'FW-FTP'
set firewall name <<FW-FIREWALL>> rule 2100 protocol 'tcp'
set firewall name <<FW-FIREWALL>> rule 2100 state new 'enable'
set firewall group address-group FW-FTP address '192.168.5.2'
With this code, I can’t make FTP show the listed files, since it uses a listening port. If you added the port range:
set firewall name <<FW-FIREWALL>> rule 2100 destination port '20,21,115,49152-65535'
Works correctly. But I don’t want to open all ports for this reason.
I’ve tried setting the new general connections to accepted:
set firewall name <<FW-FIREWALL>> rule 10 action 'accept'
set firewall name <<FW-FIREWALL>> rule 10 state established 'enable'
set firewall name <<FW-FIREWALL>> rule 10 state related 'enable'
set firewall name <<FW-FIREWALL>> rule 10 state new 'enable'
It works, but I find that it allows everything, making the permission rules meaningless.
It also provides adding the states in the rule, but this does nothing:
set firewall name <<FW-FIREWALL>> rule 2100 action 'accept'
set firewall name <<FW-FIREWALL>> rule 2100 destination port '20,21'
set firewall name <<FW-FIREWALL>> rule 2100 source group address-group 'FW-FTP'
set firewall name <<FW-FIREWALL>> rule 2100 protocol 'tcp'
set firewall name <<FW-FIREWALL>> rule 2100 state new 'enable'
set firewall name <<FW-FIREWALL>> rule 2100 state established 'enable'
set firewall name <<FW-FIREWALL>> rule 2100 state related 'enable'
What would be the correct way for this to work? without the need to allow all ports?
Or what other way can you come up with to improve security?