wordpress: Use drop-in config component for /etc files

Tests:

- Config files are all symlinks in /etc/
- Web interface works
- Adding a plugin using auto-download works
- fail2ban-client status shows wordpress-freedombox
- fail2ban catches invalid login attempts

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2023-06-05 20:30:04 -04:00
1 parent 73bc89b916
commit 86444764a7
6 files changed
+14 -1

No files matched your search

@@ -0,0 +1,64 @@
##
## On all sites, provide WordPress on a default path: /wordpress
##
## Requires the following Apache modules to be enabled:
## mod_alias
## mod_rewrite
## mod_proxy_fcgi
## mod_auth_pubtkt
##
# Redirect Webfinger queries, needed by ActivityPub plugin
RedirectMatch "^\/\.well-known\/webfinger(.*)$" "\/wordpress\/\.well-known\/webfinger$1"
# Match longer aliases first to meet expectations
Alias /wordpress/wp-content /var/lib/wordpress/wp-content
Alias /wordpress /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# Allow access only if site is marked as public or if user is an admin
<IfFile !/etc/wordpress/is_public>
Include includes/freedombox-single-sign-on.conf
<IfModule mod_auth_pubtkt.c>
TKTAuthToken "admin"
</IfModule>
</IfFile>
# Increase maximum upload file size
<IfModule proxy_fcgi_module>
ProxyFCGISetEnvIf true PHP_VALUE "post_max_size=128M \n upload_max_filesize = 128M"
</IfModule>
</Directory>
<Directory /var/lib/wordpress/wp-content>
Options FollowSymLinks
# Allow access only if site is marked as public or if user is an admin
<IfFile !/etc/wordpress/is_public>
Include includes/freedombox-single-sign-on.conf
<IfModule mod_auth_pubtkt.c>
TKTAuthToken "admin"
</IfModule>
</IfFile>
<IfFile /etc/wordpress/is_public>
Require all granted
</IfFile>
</Directory>
# Harden security by following wpscan's suggestions. Issue #2244
<LocationMatch "^/wordpress/(readme.html|xmlrpc.php|wp-cron.php)">
Deny from All
</LocationMatch>
@@ -0,0 +1,7 @@
[INCLUDES]
before = common.conf
[Definition]
_daemon = apache-access
prefregex = %(__prefix_line)s
failregex = \S+ <HOST> - \S+ \[[^\]]*\] "POST /wordpress/wp-login.php HTTP/\S+" 200
@@ -0,0 +1,4 @@
[wordpress-freedombox]
enabled = true
filter = wordpress-freedombox
journalmatch = SYSLOG_IDENTIFIER=apache-access
@@ -0,0 +1,4 @@
<?php
# Do not edit this file. Manage your settings on FreedomBox.
define('FS_METHOD','direct');