Skip to content

Commit a2affd4

Browse files
authored
Updates
1 parent be98475 commit a2affd4

4 files changed

Lines changed: 28 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to EngineScript will be documented in this file.
44

55
Changes are organized by date, with the most recent changes listed first.
66

7+
## 2025-11-03
8+
9+
### 🔧 CONFIGURATION IMPROVEMENTS
10+
11+
- **Optional Unsafe File Blocking**: Made FastCGI cache unsafe file blocking configurable
12+
713
## 2025-11-02
814

915
### 🔒 SECURITY IMPROVEMENTS

config/etc/nginx/globals/map-cache.conf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ map $request_uri $es_request_uri {
110110
"~*/edd-" 1; # Easy Digital Downloads
111111

112112
# Block: Unsafe Files
113-
"~*\.(?:asc|aspx?|bak|bash|bat|blade(\.php)?|cfg|cgi|cmd|conf|csh|dll|dump|engine|env|exe|git(ignore)?|hg|inc|info|ini|install|jsp|log|lua|make|mdb|module|old|orig(inal)?|out|pem|pl|po|profile|py|rdf|save|sh|svn|swo|swp|test|theme|tpl|twig|woa|xtmpl)$" 2;
114-
"~*(Gemfile|Gruntfile|auth|composer|composer/installed|package|package-lock|yarn)\.(?:json|lock)$" 2;
115-
"~*(changelog|example|installation|legalnotice|license|readme|wp-config)\.(?:html?|md|php|rst|txt)$" 2;
116-
"~*gems\.(?:rb|locked)?$" 2;
113+
#"~*\.(?:asc|aspx?|bak|bash|bat|blade(\.php)?|cfg|cgi|cmd|conf|csh|dll|dump|engine|env|exe|git(ignore)?|hg|inc|info|ini|install|jsp|log|lua|make|mdb|module|old|orig(inal)?|out|pem|pl|po|profile|py|rdf|save|sh|svn|swo|swp|test|theme|tpl|twig|woa|xtmpl)$" 2;
114+
#"~*(Gemfile|Gruntfile|auth|composer|composer/installed|package|package-lock|yarn)\.(?:json|lock)$" 2;
115+
#"~*(changelog|example|installation|legalnotice|license|readme|wp-config)\.(?:html?|md|php|rst|txt)$" 2;
116+
#"~*gems\.(?:rb|locked)?$" 2;
117117
#"~*/(wp-content)\/.*\.(?:7z|bz2|[rt]ar|zip)$" 2; # Disables compressed files from being accessed from the wp-content directory. Be careful with this as it will stop you from being able to manually upload plugins/themes or access backups
118-
"~*/wp-content/updraft/" 2; # Updraft
119-
"~*/wp-content/uploads/.*\.(?:js|php|[ps]?html?|swf|tpl)$" 2;
118+
#"~*/wp-content/updraft/" 2; # Updraft
119+
#"~*/wp-content/uploads/.*\.(?:js|php|[ps]?html?|swf|tpl)$" 2;
120120
#"~*/wp-content/uploads/enginescript-sse-site-exports/" 2; # EngineScript Simple Site Exporter
121121
}
122122

config/home/enginescript-install-options.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ INSTALL_EXTRA_WP_PLUGINS=1
8383
# Recommended: 0
8484
SHOW_ENGINESCRIPT_HEADER=0
8585

86+
## Nginx Unsafe File Blocking ##
87+
# Blocks access to potentially unsafe file types and locations in FastCGI cache
88+
# When enabled, blocks: .env, .log, .ini, wp-config.php, composer.json, backup files, etc.
89+
# Disable if you need to access these files through the web (not recommended for security)
90+
NGINX_BLOCK_UNSAFE_FILES=0
91+
8692
## DigitalOcean Remote Console ##
8793
# Install DigitalOcean's Droplet Agent for remote console access
8894
# This enables the Recovery Console feature in the DigitalOcean control panel

scripts/install/nginx/nginx-misc.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.
2222
cp -a /usr/local/bin/enginescript/config/etc/nginx/. /etc/nginx/
2323
sed -i "s|SEDPHPVER|${PHP_VER}|g" /etc/nginx/globals/php-fpm.conf
2424

25+
# Enable unsafe file blocking if configured
26+
if [[ "${NGINX_BLOCK_UNSAFE_FILES}" == "1" ]]; then
27+
sed -i 's|^ #\("~\*\\.\(?:asc\| \1|' /etc/nginx/globals/map-cache.conf
28+
sed -i 's|^ #\("~\*(Gemfile\| \1|' /etc/nginx/globals/map-cache.conf
29+
sed -i 's|^ #\("~\*(changelog\| \1|' /etc/nginx/globals/map-cache.conf
30+
sed -i 's|^ #\("~\*gems\\.\| \1|' /etc/nginx/globals/map-cache.conf
31+
sed -i 's|^ #\("~\*/wp-content/updraft/\| \1|' /etc/nginx/globals/map-cache.conf
32+
sed -i 's|^ #\("~\*/wp-content/uploads/\.\*\\.\| \1|' /etc/nginx/globals/map-cache.conf
33+
fi
34+
2535
# Create nginx user and group if they don't exist
2636
if ! id "www-data" &>/dev/null; then
2737
useradd -r -s /bin/false www-data

0 commit comments

Comments
 (0)