网站安全加固与恢复规划
结合托管环境审查插件与账号风险,制定网站加固、备份恢复和监控方案,并优先处理入侵迹象。
完整提示词
<context>
WordPress core is rarely how sites get hacked; outdated and abandoned plugins and themes are, followed by reused admin passwords and nulled (pirated) premium plugins that ship with backdoors. Inactive plugins still have reachable files, so they must be deleted, not just deactivated. Security plugins help but are not a substitute for fewer plugins, automatic updates and a working restore. On managed hosts many server-level controls are already done and some plugins conflict with the host's own caching or firewall, so advice must fit the hosting type. If there are signs of compromise (unknown admins, spam pages, redirects for search visitors only), hardening first is the wrong order: the site needs cleanup from a known-good backup or a professional cleanup, and every password and key rotated, or the attacker's backdoor stays.
</context>
<task>
Produce a hardening plan for: {{site}}
{{#plugins}}Plugins and theme: {{plugins}}{{/plugins}}
{{#incident}}Already observed: {{incident}}{{/incident}}
1. If anything in the input suggests an active compromise, say so first and give the cleanup order (take a copy for evidence, restore or clean, rotate all passwords and salts, then harden) before anything else.
2. Audit plugins and theme: mark each to keep, replace or delete, flagging ones that are inactive, unmaintained (no update in over a year, closed on the plugin directory), duplicated in function, or from untrusted sources. Do not invent version vulnerabilities; tell the user to check each against a vulnerability database they trust.
3. Updates: turn on automatic minor core updates and plugin auto-updates for low-risk plugins, with a staging check for big ones (WooCommerce, page builders).
4. Accounts and login: remove unused admins, give editors and authors the lowest role that works, enforce two-factor authentication for admins, limit login attempts, and do not use "admin" as a username.
5. Give the `wp-config.php` settings with values: `DISALLOW_FILE_EDIT`, `FORCE_SSL_ADMIN`, unique salts, `WP_DEBUG` off in production, and file permissions (no 777).
6. Attack surface: disable XML-RPC unless Jetpack or the mobile app needs it, block PHP execution in `wp-content/uploads`, hide directory listings, and restrict `wp-admin` by IP only if the team has fixed IPs.
7. Add a web application firewall suited to the hosting (host-provided, a plugin firewall, or a CDN in front), and HTTPS everywhere.
8. Backups: off-site, daily for a shop, with a retention window longer than the time a compromise might go unnoticed, and a scheduled test restore.
9. Monitoring: file change alerts, uptime and admin-login notifications.
</task>
<constraints>
- Fit every step to the hosting type given; mark steps the host already handles or forbids.
- Do not name specific vulnerabilities or versions you cannot verify.
- Never recommend nulled plugins or disabling updates to "keep things stable".
- Tell the user to take a full backup before making changes.
{{> guardrails/scope-discipline}}
</constraints>
<output_format>
## Plugin and theme audit
Table: name, verdict (keep, replace, delete), reason.
## Hardening steps
Numbered steps in order, each with where to do it (dashboard, host panel, file).
## wp-config settings
A code block with the exact lines to add.
## Backups and recovery
Schedule, location, retention and how to test a restore.
## Monitoring
What to watch and how alerts reach someone.
## What not to do
Short list of common mistakes for this setup.
</output_format>可替换内容
- {{site}}
- {{#plugins}}
- {{plugins}}
- {{/plugins}}
- {{#incident}}
- {{incident}}
- {{/incident}}
- {{> guardrails/scope-discipline}}
分类与标签
编程开发、网站安全、插件审计、备份恢复、入侵处置