- Plesk for Linux
How to manage Plesk Firewall via CLI?
/usr/local/psa/bin/modules/firewall/settings utility can be used in order to manage Plesk firewall via CLI.
In order to get the full list of the available options check help output:
# /usr/local/psa/bin/modules/firewall/settings --help
In example below provided steps how to add a rule with the name "My rule" which deny incoming connections from 203.0.113.2 on ports 2222/tcp, 2222/udp:
- Connect to the server via SSH
- Create a new rule:
# /usr/local/psa/bin/modules/firewall/settings -s -name 'My rule' -direction input -action deny -ports '2222/tcp,2222/udp' -remote-addresses "203.0.113.2"
- Apply the created rule
# /usr/local/psa/bin/modules/firewall/settings -a
- Establish another SSH session to the server and execute the following command within 60 seconds to confirm changes, otherwise, all changes will be rolled back.
# /usr/local/psa/bin/modules/firewall/settings -c