Linux 软件免费装
Banner图

Nahnu Login Shield

开发者 ja1me4
更新时间 2026年10月15日 00:49
PHP版本: 8.3 及以上
WordPress版本: 7.1
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

captcha login security brute force two factor geo blocking

下载

1.0.11 1.0.10

详情介绍:

Nahnu Login Shield does one thing and does it well: protect every WordPress login entry point. It is not a general security plugin. It is a login security plugin — hyperfocused on the login form, WooCommerce My Account, XML-RPC, the REST API, and all the form plugins your site might use. No subscription. No license key. No upsell. Everything is included free. Brute-force lockout Early blocking An optional must-use plugin (mu-plugin) can fire before WordPress fully loads. It is off by default and never installed automatically: enable it from the General tab by clicking "Install early-block mu-plugin", which copies nahnls-early-block.php into your must-use plugins directory (WPMU_PLUGIN_DIR). Once installed, locked-out IPs are turned away at the door — no PHP framework, no database writes, no WooCommerce — for a fraction of the normal request cost. Honeypot IPs receive a full static block page for all site pages during the lockout period. Clicking "Remove" (or deactivating/deleting the plugin) deletes the file again. CAPTCHA / Verification providers Choose one provider site-wide. The widget appears on every protected form automatically. Two-factor authentication Passwordless sign-in White-label emails Access control Geo-fencing Reads the visitor country from CDN headers with zero latency and zero API quota. Supported headers: CF-IPCountry (Cloudflare), CDN-Country (Bunny.net), CloudFront-Viewer-Country (AWS CloudFront), X-Vercel-IP-Country (Vercel), X-Country-Code (Fastly/Akamai), X-Geo-Country (generic CDN). Falls back to freeipapi.com or ipinfo.io (both free) with a configurable transient cache when no CDN header is present. Edge WAF integration JavaScript presence check A hidden field filled by a small inline script gates every submission. Headless bots that skip JavaScript execution are blocked before CAPTCHA or lockout checks run — saving API quota. Custom login URL Optionally rename /wp-login.php to a secret path. Requests to the old URL return a configurable response: 404, redirect to home, or redirect to a custom URL. REST API protection Session security Login notifications WooCommerce My Account Extend all protections - geo-blocking, lockout, honeypot, CAPTCHA, JS check, passkeys, magic links - to the WooCommerce My Account login, registration, lost-password, checkout, and order-tracking forms. Each form has its own toggle. Customers get a Login & security tab in My Account to manage passkeys, two-factor authentication and sign-in options without ever seeing wp-admin, and complete the 2FA challenge on the My Account page itself. The same panel is available anywhere via the [nahnls_account_security] shortcode. Form plugin integrations Three form integrations are supported, each with its own toggle on the Integrations tab: Bricks Builder forms (enabled per form from the Bricks form element's Spam Protection panel), SureForms (all forms, or only the forms you pick), and the native WordPress comment form. Each adds the JS marker check and the configured CAPTCHA widget to the form and validates it server-side on submit. Any other form, theme template or headless front end can integrate through the developer API: template tags, [nahnls_passkey_button] / [nahnls_magic_link_form] shortcodes, 20+ actions and filters, REST routes under nahnls/v1 and the window.NAHNLSAuth JavaScript API (see docs/API.md). Full event log Analytics MainWP extension A companion extension (Nahnu Login Shield — MainWP Extension) is available separately and allows site managers to view login shield data — lockouts, edge WAF blocks, recent events, settings summary — across all connected child sites from the MainWP dashboard, with a widget on each site overview page and a per-site detail tab. Privacy Nahnu Login Shield stores IP addresses and usernames in a local WordPress database table for the event log. The retention period and row cap are configurable. No data is sent to any Nahnu server. Third-party CAPTCHA providers and IP lookup services receive only the data required for their function, per their own privacy policies. Deleting the plugin removes all stored data via the included uninstall.php. External services Nahnu Login Shield works fully offline by default. Each service below is contacted only when the site administrator explicitly selects or configures it in the plugin settings. No data is ever sent to a Nahnu server. Country flags shown in the admin log are SVG files bundled with the plugin (assets/img/flags/); no flag CDN or other external image service is used. Bundled third-party libraries No scripts are loaded from a CDN. These libraries ship inside the plugin (assets/vendor/ unless noted otherwise):

安装:

  1. Upload the nahnu-login-shield folder to /wp-content/plugins/.
  2. Activate through Plugins in the WordPress admin.
  3. Go to Settings > Login Shield to configure.
Quick start:
  1. On the Widget tab, choose a CAPTCHA provider (or leave it as None to use lockout only).
  2. On the Lockout tab, review the attempt thresholds.
  3. On the Geo tab, enable geo-blocking and select blocked countries if needed.
  4. On the Integrations tab, enable protections for WooCommerce My Account, Bricks Builder forms, SureForms and WordPress comments as needed.
  5. On the Edge Blocking tab, connect your Bunny.net or Cloudflare account to push blocks to the edge.
To use OOPSpam, install and activate the OOPSpam Anti-Spam plugin and enter your API key there first. Nahnu Login Shield detects it automatically.

屏幕截图:

  • Widget tab — pick the CAPTCHA provider (OOPSpam, reCAPTCHA v2/v3, hCaptcha, Turnstile, Friendly Captcha) with a live preview.
  • Geo tab — block the login form by country using CDN geo headers or an IP lookup API.
  • Edge Blocking tab — push lockouts and honeypot hits to the Bunny.net or Cloudflare WAF so attackers are stopped at the edge.
  • Lockout tab — failed-attempt thresholds, escalation to long bans, the lockout message and proxy header settings.
  • Integrations tab — WooCommerce My Account forms plus Bricks Builder, SureForms and WordPress comment protection.
  • 2FA tab — two-factor authentication for selected roles, with email codes as the baseline and authenticator apps or passkeys as stronger options.
  • Passwordless tab — magic login links and passkeys (WebAuthn).
  • Settings tab — log retention and white-label email branding for every email the plugin sends.

升级注意事项:

1.0.11 SureForms protection now works (per form), and your own username can go on the honeypot list again: sign in with your email instead. If you are locked out, NAHNLS_DISABLE_HONEYPOT in wp-config.php switches the list off. 1.0.10 Prefix rename release. Settings, the event log, user 2FA/passkey data and cron schedules migrate automatically on upgrade. The early-block mu-plugin is now opt-in: the old copy is removed and nothing is copied into mu-plugins automatically - open Settings > Login Shield > General and click "Install early-block mu-plugin" if you want it. If you defined NLS_BYPASS_IP in wp-config.php it still works, but the new name is NAHNLS_BYPASS_IP. 2FA, when on, now challenges every user in the selected roles (all roles unless you used Enforce mode) with email codes as the baseline - make sure your site sends email, or add an authenticator app first. Developers: hook, shortcode, REST (nahnls/v1) and JS names changed - see docs/API.md. 1.0.9 Chart.js and the Friendly Captcha widget are now served from the plugin itself rather than a CDN. No settings changes needed. 1.0.8 Requires PHP 8.3. The early-block mu-plugin now only trusts proxy headers when "Trust proxy headers" is on - if your site sits behind Cloudflare/Bunny/a reverse proxy, make sure that setting is enabled (Lockout tab) or lockouts will be keyed to the proxy address. ip-api.com geo source removed; sites using it are switched to freeipapi. 1.0.0 Initial public release. No upgrade path from pre-release builds.

常见问题:

Do I need OOPSpam installed?

No. OOPSpam is one of seven CAPTCHA provider options. All other providers and all other features work independently.

Does this plugin slow down my site?

No. Assets load only on wp-login.php and any pages you opt into via the Integrations tab. The JS check uses a tiny inline script with no external request. Geo lookups from CDN headers are zero-latency. API fallback results are cached per IP for a configurable period. If you opt in to the early-block mu-plugin, it turns away locked-out IPs before WordPress fully loads.

What happens if the CAPTCHA API goes down?

All providers fail open. A network or API error never locks out legitimate users.

Will this conflict with other security plugins?

It hooks specifically into WordPress login actions and standard WooCommerce and form-plugin hooks. If another plugin hooks the same actions it may conflict. Open a support thread with details if you see an issue.

Can I use this without any CAPTCHA?

Yes. Set the provider to None. Geo-blocking, brute-force lockout, honeypot username trapping, the JS presence check, and 2FA all work independently of CAPTCHA.

Does it work with WooCommerce?

Yes. The WooCommerce My Account login, registration, lost-password, checkout, and order-tracking forms each have their own toggle in the WooCommerce section of the Integrations tab.

I locked myself out. How do I get back in?

Two options. First, add define( 'NAHNLS_BYPASS_IP', 'your.ip.address' ); to wp-config.php (above the "That's all, stop editing" line). It accepts a comma-separated list of IPs and CIDR ranges, and exempts them from lockouts, the IP blocklist, geo blocking and the early-block rate limit - no deactivation needed. Second, rename the plugin folder from nahnu-login-shield to _nahnu-login-shield via SFTP, which deactivates it. If you are stuck at the two-factor step instead, see the next question.

Can I put my own username on the honeypot list?

Yes, and it is a good idea: usernames are public (author pages, feeds, the REST API), so bots try them. Add your username to the Honeypot list on the Lockout tab and sign in with your email address from then on. Anyone who tries the username is locked out like a bot. Email addresses of real accounts are never blocked, so patterns like admin@* do not affect your own sign-in. The Lockout tab lists which entries are real accounts and reminds you if your own username is on the list. If you get locked out anyway, add define( 'NAHNLS_DISABLE_HONEYPOT', true ); to wp-config.php (above the "That's all, stop editing" line) to switch the honeypot list off, sign in, fix the list, then remove the line. To clear an IP that is already locked, also see the question above.

I can't receive the 2FA email / I'm locked out

When two-factor authentication is on, every sign-in asks for a code, and email codes are the baseline. If the email does not arrive (a mail problem on the server, spam filtering), first try a backup code or "Email me a code" again. If that does not help, add define( 'NAHNLS_DISABLE_2FA', true ); to wp-config.php (above the "That's all, stop editing" line). This switches the 2FA check off for everyone, so you can sign in with just your password; the plugin's settings page shows a notice while it is set. Fix email delivery (an SMTP plugin usually does it), add an authenticator app on your Login & security page so you are not dependent on email, then remove the line. Note: NAHNLS_BYPASS_IP does NOT bypass 2FA - it only exempts addresses from lockouts, the IP blocklist, geo blocking and the early-block rate limit.

Can my login, registration and My Account pages be cached?

Mostly yes. Every protected form carries a hidden security token that lives about a day. On page load the plugin's small script fetches a fresh token (one request to admin-ajax.php), so pages served from a full-page cache keep working as long as JavaScript runs - including cached blog posts with a comment form. Without JavaScript, a cached copy of the form older than a day fails the security check and asks the visitor to reload. Login, registration and My Account pages should still be excluded from full-page caching (WooCommerce requires this anyway). Developers can lengthen the token life with the nahnls_form_nonce_life filter.

Is this compatible with multisite?

It is not tested on multisite and is not recommended for network activation.

How does geo-blocking work when I do not use a CDN?

It falls back to one of two free IP geolocation APIs (freeipapi.com or ipinfo.io) with a configurable cache. CDN headers are always checked first and take priority.

How do I get a new form plugin supported?

Open a support thread or submit a request at https://nahnuloginshield.com/support/. Bricks Builder, SureForms and WordPress comments are the supported integrations today; anything else can be wired up through the developer API (docs/API.md) while a request is considered.

What is the mu-plugin and is it safe to have?

The mu-plugin is optional and opt-in. Nothing is copied until you, as an administrator, click Install early-block mu-plugin on the General tab. That button copies nahnls-early-block.php from the plugin folder into your must-use plugins directory (WPMU_PLUGIN_DIR, normally wp-content/mu-plugins/). The file checks whether the requesting IP is locked out or rate-limited and, if so, sends a 403/429 response before WordPress fully loads — dramatically reducing server load during bot floods. The General tab shows whether it is installed, not installed or outdated; after a plugin update you are offered an Update mu-plugin button (it is never refreshed automatically). Clicking Remove deletes the file, and it is also removed on plugin deactivation and deletion. If the directory is not writable, the settings page shows manual copy instructions instead. The per-IP rate-limit counters the mu-plugin uses are tiny text files stored inside your WordPress uploads directory at wp-content/uploads/nahnu-login-shield/ratelimit/ (protected by an index.php and .htaccess; files older than five minutes are pruned automatically). Nothing is written outside the WordPress installation; the folder is deleted when the plugin is uninstalled.

Can attackers bypass the lockout by rotating IPs?

The per-username lockout catches this: if the same username is attempted from too many different IPs within the time window, the username itself is locked regardless of IP. Adding common targets (admin, administrator, root) to the Honeypot username list gives the strongest protection — one attempt from any IP is enough to lock both the IP and the username globally.

更新日志:

1.0.11 1.0.10 1.0.9 1.0.8 1.0.7 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0