This guide covers keeping a running CloudSOE FreePBX 17 instance patched on AWS or Azure: PHP, the Debian 12 operating system, FreePBX modules and Asterisk, and (for the changes that shouldn’t be made in place) moving to a fresh instance of the latest image.

It matters right now. PHP2Shell, a critical remote code execution flaw in PHP, is being exploited in the wild, and the FreePBX web UI runs on PHP. If you only do one thing today, do the PHP section.

What you can upgrade in place

ComponentIn place?How
Operating system (Debian 12 security and point updates)Yesapt (see Update the operating system)
Debian 12 → Debian 13NoFreePBX 17 supports Debian 12 only, so use a fresh image
PHP 8.2YesDebian’s php8.2 packages (see Patch PHP)
FreePBX 17 modulesYesAdmin → Module Admin or fwconsole ma upgradeall
FreePBX major versionNoUse a fresh image
Asterisk (within its major version)Yesapt (Sangoma’s packages)
Asterisk major versionNot recommendedUse a fresh image
MariaDB, Apache, fail2banYesapt, from Debian’s repositories

Before you start: back up

Take two backups: a disk snapshot (fast rollback for the whole machine) and a FreePBX backup (portable, restores onto a new instance).

Disk snapshot:

  • AWS: EC2 console → Elastic Block Store → Volumes → select the instance’s root volume → Actions → Create snapshot.
  • Azure: open the VM → Disks → select the OS disk → Create snapshot.

Or from the CLI:

# AWS
aws ec2 create-snapshot --volume-id vol-xxxxxxxx --description "freepbx-01 before patching"

# Azure
az snapshot create --resource-group my-rg --name freepbx-01-pre-patch \
  --source "$(az vm show -g my-rg -n freepbx-01 --query storageProfile.osDisk.managedDisk.id -o tsv)"

FreePBX backup: in the web UI, open Admin → Backup & Restore, create (or reuse) a backup job that includes all modules, and run it. From the shell:

sudo fwconsole backup --backup=<backup-id>

Download the backup file off the instance (the job’s storage location is shown under Admin → Backup & Restore; local backups go under /var/spool/asterisk/backup/ by default) and keep it somewhere safe.

Schedule a maintenance window outside calling hours. Restarting Asterisk, which several steps below do, drops every active call.

Patch PHP (PHP2Shell)

PHP2Shell (CVE-2026-109618 and CVE-2026-109619, published 21 October 2026) is a critical remote code execution vulnerability affecting PHP 5.4 to 8.5, and it is being exploited in the wild. Updating PHP is the only complete fix: keeping port 80 restricted to your admin IPs reduces exposure but doesn’t remove the flaw.

On this image, PHP comes from Debian 12’s own php8.2 packages (Sangoma’s FreePBX repository doesn’t ship PHP), and Apache runs it as mod_php (there is no php-fpm service). The patched Debian package is 8.2.35-1~deb12u1 or later.

Check what you have:

php -v
dpkg -l | grep -E '^ii +php[0-9.]+-(cli|common) '
dpkg -l | grep -E '^ii +libapache2-mod-php'

If the version column shows anything older than 8.2.35-1~deb12u1, update all installed PHP 8.2 packages:

sudo apt update
sudo apt install --only-upgrade $(dpkg -l 'php8.2*' 'libapache2-mod-php8.2' 2>/dev/null | awk '/^ii/{print $2}')

Restart Apache so the web UI loads the new PHP, then restart FreePBX so its background PHP processes pick it up too (this restarts Asterisk and drops calls):

sudo systemctl restart apache2
sudo fwconsole restart

Confirm:

php -v                      # PHP 8.2.35 or later
dpkg -l | grep -E '^ii +(php8\.2-(cli|common)|libapache2-mod-php8\.2) '
systemctl status apache2 --no-pager

All three packages should show 8.2.35-1~deb12u1 (or newer). If php -v reports a different PHP line because you added another repository yourself (for example packages.sury.org), the upstream fixed releases are 8.2.35, 8.3.36, 8.4.27 and 8.5.12, so update from that repository instead. FreePBX 17 itself expects PHP 8.2.

Update the operating system

OS updates come from Debian’s repositories; Sangoma’s FreePBX repository (deb.freepbx.org) supplies Asterisk and FreePBX packages alongside them.

sudo apt update
sudo apt upgrade

When prompted about a changed configuration file, keep your installed version (the default answer, N) unless you know you want the maintainer’s.

Then check whether a reboot is needed (typically after a kernel or core library update) and reboot in your maintenance window:

[ -f /var/run/reboot-required ] && echo "Reboot required" || echo "No reboot needed"
sudo reboot

Packages that are held back (by design)

Sangoma’s installer holds some packages, so apt upgrade lists them as “kept back”. Leave them that way:

apt-mark showhold
  • freepbx17, sangoma-pbx17, nodejs and node-* are held on purpose. FreePBX itself is updated through Module Admin (next section), not by apt.
  • Kernel packages may also appear here. On every apt update, FreePBX’s kernel-check hook holds kernels newer than the version Sangoma’s DAHDI drivers support, and releases them once support catches up. This is expected FreePBX behaviour.

Automatic updates

To see whether unattended upgrades are active on your instance:

systemctl status unattended-upgrades --no-pager
cat /etc/apt/apt.conf.d/20auto-upgrades 2>/dev/null

Whether or not they are, run the manual update above on a regular schedule, and always after a security advisory like PHP2Shell.

Don’t attempt a Debian 12 → 13 upgrade. FreePBX 17 supports Debian 12 only. When a newer base is supported, move to a fresh image.

Upgrade FreePBX and Asterisk

FreePBX modules

FreePBX is upgraded module by module. In the web UI, open Admin → Module Admin → Check Online, then Upgrade all, and click Apply Config when done. From the shell:

sudo fwconsole ma refreshsignatures
sudo fwconsole ma showupgrades     # what's available
sudo fwconsole ma upgradeall
sudo fwconsole chown
sudo fwconsole reload

Module upgrades need outbound internet access from the instance. Upgrade the framework and core modules in a maintenance window. Some upgrades restart services.

Asterisk

Asterisk on this image comes from Sangoma’s repository as asterisk22 packages (check with asterisk -rx "core show version"). Patch releases within the same major version arrive through the normal OS update:

sudo apt update
sudo apt upgrade
sudo fwconsole restart

Moving Asterisk to a different major version (Sangoma ships an asterisk-version-switch tool for this) is a bigger change that touches every module FreePBX generates config for. We recommend a fresh image instead. If you do use the tool, take a snapshot first and follow Sangoma’s documentation.

FreePBX major versions

There is no supported in-place upgrade between FreePBX major versions on this image. Launch a fresh instance of the newer CloudSOE image and restore your backup, as described next.

Move to a fresh CloudSOE image

A fresh instance gives you the newest OS, PHP, FreePBX and Asterisk at once, with no leftover state. FreePBX’s Backup & Restore module is designed for exactly this.

1. Back up the old instance

Run a full backup under Admin → Backup & Restore (or sudo fwconsole backup --backup=<backup-id>), then copy the backup file to your own machine:

scp debian@<old-ip>:/var/spool/asterisk/backup/<backup-name>/<backup-file>.tar.gz .

Adjust the path to where your backup job stores its files (shown in the Backup & Restore module). On Azure, use the admin username you chose at deployment instead of debian. If scp is refused for permissions, copy the file to your home directory with sudo cp and sudo chown $(whoami) it first.

2. Launch the latest image

Follow the getting-started guide for your cloud (AWS, Azure): use the same security group / NSG rules, and create the admin account immediately on the first visit to the web UI. The restore may replace it with the admin account from your backup.

3. Restore

Copy the backup to the new instance:

scp <backup-file>.tar.gz debian@<new-ip>:/tmp/

In the new instance’s web UI, open Admin → Backup & Restore → Restore, upload the file (or point it at /tmp/<backup-file>.tar.gz) and run the restore. From the shell:

sudo fwconsole backup --restore=/tmp/<backup-file>.tar.gz
sudo fwconsole chown
sudo fwconsole reload

If you bought commercial modules, the activation is tied to the old machine. Move the deployment to the new one through your Sangoma portal account before you retire the old instance.

4. Update everything that embeds the IP address

The restore brings back the old instance’s settings, including its public IP. Easiest is to move the public IP itself:

  • AWS: disassociate the Elastic IP from the old instance and associate it with the new one.
  • Azure: dissociate the static public IP from the old VM’s network interface and associate it with the new VM’s.

Then nothing outside needs to change. If the address does change:

  • Settings → Asterisk SIP Settings: set External Address to the new public IP, check Local Networks matches your VPC/VNet, Submit and Apply Config.
  • Your SIP trunk provider: update the IP allow-list or registration/authentication settings at the carrier.
  • Phones and softphones: point them at the new address (or update the DNS name they use).
  • Firewall rules: update any security group / NSG rules elsewhere that reference the old IP.

5. Re-register phones and test

Reboot or re-provision the phones, then check from the Asterisk console that they registered and that your trunk is up:

sudo asterisk -rx "pjsip show endpoints"
sudo asterisk -rx "pjsip show registrations"

Make test calls in both directions (internal, outbound via the trunk and inbound to a DID) and confirm two-way audio. One-way audio after a move almost always means a wrong External Address or a closed RTP range (see tips & tricks).

6. Retire the old instance

Once the new instance has handled real traffic for a few days, stop and then terminate (AWS) or delete (Azure) the old one, and delete the snapshots and disks you no longer need so they stop costing money.

Check everything works

After any upgrade, run through these checks:

sudo fwconsole ma list | head -20                 # modules installed and enabled
sudo asterisk -rx "core show version"             # Asterisk is up
sudo asterisk -rx "pjsip show endpoints"          # phones registered
sudo asterisk -rx "pjsip show registrations"      # trunk registered
php -v                                            # PHP 8.2.35 or later
systemctl status apache2 mariadb fail2ban --no-pager

Then log in to the web UI, confirm there’s no red Apply Config banner left over, and place a test call through your trunk.

Next steps

  • Configure FreePBX: file locations, NAT settings, RTP ports and services
  • Tips & tricks: the deferred ffmpeg install, backups, one-way audio and troubleshooting