<?xml version="1.0"?>
<rss version="2.0"><channel><title>CWP - Control WEB Panel Latest Topics</title><link>https://www.alphagnu.com/forum/7-cwp-control-web-panel/</link><description>CWP - Control WEB Panel Latest Topics</description><language>en</language><item><title>Fixing False Positive CWP Security Audit Alerts on AlmaLinux 9.x</title><link>https://www.alphagnu.com/topic/625-fixing-false-positive-cwp-security-audit-alerts-on-almalinux-9x/</link><description><![CDATA[<p>After recent CWP updates, some AlmaLinux 9.x servers may report false security alerts when running:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>sh /scripts/cwp_security_audit
</code></pre><p>A typical false positive looks like this:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>------------------------------------------------------
[INFO] Auditing cwpsrv (PID: 767572)
[OK] cwpsrv looks clean.
------------------------------------------------------
[INFO] Auditing php-fpm-cwp (PID: 710)
[SECURITY ALERT] Unknown/Untrusted file: /usr/lib64/gconv/gconv-modules.cache
Error:Can't add notification![SECURITY ALERT] Unauthorized port: php-fpm
Error:Can't add notification!------------------------------------------------------
[INFO] Auditing apache (PID: 768077)
[OK] apache looks clean.
------------------------------------------------------
[DONE] Security audit finished.
</code></pre><p>In this case the warning is misleading. On AlmaLinux 9.x, the file:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>/usr/lib64/gconv/gconv-modules.cache
</code></pre><p>is a normal system file used by the GNU C Library character conversion system. The original CWP audit script does not include <code>/usr/lib64/gconv/</code> in the allowed library paths, so it incorrectly reports this file as unknown or untrusted.</p><p>There is also a second parsing issue in the port audit section. The original script extracts listening ports using a simple <code>awk -F':'</code> expression against generic <code>lsof</code> output. In some cases this can incorrectly parse process-related text and produce an alert such as:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>[SECURITY ALERT] Unauthorized port: php-fpm
</code></pre><p>Obviously, <code>php-fpm</code> is not a port number.</p><h2>What needs to be fixed</h2><p>There are two small changes that solve the false positives.</p><p>First, add this path to <code>ALLOWED_LIB_PATHS</code>:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>"/usr/lib64/gconv/"
</code></pre><p>Second, replace the port audit line with a more precise <code>lsof</code> command that only checks TCP listening sockets:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>local CURRENT_PORTS=$(lsof -Pan -p $PID -iTCP -sTCP:LISTEN 2&gt;/dev/null | awk 'NR&gt;1 {split($9,a,":"); print a[length(a)]}')
</code></pre><p>This avoids parsing unrelated <code>lsof</code> lines and prevents values like <code>php-fpm</code> from being treated as ports.</p><hr><h1>Patched version of <code>/scripts/cwp_security_audit</code></h1><p>Below is the corrected version. It keeps the original logic but fixes the AlmaLinux 9.x false positives.</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>#!/bin/bash

# --- CONFIGURATION ---
ALLOWED_LIB_PATHS=(
    "/usr/lib64/lib"
    "/usr/lib64/ld-"
    "/usr/local/ioncube/"
    "/usr/lib/locale/"
    "/usr/local/cwp/"
    "/usr/local/apache/modules/"
    "/usr/local/lib/"
    "/usr/lib64/gconv/"
)

ALLOWED_BINARIES=(
    "/usr/local/cwpsrv/bin/cwpsrv"
    "/usr/local/cwp/php71/sbin/php-fpm"
    "/usr/local/apache/bin/httpd"
)

ALLOWED_PORTS=("2030" "2031" "2082" "2083" "2086" "2087" "2095" "2096" "9000" "2302" "2304" "8181" "8443" "80" "443")

# --- INITIALIZATION ---
if ! command -v lsof &amp;&gt; /dev/null; then
    yum install -y lsof
fi

# --- FUNCTIONS ---

check_process() {
    local PROC_NAME=$1
    local SEARCH_PATTERN=$2
    local PID=$(ps aux | grep "$SEARCH_PATTERN" | grep -v grep | awk '{print $2}' | head -n 1)

    if [ -z "$PID" ]; then
        echo "[SKIP] Process '$PROC_NAME' not found."
        return
    fi

    echo "------------------------------------------------------"
    echo "[INFO] Auditing $PROC_NAME (PID: $PID)"
    local GLOBAL_ERROR=0

    # 1. Detect GHOST Files (DELETED or missing via stat)
    local GHOST_DATA=$(lsof -p $PID -n | grep -E "DEL|\(stat:" | grep -v "/dev/zero")
    if [ ! -z "$GHOST_DATA" ]; then
        echo "[!!! CRITICAL ALERT !!!] Ghost files (deleted but running) found:"
        echo "$GHOST_DATA"
        /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php --level="danger" --subject="CWP Security Audit - Ghost files (deleted but running)" --message="[!!! CRITICAL ALERT !!!] Ghost files (deleted but running) found, for more info run:  sh /scripts/cwp_security_audit"
        GLOBAL_ERROR=1
    fi

    # 2. Deep Memory Audit (Path + RPM Package Check)
    local CURRENT_MEM=$(lsof -p $PID -n | grep "mem" | awk '{for(i=9;i&lt;=NF;i++) printf "%s ", $i; print ""}' | sed 's/(stat:.*//' | xargs)
    
    for FILE in $CURRENT_MEM; do
        [[ -z "$FILE" || "$FILE" == "REG" || "$FILE" == "mem" || "$FILE" == "/" ]] &amp;&amp; continue
        
        local MATCH=0

        for ALLOWED in "${ALLOWED_LIB_PATHS[@]}"; do
            if [[ "$FILE" == "$ALLOWED"* ]]; then MATCH=1; break; fi
        done

        for ALLOWED in "${ALLOWED_BINARIES[@]}"; do
            if [[ "$FILE" == "$ALLOWED" ]]; then MATCH=1; break; fi
        done

        if [ $MATCH -eq 0 ]; then
            echo "[SECURITY ALERT] Unknown/Untrusted file: $FILE"
            /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php --level="danger" --subject="CWP Security Audit - Unknown/Untrusted file" --message="[SECURITY ALERT] Unknown/Untrusted file: $FILE"
            GLOBAL_ERROR=1
        else
            if [[ "$FILE" == "/usr/lib64/"* ]]; then
                if ! rpm -qf "$FILE" &amp;&gt;/dev/null; then
                    echo "[!!! DANGER !!!] File in system path but NOT owned by any package: $FILE"
                    /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php --level="danger" --subject="CWP Security Audit - File in system path" --message="[!!! DANGER !!!] File in system path but NOT owned by any package, for more info run:  sh /scripts/cwp_security_audit"
                    GLOBAL_ERROR=1
                fi
            fi
        fi
    done

    # 3. Port Audit
    local CURRENT_PORTS=$(lsof -Pan -p $PID -iTCP -sTCP:LISTEN 2&gt;/dev/null | awk 'NR&gt;1 {split($9,a,":"); print a[length(a)]}')
    for PORT in $CURRENT_PORTS; do
        local PORT_MATCH=0

        for ALLOWED in "${ALLOWED_PORTS[@]}"; do
            if [ "$PORT" == "$ALLOWED" ]; then PORT_MATCH=1; break; fi
        done

        if [ $PORT_MATCH -eq 0 ]; then
            echo "[SECURITY ALERT] Unauthorized port: $PORT"
            /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php --level="danger" --subject="CWP Security Audit - Unauthorized port: $PORT" --message="[SECURITY ALERT] Unauthorized port, for more info run:  sh /scripts/cwp_security_audit"
            GLOBAL_ERROR=1
        fi
    done

    [ $GLOBAL_ERROR -eq 0 ] &amp;&amp; echo "[OK] $PROC_NAME looks clean."
}

# --- EXECUTION ---
check_process "cwpsrv" "cwpsrv: master process"
check_process "php-fpm-cwp" "php-fpm: master process .*cwpsrv.conf"
check_process "apache" "/usr/local/apache/bin/httpd"

echo "------------------------------------------------------"
echo "[DONE] Security audit finished."
</code></pre><hr><h1>Problem: CWP updates may overwrite the fix</h1><p>CWP updates may overwrite <code>/scripts/cwp_security_audit</code>, so manually patching the file once is not always enough.</p><p>One practical solution is to keep a local fixed copy and automatically restore it if CWP replaces the file during an update.</p><p>The following installer creates:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>/root/cwp-overrides/cwp_security_audit.fixed
/root/cwp-overrides/repair-cwp-security-audit.sh
/etc/systemd/system/cwp-security-audit-override.service
/etc/systemd/system/cwp-security-audit-override.path
/etc/cron.d/cwp-security-audit-override
</code></pre><p>The <code>systemd.path</code> unit watches <code>/scripts/cwp_security_audit</code>. If the file changes, the repair script compares it to the fixed version and restores the patched file if needed. A daily cron fallback is also added in case the file watch misses an event.</p><hr><h1>Installer script</h1><p>Save this as:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>install-cwp-security-audit-override.sh
</code></pre><p>Then run it as root:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>chmod +x install-cwp-security-audit-override.sh
./install-cwp-security-audit-override.sh
</code></pre><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>#!/bin/bash
set -euo pipefail

# ============================================================
# CWP security audit override installer
# Restores the locally fixed /scripts/cwp_security_audit
# if CWP updates overwrite it.
# ============================================================

if [ "$(id -u)" -ne 0 ]; then
    echo "ERROR: This installer must be run as root."
    exit 1
fi

OVERRIDE_DIR="/root/cwp-overrides"
BACKUP_DIR="${OVERRIDE_DIR}/backups"
FIXED_FILE="${OVERRIDE_DIR}/cwp_security_audit.fixed"
REPAIR_SCRIPT="${OVERRIDE_DIR}/repair-cwp-security-audit.sh"
TARGET="/scripts/cwp_security_audit"
SERVICE_FILE="/etc/systemd/system/cwp-security-audit-override.service"
PATH_FILE="/etc/systemd/system/cwp-security-audit-override.path"
CRON_FILE="/etc/cron.d/cwp-security-audit-override"
LOG_FILE="/var/log/cwp-security-audit-override.log"

echo "------------------------------------------------------"
echo "[INFO] Installing CWP security audit override"
echo "------------------------------------------------------"

mkdir -p "$OVERRIDE_DIR" "$BACKUP_DIR"
chmod 700 "$OVERRIDE_DIR"
chmod 700 "$BACKUP_DIR"

if ! command -v lsof &gt;/dev/null 2&gt;&amp;1; then
    echo "[INFO] lsof not found. Installing..."

    if command -v dnf &gt;/dev/null 2&gt;&amp;1; then
        dnf install -y lsof
    elif command -v yum &gt;/dev/null 2&gt;&amp;1; then
        yum install -y lsof
    else
        echo "WARNING: Neither dnf nor yum found. Please install lsof manually."
    fi
fi

if [ -f "$TARGET" ]; then
    INITIAL_BACKUP="${BACKUP_DIR}/cwp_security_audit.initial.$(date '+%Y%m%d-%H%M%S').bak"
    cp -a "$TARGET" "$INITIAL_BACKUP"
    echo "[INFO] Current target backed up to: $INITIAL_BACKUP"
else
    echo "[WARNING] Target file does not exist yet: $TARGET"
fi

cat &gt; "$FIXED_FILE" &lt;&lt;'CWP_FIXED_SCRIPT'
#!/bin/bash

# --- CONFIGURATION ---
ALLOWED_LIB_PATHS=(
    "/usr/lib64/lib"
    "/usr/lib64/ld-"
    "/usr/local/ioncube/"
    "/usr/lib/locale/"
    "/usr/local/cwp/"
    "/usr/local/apache/modules/"
    "/usr/local/lib/"
    "/usr/lib64/gconv/"
)

ALLOWED_BINARIES=(
    "/usr/local/cwpsrv/bin/cwpsrv"
    "/usr/local/cwp/php71/sbin/php-fpm"
    "/usr/local/apache/bin/httpd"
)

ALLOWED_PORTS=("2030" "2031" "2082" "2083" "2086" "2087" "2095" "2096" "9000" "2302" "2304" "8181" "8443" "80" "443")

if ! command -v lsof &amp;&gt; /dev/null; then
    yum install -y lsof
fi

check_process() {
    local PROC_NAME=$1
    local SEARCH_PATTERN=$2
    local PID=$(ps aux | grep "$SEARCH_PATTERN" | grep -v grep | awk '{print $2}' | head -n 1)

    if [ -z "$PID" ]; then
        echo "[SKIP] Process '$PROC_NAME' not found."
        return
    fi

    echo "------------------------------------------------------"
    echo "[INFO] Auditing $PROC_NAME (PID: $PID)"
    local GLOBAL_ERROR=0

    local GHOST_DATA=$(lsof -p $PID -n | grep -E "DEL|\(stat:" | grep -v "/dev/zero")
    if [ ! -z "$GHOST_DATA" ]; then
        echo "[!!! CRITICAL ALERT !!!] Ghost files (deleted but running) found:"
        echo "$GHOST_DATA"
        /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php --level="danger" --subject="CWP Security Audit - Ghost files (deleted but running)" --message="[!!! CRITICAL ALERT !!!] Ghost files (deleted but running) found, for more info run:  sh /scripts/cwp_security_audit"
        GLOBAL_ERROR=1
    fi

    local CURRENT_MEM=$(lsof -p $PID -n | grep "mem" | awk '{for(i=9;i&lt;=NF;i++) printf "%s ", $i; print ""}' | sed 's/(stat:.*//' | xargs)
    
    for FILE in $CURRENT_MEM; do
        [[ -z "$FILE" || "$FILE" == "REG" || "$FILE" == "mem" || "$FILE" == "/" ]] &amp;&amp; continue
        
        local MATCH=0

        for ALLOWED in "${ALLOWED_LIB_PATHS[@]}"; do
            if [[ "$FILE" == "$ALLOWED"* ]]; then MATCH=1; break; fi
        done

        for ALLOWED in "${ALLOWED_BINARIES[@]}"; do
            if [[ "$FILE" == "$ALLOWED" ]]; then MATCH=1; break; fi
        done

        if [ $MATCH -eq 0 ]; then
            echo "[SECURITY ALERT] Unknown/Untrusted file: $FILE"
            /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php --level="danger" --subject="CWP Security Audit - Unknown/Untrusted file" --message="[SECURITY ALERT] Unknown/Untrusted file: $FILE"
            GLOBAL_ERROR=1
        else
            if [[ "$FILE" == "/usr/lib64/"* ]]; then
                if ! rpm -qf "$FILE" &amp;&gt;/dev/null; then
                    echo "[!!! DANGER !!!] File in system path but NOT owned by any package: $FILE"
                    /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php --level="danger" --subject="CWP Security Audit - File in system path" --message="[!!! DANGER !!!] File in system path but NOT owned by any package, for more info run:  sh /scripts/cwp_security_audit"
                    GLOBAL_ERROR=1
                fi
            fi
        fi
    done

    local CURRENT_PORTS=$(lsof -Pan -p $PID -iTCP -sTCP:LISTEN 2&gt;/dev/null | awk 'NR&gt;1 {split($9,a,":"); print a[length(a)]}')
    for PORT in $CURRENT_PORTS; do
        local PORT_MATCH=0

        for ALLOWED in "${ALLOWED_PORTS[@]}"; do
            if [ "$PORT" == "$ALLOWED" ]; then PORT_MATCH=1; break; fi
        done

        if [ $PORT_MATCH -eq 0 ]; then
            echo "[SECURITY ALERT] Unauthorized port: $PORT"
            /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php --level="danger" --subject="CWP Security Audit - Unauthorized port: $PORT" --message="[SECURITY ALERT] Unauthorized port, for more info run:  sh /scripts/cwp_security_audit"
            GLOBAL_ERROR=1
        fi
    done

    [ $GLOBAL_ERROR -eq 0 ] &amp;&amp; echo "[OK] $PROC_NAME looks clean."
}

check_process "cwpsrv" "cwpsrv: master process"
check_process "php-fpm-cwp" "php-fpm: master process .*cwpsrv.conf"
check_process "apache" "/usr/local/apache/bin/httpd"

echo "------------------------------------------------------"
echo "[DONE] Security audit finished."
CWP_FIXED_SCRIPT

chmod 600 "$FIXED_FILE"

cat &gt; "$REPAIR_SCRIPT" &lt;&lt;'REPAIR_SCRIPT'
#!/bin/bash
set -euo pipefail

TARGET="/scripts/cwp_security_audit"
FIXED="/root/cwp-overrides/cwp_security_audit.fixed"
BACKUP_DIR="/root/cwp-overrides/backups"
LOG="/var/log/cwp-security-audit-override.log"

mkdir -p "$BACKUP_DIR"

timestamp="$(date '+%Y-%m-%d %H:%M:%S')"

notify_cwp() {
    local level="$1"
    local subject="$2"
    local message="$3"

    if [ -x /usr/local/cwp/php71/bin/php ] &amp;&amp; [ -f /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php ]; then
        /usr/local/cwp/php71/bin/php \
            /usr/local/cwpsrv/htdocs/resources/admin/include/libs/notifications/cli.php \
            --level="$level" \
            --subject="$subject" \
            --message="$message" \
            &gt;/dev/null 2&gt;&amp;1 || true
    fi
}

if [ ! -f "$FIXED" ]; then
    echo "[$timestamp] ERROR: fixed file not found: $FIXED" &gt;&gt; "$LOG"
    notify_cwp "danger" \
        "CWP override error" \
        "Fixed CWP security audit file not found: $FIXED"
    exit 1
fi

if [ ! -f "$TARGET" ]; then
    echo "[$timestamp] WARNING: target file missing, restoring: $TARGET" &gt;&gt; "$LOG"
    install -m 755 "$FIXED" "$TARGET"

    notify_cwp "warning" \
        "CWP security audit restored" \
        "Target file was missing and has been restored: $TARGET"

    exit 0
fi

target_hash="$(sha256sum "$TARGET" | awk '{print $1}')"
fixed_hash="$(sha256sum "$FIXED" | awk '{print $1}')"

if [ "$target_hash" != "$fixed_hash" ]; then
    backup="$BACKUP_DIR/cwp_security_audit.$(date '+%Y%m%d-%H%M%S').bak"

    cp -a "$TARGET" "$backup"
    install -m 755 "$FIXED" "$TARGET"

    echo "[$timestamp] RESTORED: $TARGET was changed. Backup saved to: $backup" &gt;&gt; "$LOG"

    notify_cwp "warning" \
        "CWP override restored cwp_security_audit" \
        "CWP update changed /scripts/cwp_security_audit. The local fixed version was restored. Backup: $backup"
else
    echo "[$timestamp] OK: no change detected." &gt;&gt; "$LOG"
fi
REPAIR_SCRIPT

chmod 700 "$REPAIR_SCRIPT"

cat &gt; "$SERVICE_FILE" &lt;&lt;'SERVICE_UNIT'
[Unit]
Description=Restore local fixed CWP security audit script if overwritten

[Service]
Type=oneshot
ExecStart=/root/cwp-overrides/repair-cwp-security-audit.sh
SERVICE_UNIT

chmod 644 "$SERVICE_FILE"

cat &gt; "$PATH_FILE" &lt;&lt;'PATH_UNIT'
[Unit]
Description=Watch CWP security audit script for changes

[Path]
PathChanged=/scripts/cwp_security_audit
PathModified=/scripts/cwp_security_audit
Unit=cwp-security-audit-override.service

[Install]
WantedBy=multi-user.target
PATH_UNIT

chmod 644 "$PATH_FILE"

cat &gt; "$CRON_FILE" &lt;&lt;'CRON_FALLBACK'
# CWP security audit override fallback check
# Runs daily in case systemd.path missed a file change.
17 3 * * * root /root/cwp-overrides/repair-cwp-security-audit.sh &gt;/dev/null 2&gt;&amp;1
CRON_FALLBACK

chmod 644 "$CRON_FILE"

systemctl daemon-reload
systemctl enable --now cwp-security-audit-override.path

echo "[INFO] Running first repair/check..."
"$REPAIR_SCRIPT"

echo "------------------------------------------------------"
echo "[OK] Installation finished."
echo
echo "Status:"
systemctl --no-pager status cwp-security-audit-override.path || true
echo
echo "Last log entries:"
tail -n 10 "$LOG_FILE" 2&gt;/dev/null || true
echo "------------------------------------------------------"
</code></pre><hr><h1>Verification</h1><p>After installation, run:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>systemctl status cwp-security-audit-override.path
tail -n 30 /var/log/cwp-security-audit-override.log
sha256sum /scripts/cwp_security_audit /root/cwp-overrides/cwp_security_audit.fixed
</code></pre><p>The two <code>sha256sum</code> values should be identical.</p><p>Then run the CWP audit again:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>sh /scripts/cwp_security_audit
</code></pre><p>On a clean AlmaLinux 9.x server, the previous false alerts for:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>/usr/lib64/gconv/gconv-modules.cache
</code></pre><p>and:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Unauthorized port: php-fpm
</code></pre><p>should be gone.</p><hr><h1>Notes</h1><p>This does not disable the CWP security audit. It only fixes two false-positive conditions:</p><ol><li><p>missing allowed path for <code>/usr/lib64/gconv/</code>,</p></li><li><p>unsafe parsing of listening ports from generic <code>lsof</code> output.</p></li></ol><p>The script also keeps backups of any CWP-provided version that gets overwritten, so you can later compare what changed after an update:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>ls -lah /root/cwp-overrides/backups/
</code></pre><p>This approach is safer than using:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>chattr +i /scripts/cwp_security_audit
</code></pre><p>because CWP updates are not blocked. The update can complete normally, and the local fixed version is restored afterwards.</p>]]></description><guid isPermaLink="false">625</guid><pubDate>Fri, 15 May 2026 10:18:38 +0000</pubDate></item><item><title>CWP Apache Restore original visitor IPs with mod_remoteip when using Cloudflare proxy</title><link>https://www.alphagnu.com/topic/28-cwp-apache-restore-original-visitor-ips-with-mod_remoteip-when-using-cloudflare-proxy/</link><description><![CDATA[<p>
	In this tutorial we’ll going to learn how to configure Apache mod_remoteip in order to restore original ip when using cloudflare proxy. We’ve another blog post upon how we can configure mod_cloudflare to restore ip which for some are not at all working. This is the method which is working and recommended in cloudflare website.
</p>

<p>
	So without wasting time lets get started with this simple steps. :
</p>

<p>
	<strong>Step 1 :</strong><br />
	Enabling mod_remoteip in Apache config :
</p>

<pre class="ipsCode">sed -i '/LoadModule remoteip_module modules/ s/^#//g' /usr/local/apache/conf/httpd.conf  </pre>

<p>
	<br />
	<strong>Step 2 :</strong><br />
	Now we’re going to configure cloudflare original ip config :
</p>

<p>
	first of all create a file named “cloudflare.conf” in /usr/local/apache/conf.d
</p>

<pre class="ipsCode">cd /usr/local/apache/conf.d
nano cloudflare.conf</pre>

<p>
	<br />
	then copy paste below config and save it :
</p>

<pre class="ipsCode">#LogFormat "%a %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
RemoteIPHeader CF-Connecting-IP
RemoteIPTrustedProxy 173.245.48.0/20
RemoteIPTrustedProxy 103.21.244.0/22
RemoteIPTrustedProxy 103.22.200.0/22
RemoteIPTrustedProxy 103.31.4.0/22
RemoteIPTrustedProxy 141.101.64.0/18
RemoteIPTrustedProxy 108.162.192.0/18
RemoteIPTrustedProxy 190.93.240.0/20
RemoteIPTrustedProxy 188.114.96.0/20
RemoteIPTrustedProxy 197.234.240.0/22
RemoteIPTrustedProxy 198.41.128.0/17
RemoteIPTrustedProxy 162.158.0.0/15
RemoteIPTrustedProxy 104.16.0.0/12
RemoteIPTrustedProxy 172.64.0.0/13
RemoteIPTrustedProxy 131.0.72.0/22
RemoteIPTrustedProxy 2400:cb00::/32
RemoteIPTrustedProxy 2606:4700::/32
RemoteIPTrustedProxy 2803:f800::/32
RemoteIPTrustedProxy 2405:b500::/32
RemoteIPTrustedProxy 2405:8100::/32
RemoteIPTrustedProxy 2a06:98c0::/29
RemoteIPTrustedProxy 2c0f:f248::/32</pre>

<p>
	<br />
	*you can remove “#” uncomment from in front of LogFormat for customized log format.
</p>

<p>
	Step 3 :<br />
	Restart Apache webserver and done :
</p>

<pre class="ipsCode">systemctl restart httpd</pre>

<p>
	 
</p>
]]></description><guid isPermaLink="false">28</guid><pubDate>Sat, 03 Jun 2023 17:14:33 +0000</pubDate></item><item><title>Getting a [!!! CRITICAL ALERT !!!] Ghost files (deleted but running) found in NEW CWP install</title><link>https://www.alphagnu.com/topic/621-getting-a-critical-alert-ghost-files-deleted-but-running-found-in-new-cwp-install/</link><description><![CDATA[<p>Posted in the CWP forums but there is not much going on there figure might get some help here..</p><p>New CWP install on Alma 8. On a private IP with no ports forwarded just doing the updates and such.</p><p>Ran some updates and. got the popup in the webpage ran and got this.</p><p>No idea? Is it serious or just a false positive on something.<br><br>sh /scripts/cwp_security_audit<br>------------------------------------------------------<br>[INFO] Auditing cwpsrv (PID: 156548)<br>[OK] cwpsrv looks clean.<br>------------------------------------------------------<br>[INFO] Auditing php-fpm-cwp (PID: 1086)<br>[!!! CRITICAL ALERT !!!] Ghost files (deleted but running) found:<br><strong>php-fpm 1086 root  DEL       REG              253,0             1837740 /usr/local/ioncube/ioncube_loader_lin_</strong><a rel="external nofollow" href="https://7.2.so"><strong>7.2.so</strong></a><br>Error:Can't add notification!------------------------------------------------------<br>[INFO] Auditing apache (PID: 157091)<br>[OK] apache looks clean.<br>------------------------------------------------------</p>]]></description><guid isPermaLink="false">621</guid><pubDate>Sat, 21 Feb 2026 05:39:07 +0000</pubDate></item><item><title>How to Add Custom PHP-FPM 8.4 / 8.5 Support to CWP on AlmaLinux 9.x</title><link>https://www.alphagnu.com/topic/614-how-to-add-custom-php-fpm-84-85-support-to-cwp-on-almalinux-9x/</link><description><![CDATA[<p><em>Full tutorial with GUI integration, </em><strong><em>fixed OpenSSL support</em></strong><em>, external modules, and a working custom PHP builder.</em></p><p>This guide explains how to properly add <strong>PHP 8.4</strong> and <strong>PHP 8.5</strong> to <strong>Control Web Panel (CWP)</strong> on EL9-based systems.<br>Unlike older CWP releases, CWP does <em>not</em> provide official PHP 8.4/8.5 packages yet — but with the steps below you can fully integrate them into and you can also fix the PHP 8.3 OpenSSL problem based on this:</p><p><span class="ipsEmoji" title="">✔</span> the CWP PHP Selector GUI<br><span class="ipsEmoji" title="">✔</span> Apache / Nginx vhosts<br><span class="ipsEmoji" title="">✔</span> external PECL modules<br><span class="ipsEmoji" title="">✔</span> system services<br><span class="ipsEmoji" title="">✔</span> CSF/Monit integration</p><p>This article provides everything: file paths, scripts, corrections, and the build steps.</p><h1><strong><span class="ipsEmoji" title="">⚙️</span> Step 1 — Extend the CWP GUI to Support PHP 8.4 and 8.5</strong></h1><p>CWP reads available PHP versions from:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/versions.ini</code></pre><p>Add the new PHP versions like:</p><pre spellcheck="" class="ipsCode language-ini" data-language="ini"><code>[8.3]
version[]=8.3.28
version[]=8.3.27
version[]=8.3.25
version[]=8.3.21
version[]=8.3.20
version[]=8.3.19
version[]=8.3.17
version[]=8.3.16
version[]=8.3.15
version[]=8.3.14
version[]=8.3.13
version[]=8.3.12
version[]=8.3.11
version[]=8.3.10
version[]=8.3.9
version[]=8.3.8
version[]=8.3.7
version[]=8.3.6
version[]=8.3.4
version[]=8.3.3
version[]=8.3.2
version[]=8.3.1
version[]=8.3.0

[8.4]
version[]=8.4.15
version[]=8.4.14
version[]=8.4.13
version[]=8.4.12
version[]=8.4.11
version[]=8.4.10
version[]=8.4.9
version[]=8.4.8
version[]=8.4.7
version[]=8.4.6
version[]=8.4.4
version[]=8.4.3
version[]=8.4.2
version[]=8.4.1
version[]=8.4.0

[8.5]
version[]=8.5.0
</code></pre><p>This makes the versions selectable in the GUI.</p><p>If you don't want to make previous PHP 8.4 versions optional under 8.4.14, you can leave them out of the list.</p><h1><strong><span class="ipsEmoji" title="">⚙️</span> Step 2 — Create </strong><code>8.4.ini</code><strong> and </strong><code>8.5.ini</code><strong> GUI Templates</strong></h1><p>Location:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/</code></pre><p>Create these files based on the sample and content of 8.3.ini:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>8.4.ini
8.5.ini
</code></pre><p>Both must contain a corrected OpenSSL section:</p><pre spellcheck="" class="ipsCode language-ini" data-language="ini"><code>[openssl]
default=1
option="--with-openssl=/usr"
info-file=openssl.txt
</code></pre><p>(Older CWP templates use deprecated OpenSSL paths that break EL9 builds. The corrected version above is mandatory. And similarly, the OpenSSL section in the 8.3.ini file must be corrected.)</p><p>These files provide the GUI-driven configure flags that our builder script will later use.</p><h1><strong><span class="ipsEmoji" title="">⚙️</span> Step 3 — Create External and Pre Run Modules for PHP 8.4 and 8.5</strong></h1><p>Create these directories and update the content of 8.3 folder with the linked ZIP file:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/external_modules/8.3
/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/external_modules/8.4
/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/external_modules/8.5</code></pre><p>Populate each directory with the updated scripts:</p><ul><li><p><code>apcu.sh</code></p></li><li><p><code>imagick.sh</code></p></li><li><p><code>memcache.sh</code></p></li><li><p><code>memcached.sh</code></p></li><li><p><code>mailparse.sh</code></p></li><li><p><code>mongodb.sh</code></p></li><li><p><code>redis.sh</code></p></li><li><p><code>ssh2.sh</code></p></li><li><p><code>uploadprogress.sh</code></p></li><li><p><code>xdebug.sh</code></p></li><li><p><code>yaz.sh</code></p></li><li><p><code>sodium.sh</code></p></li><li><p><code>sourceguardian.sh</code></p></li><li><p><code>sqlsrv.sh</code></p></li><li><p><code>ioncube.sh</code><br>(With proper loader URL handling: stable for 8.4, beta for 8.5.)</p></li></ul><p><span class="ipsEmoji" title="">👉</span> Here is the ZIP file with all corrected module scripts to this post for download:</p><p><a rel="external nofollow" href="https://drive.google.com/file/d/1dLb8QhK90xatAPId39gD9n7CAUSGzWvd/view?usp=sharing">External_Modules</a></p><p>Create these directories and update the content of 8.3 folder with the linked ZIP file:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/pre_run/8.3
/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/pre_run/8.4
/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/pre_run/8.5</code></pre><p><a rel="external nofollow" href="https://drive.google.com/file/d/1-S_uQs0vIW3mQMwtfyDbUTwDdv-AytR7/view?usp=sharing">Pre Run Modules</a></p><p></p><h1><strong><span class="ipsEmoji" title="">⚙️</span> Step 4 — Install the Custom Builder Script</strong></h1><p>Place the builder script in:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>/root/build-php-fpm84-el9.sh
</code></pre><p>This script:</p><p><span class="ipsEmoji" title="">✔</span> reads the GUI-generated configure template<br><span class="ipsEmoji" title="">✔</span> enforces OpenSSL 3.x for EL9<br><span class="ipsEmoji" title="">✔</span> builds PHP cleanly under <code>/opt/alt/php-fpm84/usr/</code><br><span class="ipsEmoji" title="">✔</span> installs FPM service, ini files, sockets<br><span class="ipsEmoji" title="">✔</span> compiles all external modules<br><span class="ipsEmoji" title="">✔</span> integrates CSF and Monit<br><span class="ipsEmoji" title="">✔</span> logs every step</p><p>You can rewrite this script to install PHP 8.3.28 or PHP 8.5.0 by changing just a few variables.</p><p>Here is the corrected PHP compiler script located in /root/build-php-fpm84-el9.sh file:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>#!/bin/bash
set -euo pipefail
set -x

# --- Basic variables ---
PHPMAJOR="84"                  # php-fpm84
PHPVER="8.4.15"                # PHP version
FPMDIR="/opt/alt/php-fpm${PHPMAJOR}"
CONFBASE="/usr/local/cwp/.conf/php-fpm_conf"

arch=$(uname -m)
if [[ "$arch" == "x86_64" ]]; then
    platform="x86-64"
    libdir="/usr/lib64"
else
    platform="x86"
    libdir="/usr/lib"
fi

# --- Packages for Build (EL9) ---
dnf -y install \
  krb5-devel glibc-common gnutls-devel \
  libargon2 libargon2-devel libbsd-devel \
  perl libzip libzip-devel pcre2 pcre2-devel \
  libavif libavif-devel \
  uw-imap-devel \
  openssl-devel

# If there is any old CWP OpenSSL hack left, don't use it.:
if [ -d /usr/local/opensslso ]; then
  echo "WARN: /usr/local/opensslso exists, but we DO NOT USE for compiling PHP (OpenSSL 1.1 hack)."
fi

# --- Force OpenSSL 3.x ---
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
export OPENSSL_CFLAGS="-I/usr/include"
export OPENSSL_LIBS="-L/usr/lib64"
export LDFLAGS="-lssl -lcrypto"

# --- CWP pre-conf, if exists (e.g.: pcre2, &amp; other libs) ---
if [ -e "${CONFBASE}/php${PHPMAJOR}_pre.conf" ]; then
    bash "${CONFBASE}/php${PHPMAJOR}_pre.conf"
fi

# --- PHP SOURCE DOWNLOAD CHECK: CWP CDN → OFFICIAL php.net → GitHub fallback ---
CWP_URL="http://static.cdn-cwp.com/files/php/php-${PHPVER}.tar.gz"
PHPNET_URL="https://www.php.net/distributions/php-${PHPVER}.tar.gz"
GITHUB_URL="https://codeload.github.com/php/php-src/tar.gz/refs/tags/php-${PHPVER}"

# Function: check HTTP 200 + verify tar.gz content
check_and_verify() {
    local url="$1"
    local testfile="/tmp/php-test-${PHPVER}.tar.gz"

    echo "Checking: $url"

    # First check HTTP status code
    if ! curl -I -L -s "$url" | grep -q "200"; then
        echo "  → HTTP check failed"
        return 1
    fi

    # Download temporary test file
    if ! wget -q "$url" -O "$testfile"; then
        echo "  → Download failed"
        return 1
    fi

    # Validate MIME type of tar.gz
    if file "$testfile" | grep -qiE "gzip compressed data|tar archive"; then
        rm -f "$testfile"
        echo "  → Valid TAR.GZ"
        return 0
    fi

    echo "  → Invalid TAR.GZ (HTML or wrong file)"
    rm -f "$testfile"
    return 1
}

# Check sources in order (CWP → php.net → GitHub)
if check_and_verify "$CWP_URL"; then
    PHPSOURCE="$CWP_URL"
elif check_and_verify "$PHPNET_URL"; then
    PHPSOURCE="$PHPNET_URL"
elif check_and_verify "$GITHUB_URL"; then
    PHPSOURCE="$GITHUB_URL"
else
    echo "ERROR: Could not download a valid PHP source for version ${PHPVER}"
    exit 1
fi

echo "Using source: $PHPSOURCE"

# --- Build directory ---
rm -rf /usr/local/src/php-build
mkdir -p /usr/local/src/php-build
cd /usr/local/src/php-build

wget -q "${PHPSOURCE}" -O "php-${PHPVER}.tar.gz"

tar -xvf "php-${PHPVER}.tar.gz"
cd "php-${PHPVER}"

# --- Configure: CWP's own php84.conf, but already wired to OpenSSL 3.x from env ---
if [ ! -x "${CONFBASE}/php${PHPMAJOR}.conf" ]; then
    chmod +x "${CONFBASE}/php${PHPMAJOR}.conf" 2&gt;/dev/null || true
fi

# IMPORTANT: LDFLAGS + PKG_CONFIG_PATH already exported
bash "${CONFBASE}/php${PHPMAJOR}.conf"

# --- Compiling ---
if command -v nproc &gt;/dev/null 2&gt;&amp;1; then
    make -j"$(nproc)"
else
    make
fi

make install

# --- PHP.ini + FPM scaffolding ---
mkdir -p "${FPMDIR}/usr/php/php.d"
mkdir -p "${FPMDIR}/usr/var/sockets"
mkdir -p "${FPMDIR}/usr/etc/php-fpm.d"
mkdir -p "${FPMDIR}/usr/etc/php-fpm.d/users"

rsync php.ini-production "${FPMDIR}/usr/php/php.ini"

sed -i 's/^short_open_tag.*/short_open_tag = On/' "${FPMDIR}/usr/php/php.ini"
sed -i 's/^;cgi.fix_pathinfo=.*/cgi.fix_pathinfo=1/' "${FPMDIR}/usr/php/php.ini"
sed -i 's/.*mail.add_x_header.*/mail.add_x_header = On/' "${FPMDIR}/usr/php/php.ini"
sed -i 's@.*mail.log.*@mail.log = /usr/local/apache/logs/phpmail.log@' "${FPMDIR}/usr/php/php.ini"

echo "include=${FPMDIR}/usr/etc/php-fpm.d/users/*.conf" &gt; "${FPMDIR}/usr/etc/php-fpm.d/users.conf"
echo "include=${FPMDIR}/usr/etc/php-fpm.d/*.conf" &gt; "${FPMDIR}/usr/etc/php-fpm.conf"

cat &gt; "${FPMDIR}/usr/etc/php-fpm.d/cwpsvc.conf" &lt;&lt;EOF
[cwpsvc]
listen = ${FPMDIR}/usr/var/sockets/cwpsvc.sock
listen.owner = cwpsvc
listen.group = cwpsvc
listen.mode = 0640
user = cwpsvc
group = cwpsvc
pm = ondemand
pm.max_children = 25
pm.process_idle_timeout = 15s
request_terminate_timeout = 0
EOF

# --- Systemd service ---
cp sapi/fpm/php-fpm.service "/usr/lib/systemd/system/php-fpm${PHPMAJOR}.service"
sed -i "s|\${exec_prefix}|${FPMDIR}/usr|g" "/usr/lib/systemd/system/php-fpm${PHPMAJOR}.service"
sed -i "s|\${prefix}|${FPMDIR}/usr|g" "/usr/lib/systemd/system/php-fpm${PHPMAJOR}.service"

systemctl daemon-reload
systemctl enable "php-fpm${PHPMAJOR}"

# --- Loading Apache FPM module if not already present ---
if [ ! -e "/usr/local/apache/conf.d/php-fpm.conf" ]; then
cat &gt; /usr/local/apache/conf.d/php-fpm.conf &lt;&lt;EOF
&lt;IfModule !proxy_fcgi_module&gt;
    LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
&lt;/IfModule&gt;
EOF
fi

# --- External modules (imagick, redis, imap, etc.) ---
if [ -e "${CONFBASE}/php${PHPMAJOR}_external.conf" ]; then
    bash "${CONFBASE}/php${PHPMAJOR}_external.conf" || true
fi

# --- Monitor integration ---
if [ -d "/etc/monit.d" ]; then
  if [ ! -e "/etc/monit.d/php-fpm${PHPMAJOR}" ]; then
    if [ -e "/usr/local/cwpsrv/htdocs/resources/conf/monit.d/php-fpm${PHPMAJOR}" ]; then
      cp "/usr/local/cwpsrv/htdocs/resources/conf/monit.d/php-fpm${PHPMAJOR}" /etc/monit.d/ 2&gt;/dev/null || true
      monit reload || true
    fi
  fi
fi

systemctl restart "php-fpm${PHPMAJOR}"

# --- CSF pignore ---
if [ -e "/etc/csf/csf.pignore" ]; then

    # PHP-FPM + PHP binary
    if ! grep -q "${FPMDIR}/usr/sbin/php-fpm" /etc/csf/csf.pignore; then
        echo "exe:${FPMDIR}/usr/sbin/php-fpm" &gt;&gt; /etc/csf/csf.pignore
    fi

    if ! grep -q "${FPMDIR}/usr/bin/php" /etc/csf/csf.pignore; then
        echo "exe:${FPMDIR}/usr/bin/php" &gt;&gt; /etc/csf/csf.pignore
    fi

    # memcached daemon
    if command -v memcached &gt;/dev/null 2&gt;&amp;1; then
        if ! grep -q "exe:/usr/bin/memcached" /etc/csf/csf.pignore; then
            echo "exe:/usr/bin/memcached" &gt;&gt; /etc/csf/csf.pignore
        fi
    fi

    # redis-server daemon
    if command -v redis-server &gt;/dev/null 2&gt;&amp;1; then
        if ! grep -q "exe:/usr/bin/redis-server" /etc/csf/csf.pignore; then
            echo "exe:/usr/bin/redis-server" &gt;&gt; /etc/csf/csf.pignore
        fi
    fi

    # Restart CSF/LFD to apply changes
    csf -r
fi

rm -rf /usr/local/src/php-build
rm -rf /usr/local/src/build-dir

echo "PHP ${PHPVER} (php-fpm${PHPMAJOR}) build finished successfully."

</code></pre><p>It is for sample, you can modify it by your needs.</p><p></p><h1><strong><span class="ipsEmoji" title="">⚙️</span> Step 5 — Trigger the GUI Build Once</strong></h1><p>From the CWP Admin Panel:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>PHP-FPM Selector → PHP 8.4 → Choose desired version of PHP → Build
</code></pre><p>CWP will:</p><ul><li><p>generate the build configuration files</p></li><li><p>stop early because no packages exist (expected!)</p></li><li><p>but now the config files are ready</p></li></ul><p><a rel="external nofollow" href="https://drive.google.com/file/d/1ZcO2_P0Gqm-1YKFBdIC_wRQhJnP1knKB/view?usp=sharing">The GUI selector</a></p><p>(Image on the shared link)</p><p>This step <strong>must</strong> be done once so the GUI produces:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>/usr/local/cwp/.conf/php-fpm_conf/php84.conf
/usr/local/cwp/.conf/php-fpm_conf/php84_pre.conf
/usr/local/cwp/.conf/php-fpm_conf/php84_external.conf
</code></pre><p>Our builder script depends on them.</p><p></p><h1><strong><span class="ipsEmoji" title="">⚙️</span> Step 6 — Build PHP 8.4 With Logging</strong></h1><p>Run the custom builder script manually:</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>bash /root/build-php-fpm84-el9.sh 2&gt;&amp;1 | tee /root/php84-build.log
</code></pre><p>This:</p><ul><li><p>logs all output</p></li><li><p>compiles PHP 8.4.14</p></li><li><p>installs extensions - e.g. IonCube loader if it was selected</p></li><li><p>reloads FPM</p></li><li><p>integrates CSF pignore entries</p><ul><li><p><code>exe:/usr/bin/redis-server</code></p></li><li><p><code>exe:/usr/bin/memcached</code></p></li></ul></li></ul><p>After the build:</p><h3>Test PHP:</h3><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>/opt/alt/php-fpm84/usr/bin/php -v
/opt/alt/php-fpm84/usr/sbin/php-fpm -t
</code></pre><h3>Verify IonCube:</h3><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>grep -Ri ioncube /opt/alt/php-fpm84/usr/php/php.d/
</code></pre><h3>Verify Imagick:</h3><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>/opt/alt/php-fpm84/usr/bin/php -r "print_r(Imagick::getVersion());"</code></pre><hr><h1><strong><span class="ipsEmoji" title="">⚙️</span> Repeat the Process for PHP 8.5</strong></h1><p>The steps are identical, except:</p><ul><li><p>PHP version is different</p></li><li><p>ionCube loader uses the <strong>beta</strong> build<br><code>ioncube_loaders_lin_x86-64_beta.tar.gz</code></p></li></ul><p>Here is the <a rel="external nofollow" href="https://www.ioncube.com/loaders.php">IonCube documentation</a>. The PHP 8.4 is fully supported, PHP 8.5 is Beta in the moment.</p><hr><h1><strong><span class="ipsEmoji" title="">🎉</span> Result</strong></h1><p>After completing these steps you will have:</p><p><span class="ipsEmoji" title="">✔</span> Fully working PHP 8.4 or 8.5<br><span class="ipsEmoji" title="">✔</span> 100% GUI-compatible (PHP Selector, vhost handler, extension manager)<br><span class="ipsEmoji" title="">✔</span> Proper OpenSSL 3.x integration<br><span class="ipsEmoji" title="">✔</span> All external PECL modules working<br><span class="ipsEmoji" title="">✔</span> Systemd FPM services<br><span class="ipsEmoji" title="">✔</span> Clean, isolated alt-PHP folders under <code>/opt/alt</code><br><span class="ipsEmoji" title="">✔</span> No conflict with AlmaLinux REMI PHP packages</p><p>And most importantly:</p><p><strong>You can now run PHP 8.4 / 8.5 safely in production on CWP EL9.</strong></p><p>I also fixed the PHP - OpenSSL compilation issue in AlmaLinux 9.x with PHP 8.3.28 version of the script. PHP now uses OpenSSL 3.x.</p><p>Checking the compiled PHP versions (e.g. 8.4.14 and 8.3.28):</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>[root@vps ~]# /opt/alt/php-fpm84/usr/bin/php -v
PHP 8.4.14 (cli) (built: Dec  1 2025 22:53:34) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.14, Copyright (c) Zend Technologies
    with the ionCube PHP Loader v15.0.0, Copyright (c) 2002-2025, by ionCube Ltd.
    with Zend OPcache v8.4.14, Copyright (c), by Zend Technologies

[root@vps ~]# /opt/alt/php-fpm83/usr/bin/php -v
PHP 8.3.28 (cli) (built: Dec  1 2025 16:39:53) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.28, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.28, Copyright (c), by Zend Technologies
[root@vps ~]# 
</code></pre><p>Checking OpenSSL:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>[root@vps ~]# /opt/alt/php-fpm84/usr/bin/php -i | grep -i "openssl"
Configure Command =&gt;  './configure'  '--prefix=/opt/alt/php-fpm84/usr' '--with-config-file-path=/opt/alt/php-fpm84/usr/php' '--with-config-file-scan-dir=/opt/alt/php-fpm84/usr/php/php.d' '--with-zlib=/usr' '--enable-mbstring' '--with-zip' '--enable-bcmath' '--enable-pcntl' '--enable-ftp' '--enable-exif' '--enable-calendar' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-tidy' '--with-curl' '--with-iconv' '--with-gmp' '--with-pspell' '--enable-gd' '--with-jpeg' '--with-freetype' '--enable-gd-jis-conv' '--with-webp' '--with-avif' '--with-zlib-dir=/usr' '--with-xpm' '--with-openssl=/usr' '--with-pdo-mysql=mysqlnd' '--with-gettext=/usr' '--with-bz2=/usr' '--with-mysqli' '--enable-soap' '--enable-phar' '--with-xsl' '--with-kerberos' '--enable-posix' '--enable-sockets' '--with-external-pcre' '--with-libdir=lib64' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--enable-intl' '--with-imap' '--with-imap-ssl' '--enable-fpm' '--enable-opcache' '--with-password-argon2' 'PKG_CONFIG_PATH=/usr/lib64/pkgconfig' 'OPENSSL_CFLAGS=-I/usr/include' 'OPENSSL_LIBS=-L/usr/lib64'
SSL Version =&gt; OpenSSL/3.5.1
libSSH Version =&gt; libssh/0.10.4/openssl/zlib
openssl
OpenSSL support =&gt; enabled
OpenSSL Library Version =&gt; OpenSSL 3.5.1 1 Jul 2025
OpenSSL Header Version =&gt; OpenSSL 3.5.1 1 Jul 2025
Openssl default config =&gt; /etc/pki/tls/openssl.cnf
openssl.cafile =&gt; no value =&gt; no value
openssl.capath =&gt; no value =&gt; no value
OpenSSL support =&gt; enabled
[root@vps ~]# 
</code></pre><p>If you have any suggestions, please feel free to write to me.</p><p></p>]]></description><guid isPermaLink="false">614</guid><pubDate>Tue, 02 Dec 2025 12:37:14 +0000</pubDate></item><item><title>Update phpMyAdmin to latest (currently 5.2.1)?</title><link>https://www.alphagnu.com/topic/525-update-phpmyadmin-to-latest-currently-521/</link><description><![CDATA[<p>
	Is there a way besides the script in the /scripts folder to update phpMyAdmin?
</p>

<p>
	The script in the directory say it has the latest, but is running 5.1.1, and the current version (as of 2024-06-07) is 5.2.1.
</p>

<p>
	 
</p>

<p>
	Thanks
</p>
]]></description><guid isPermaLink="false">525</guid><pubDate>Fri, 07 Jun 2024 11:03:45 +0000</pubDate></item><item><title>Upgrade MariaDB 10.11 In CWP Centos 7 Centos 8 stream AlmaLinux 7/8 RockyLinux 7/8</title><link>https://www.alphagnu.com/topic/23-upgrade-mariadb-1011-in-cwp-centos-7-centos-8-stream-almalinux-78-rockylinux-78/</link><description><![CDATA[<p>MariaDB 10.11 is now very stable and many features have been added and improved in this version You can check all the lists of changes here</p><p>I’ve checked MariaDB 10.11 with WordPress, Joomla, xenforo, IPS forum and some more PHP scripts which depends on MySQL DB are working fine with this version hence it is safe to upgrade to this version.</p><p>Short description about MariaDB :</p><p>MariaDB is designed as a drop-in replacement of MySQL with more features, new storage engines, fewer bugs, and better performance. MariaDB is developed by many of the original developers of MySQL who now work for the MariaDB Foundation and the MariaDB Corporation, and by many people in the community.</p><p><strong>Step 1 :</strong><br>Remove MariaDB 10.0/10.1/10.2/10.3/10.x<br>To upgrade Mariadb 10.11 in Centos 7/CWP do this :<br>Before installing it is recommended to backup your databases, although it is not necessary if you followed this steps carefully.</p><p>First, backup your current my.cnf config :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>cp /etc/my.cnf /etc/my.cnf.bak</code></pre><p><br>Remove MariaDB 10.0/10.1/10.2/10.3/10.xx :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>systemctl stop mariadb mysql mysqld
systemctl disable mariadb
rpm -e --nodeps $(rpm -qa | grep -i mariadb)
rpm -e --nodeps mysql-common mysql-libs mysql-devel
rpm --nodeps -ev MariaDB-server</code></pre><p><br>At this point, MariaDB 10.0/10.1/10.2/10.3.10.xx will be removed completely, but the databases are not removed, so you don’t need to worry.</p><p>Then Install MariaDB 10.11 :</p><p><strong>Step 2 :</strong><br>Installation/Updating from MariaDB 10.0/10.1/10.2/10.3/10.xx to MariaDB 10.11</p><p><br><strong>To upgrade Mariadb to 10.11 in Centos 7 CWP do this :</strong><br>Install/enable the Official repo for mariadb 10.11:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>yum install nano epel-release -y</code></pre><p><br>Now edit/create the Repo file :</p><p>Ensure you don’t have any other MariaDB repo file in /etc/yum.repos.d If it exists, delete or backup the existing repo file :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb.repo.bak
nano /etc/yum.repos.d/mariadb.repo</code></pre><p><br>Then paste these lines and save them:<br>to install Mariadb 10.11</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>[mariadb]
name = MariaDB
baseurl = https://rpm.mariadb.org/10.11/centos/$releasever/$basearch
module_hotfixes = 1
gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck = 1</code></pre><p><br>After that, we’ll install MariaDB 10.11 :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>yum clean all
yum install MariaDB-server MariaDB-client MariaDB-devel MariaDB-shared net-snmp perl-DBD-MySQL -y
yum update -y</code></pre><p><br><strong>To upgrade Mariadb 10.11 in CentOS 8 stream/AlmaLinux 8/rockylinux 8, do this :</strong></p><p>Check this reply if the upgrade is failing : <br><a rel="" href="https://www.alphagnu.com/topic/23-upgrade-mariadb-1011-in-cwp-centos-7-centos-8-stream-almalinux-78-rockylinux-78/#findComment-1302">https://www.alphagnu.com/topic/23-upgrade-mariadb-1011-in-cwp-centos-7-centos-8-stream-almalinux-78-rockylinux-78/#findComment-1302</a><br><br>Now edit/create the Repo file :</p><p>Ensure you don’t have any other MariaDB repo file in /etc/yum.repos.d If it exists, delete or backup the existing repo file :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb.repo.bak
nano /etc/yum.repos.d/mariadb.repo</code></pre><p><br>Add these lines and save them:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>[mariadb]
name = MariaDB
baseurl = https://rpm.mariadb.org/10.11/centos/$releasever/$basearch
module_hotfixes = 1
gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck = 1</code></pre><p><br>After that, update Mariadb 10.11 :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>yum clean all
yum install MariaDB-server MariaDB-client MariaDB-devel MariaDB-shared net-snmp perl-DBD-MySQL -y
yum update -y</code></pre><p><br><strong>Step 3 :</strong><br>Restore the my.cnf file :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>rm -rf /etc/my.cnf
cp /etc/my.cnf.bak /etc/my.cnf</code></pre><p><br>Then enable MariaDB to start on boot and start the service :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>systemctl enable mariadb
service mariadb start</code></pre><p><br><strong>Step 4 :</strong><br>After Installation, we need to upgrade the current databases with this command :</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>mysql_upgrade --force</code></pre><p><br>that’s it you’ve successfully upgraded MariaDB 10.0/10.1/10.2/10.3/10.xx to MariaDB 10.11.</p><p>You can confirm the version by running this command from the terminal: ssh:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>mysql -V</code></pre><p> </p>]]></description><guid isPermaLink="false">23</guid><pubDate>Fri, 02 Jun 2023 14:42:16 +0000</pubDate></item><item><title>Trying to access array offset on value of type null</title><link>https://www.alphagnu.com/topic/622-trying-to-access-array-offset-on-value-of-type-null/</link><description><![CDATA[<p>Hi,</p><p>I moved to new server 7 days ago with new Alma 9 linux. Since then had some problems which I manage to fix, and solve with email certs and policybd etc.</p><p>Have some more bugs which I noticed inside mails:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Cron &lt;root@srv1&gt; /usr/local/cwp/php71/bin/php /usr/local/cwpsrv/htdocs/resources/admin/include/alertandautorenewssl.php

PHP Notice:  Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/alertandautorenewssl.php on line 0 PHP Notice:  Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/alertandautorenewssl.php on line 0 PHP Notice:  Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/alertandautorenewssl.php on line 0</code></pre><p>Also backup script daily:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>###############################################
Daily MySQL Backup starting
###############################################

PHP Notice:  Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/cron_backup.php on line 0

Notice: Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/cron_backup.php on line 0 Database Backup: xx_yy --&gt; /backup/mysql/daily//xx_yy.sql.gz
PHP Notice:  Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/cron_backup.php on line 0

Notice: Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/cron_backup.php on line 0 Database Backup: yy_zz --&gt; /backup/mysql/daily//yy_zz.sql.gz
PHP Notice:  Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/cron_backup.php on line 0

Notice: Trying to access array offset on value of type null in /usr/local/cwpsrv/htdocs/resources/admin/include/cron_backup.php on line 0 Database Backup: sys --&gt; /backup/mysql/daily//sys.sql.gz
warning: /var/tmp/rpm-tmp.9IcRNA: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
error: Failed dependencies:
	perl(DBD::mysql) &gt;= 1.0 is needed by percona-toolkit-2.2.16-1.noarch

###############################################
Daily MySQL Backup finished
###############################################

/etc/cron.daily/cwp_acme.sh:

[Sat Feb 28 03:47:15 AM CET 2026] Already up to date!
[Sat Feb 28 03:47:15 AM CET 2026] Upgrade successful!
/etc/cron.daily/cwp_bandwidth:

sh: line 1: /usr/sbin/repquota: No such file or directory
sh: line 1: /usr/sbin/repquota: No such file or directory
sh: line 1: /usr/sbin/repquota: No such file or directory
sh: line 1: /usr/sbin/repquota: No such file or directory
sh: line 1: /usr/sbin/repquota: No such file or directory
sh: line 1: /usr/sbin/repquota: No such file or directory
sh: line 1: /usr/sbin/repquota: No such file or directory
sh: line 1: /usr/sbin/repquota: No such file or directory
/etc/cron.daily/cwp_security_audit.sh:

------------------------------------------------------
[INFO] Auditing cwpsrv (PID: 3992939)
[OK] cwpsrv looks clean.
------------------------------------------------------
[INFO] Auditing php-fpm-cwp (PID: 3336219) [SECURITY ALERT] Unauthorized port: php-fpm Error:Can't add notification!------------------------------------------------------
[INFO] Auditing apache (PID: 3993579)
[OK] apache looks clean.
------------------------------------------------------
[DONE] Security audit finished.

</code></pre><p>If someone have some ideas it would be great to hear.</p><p>Best regards</p><p></p>]]></description><guid isPermaLink="false">622</guid><pubDate>Sun, 01 Mar 2026 23:38:22 +0000</pubDate></item><item><title>Updated Dovecot 2.4 conf file</title><link>https://www.alphagnu.com/topic/623-updated-dovecot-24-conf-file/</link><description><![CDATA[<p>Doesn't anyone have an updated dovecot.conf for Dovecot 2.4 that is working correctly?</p><p>There have been changes from 2.3 -&gt; 2.4</p><p>We fix one or 2 lines, but then get another error.<br>Was wondering if anyone had it working fully?</p><p></p><p>Thanks</p>]]></description><guid isPermaLink="false">623</guid><pubDate>Tue, 03 Mar 2026 02:24:15 +0000</pubDate></item><item><title>Policyd (cbpolicyd) Failure After upgrading MariaDB on AlmaLinux 8 / 9 with CWP</title><link>https://www.alphagnu.com/topic/620-policyd-cbpolicyd-failure-after-upgrading-mariadb-on-almalinux-8-9-with-cwp/</link><description><![CDATA[<h2>This phenomenon typically occurs after a MariaDB upgrade.</h2><p>Typical log fragments in the maillog:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>warning: connect to 127.0.0.1:10031: Connection timed out
warning: problem talking to server 127.0.0.1:10031
451 4.3.5 Recipient address rejected: Server configuration problem
install_driver(mysql) failed: Can't locate DBD/mysql.pm</code></pre><p>This indicates that <strong>cbpolicyd (Cluebringer)</strong> cannot load the required Perl database driver.</p><h3>Root Cause</h3><p>Policyd relies on a Perl DBI driver to connect to its MariaDB/MySQL backend. If the <code>DBD::mysql</code> module is removed or mismatched, Policyd child processes exit with status 2, and Postfix rejects all RCPT requests due to policy service timeout.</p><h2>AlmaLinux 8 vs AlmaLinux 9 Behavior</h2><h3>AlmaLinux 8 (EL8)</h3><ul><li><p>Policyd requires:<br><code>perl-DBD-MySQL</code></p></li><li><p>The configuration remains in /etc/cbpolicyd/cbpolicyd.conf </p></li></ul><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>DSN=DBI:mysql:database=postfix_policyd;host=localhost</code></pre><p>Installing <code>perl-DBD-MySQL</code> resolves the issue.</p><hr><h3>AlmaLinux 9 (EL9)</h3><p>EL9 introduces a packaging change where installing <code>perl-DBD-MySQL</code> may attempt to pull MySQL 8 libraries that conflict with MariaDB.</p><p>Instead, install:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>dnf install perl-DBD-MariaDB</code></pre><p>Then <strong>update the Policyd configuration</strong>:</p><p>Edit:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>/etc/cbpolicyd/cbpolicyd.conf</code></pre><p>Replace:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>DSN=DBI:mysql:database=postfix_policyd;host=localhost</code></pre><p>With:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>DSN=DBI:MariaDB:database=postfix_policyd;host=localhost</code></pre><p>This forces Policyd to load the <code>DBD::MariaDB</code> driver instead of <code>DBD::mysql</code>.</p><p>After modification:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>systemctl restart cbpolicyd
systemctl restart postfix</code></pre><h2>Key Takeaway</h2><ul><li><p>EL8 → install <code>perl-DBD-MySQL</code></p></li><li><p>EL9 → install <code>perl-DBD-MariaDB</code> <strong>and change the DSN driver in </strong><code>/etc/cbpolicyd/cbpolicyd.conf</code></p></li></ul><p>Failure to update the DSN on EL9 will cause continuous Policyd crashes and complete mail flow disruption.</p><p>This distinction is critical for maintaining stable CWP mail servers after MariaDB upgrades or package maintenance.</p><p></p>]]></description><guid isPermaLink="false">620</guid><pubDate>Fri, 20 Feb 2026 16:24:27 +0000</pubDate></item><item><title>Install latest version of php 8.4 PHP switcher in CWP- Control web panel - EL8/9 AlmaLinux 8/9</title><link>https://www.alphagnu.com/topic/615-install-latest-version-of-php-84-php-switcher-in-cwp-control-web-panel-el89-almalinux-89/</link><description><![CDATA[<p>This is a tutorial for PHP 8.4 installation in CWP PHP Switcher</p><p>I've switched to direct compiler environment variables that pass flags straight to gcc, g++, and ld - eliminating pkg-config dependency that was failing across servers.</p><p>Old Method (Unstable):</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>pkg-config → generates flags → gcc/g++/ld
↓
Breaks when pkg-config .pc files missing/corrupted/version mismatch</code></pre><p>New Method (Stable):</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>CFLAGS/CXXFLAGS/LDFLAGS → gcc/g++/ld directly
↓
No pkg-config intermediary = consistent builds everywhere</code></pre><p>Install dependencies :</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code># For el9 only : 
dnf config-manager --set-enabled crb

# run these for el8 and el9
dnf groupinstall "Development Tools"
dnf install glibc-devel elfutils-libelf-devel
dnf install git make gcc gcc-c++ binutils glibc-devel autoconf libtool bison re2c automake libxml2-devel openssl-devel sqlite-devel bzip2-devel libcurl-devel libpng-devel libavif-devel libwebp-devel libjpeg-devel libXpm-devel freetype-devel gmp-devel libicu-devel openldap-devel oniguruma-devel libargon2-devel libtidy-devel libxslt-devel </code></pre><p>Build PHP 8.4 switcher :</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>rm -rf /usr/local/php-84
mkdir -p /usr/local/php-84
cd /usr/local/php-84
wget http://php.net/distributions/php-8.4.15.tar.gz
tar zxvf php-8.4.15.tar.gz
cd php-8.4.15
./configure --with-config-file-path=/usr/local/php --enable-cgi --with-config-file-scan-dir=/usr/local/php/php.d --with-zlib=/usr --enable-mbstring --with-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-curl --with-iconv --with-gmp --enable-gd --with-avif --with-jpeg --with-freetype --enable-gd-jis-conv --with-webp --with-xpm --with-openssl --with-pdo-mysql=mysqlnd --with-gettext=/usr --with-bz2=/usr --with-mysqli --enable-soap --enable-phar --with-xsl --enable-posix --enable-sockets --with-external-pcre --with-libdir=lib64 --with-mysql-sock=/var/lib/mysql/mysql.sock --enable-intl --with-password-argon2 --enable-litespeed --with-ldap=/usr --with-ldap-sasl=/usr 
export CFLAGS="-O2 -fPIE -DPIC"
export CXXFLAGS="-O2 -fPIE -DPIC"
export LDFLAGS="-pie -Wl,--as-needed"
make -j$(nproc)
make install</code></pre><p>After that, PHP 8.4 will be installed. You can check via the php -v command :</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>[root@alma]# php -v
PHP 8.4.15 (cli) (built: Dec  3 2025 01:45:34) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.15, Copyright (c) Zend Technologies</code></pre>]]></description><guid isPermaLink="false">615</guid><pubDate>Wed, 03 Dec 2025 01:48:43 +0000</pubDate></item><item><title>TLSA DNS Record</title><link>https://www.alphagnu.com/topic/617-tlsa-dns-record/</link><description><![CDATA[<p><a href="https://www.alphagnu.com/profile/1-sandeep-b/" class="ipsMention" data-mentionid="1" data-ipshover="" data-ipshover-target="https://www.alphagnu.com/profile/1-sandeep-b/?do=hovercard" rel="">@Sandeep B.</a>  or Anyone have an idea how to create a TLSA DNS record on AlmaLinux 9 with CWP?</p><p></p><p>Thanks</p>]]></description><guid isPermaLink="false">617</guid><pubDate>Wed, 21 Jan 2026 13:46:30 +0000</pubDate></item><item><title>CWP DNS Auditing, Automation for CoudFlare DNS Synchronization, and Gmail (Email) Deliverability</title><link>https://www.alphagnu.com/topic/619-cwp-dns-auditing-automation-for-coudflare-dns-synchronization-and-gmail-email-deliverability/</link><description><![CDATA[<p>Over the years I made some sloppy edits and god knows what tech support might have done DNS records. </p><p>I used Gemini's cli tools to do an audit of the DNS and email Deliverability. This saved me soooo much time and frustration. </p><p>The following is published here "<a rel="external nofollow" href="https://i-cloud.ltd/cwp-dns-manual/">https://i-cloud.ltd/cwp-dns-manual/</a>" and you can get the script and manual for this </p><p><a rel="external nofollow" href="https://i-cloud.ltd/cwp-dns-manual/manual.txt"><strong>Download Manual (TXT)</strong></a><strong> &amp; </strong><a rel="external nofollow" href="https://i-cloud.ltd/cwp-dns-manual/sync_cloudflare_dns.py"><strong>Download Sync Script (Python)</strong></a></p><p></p><p><strong>CWP DNS Auditing, Automation for CoudFlare DNS Synchronization, and Gmail (Email) Deliverability Manual</strong></p><p><strong>Authoritative Synchronization between CWP Control Web Panel and Cloudflare</strong></p><p><em>Contributor Attribution: J:Mc @ i-cloud.ltd</em></p><h2>1. Introduction</h2><p>Managing DNS records across multiple domains is one of the most critical yet error-prone tasks for a system administrator. While CentOS Web Panel (CWP) provides a robust environment for local mail and web hosting, maintaining consistency with external DNS providers like Cloudflare often requires tedious manual entry.</p><p>Small discrepancies such as a mismatched DKIM key or malformed SPF records can instantly degrade a domain's sender reputation, causing legitimate emails to be flagged as spam or rejected entirely by providers like Gmail and Outlook. This manual outlines a standardized, CLI-driven workflow to automate the synchronization of local server records with Cloudflare, ensuring 100% compliance with modern email deliverability standards.</p><h2>2. Core Purpose &amp; Strategic Value</h2><p>The primary objective of this automation is to ensure that the "local reality" of the server (the keys and IPs actually in use) is perfectly reflected in the "public reality" of the global DNS.</p><h3>Key Use Cases:</h3><ul><li><p><strong>Production Environment Drift:</strong> Over time, manual edits or CWP updates can lead to duplicate SPF records or redundant MX entries. This process identifies and prunes those errors automatically.</p></li><li><p><strong>Server Migration Scenarios:</strong> When moving domains to a new server or a new IP address, the ability to bulk-update records across dozens of zones via the CLI saves hours of manual UI work.</p></li><li><p><strong>New Server Provisioning:</strong> During initial builds, the workflow allows you to generate keys locally and "push" them to Cloudflare in seconds.</p></li><li><p><strong>Automated "Overwrite" Logic:</strong> Our CLI approach performs a true "diff," deleting stale records and updating active ones to ensure a clean, authoritative state.</p></li></ul><p><strong>Associated Files:</strong><a rel="external nofollow" href="https://i-cloud.ltd/cwp-dns-manual/manual.txt"><strong>Download Manual (TXT)</strong></a><a rel="external nofollow" href="https://i-cloud.ltd/cwp-dns-manual/sync_cloudflare_dns.py"><strong>Download Sync Script (Python)</strong></a></p><h2>3. Preliminary Configuration</h2><h3>Cloudflare API Integration</h3><p>Security is paramount. Create a scoped token in the Cloudflare Dashboard with <code>Zone - DNS - Edit</code> and <code>Zone - Zone - Read</code> permissions. Use IP filtering to restrict the token to your server's IPv4 address.</p><h3>Server-Side Preparation</h3><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code># Initialize a isolated environment
python3 -m venv venv
source venv/bin/activate

# Install required dependencies
pip install cloudflare httpx</code></pre><h2>4. Local BIND Audit &amp; Correction</h2><p>Before syncing, the local BIND zone files (<code>/var/named/*.db</code>) must be syntactically correct.</p><ul><li><p><strong>Quoting TXT Records:</strong> Ensure all TXT values, particularly DMARC and SPF, are enclosed in double quotes.</p></li><li><p><strong>SPF Optimization:</strong> Use a clean IP-based string: <code>"v=spf1 +a +mx +ip4:YOUR_SERVER_IP ~all"</code></p></li><li><p><strong>Zone Reloading:</strong> <code>sudo rndc reload domain.com</code></p></li></ul><h2>5. Executing the Synchronization</h2><p>We utilize the <code>sync_cloudflare_dns.py</code> script to perform the synchronization.</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code># 1. Export Token
export CLOUDFLARE_API_TOKEN='your_secret_token'

# 2. Validation (Dry-Run)
python3 sync_cloudflare_dns.py domain.com local_template.txt

# 3. Execution
python3 sync_cloudflare_dns.py domain.com local_template.txt --run</code></pre><h2>6. Global Deliverability Checklist</h2><ul><li><p><strong>SPF:</strong> Single, valid record including your server's IPv4.</p></li><li><p><strong>DKIM:</strong> Public key in Cloudflare must exactly match the server key.</p></li><li><p><strong>DMARC:</strong> A policy of at least <code>p=none</code>; <code>p=quarantine</code> is recommended.</p></li><li><p><strong>Network Protocol:</strong> Force mail traffic over IPv4 if IPv6 PTR is missing: <code>sudo postconf -e "inet_protocols = ipv4" &amp;&amp; sudo systemctl restart postfix</code></p></li></ul><p></p><p>I hope this is useful to you. </p>]]></description><guid isPermaLink="false">619</guid><pubDate>Sun, 01 Feb 2026 22:02:45 +0000</pubDate></item><item><title>ImageMagick install script for AlmaLinux 9.x and CWP</title><link>https://www.alphagnu.com/topic/618-imagemagick-install-script-for-almalinux-9x-and-cwp/</link><description><![CDATA[<p>There was some change in the availability of ImageMagick, so the PHP 8.4 and 8.5 installation script needed to be corrected.</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>#!/bin/bash

# Detect PHP FPM version
PHPFPM="/opt/alt/php-fpm84"
if [ ! -e "${PHPFPM}/usr/bin/php-config" ]; then
    PHPFPM="/opt/alt/php-fpm85"
fi

PHPBIN="${PHPFPM}/usr/bin/php"
PHPCONFIG="${PHPFPM}/usr/bin/php-config"
PHPINIDIR="${PHPFPM}/usr/php/php.d"

if [ ! -x "${PHPCONFIG}" ]; then
    echo "Skipping Imagick: php-config not found (${PHPCONFIG})"
    exit 0
fi

echo "Installing prerequisites..."
dnf -y install ImageMagick ImageMagick-devel ImageMagick-perl pkgconfig

cd /usr/local/src
rm -rf imagick-*

echo "Downloading imagick-3.8.1..."
wget https://pecl.php.net/get/imagick -O imagick.tgz
tar -xf imagick.tgz
cd imagick-*

echo "phpize..."
${PHPFPM}/usr/bin/phpize

echo "Configuring..."
./configure --with-php-config=${PHPCONFIG}

echo "Compiling..."
make -j"$(nproc)" &amp;&amp; make install

EXTDIR="$(${PHPCONFIG} --extension-dir)"

if [ -e "${EXTDIR}/imagick.so" ]; then
    echo "Creating imagick.ini"
    echo "extension=imagick.so" &gt; "${PHPINIDIR}/imagick.ini"
    echo "Imagick installation OK."
else
    echo "ERROR: imagick.so missing: ${EXTDIR}/imagick.so"
fi
</code></pre><p>The place of the script is:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>/usr/local/cwpsrv/htdocs/resources/conf/el9/php-fpm_selector/external_modules/8.4</code></pre><p></p>]]></description><guid isPermaLink="false">618</guid><pubDate>Wed, 21 Jan 2026 16:27:24 +0000</pubDate></item><item><title>Install latest version of php 8.5 PHP switcher in CWP- Control web panel - EL8/9 AlmaLinux 8/9</title><link>https://www.alphagnu.com/topic/616-install-latest-version-of-php-85-php-switcher-in-cwp-control-web-panel-el89-almalinux-89/</link><description><![CDATA[<p>This is a tutorial for PHP 8.5 installation in CWP PHP Switcher</p><p>I've switched to direct compiler environment variables that pass flags straight to gcc, g++, and ld - eliminating pkg-config dependency that was failing across servers.</p><p>Old Method (Unstable):</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>pkg-config → generates flags → gcc/g++/ld
↓
Breaks when pkg-config .pc files missing/corrupted/version mismatch</code></pre><p>New Method (Stable):</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>CFLAGS/CXXFLAGS/LDFLAGS → gcc/g++/ld directly
↓
No pkg-config intermediary = consistent builds everywhere</code></pre><p>Install dependencies :</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code># For el9 only : 
dnf config-manager --set-enabled crb

# run these for el8 and el9
dnf groupinstall "Development Tools"
dnf install glibc-devel elfutils-libelf-devel
dnf install git make gcc gcc-c++ binutils glibc-devel autoconf libtool bison re2c automake libxml2-devel openssl-devel sqlite-devel bzip2-devel libcurl-devel libpng-devel libavif-devel libwebp-devel libjpeg-devel libXpm-devel freetype-devel gmp-devel libicu-devel openldap-devel oniguruma-devel libargon2-devel libtidy-devel libxslt-devel </code></pre><p>Build PHP 8.5 switcher :</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>rm -rf /usr/local/php-85
mkdir -p /usr/local/php-85
cd /usr/local/php-85
wget http://php.net/distributions/php-8.5.0.tar.gz
tar zxvf php-8.5.0.tar.gz
cd php-8.5.0
./configure --with-config-file-path=/usr/local/php --enable-cgi --with-config-file-scan-dir=/usr/local/php/php.d --with-zlib=/usr --enable-mbstring --with-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-curl --with-iconv --with-gmp --enable-gd --with-avif --with-jpeg --with-freetype --enable-gd-jis-conv --with-webp --with-xpm --with-openssl --with-pdo-mysql=mysqlnd --with-gettext=/usr --with-bz2=/usr --with-mysqli --enable-soap --enable-phar --with-xsl --enable-posix --enable-sockets --with-external-pcre --with-libdir=lib64 --with-mysql-sock=/var/lib/mysql/mysql.sock --enable-intl --with-password-argon2 --enable-litespeed --with-ldap=/usr --with-ldap-sasl=/usr 
export CFLAGS="-O2 -fPIE -DPIC"
export CXXFLAGS="-O2 -fPIE -DPIC"
export LDFLAGS="-pie -Wl,--as-needed"
make -j$(nproc)
make install</code></pre><p>After that, PHP 8.5 will be installed. You can check via the php -v command :</p><pre spellcheck="" class="ipsCode language-bash" data-language="Bash"><code>[root@alma]# php -v
PHP 8.5.0 (cli) (built: Dec  3 2025 01:59:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.5.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.0, Copyright (c), by Zend Technologies</code></pre>]]></description><guid isPermaLink="false">616</guid><pubDate>Wed, 03 Dec 2025 02:01:01 +0000</pubDate></item><item><title>Manual update of PHP in CWP</title><link>https://www.alphagnu.com/topic/605-manual-update-of-php-in-cwp/</link><description><![CDATA[<p><a href="https://www.alphagnu.com/profile/1-sandeep-b/" class="ipsMention" data-mentionid="1" data-ipshover="" data-ipshover-target="https://www.alphagnu.com/profile/1-sandeep-b/?&amp;do=hovercard" rel="">@Sandeep B.</a> </p><p>Since CWP is now 2 versions behind the current versions, was wondering if you could post how to manually update PHP and PHP-FPM?</p><p>Along with the options for ionCube, LDAP, and mailparse.</p><p></p><p>Thanks</p>]]></description><guid isPermaLink="false">605</guid><pubDate>Fri, 25 Jul 2025 18:04:37 +0000</pubDate></item><item><title>Time to fully integrate the New Backup Beta</title><link>https://www.alphagnu.com/topic/595-time-to-fully-integrate-the-new-backup-beta/</link><description><![CDATA[<p>Hi Sandeep</p><p>As I found out a long time ago, the New Backup Beta in CWP works so much better than the standard backup which is completely obsolete now.</p><p>So time to integrate it fully into the MMI in the main page and drop the currently linked standard backup completely.</p><p>Also a kind of persistent annoyance when the MMI says backup is switched off even when the new backup beta is enabled and running. There have been numerous events now when I switched it on occasionally and only having two backups running in paralell and eating up my disk space quickly.</p><p>I think there is no one out there who still uses the standad backup anymore when the new backup beta runs flawlessly since years. Sure this is for beaty right now but we should keep CWP in a deflated and disk efficient status, and for you this would be a nobrainer to be integrated in less than 5 minutes I guess.</p><p>Keep it up man</p><p></p>]]></description><guid isPermaLink="false">595</guid><pubDate>Sun, 16 Mar 2025 08:09:40 +0000</pubDate></item><item><title>CSF replacements needs</title><link>https://www.alphagnu.com/topic/607-csf-replacements-needs/</link><description><![CDATA[<p>The CSF project is abandoned, and newly installed CWP Pro already has several issues during installation. <br>Here is the topic: <a rel="external nofollow" href="https://www.jaspreet.net/2025/09/06/3180/how-to-fix-csf-firewall-error-oops-unable-to-download-no-host-option-provided/">https://www.jaspreet.net/2025/09/06/3180/how-to-fix-csf-firewall-error-oops-unable-to-download-no-host-option-provided/</a></p><p><a href="https://www.alphagnu.com/profile/1-sandeep-b/" class="ipsMention" data-mentionid="1" data-ipshover="" data-ipshover-target="https://www.alphagnu.com/profile/1-sandeep-b/?&amp;do=hovercard" rel="">@Sandeep B.</a> Do you have any idea how to replace CSF in CWP Pro servers?</p>]]></description><guid isPermaLink="false">607</guid><pubDate>Wed, 01 Oct 2025 17:43:05 +0000</pubDate></item><item><title>about jailkit</title><link>https://www.alphagnu.com/topic/608-about-jailkit/</link><description><![CDATA[<p>Hello. I wonder if the jailkit can be used instead of cagefs?</p>]]></description><guid isPermaLink="false">608</guid><pubDate>Wed, 01 Oct 2025 18:03:22 +0000</pubDate></item><item><title>Reseller customer disk space problem.</title><link>https://www.alphagnu.com/topic/606-reseller-customer-disk-space-problem/</link><description><![CDATA[<p><span style='font-family: "Arial", "Helvetica", sans-serif'>I can't see the total disk size of my reseller customer and all its customers. Is there a solution for this?</span></p>]]></description><guid isPermaLink="false">606</guid><pubDate>Mon, 01 Sep 2025 10:03:08 +0000</pubDate></item><item><title>httpd wont start after mod security install</title><link>https://www.alphagnu.com/topic/498-httpd-wont-start-after-mod-security-install/</link><description><![CDATA[<p>
	after mod security install httpd will not start
</p>

<p>
	httpd: Syntax error on line 516 of /usr/local/apache/conf/httpd.conf: Syntax error on line 2 of /usr/local/apache/conf.d/mod_security.conf: Cannot load /usr/lib64/ into server: /usr/lib64/: cannot read file data: Is a directory
</p>

<p>
	here are the lines<br />
	line 2 of mod_security.conf: LoadFile /usr/lib64/<br />
	line 516 of httpd.conf: Include /usr/local/apache/conf.d/*.conf<br />
	 
</p>
]]></description><guid isPermaLink="false">498</guid><pubDate>Fri, 05 Apr 2024 16:35:43 +0000</pubDate></item><item><title>Issue with CWP &#x2013; File Permission Problems</title><link>https://www.alphagnu.com/topic/604-issue-with-cwp-file-permission-problems/</link><description><![CDATA[<p>Dear Sandeep B.,<br>I hope this message finds you well.</p><p>I would like to check if there are any updates regarding the issue we are experiencing with CWP. We are currently facing problems with file permissions: the File Manager does not allow us to modify or delete files, and the same happens when attempting to do so via FTP.</p><p>I would appreciate any information or updates you can provide on this matter.</p><p>Looking forward to your response.<br>Best regards,<br><br>Thank</p>]]></description><guid isPermaLink="false">604</guid><pubDate>Thu, 17 Jul 2025 21:38:35 +0000</pubDate></item><item><title>Update CWP RoundCube Mail Version 1.5.8 &#x2013; Control Web Panel</title><link>https://www.alphagnu.com/topic/33-update-cwp-roundcube-mail-version-158-%E2%80%93-control-web-panel/</link><description><![CDATA[<p>
	Update Roundcube on CWP, the new Version of Roundcube 1.5 LTS have clear Interface with modern look also in this version some major security holes were fixed. It is recommended to update the roundcube to latest version.
</p>

<p>
	<strong>Step1</strong><br />
	Install Required php extension INTL in CWP :-
</p>

<p>
	<strong>Centos 7/EL7 :</strong>
</p>

<p>
	To install INTL :
</p>

<pre class="ipsCode">yum update ca-certificates -y
rpm -ivh https://github.com/mysterydata/md-disk/raw/main/libicu69-69.1-4.el7.x86_64.rpm
curl -s -L https://www.alphagnu.com/upload/tmp/cwp_rc_fix.sh | bash</pre>

<p>
	<br />
	To remove INTL :
</p>

<pre class="ipsCode">curl -s -L https://www.alphagnu.com/upload/tmp/cwp_rc_fix_remove.sh | bash</pre>

<p>
	<br />
	<strong>Centos 8 stream/EL8 :</strong>
</p>

<p>
	To install INTL :
</p>

<pre class="ipsCode">dnf update ca-certificates -y
rpm -ivh https://github.com/mysterydata/md-disk/raw/main/libicu69-69.1-4.el8.x86_64.rpm
curl -s -L https://www.alphagnu.com/upload/tmp/el8/cwp_rc_fix_el8.sh | bash</pre>

<p>
	<br />
	To remove INTL :
</p>

<pre class="ipsCode">curl -s -L https://www.alphagnu.com/upload/tmp/cwp_rc_fix_remove.sh | bash</pre>

<p>
	<br />
	<strong>Step 2</strong><br />
	Download roundcube script from official source :
</p>

<pre class="ipsCode">cd /usr/local/src
rm -rf roundcube*
wget https://github.com/roundcube/roundcubemail/releases/download/1.5.8/roundcubemail-1.5.8-complete.tar.gz</pre>

<p>
	<br />
	Now extract the archive file :
</p>

<pre class="ipsCode">tar xf roundcubemail-1.5.8-complete.tar.gz</pre>

<p>
	<br />
	<strong>Step 3</strong><br />
	Update the Roundcube installation :
</p>

<pre class="ipsCode">cd  roundcubemail-1.5.8
sed -i "s@\/usr\/bin\/env php@\/usr\/bin\/env \/usr\/local\/cwp\/php71\/bin\/php@g" /usr/local/src/roundcubemail-1.5.8/bin/installto.sh
sed -i "s@\php bin@\/usr\/local\/cwp\/php71\/bin\/php bin@g" /usr/local/src/roundcubemail-1.5.8/bin/installto.sh
bin/installto.sh /usr/local/cwpsrv/var/services/roundcube</pre>

<p>
	<br />
	Installation Instructions :
</p>

<pre class="ipsCode">Upgrading from 1.4.11. Do you want to continue? (y/N)
type : y and hit enter </pre>

<p>
	<br />
	At last you’ll see this message upon installation complete :
</p>

<pre class="ipsCode">Running update script at target...
Executing database schema update.
Updating database schema (2020020100)... [OK]
Updating database schema (2020020101)... [OK]
Updating database schema (2020091000)... [OK]
Updating database schema (2020122900)... [OK]
This instance of Roundcube is up-to-date.
Have fun!
All done.</pre>

<p>
	<br />
	All done check by login into roundcube
</p>
]]></description><guid isPermaLink="false">33</guid><pubDate>Sun, 04 Jun 2023 13:29:25 +0000</pubDate></item><item><title>How to enable TLS 1.3 in CWP Nginx reverse proxy</title><link>https://www.alphagnu.com/topic/47-how-to-enable-tls-13-in-cwp-nginx-reverse-proxy/</link><description><![CDATA[<p>
	In this tutorial we’ll Build NGINX from source and enable TLS 1.3 in Linux server. TLS 1.3 is secure and fast TLS protocol till now it have its own benefits like security and performance, the website using TLS 1.3 loads faster and is more secure.
</p>

<p>
	Transportation Layer Security (TLS) 1.3 protocol provides unparalleled privacy and performance compared to previous versions of TLS and non-secure HTTP. Performance has a major impact on user experience. TLS 1.3 represents a pivotal turning point for HTTPS performance. Modern mobile networks will routinely add over 100ms of latency to each request. TLS 1.3 makes page load times significantly faster for mobile devices, improving the user experience for your visitors.
</p>

<p>
	To build Nginx from source we need to remove any nginx installed from other sources like from official repository or from 3rdpart repository.
</p>

<p>
	Step 1 :
</p>

<p>
	First backup current nginx dir which contains configurations and vhosts :
</p>

<pre class="ipsCode">cp -r /etc/nginx /etc/nginx.bak</pre>

<p>
	<br />
	Step 2 :
</p>

<p>
	Remove Nginx :
</p>

<pre class="ipsCode">yum remove nginx*</pre>

<p>
	<br />
	Step 3 :
</p>

<p>
	Downloading dependencies and openssl :
</p>

<p>
	Install deps from yum /centos7/8/el7/8 :
</p>

<pre class="ipsCode">yum install -y perl perl-devel perl-ExtUtils-Embed libxslt libxslt-devel libxml2 libxml2-devel gd gd-devel GeoIP GeoIP-devel perl-IPC-Cmd</pre>

<p>
	<br />
	PCRE download :
</p>

<pre class="ipsCode">cd /usr/local/src
rm -rf pcre*
wget https://github.com/mysterydata/md-disk/raw/main/pcre-8.45.zip
unzip pcre-8.45.zip</pre>

<p>
	<br />
	ZLIB download :
</p>

<pre class="ipsCode">cd /usr/local/src
rm -rf zlib*
wget https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -O zlib.tar.gz
tar zxvf zlib.tar.gz
rm -rf zlib.tar.gz
mv zlib-* zlib</pre>

<p>
	<br />
	Download openssl 3.0 :
</p>

<pre class="ipsCode">cd /usr/local/src
rm -rf openssl*
wget https://www.openssl.org/source/openssl-3.0.12.tar.gz -O openssl.tar.gz
tar -xf openssl.tar.gz
rm -rf openssl.tar.gz
mv openssl-* openssl</pre>

<p>
	<br />
	Step 3 :
</p>

<p>
	Building Nginx from source :
</p>

<pre class="ipsCode">cd /usr/local/src
rm -rf nginx*
wget http://nginx.org/download/nginx-1.24.0.tar.gz
tar zxvf nginx-1.24.0.tar.gz
cd nginx-1.24.0
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --build=CentOS --builddir=nginx-custom --with-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=dynamic --with-stream_ssl_preread_module --with-compat --with-pcre=/usr/local/src/pcre-8.45 --with-pcre-jit --with-zlib=/usr/local/src/zlib --with-openssl=/usr/local/src/openssl  --with-openssl-opt=no-nextprotoneg --with-debug  
make &amp;&amp; make install</pre>

<p>
	<br />
	Step 4 :
</p>

<p>
	Now copy the config from the backup done before :
</p>

<pre class="ipsCode">cat /etc/nginx.bak/nginx.conf &gt; /etc/nginx/nginx.conf</pre>

<p>
	<br />
	Step 5 :
</p>

<p>
	Creating systemed service file for nginx and disable nginx to install via yum package manager :
</p>

<p>
	now create the systemed service file for nginx :
</p>

<pre class="ipsCode">nano /usr/lib/systemd/system/nginx.service</pre>

<p>
	<br />
	and paste this to it and save :
</p>

<pre class="ipsCode">[Unit]
Description=nginx - high performance web server
Documentation=https://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install]
WantedBy=multi-user.target</pre>

<p>
	<br />
	Disable nginx in yum/dnf package manager for not to override your compiled nginx [important] :
</p>

<p>
	Centos 7/el7 :
</p>

<pre class="ipsCode">cat /etc/yum.conf |grep "^exclude="|grep nginx 1&gt; /dev/null 2&gt; /dev/null || echo 'exclude=nginx*' &gt;&gt; /etc/yum.conf </pre>

<p>
	<br />
	Centos 8/el8 :
</p>

<pre class="ipsCode">cat /etc/dnf/dnf.conf |grep "^exclude="|grep nginx 1&gt; /dev/null 2&gt; /dev/null || echo 'exclude=nginx*' &gt;&gt; /etc/dnf/dnf.conf </pre>

<p>
	<br />
	Step 6 :
</p>

<p>
	Enabling TLSv1.3 in nginx :
</p>

<p>
	Now we’ll add TLS 1.3 entry in all nginx vhost and in nginx.conf
</p>

<pre class="ipsCode">sed -i 's/TLSv1.2;/TLSv1.2 TLSv1.3;/g' /etc/nginx/nginx.conf /etc/nginx/conf.d/*.conf /etc/nginx/conf.d/vhosts/*.conf /usr/local/cwpsrv/htdocs/resources/conf/web_servers/main/nginx/conf/nginx.conf
systemctl restart nginx
systemctl enable nginx</pre>

<p>
	<br />
	** in CWP you need to do some extra steps which is mentioned below in Step
</p>

<p>
	If you’re not using CWP then you’re done configuring TLS 1.3
</p>

<p>
	Step 7 :
</p>

<p>
	Ensure you create proper template for nginx in CWP else on every webserver build or ssl renew TLS 1.3 will be disabled
</p>

<p>
	you need to copy the existing templates (tpl and stpl) and edit the stpl file and replace this line with new one :
</p>

<pre class="ipsCode">ssl_protocols TLSv1 TLSv1.1 TLSv1.2;</pre>

<p>
	<br />
	with
</p>

<pre class="ipsCode">ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;</pre>

<p>
	<br />
	that is only TLSv1.3 is need to be added before Semicolons ;
</p>

<p>
	for example if you’re using default template for website you need to copy default templates to custom name example default-tls13.tpl and default-tls13.stpl ensure you’re using this template as a default for all domains and sub domain else tls 1.3 will not work by going to CWP.admin &gt;&gt; Webserver settings &gt;&gt; WEbservers Main conf choose Nginx default Vhost template from drop down menu which you created via below commands (default-tls13/force-https-http2-tls13). If you’re using php-fpm + nginx do the same for Nginx default PHP-FPM template
</p>

<p>
	to copy the template to custom name do this :
</p>

<pre class="ipsCode">cd /usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/nginx
cp -r default.stpl default-tls13.stpl
cp -r default.tpl default-tls13.tpl
sed -i 's/TLSv1.2;/TLSv1.2 TLSv1.3;/g' default-tls13.tpl default-tls13.stpl</pre>

<p>
	<br />
	** you can replace the “default” with the template name like for http2 “force-https-http2” template eg :
</p>

<pre class="ipsCode">cd /usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/nginx
cp -r force-https-http2.stpl force-https-http2-tls13.stpl
cp -r force-https-http2.tpl force-https-http2-tls13.tpl
sed -i 's/TLSv1.2;/TLSv1.2 TLSv1.3;/g' force-https-http2-tls13.tpl force-https-http2-tls13.stpl</pre>

<p>
	<br />
	*** if you’re using nginx + fpm go to “/usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/nginx/php-fpm” dir and do the same for it too as above.
</p>

<p>
	After running the above command lock this files if you don’t change nginx main config and Hostname of the server :
</p>

<pre class="ipsCode">chattr +i /etc/nginx/conf.d/hostname-ssl.conf /etc/nginx/nginx.conf</pre>

<p>
	<br />
	If you want to change nginx main conf or change the server hostname just unlock this files and then rebuild webserver config or vhost :
</p>

<pre class="ipsCode">chattr -i /etc/nginx/conf.d/hostname-ssl.conf /etc/nginx/nginx.conf</pre>

<p>
	<br />
	***after edit and webserver rebuild or vhost rebuild just lock the files again.
</p>
]]></description><guid isPermaLink="false">47</guid><pubDate>Tue, 20 Jun 2023 14:57:15 +0000</pubDate></item><item><title>Email forwarding - SPAM mails</title><link>https://www.alphagnu.com/topic/602-email-forwarding-spam-mails/</link><description><![CDATA[<p>My users have setup many email forwards</p><p>The SPAM emails also get forwarded</p><p>Due to this, email providers like microsoft / gmail are rate limiting emails from my servers and also blacklisting the IP</p><p></p><p>How to stop my server forwarding SPAM</p><p>I have enabled </p><div class="ipsRichText__table-wrapper"><table style="min-width: 40px"><colgroup><col style="min-width:20px;"><col style="min-width:20px;"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p><br></p></td><td colspan="1" rowspan="1"><p>ClamAV, Amavis &amp; Spamassassin</p></td></tr></tbody></table></div><p></p><p></p>]]></description><guid isPermaLink="false">602</guid><pubDate>Wed, 21 May 2025 07:14:25 +0000</pubDate></item><item><title>Enable Brotli Compression on Nginx, CWP and on Linux OS for official nginx</title><link>https://www.alphagnu.com/topic/10-enable-brotli-compression-on-nginx-cwp-and-on-linux-os-for-official-nginx/</link><description><![CDATA[<p>
	Brotli for web-server is the new modern compression module that is better than gzip/deflate, Also it is more secure since brotli only runs on HTTPS protocol.
</p>

<p>
	Just like gzip, Brotli is a lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling, with a compression ratio comparable to the best currently available general-purpose compression methods. It is similar in speed with deflate/gzip but offers more best compression.
</p>

<p>
	Gzip vs Brotli:<br />
	The advantage for Brotli over gzip is that it makes use of a dictionary and thus it only needs to send keys instead of full keywords.
</p>

<ol>
	<li>
		Javascript files compressed with Brotli are 14-16% smaller than gzip.
	</li>
	<li>
		HTML files are 21-25% smaller than gzip.
	</li>
	<li>
		CSS files are 17-20% smaller than gzip.
	</li>
</ol>

<p>
	Lets Get started with the integration :
</p>

<p>
	<strong>Step 1 :</strong><br />
	Ensure Nginx web server is already installed on your server and install brotli
</p>

<p>
	ensure nginx is installed via official nginx repo check the guide here to install nginx from official repo: CLICK HERE
</p>

<p>
	Installing Brotli on your server:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">yum install pcre-devel cmake -y
cd /usr/local/src
git clone https://github.com/google/brotli.git
cd brotli
git checkout v1.0
./configure-cmake
make &amp;&amp; make install</span></pre>

<p>
	<br />
	Adding path for brotli dependencies files (run this commands one by one):
</p>

<pre class="ipsCode">grep "/usr/local/lib/" /etc/ld.so.conf || echo "/usr/local/lib/" &gt;&gt; /etc/ld.so.conf
ldconfig</pre>

<p>
	<br />
	<strong>Step 2 :</strong><br />
	Download This Nginx Static Brotli module 64bit :
</p>

<p>
	If you’re using mainline version of nginx please move to stable version of nginx in order to use this module
</p>

<p>
	<span style="color:#c0392b;"><strong>Updated on :  17th April, 2023</strong></span><br />
	For Stable Nginx 1.24.0 Brotli Module (tested on CWP| Custom env)
</p>

<pre class="ipsCode">cd /usr/lib64/nginx
mkdir modules #skip if folder exists
cd modules
rm -rf ngx_http_brotli*
wget --no-cache https://www.alphagnu.com/upload/nginx-brotli-modules.zip
unzip nginx-brotli-modules.zip
rm -rf nginx-brotli-modules.zip</pre>

<p>
	or
</p>

<pre class="ipsCode">cd /etc/nginx/modules
rm -rf ngx_http_brotli*
wget --no-cache https://www.alphagnu.com/upload/nginx-brotli-modules.zip
unzip nginx-brotli-modules.zip
rm -rf nginx-brotli-modules.zip </pre>

<p>
	<br />
	<strong>How to update this module?</strong><br />
	just follow the upper step and then update nginx (don’t update nginx before)
</p>

<p>
	<strong>Step 3 :</strong><br />
	Now add nginx module configuration on “nginx.conf” :<br />
	nginx.conf can be default found in the dir : /etc/nginx
</p>

<p>
	edit /etc/nginx/nginx.conf
</p>

<pre class="ipsCode">nano /etc/nginx/nginx.conf</pre>

<p>
	<br />
	then add this lines to top of the config line i.e. on first line :
</p>

<pre class="ipsCode">load_module "modules/ngx_http_brotli_filter_module.so";
load_module "modules/ngx_http_brotli_static_module.so";</pre>

<p>
	<br />
	Now we need to add brotli compression configuration in nginx.conf file under/in http {section and before http closing }:
</p>

<pre class="ipsCode"># Compression brotli
    brotli              on;
    brotli_comp_level   6;
    brotli_static       on;
    brotli_types        text/xml image/svg+xml application/x-font-ttf image/vnd.microsoft.icon application/x-font-opentype application/json font/eot application/vnd.ms-fontobject application/javascript font/otf application/xml application/xhtml+xml text/javascript  application/x-javascript text/plain application/x-font-truetype application/xml+rss image/x-icon font/opentype text/css image/x-win-bitmap;</pre>

<p>
	<br />
	Example config placement in nginx.conf :
</p>

<pre class="ipsCode">load_module "modules/ngx_http_brotli_filter_module.so";
load_module "modules/ngx_http_brotli_static_module.so";
user nobody;
worker_processes auto;
#worker_rlimit_nofile    65535;
error_log               /var/log/nginx/error.log crit;
pid                     /var/run/nginx.pid;

events {
    worker_connections  1024;
    use                 epoll;
    multi_accept        on;

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    client_header_timeout 3m;
    client_body_timeout 3m;
    client_max_body_size 256m;
    client_header_buffer_size 4k;
    client_body_buffer_size 256k;
    large_client_header_buffers 4 32k;
    send_timeout 3m;
    keepalive_timeout 60 60;
    reset_timedout_connection       on;
    server_names_hash_max_size 1024;
    server_names_hash_bucket_size 1024;
    ignore_invalid_headers on;
    connection_pool_size 256;
    request_pool_size 4k;
    output_buffers 4 32k;
    postpone_output 1460;

    include mime.types;
    default_type application/octet-stream;


# Compression brotli 
    brotli              on;
    brotli_comp_level   6;
    brotli_static       on;
    brotli_types        text/xml image/svg+xml application/x-font-ttf image/vnd.microsoft.icon application/x-font-opentype application/json font/eot application/vnd.ms-fontobject application/javascript font/otf application/xml application/xhtml+xml text/javascript  application/x-javascript text/plain application/x-font-truetype application/xml+rss image/x-icon font/opentype text/css image/x-win-bitmap;


# Compression gzip
    gzip on;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";
    gzip_proxied any;
    gzip_min_length 512;
    gzip_comp_level 6;
    gzip_buffers 8 64k;
    gzip_types text/plain text/xml text/css text/js application/x-javascript application/xml image/png image/x-icon image/gif image/jpeg image/svg+xml application/xml+rss text/javascript application/atom+xml application/javascript application/json application/x-font-ttf font/opentype;

}</pre>

<p>
	<br />
	You can adjust compression level for brotli to 0-11 “brotli_comp_level” eg. “brotli_comp_level  11” i’ll suggest to use value 6
</p>

<p>
	save the file and restart nginx :
</p>

<p>
	Restart nginx Service :
</p>

<p>
	Before restarting check the nginx config is correct :
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">nginx -t</span></pre>

<p>
	<br />
	if it outputs successful proceed with restart
</p>

<pre class="ipsCode">service nginx restart
or
systemctl restart nginx</pre>

<p>
	<br />
	Congratulation you’ve enabled brotli for nginx, here is how you can check it :
</p>

<p>
	<strong>Step 4 :</strong><br />
	Go to this site for the checks : <a href="https://tools.keycdn.com/brotli-test" rel="external nofollow">https://tools.keycdn.com/brotli-test</a>
</p>

<p>
	or via command line <span>: </span>
</p>

<p>
	For advanced user you can check content-encoding via http header :
</p>

<pre class="ipsCode">HTTP/2.0 200 OK
server: nginx
date: Wed, 15 May 2019 07:13:07 GMT
content-type: text/html; charset=UTF-8
x-powered-by: PHP/7.3.5
vary: Accept-Encoding, Cookie
cache-control: max-age=3, must-revalidate
strict-transport-security: max-age=31536000; includeSubDomains; preload
content-encoding: br   
X-Firefox-Spdy: h2</pre>

<p>
	 
</p>
]]></description><guid isPermaLink="false">10</guid><pubDate>Fri, 02 Jun 2023 13:50:23 +0000</pubDate></item></channel></rss>
