agentsclimarketplace

Lw firewall management abilities

Skill Lonsdale201/wp-agent-skills/lw-plugins/lw-firewall-management-abilities

Automate or audit LW Firewall management through WP-CLI, Site Manager abilities, config import/export, options, logs, worker status, IP blacklist changes, and wp-config overrides. Use when code or operational runbooks mention `wp lw-firewall`, `lw-firewall/get-options`, `lw-firewall/get-log`, `lw-firewall/block-ip`, `lw-firewall/unblock-ip`, `Options::save`, `LW_FIREWALL_*` constants, `log_enabled`, worker install/reinstall, config-items, or firewall settings migration.From its SKILL.md

Install
npx -y skills add Lonsdale201/wp-agent-skills --skill lw-firewall-management-abilities

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 21 stars21 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

7.2 KB, ~1.6k tokens by cl100k_base, as published. Nobody here has run it

LW Firewall: management abilities and CLI

Use this when a plugin, deployment script, or AI agent needs to inspect or change LW Firewall safely. There are three management surfaces with different scope: admin settings/import-export, WP-CLI, and LW Site Manager abilities.

Management surface matrix

SurfaceBest forCapability
Admin UIhuman settings, import/export, worker reinstall, log clearmanage_options
WP-CLIdeployment, scripted config, list edits, geo, logs, workershell WP-CLI user context
Site Manager abilitiesAI/REST management of options, logs, manual blacklistcan_manage_options
wp-config.php constantsimmutable environment overridesserver access

Do not use Site Manager abilities for features they do not expose. Use WP-CLI or admin/import-export for full configuration changes.

Option model

All settings live in one option:

LightweightPlugins\Firewall\Options::OPTION_NAME // lw_firewall

Always use:

$options = \LightweightPlugins\Firewall\Options::get_all();
$options['rate_limit'] = 50;
\LightweightPlugins\Firewall\Options::save( $options );

get_all() merges defaults and normalizes list options. Avoid updating lw_firewall with partial raw arrays; missing keys can reset behavior if not merged with defaults/current values first.

List-typed settings:

  • filter_params
  • blocked_bots
  • ip_whitelist
  • ip_blacklist
  • blocked_countries

wp-config constants

Options::get() checks LW_FIREWALL_<KEY> before saved options. Constants win over admin UI, CLI, and abilities for single-value reads.

Common examples:

define( 'LW_FIREWALL_ENABLED', true );
define( 'LW_FIREWALL_STORAGE', 'apcu' );
define( 'LW_FIREWALL_RATE_LIMIT', 30 );
define( 'LW_FIREWALL_RATE_WINDOW', 60 );
define( 'LW_FIREWALL_ACTION', '429' );
define( 'LW_FIREWALL_PROTECT_REST_API', false );
define( 'LW_FIREWALL_LOG_ENABLED', false );
define( 'LW_FIREWALL_DISABLE_WORKER', true );

When a setting "does not change", check constants first.

WP-CLI

Status:

wp lw-firewall status

Config:

wp lw-firewall config list --format=json
wp lw-firewall config get filter_params --format=json
wp lw-firewall config set rate_limit 50
wp lw-firewall config set storage redis
wp lw-firewall config reset --yes

List edits without replacing the whole list:

wp lw-firewall config-items add filter_params "add-to-cart|10"
wp lw-firewall config-items remove filter_params "add-to-cart|10"
wp lw-firewall config-items add blocked_countries KP

IP lists:

wp lw-firewall ip list whitelist --format=json
wp lw-firewall ip add blacklist 203.0.113.42
wp lw-firewall ip remove blacklist 203.0.113.42

Worker:

wp lw-firewall worker install
wp lw-firewall worker remove

Prefer config-items for list settings in automation; replacing full lists is more error-prone.

Site Manager abilities

LW Firewall registers the firewall category and these abilities when LW Site Manager is active:

AbilityTypeNotes
lw-firewall/get-optionsreadreturns merged options
lw-firewall/get-logreadlimit 1-100; useful only when log_enabled
lw-firewall/list-blockedreadmanual blacklist only
lw-firewall/block-ipwriteadd IP/CIDR to manual blacklist
lw-firewall/unblock-ipwriteremove IP/CIDR from manual blacklist

All use $permissions->callback( 'can_manage_options' ). The write abilities are idempotent for repeated block/unblock operations, but they only affect manual ip_blacklist. Auto-bans are stored separately and are not listed or removed through these abilities.

Import/export

Admin import/export downloads or uploads JSON for known option keys only. Import fills missing keys from defaults and ignores unknown keys by iterating defaults.

After import or normal settings save, geo .htaccess rules are synced.

Do not import untrusted JSON into production without review; this can enable REST blocking, broad geo blocking, or global worker disablement through options.

Logs

Logs are stored in option lw_firewall_log, capped at 100 newest entries, and only written when log_enabled is true.

Entries contain:

  • ip
  • reason
  • ua
  • url
  • time

Treat logs as operational data that may contain IP addresses and User-Agent strings. Do not expose them to non-admin users.

Worker status

The worker is expected at:

wp-content/mu-plugins/lw-firewall-worker.php

If missing or outdated, the plugin attempts reinstall and records the latest install result in transient lw_firewall_worker_install_attempt. Admin notices surface the failure; WP-CLI status reports worker state.

Automation checklist

  • Use WP-CLI for full config and list edits.
  • Use Site Manager abilities only for options read, log read, and manual blacklist operations.
  • Check LW_FIREWALL_* constants before debugging saved options.
  • Use exact IP/CIDR validation before blacklisting.
  • Confirm log_enabled before relying on logs.
  • Confirm worker installed/current before expecting early blocking.
  • Do not confuse manual blacklist with auto-ban storage.

Cross-references

  • Run lw-site-manager-extend-abilities when adding new Site Manager abilities.
  • Run lw-firewall-rate-limit-worker when changing endpoint protection behavior.
  • Run wp-cli-extending when adding companion WP-CLI commands.

What this skill does NOT cover

  • Building a new firewall rule engine.
  • Managing CDN/WAF provider rules.
  • Editing the MU-plugin worker directly.

References

  • Official documentation: https://github.com/lwplugins/lw-firewall
  • Verified source paths:
    • wp-content/plugins/lw-firewall/lw-firewall.php
    • wp-content/plugins/lw-firewall/includes/Options.php
    • wp-content/plugins/lw-firewall/includes/Admin/SettingsSaver.php
    • wp-content/plugins/lw-firewall/includes/Admin/ImportExportHandler.php
    • wp-content/plugins/lw-firewall/includes/CLI/FirewallCommand.php
    • wp-content/plugins/lw-firewall/includes/CLI/ConfigCommand.php
    • wp-content/plugins/lw-firewall/includes/CLI/ConfigItemsCommand.php
    • wp-content/plugins/lw-firewall/includes/CLI/IpCommand.php
    • wp-content/plugins/lw-firewall/includes/SiteManager/Integration.php
    • wp-content/plugins/lw-firewall/includes/SiteManager/FirewallAbilities.php
    • wp-content/plugins/lw-firewall/includes/SiteManager/FirewallService.php
    • wp-content/plugins/lw-firewall/docs/management.md
    • wp-content/plugins/lw-firewall/docs/site-manager-abilities.md

What ships with it: 1 file

250 B alongside SKILL.md

agents/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.