WordPress: Difference between revisions
imported>Onny Update custom theme example to new attrs option format |
imported>Onny Add section on security hardening |
||
Line 125: | Line 125: | ||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
services.wordpress.sites."example.org" = { | services.wordpress.sites."example.org" = { | ||
plugins = | plugins = { | ||
inherit (pkgs.wordpressPackages.plugins) | |||
static-mail-sender-configurator; | |||
}; | |||
extraConfig = '' | extraConfig = '' | ||
// Enable the plugin | // Enable the plugin | ||
Line 132: | Line 135: | ||
require_once(ABSPATH . 'wp-settings.php'); | require_once(ABSPATH . 'wp-settings.php'); | ||
require_once ABSPATH . 'wp-admin/includes/plugin.php'; | require_once ABSPATH . 'wp-admin/includes/plugin.php'; | ||
activate_plugin( ' | activate_plugin( 'static-mail-sender-configurator/static-mail-sender-configurator.php' ); | ||
''; | ''; | ||
settings = { | settings = { | ||
Line 287: | Line 290: | ||
* [https://pagespeed.web.dev Google PageSpeed Insights] | * [https://pagespeed.web.dev Google PageSpeed Insights] | ||
* [https://www.seobility.net/en/seocheck seobility SEO Checker] | * [https://www.seobility.net/en/seocheck seobility SEO Checker] | ||
=== Security hardening === | |||
By enabling these two plugins, your Wordpress login is protected by a simple numeric captcha and the xml-rpc api, used by alternative Wordpress clients, gets disabled. | |||
<syntaxHighlight lang="nix"> | |||
services.wordpress.sites."example.org" = { | |||
plugins = { | |||
inherit (pkgs.wordpressPackages.plugins) | |||
disable-xml-rpc | |||
simple-login-captcha; | |||
}; | |||
extraConfig = '' | |||
// Enable the plugin | |||
if ( !defined('ABSPATH') ) | |||
define('ABSPATH', dirname(__FILE__) . '/'); | |||
require_once(ABSPATH . 'wp-settings.php'); | |||
require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |||
activate_plugin( 'disable-xml-rpc/disable-xml-rpc.php' ); | |||
activate_plugin( 'simple-login-captcha/simple-login-captcha.php' ); | |||
''; | |||
}; | |||
</syntaxHighlight> | |||
== Troubleshooting == | == Troubleshooting == |