Skip to content

Commit a205dcb

Browse files
authored
Bug Fixes
Testing openssl configuration changes to reduce issues with version 3.5
1 parent 8f44bb6 commit a205dcb

10 files changed

Lines changed: 125 additions & 60 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
# Changelog
1+
# Chan## 2025-07-14
2+
3+
### 🚨 NGINX BUILD SYSTEM CRITICAL FIXES
4+
- **Permission Issues Resolved**: Fixed critical permission errors preventing nginx from starting
5+
- **Directory Creation**: Ensured all nginx directories exist before setting permissions
6+
- **SSL Certificate Permissions**: Added proper ownership and permissions for SSL certificate files
7+
- **Service User Management**: Added www-data user creation if missing
8+
- **Log Directory Access**: Fixed permission denied errors for nginx error and access logs
9+
- **Service Management**: Enhanced nginx service installation and startup process
10+
- **Configuration Testing**: Added nginx configuration validation before service startup
11+
- **Service Status Verification**: Implemented proper service status checking and error reporting
12+
- **Startup Sequence**: Improved service start sequence with proper error handling
13+
- **Compilation Warnings Reduction**: Minimized OpenSSL compilation warnings
14+
- **Padlock Engine**: Disabled problematic padlock engine causing buffer overflow warnings
15+
- **Compiler Flags**: Added warning suppression flags for stringop-overflow in OpenSSL
16+
- **Build Optimization**: Maintained security while reducing build noise
17+
18+
### 🚨 ADMIN CONTROL PANEL CRITICAL FIXog
219

320
All notable changes to EngineScript will be documented in this file.
421

scripts/functions/cron/permissions.sh

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14+
# Source shared functions library
15+
source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh
1416

1517

1618
#----------------------------------------------------------------------------------
@@ -43,28 +45,10 @@ do
4345
done
4446

4547
# Assign Nginx Permissions
46-
chown -R www-data:www-data /etc/nginx
47-
chown -R www-data:www-data /tmp/nginx_proxy
48-
chown -R www-data:www-data /usr/lib/nginx/modules
49-
chown -R www-data:www-data /var/cache/nginx
50-
chown -R www-data:www-data /var/lib/nginx
51-
chown -R www-data:www-data /var/log/domains
52-
chown -R www-data:www-data /var/www
53-
chmod 775 /var/cache/nginx
48+
set_nginx_permissions
5449

5550
# Assign PHP Permissions
56-
find /var/log/php -type d,f -exec chmod 775 {} \;
57-
find /var/log/opcache -type d,f -exec chmod 775 {} \;
58-
find /etc/php -type d,f -exec chmod 775 {} \;
59-
chmod 775 /var/cache/opcache
60-
chmod 775 /var/cache/php-sessions
61-
chmod 775 /var/cache/wsdlcache
62-
chown -R www-data:www-data /var/cache/opcache
63-
chown -R www-data:www-data /var/cache/php-sessions
64-
chown -R www-data:www-data /var/cache/wsdlcache
65-
chown -R www-data:www-data /var/log/opcache
66-
chown -R www-data:www-data /var/log/php
67-
chown -R www-data:www-data /etc/php
51+
set_php_permissions
6852

6953
# Ensure correct socket ownership and permissions
7054
chown redis:redis /run/redis/redis-server.sock 2>/dev/null || true

scripts/functions/shared/enginescript-common.sh

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,44 @@ function set_enginescript_frontend_permissions() {
258258
find /etc/enginescript -type d -print0 | sudo xargs -0 chmod 0755
259259
find /etc/enginescript -type f -print0 | sudo xargs -0 chmod 0644
260260
chown -R www-data:www-data /etc/enginescript
261-
}
261+
}
262+
263+
# Set permissions for Nginx directories and files
264+
function set_nginx_permissions() {
265+
chown -R www-data:www-data /etc/nginx
266+
chown -R www-data:www-data /tmp/nginx_proxy
267+
chown -R www-data:www-data /usr/lib/nginx/modules
268+
chown -R www-data:www-data /var/cache/nginx
269+
chown -R www-data:www-data /var/lib/nginx
270+
chown -R www-data:www-data /var/log/domains
271+
chown -R www-data:www-data /var/log/nginx
272+
chown -R www-data:www-data /var/www
273+
chmod 775 /var/cache/nginx
274+
chmod 755 /var/log/nginx
275+
chmod 755 /var/log/domains
276+
277+
# Set proper permissions for SSL certificates
278+
if [ -d "/etc/nginx/ssl" ]; then
279+
chown -R root:www-data /etc/nginx/ssl
280+
chmod -R 750 /etc/nginx/ssl
281+
find /etc/nginx/ssl -name "*.key" -exec chmod 640 {} \;
282+
find /etc/nginx/ssl -name "*.crt" -exec chmod 644 {} \;
283+
find /etc/nginx/ssl -name "*.pem" -exec chmod 644 {} \;
284+
fi
285+
}
286+
287+
# Set permissions for PHP directories and files
288+
function set_php_permissions() {
289+
find "/var/log/php" -type d,f -exec chmod 775 {} \;
290+
find "/var/log/opcache" -type d,f -exec chmod 775 {} \;
291+
find "/etc/php" -type d,f -exec chmod 775 {} \;
292+
chmod 775 /var/cache/opcache
293+
chmod 775 /var/cache/php-sessions
294+
chmod 775 /var/cache/wsdlcache
295+
chown -R www-data:www-data /var/cache/opcache
296+
chown -R www-data:www-data /var/cache/php-sessions
297+
chown -R www-data:www-data /var/cache/wsdlcache
298+
chown -R www-data:www-data /var/log/opcache
299+
chown -R www-data:www-data /var/log/php
300+
chown -R www-data:www-data /etc/php
301+
}

scripts/install/nginx/nginx-compile.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ if [[ "${INSTALL_HTTP3}" == "1" ]];
111111
--builddir=nginx-${NGINX_VER} \
112112
--with-cc-opt="$CPU_SPECIFIC_FLAGS -DTCP_FASTOPEN=23 -O3 -fcode-hoisting -flto=auto -fPIC -fstack-protector-strong $LD_FLAG -Werror=format-security -Wformat -Wimplicit-fallthrough=0 -Wno-error=pointer-sign -Wno-implicit-function-declaration -Wno-int-conversion -Wno-cast-function-type -Wno-deprecated-declarations -Wno-error=date-time -Wno-error=strict-aliasing -Wno-format-extra-args --param=ssp-buffer-size=4" \
113113
--with-ld-opt="-Wl,-z,relro -Wl,-z,now -Wl,-s -fPIC -flto=auto $LD_FLAG" \
114-
--with-openssl-opt="enable-ec_nistp_64_gcc_128 enable-ktls no-ssl3-method no-tls1_1-method no-tls-deprecated-ec no-weak-ssl-ciphers -fPIC -march=native" \
114+
--with-openssl-opt="enable-ec_nistp_64_gcc_128 enable-ktls no-ssl3-method no-tls1_1-method no-tls-deprecated-ec no-weak-ssl-ciphers no-engine-padlock -fPIC -march=native" \
115115
--with-openssl=/usr/src/openssl-${OPENSSL_VER} \
116116
--with-libatomic \
117117
--with-file-aio \
@@ -158,7 +158,7 @@ if [[ "${INSTALL_HTTP3}" == "1" ]];
158158
--builddir=nginx-${NGINX_VER} \
159159
--with-cc-opt="$CPU_SPECIFIC_FLAGS -DTCP_FASTOPEN=23 -O3 -fcode-hoisting -flto=auto -fPIC -fstack-protector-strong $LD_FLAG -Werror=format-security -Wformat -Wimplicit-fallthrough=0 -Wno-error=pointer-sign -Wno-implicit-function-declaration -Wno-int-conversion -Wno-cast-function-type -Wno-deprecated-declarations -Wno-error=date-time -Wno-error=strict-aliasing -Wno-format-extra-args --param=ssp-buffer-size=4" \
160160
--with-ld-opt="-Wl,-z,relro -Wl,-z,now -Wl,-s -fPIC -flto=auto $LD_FLAG" \
161-
--with-openssl-opt="enable-ec_nistp_64_gcc_128 enable-ktls no-ssl3-method no-tls1_1-method no-tls-deprecated-ec no-weak-ssl-ciphers -fPIC -march=native" \
161+
--with-openssl-opt="enable-ec_nistp_64_gcc_128 enable-ktls no-ssl3-method no-tls1_1-method no-tls-deprecated-ec no-weak-ssl-ciphers no-engine-padlock -fPIC -march=native" \
162162
--with-openssl=/usr/src/openssl-${OPENSSL_VER} \
163163
--with-libatomic \
164164
--with-file-aio \

scripts/install/nginx/nginx-install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ source /home/EngineScript/enginescript-install-options.txt
1414
# Source shared functions library
1515
source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh
1616

17+
1718
#----------------------------------------------------------------------------------
1819
# Start Main Script
1920

@@ -82,6 +83,9 @@ debug_pause "SSL"
8283
print_last_errors
8384
debug_pause "Admin Password"
8485

86+
# Assign Permissions BEFORE nginx tries to start
87+
set_nginx_permissions
88+
8589
# Install Nginx Service
8690
/usr/local/bin/enginescript/scripts/install/nginx/nginx-service.sh 2>> /tmp/enginescript_install_errors.log
8791
print_last_errors

scripts/install/nginx/nginx-misc.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14+
#Source shared functions library
15+
source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh
1416

1517

1618
#----------------------------------------------------------------------------------
@@ -20,16 +22,21 @@ source /home/EngineScript/enginescript-install-options.txt
2022
cp -a /usr/local/bin/enginescript/config/etc/nginx/. /etc/nginx/
2123
sed -i "s|SEDPHPVER|${PHP_VER}|g" /etc/nginx/globals/php-fpm.conf
2224

23-
# Assign Permissions
24-
chown -R www-data:www-data /etc/nginx
25-
chown -R www-data:www-data /tmp/nginx_proxy
26-
chown -R www-data:www-data /usr/lib/nginx/modules
27-
chown -R www-data:www-data /var/cache/nginx
28-
chown -R www-data:www-data /var/lib/nginx
29-
chown -R www-data:www-data /var/log/domains
30-
chown -R www-data:www-data /var/log/nginx
31-
chown -R www-data:www-data /var/www
32-
chmod 775 /var/cache/nginx
25+
# Create nginx user and group if they don't exist
26+
if ! id "www-data" &>/dev/null; then
27+
useradd -r -s /bin/false www-data
28+
fi
29+
30+
# Ensure all necessary directories exist
31+
mkdir -p /var/log/nginx
32+
mkdir -p /var/log/domains
33+
mkdir -p /var/cache/nginx
34+
mkdir -p /var/lib/nginx/{body,fastcgi,proxy}
35+
mkdir -p /tmp/nginx_proxy
36+
mkdir -p /usr/lib/nginx/modules
37+
38+
# Assign Permissions BEFORE nginx tries to start
39+
set_nginx_permissions
3340

3441
# Logrotate - Nginx and Domains
3542
cp -rf /usr/local/bin/enginescript/config/etc/logrotate.d/nginx /etc/logrotate.d/nginx

scripts/install/nginx/nginx-service.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,28 @@ fi
3030
rm -rf /usr/lib/systemd/system/nginx.service
3131
cp -rf /usr/local/bin/enginescript/config/etc/systemd/system/nginx.service /etc/systemd/system/nginx.service
3232
chmod 644 /etc/systemd/system/nginx.service
33+
34+
# Reload systemd and enable nginx
3335
systemctl daemon-reload
3436
systemctl enable nginx
37+
38+
# Verify nginx configuration before starting
39+
echo "Testing nginx configuration..."
40+
if ! /usr/sbin/nginx -t; then
41+
echo "ERROR: Nginx configuration test failed!"
42+
echo "Please check the configuration and fix any issues before starting nginx."
43+
exit 1
44+
fi
45+
46+
# Start nginx service
47+
echo "Starting nginx service..."
3548
systemctl start nginx
49+
50+
# Verify nginx is running
51+
if systemctl is-active --quiet nginx; then
52+
echo "PASSED: Nginx is running."
53+
else
54+
echo "ERROR: Failed to start nginx service."
55+
systemctl status nginx
56+
exit 1
57+
fi

scripts/install/php/php-install.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ source /home/EngineScript/enginescript-install-options.txt
1515
source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh
1616

1717

18-
1918
#----------------------------------------------------------------------------------
2019
# Start Main Script
2120

@@ -82,18 +81,8 @@ touch "/var/log/php/php${PHP_VER}-fpm.log"
8281
#touch /var/log/php/php-www.log
8382
#touch /var/log/php/php-fpm.log
8483

85-
find "/var/log/php" -type d,f -exec chmod 775 {} \;
86-
find "/var/log/opcache" -type d,f -exec chmod 775 {} \;
87-
find "/etc/php" -type d,f -exec chmod 775 {} \;
88-
chmod 775 /var/cache/opcache
89-
chmod 775 /var/cache/php-sessions
90-
chmod 775 /var/cache/wsdlcache
91-
chown -R www-data:www-data /var/cache/opcache
92-
chown -R www-data:www-data /var/cache/php-sessions
93-
chown -R www-data:www-data /var/cache/wsdlcache
94-
chown -R www-data:www-data /var/log/opcache
95-
chown -R www-data:www-data /var/log/php
96-
chown -R www-data:www-data /etc/php
84+
# Assign PHP Permissions
85+
set_php_permissions
9786

9887
# Restart PHP
9988
restart_service "php${PHP_VER}-fpm"

scripts/update/nginx-update.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,18 @@ rm -rf /etc/nginx/{*.default,*.dpkg-dist}
109109
# Remove debug symbols
110110
strip -s /usr/sbin/nginx*
111111

112+
# Assign Nginx Permissions
113+
set_nginx_permissions
114+
115+
# Verify nginx configuration before starting
116+
echo "Testing nginx configuration..."
117+
if ! /usr/sbin/nginx -t; then
118+
echo "ERROR: Nginx configuration test failed!"
119+
echo "Please check the configuration and fix any issues before starting nginx."
120+
exit 1
121+
fi
122+
123+
# Start Nginx Service
112124
systemctl start nginx
113125

114126
echo -e "\n\n=-=-=-=-=-=-=-=-=-\nNginx Info\n=-=-=-=-=-=-=-=-=-\n"
@@ -124,5 +136,6 @@ if [[ "${STATUS}" == "active" ]]; then
124136
echo "NGINX=1" >> /var/log/EngineScript/install-log.txt
125137
else
126138
echo "FAILED: Nginx not running. Please diagnose this issue before proceeding."
139+
systemctl status nginx
127140
exit 1
128141
fi

scripts/update/php-update.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,8 @@ mkdir -p /var/log/php
136136
touch "/var/log/opcache/opcache.log"
137137
touch "/var/log/php/php${NEW_PHP_VER}-fpm.log"
138138

139-
# Set permissions
140-
find "/var/log/php" -type d,f -exec chmod 775 {} \;
141-
find "/var/log/opcache" -type d,f -exec chmod 775 {} \;
142-
find "/etc/php" -type d,f -exec chmod 775 {} \;
143-
chmod 775 /var/cache/opcache
144-
chmod 775 /var/cache/php-sessions
145-
chmod 775 /var/cache/wsdlcache
146-
chown -R www-data:www-data /var/cache/opcache
147-
chown -R www-data:www-data /var/cache/php-sessions
148-
chown -R www-data:www-data /var/cache/wsdlcache
149-
chown -R www-data:www-data /var/log/opcache
150-
chown -R www-data:www-data /var/log/php
151-
chown -R www-data:www-data /etc/php
139+
# Assign PHP Permissions
140+
set_php_permissions
152141

153142
# Update Nginx configuration to use new PHP version
154143
echo "Updating Nginx configuration for PHP ${NEW_PHP_VER}..."

0 commit comments

Comments
 (0)