This guide covers keeping a CloudSOE Squid proxy patched on both AWS and Azure: operating-system updates, Squid itself, and moving your configuration to a fresh CloudSOE image. The image runs on Ubuntu 26.04 LTS and doesn’t include PHP, so PHP2Shell doesn’t apply.

Squid on this image is Ubuntu’s own squid package, so it’s patched with the rest of the OS.

What you can upgrade in place

ComponentIn place?How
Operating system (Ubuntu 26.04 LTS)Yesapt; see Update the operating system
Squid (Ubuntu squid package)Yesapt; keep your squid.conf when asked (see Upgrade Squid)
Libraries Squid uses (OpenSSL etc.)Yesapt, then restart squid so it loads the patched libraries
Your configuration in /etc/squidKeptNot replaced by package updates as long as you keep your version at the prompt

Squid holds very little state (configuration, plus an optional disk cache), so a fresh image is also a quick, low-risk option. See Move to a fresh CloudSOE image.

Before you start: back up

Cloud disk snapshot

  • AWS: EC2 → Volumes → select the instance’s root volume → Actions → Create snapshot.
  • Azure: your VM → Disks → select the OS disk → Create snapshot.

Squid configuration

Everything you’ve customised lives under /etc/squid: the main squid.conf, drop-ins in conf.d/, and a passwords file if you added basic authentication.

sudo tar czf /home/$(whoami)/squid-config-$(date +%F).tar.gz /etc/squid
sudo chown $(whoami): /home/$(whoami)/squid-config-*.tar.gz
chmod 600 /home/$(whoami)/squid-config-*.tar.gz

The chmod matters if you use basic authentication: the tarball then contains your password hashes. Copy the file off the instance. The cache in /var/spool/squid doesn’t need backing up, because Squid refills it.

Update the operating system

OS packages, including Squid, come from Ubuntu’s repositories. Patch on your own schedule:

sudo apt update
apt list --upgradable
sudo apt upgrade

If an update needs a reboot, Ubuntu creates /var/run/reboot-required:

[ -f /var/run/reboot-required ] && cat /var/run/reboot-required.pkgs
sudo reboot

A reboot interrupts everything going through the proxy. Schedule it when clients can tolerate a short outage, or put a second proxy behind a load balancer or DNS name if they can’t. Squid is enabled at boot and serves again within seconds. Once you’ve rebooted into a new kernel, sudo apt autoremove clears out the old one.

Automatic security updates. Ubuntu normally runs unattended-upgrades for security fixes, and the CloudSOE build doesn’t switch it off. Check what your instance is doing:

systemctl status unattended-upgrades
cat /etc/apt/apt.conf.d/20auto-upgrades

It installs packages but doesn’t reboot, so keep an eye on /var/run/reboot-required.

Held packages. apt-mark showhold lists anything pinned at its current version. A held squid package won’t get security fixes, so release holds you no longer need with sudo apt-mark unhold <package>.

Stay on Ubuntu 26.04. Don’t run do-release-upgrade on this instance. When you want a newer Ubuntu release, and with it a newer Squid major version, move to a fresh CloudSOE image instead.

Upgrade Squid

Squid security fixes arrive as updates to Ubuntu’s squid package, so sudo apt upgrade covers them. To update just Squid, for example in response to a specific advisory:

squid -v | head -1                         # version before
sudo apt update
sudo apt install --only-upgrade squid
squid -v | head -1                         # version after

Keep your configuration. The image replaces Ubuntu’s default /etc/squid/squid.conf with its own. If a package update ships a new default config, apt asks what to do with the modified file. Answer N (keep your currently-installed version). Taking the package maintainer’s version would replace the CloudSOE config, including your ACLs. To answer that question automatically, for example in a scripted patch run:

sudo apt-get -o Dpkg::Options::="--force-confold" install --only-upgrade squid

If you’re not sure what a new package default changes, dpkg leaves it next to your file as /etc/squid/squid.conf.dpkg-dist (when you keep yours) for you to compare.

Restart after the upgrade. Check that the configuration still parses with the new version, then restart so the patched binary and libraries are the ones running. A restart drops in-flight connections, so expect clients to retry briefly:

sudo squid -k parse
sudo systemctl restart squid

Use restart here, not reload: a reload re-reads the config but keeps the old process running.

Move to a fresh CloudSOE image

A fresh image gets you the latest Ubuntu patches and Squid build with a clean base. The old proxy keeps serving until you switch clients over.

1. Back up the old instance. Create the /etc/squid tarball as in Before you start. Also note any changes you made outside /etc/squid, such as extra packages (apache2-utils for htpasswd), cron jobs, or firewall rules.

2. Launch the latest image. Follow the getting-started guide for AWS or Azure. Launch it into the same VPC / virtual network as the old proxy, with the same security group / NSG rules for port 3128.

3. Copy the backup across. Copy it from your workstation (or directly between the instances if they can reach each other):

scp <admin-user>@<old-ip>:squid-config-<date>.tar.gz .
scp squid-config-<date>.tar.gz <admin-user>@<new-ip>:

4. Restore on the new instance. Unpack to a staging directory, then copy back only what you changed:

mkdir ~/squid-restore
sudo tar xzf /home/$(whoami)/squid-config-<date>.tar.gz -C ~/squid-restore

# Compare with the new image's config before overwriting
sudo diff ~/squid-restore/etc/squid/squid.conf /etc/squid/squid.conf

sudo cp ~/squid-restore/etc/squid/squid.conf /etc/squid/squid.conf
sudo cp -n ~/squid-restore/etc/squid/conf.d/*.conf /etc/squid/conf.d/   # your own drop-ins
sudo cp ~/squid-restore/etc/squid/passwords /etc/squid/passwords        # only if you use basic auth
sudo chown root:root /etc/squid/squid.conf
sudo chmod 644 /etc/squid/squid.conf

If you use basic authentication, set the same ownership and mode on /etc/squid/passwords as it had on the old instance (ls -l the staged copy). The proxy user Squid runs its helpers as must be able to read it.

Check the restored config against the new Squid version before restarting. Squid can drop or rename directives between versions, and squid -k parse reports anything it no longer understands:

sudo squid -k parse
sudo systemctl restart squid

If your config has a cache_dir, the service builds the cache directory structure on start, so you don’t need a separate squid -z. Size the new instance’s disk for it. Once everything works, remove the staging copy with rm -rf ~/squid-restore.

5. Switch clients over. Everything that uses the proxy points at the old proxy’s address: http_proxy / https_proxy environment variables, /etc/apt/apt.conf.d/01proxy on client servers, browser and OS proxy settings, container and CI runner configs. Choose one:

  • Point clients at a DNS name in a private zone (Route 53 private hosted zone, Azure Private DNS) and update that one record. If clients still use a raw IP, this is a good moment to switch them to a name.
  • Reuse the address. Clients normally use the proxy’s private IP. On Azure, you can free the old VM’s static private IP and assign it to the new VM’s NIC. On AWS, you can move a secondary private IP or a dedicated network interface between instances, but not the primary private IP.
  • Otherwise, update each client’s proxy setting to the new private IP.

6. Retire the old instance. Watch /var/log/squid/access.log on the old proxy: when no more requests arrive, every client has moved. Stop it for a few days, then terminate it (AWS) or delete the VM with its disks, NIC and public IP (Azure). Delete old snapshots once you no longer need them for rollback.

Check everything works

Run these after any OS update, Squid upgrade or migration:

# Config parses and the service is running
sudo squid -k parse
systemctl status squid
squid -v | head -1

# Listening on 3128
sudo ss -ltnp | grep 3128

# Requests are being logged
sudo tail -n 5 /var/log/squid/access.log

From a client in the same network, using the proxy’s private IP:

curl -x http://<squid-private-ip>:3128 -sI https://www.example.com/

A 200 Connection established line followed by the site’s headers means the proxy is working. If you use basic authentication, add -U proxyuser and check that requests without credentials are refused.

Finally, re-check that the proxy isn’t open to the internet. From a machine outside your trusted ranges, the same curl against the public IP should time out or return 403. See tips & tricks for details.

Next steps