Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

How does the Plesk Firewall CLI tool update and restore configuration?

 
applications extensionsclidatabasefirewallplesk firewall

Question

A new Plesk Firewall configuration has been applied via CLI with the --apply parameter:

# /usr/local/psa/bin/modules/firewall/settings --apply

How is the configuration applied?

Can the old configuration be restored after this step?

Answer

How is the configuration applied?

Setting a new rule (--set-rule) changes the pending configuration in the database and after --apply is executed the pending configuration from the database is transferred to the /usr/local/psa/var/modules/firewall/firewall-new.sh file.

If in next 60 second --confirm is received content of the  /usr/local/psa/var/modules/firewall/firewall-new.sh file is copied to the /usr/local/psa/var/modules/firewall/firewall-active.sh​ file, and pending configuration is copied to the active configuration of the database.

If  --confirm is not received in 60 seconds after --apply executed then /usr/local/psa/var/modules/firewall/firewall-active.sh is applied to iptables (this effectively rolls back the currently running configuration).

Can the old configuration be restored after this step?

If the --apply option was executed by mistake it's recommended to wait 60 seconds for configuration to roll back to its previous state.

If a new configuration is applied again while the previous process is still running the second configuration will not be able to be confirmed. Before executing the second --apply  wait until the previous process is finished.

You can check if the process is finished with the following command (wait until the output is empty):

# ps auxf | grep -i firewall-new.sh | grep -v grep

To perform rollback in the database configuration as well use --reset option. 

Note that the /usr/local/psa/var/modules/firewall/firewall-new.sh file should not be removed and any manual change of internal firewall state should be avoided.

To rolls back changes made in the pending configuration of the database by the --set-rule option use the the --reset option. The --reset option used then the rule was set by mistake and the pending configuration of the database needs to be rollback. Note that it does not roll back the state of the /usr/local/psa/var/modules/firewall/firewall-new.sh file. 

All rules that were set (--set-rule) stay in the pending configuration of the database until confirmation (--confirm) or reset (--reset) are executed. If the confirmation window of 60 seconds was missed it's possible to apply and then confirm rules again without setting them.

 

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

Plesk with Centralized Database and Network File System

Read More »

WordPress Firewall – Why Do You Need One?

Read More »

Wordfence vs Sucuri – WordPress Security Plugins Comparison

Read More »
Knowledge Base

If Plesk Firewall is enabled, rules manually added in CLI are removed

Read More »

How to create additional Plesk administrator accounts with fewer permissions on Plesk for Linux via CLI?

Read More »

How to change ‘IP to Country Lite database’ to MaxMind as a source for blocking countries in Plesk Firewall

Read More »

Plesk Firewall can not be enabled in Plesk 18.0.52 and newer: I did not receive connectivity confirmation after applying new firewall configuration

Read More »

Hosting Wiki

  • CLI
  • AMP
  • Linux
  • Plesk
  • SQL database
  • NoSQL Database
  • Firewall
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family