Configuring Really Simple Security with WP-CLI

Table of contents

What is WP-CLI?

WP-CLI is a command-line interface for WordPress. It allows you to manage your WordPress site using commands in your terminal or command prompt, making it easier to automate tasks and manage your site without needing to log into the WordPress admin dashboard.

Why would you want to use it?

Using WP-CLI can significantly speed up your workflow by allowing you to perform tasks on your WordPress site quickly and efficiently. It is especially useful for developers and administrators who need to manage multiple WordPress sites or perform repetitive tasks. With WP-CLI, you can:

  • Install and update plugins and themes
  • Manage users
  • Perform database operations
  • Automation of routine tasks

Prerequisites and how to install

For detailed instructions on how to install and use WP-CLI, please refer to the official WP-CLI documentation.

How to use WP-CLI

Once installed, you can use WP-CLI by navigating to your WordPress directory in your terminal and typing wp followed by the command you want to execute. For example, the command wp user list returns a list of all registered user accounts on a WordPress site.

To work with WP-CLI commands for specific plugins on your site, you’ll have to use the plugin’s namespace before the command: wp [namespace] [command]

To execute commands specific to Really Simple Security, you would use the rsssl namespace. For example: wp rsssl activate_ssl

WP-CLI - Running custom plugin commands

Really Simple Security WP-CLI commands


activate_ssl

Activates SSL on your site.

Usage:

wp rsssl activate_ssl

Result: SSL is activated on your site.

Pro required: No.


deactivate_ssl

Deactivates SSL on your site.

Usage:

wp rsssl deactivate_ssl

Result: SSL is deactivated on your site.

Pro required: No.


update_option

Updates a Really Simple Security option.

Usage:

wp rsssl update_option --name=option_name --value=option_value

Associative Arguments:

  • –name (required): The name of the option to update.
  • –value (required): The value to set for the option.

Examples:

wp rsssl update_option --name=site_has_ssl --value=true
wp rsssl update_option --name=hsts --value=1

Result: The specified option is updated with the given value.

Pro required: No.


Activates all recommended features.

Usage:

wp rsssl activate_recommended_features

Result: All recommended features are activated.

Pro required: No.


Deactivates all recommended features.

Usage:

wp rsssl deactivate_recommended_features

Result: All recommended features are deactivated.

Pro required: No.


activate_firewall

Activates the firewall.

Usage:

wp rsssl activate_firewall

Result: The firewall is activated.

Pro required: Yes.


deactivate_firewall

Deactivates the firewall.

Usage:

wp rsssl deactivate_firewall

Result: The firewall is deactivated.

Pro required: Yes.


activate_2fa

Activates Two-Factor Authentication.

Usage:

wp rsssl activate_2fa

Result: Two-Factor Authentication is activated.

Pro required: No.


deactivate_2fa

Deactivates Two-Factor Authentication.

Usage:

wp rsssl deactivate_2fa

Result: Two-Factor Authentication is deactivated.

Pro required: No.


activate_password_security

Activates password security features.

Usage:

wp rsssl activate_password_security

Result: Password security features are activated.

Pro required: Yes.


deactivate_password_security

Deactivates password security features.

Usage:

wp rsssl deactivate_password_security

Result: Password security features are deactivated.

Pro required: Yes.


activate_lla

Activates limit login attempts.

Usage:

wp rsssl activate_lla

Result: Limit login attempts is activated.

Pro required: Yes.


deactivate_lla

Deactivates limit login attempts.

Usage:

wp rsssl deactivate_lla

Result: Limit login attempts is deactivated.

Pro required: Yes.


activate_vulnerability_scanning

Activates vulnerability scanning.

Usage:

wp rsssl activate_vulnerability_scanning

Result: Vulnerability scanning is activated.

Pro required: No.


deactivate_vulnerability_scanning

Deactivates vulnerability scanning.

Usage:

wp rsssl deactivate_vulnerability_scanning

Result: Vulnerability scanning is deactivated.

Pro required: No.


activate_license

Activates a license key.

Usage:

wp rsssl activate_license YOUR_LICENSE_KEY

Result: The license key is activated.

Pro required: Yes.


deactivate_license

Deactivates the license.

Usage:

wp rsssl deactivate_license

Result: The license is deactivated.

Pro required: Yes.


add_lock_file

Adds a lock file for safe mode.

Usage:

wp rsssl add_lock_file

Result: A lock file for safe mode is created.

Pro required: No.


remove_lock_file

Removes the lock file for safe mode.

Usage:

wp rsssl remove_lock_file

Result: The lock file for safe mode is removed.

Pro required: No.


update_advanced_headers

Action rsssl_update_rules will be executed within WordPress. It is recommended to run this command after enabling Security Headers.

Usage:

wp rsssl update_advanced_headers

Result: Update the advanced-headers.php with the latest rules.

Pro required: No.


add_firewall_ip_block

Add an IP block to the firewall blocklist.

Usage:

wp rsssl add_firewall_ip_block 123.123.123.12

Associative Arguments:

  • –permanent (optional): Flag to add a permanent block.
  • –note (optional): A note to associate with the IP.

Examples:

wp rsssl add_firewall_ip_block 123.123.123.1 --note="This is a temporary block"
wp rsssl add_firewall_ip_block 123.123.123.1 --permanent --note="This is a permanent block"

Result: The specified IP block is added to the firewall blocklist. If –permanent is used, a permanent block is added.

Pro required: No.


remove_firewall_ip_block

Removes an IP block from the firewall blocklist.

Usage:

wp rsssl remove_firewall_ip_block 123.123.123.12

Result: The specified IP block is removed from the firewall blocklist.

Pro required: No.


show_blocked_ips

Displays a table of the current blocked IPs.

Usage:

wp rsssl show_blocked_ips

Result: A table of the current blocked IPs is displayed.

Pro required: No.


activate_security_headers

Activates essential Security Headers. Note: Run the command wp rsssl update_advanced_headers afterwards for changes to take effect.

Usage:

wp rsssl activate_security_headers

Result: Essential Security Headers are activated.

Pro required: Yes.


deactivate_security_headers

Deactivates essential Security Headers. Note: Run the command wp rsssl update_advanced_headers afterwards for changes to take effect.

Usage:

wp rsssl deactivate_security_headers

Result: Essential Security Headers are deactivated.

Pro required: Yes.


add_firewall_trusted_ip

Adds a trusted IP to the firewall.

Usage:

wp rsssl add_firewall_trusted_ip 123.123.123.1 --note="Trusted IP"

Associative Arguments:

  • –note (optional): A note to associate with the trusted IP.

Examples:

wp rsssl add_firewall_trusted_ip 123.123.123.1
wp rsssl add_firewall_trusted_ip 123.123.123.1 --note="Trusted IP"

Result: The specified IP is added to the firewall’s trusted list. If –note is used, the note is associated with the trusted IP.

Pro required: No.


remove_firewall_trusted_ip

Removes a trusted IP from the firewall.

Usage:

wp rsssl remove_firewall_trusted_ip 123.123.123.1

Result: The specified IP is removed from the firewall’s trusted list.

Pro required: No.


add_lla_trusted_ip

Adds a trusted IP to the Limit Login Attempts table.

Usage:

wp rsssl add_lla_trusted_ip 123.123.123.1

Result: The specified IP is added to the Limit Login Attempts table as trusted.

Pro required: No.


remove_lla_trusted_ip

Removes a trusted IP from the Limit Login Attempts table.

Usage:

wp rsssl remove_lla_trusted_ip 123.123.123.1

Result: The specified IP is removed from the Limit Login Attempts table as trusted.

Pro required: No.


add_lla_blocked_ip

Adds a blocked IP to the Limit Login Attempts table.

Usage:

wp rsssl add_lla_blocked_ip 123.123.123.1

Associative Arguments:

  • –permanent (optional): Flag to add a permanent block.

Examples:

wp rsssl add_lla_blocked_ip 123.123.123.1
wp rsssl add_lla_blocked_ip 123.123.123.1 --permanent

Result: The specified IP is added to the Limit Login Attempts table as blocked.

Pro required: No.


remove_lla_blocked_ip

Removes a blocked IP from the Limit Login Attempts table.

Usage:

wp rsssl remove_lla_blocked_ip 123.123.123.1

Associative Arguments:

  • –permanent (optional): Flag to remove a permanent block.

Examples:

wp rsssl remove_lla_blocked_ip 123.123.123.1
wp rsssl remove_lla_blocked_ip 123.123.123.1 --permanent

Result: The specified IP is removed from the Limit Login Attempts table as blocked.

Pro required: No.


add_lla_trusted_username

Adds a trusted username to the Limit Login Attempts table.

Usage:

wp rsssl add_lla_trusted_username username

Result: The specified username is added to the Limit Login Attempts table as trusted.

Pro required: No.


remove_lla_trusted_username

Removes a trusted username from the limit login attempts table.

Usage:

wp rsssl remove_lla_trusted_username username

Result: The specified username is removed from the Limit Login Attempts table as trusted.

Pro required: No.


add_lla_blocked_username

Adds a blocked username to the Limit Login Attempts table.

Usage:

wp rsssl add_lla_blocked_username username

Associative Arguments:

  • –permanent (optional): Flag to add a permanent block.

Examples:

wp rsssl add_lla_blocked_username username
wp rsssl add_lla_blocked_username username --permanent

Result: The specified username is added to the Limit Login Attempts table as blocked.

Pro required: No.


remove_lla_blocked_username

Removes a blocked username from the Limit Login Attempts table.

Usage:

wp rsssl remove_lla_blocked_username username

Associative Arguments:

  • –permanent (optional): Flag to remove a permanent block.

Examples:

wp rsssl remove_lla_blocked_username username
wp rsssl remove_lla_blocked_username username --permanent

Result: The specified username is removed from the limit login attempts table as blocked.

Pro required: No.


reset_2fa

Resets the 2FA status of a user to Open.

Usage:

wp rsssl reset_2fa 123

Result: The 2FA status of the user with the specified ID is reset to Open.

Pro required: No.

Simple and Performant Security.
Easily improve site security with WordPress Hardening, Two-Factor Authentication (2FA), Login Protection, Vulnerability Detection and SSL certificate generation.