Emergency server help: get in touch

FreePBX UCP from Outside the Office, Safely: Keep the Admin GUI Private (Tested)

How to give FreePBX UCP users access from outside without publishing the admin GUI: a tested Apache access file, HTTPS redirects and the fail2ban jail that bans on denied requests.

Published Updated 6 min read

Short answer: The safest way to use FreePBX UCP from outside is a VPN. If you publish it instead, serve UCP over HTTPS only, keep /admin limited to your LAN or VPN in Apache, and add your own addresses to fail2ban’s ignoreip: on our FreePBX 17 lab, two denied /admin requests were enough for the apache-tcpwrapper jail to block our test server on every TCP port for 30 minutes. (Reviewed October 2026.)

“Accessing UCP outside LAN” is a regular FreePBX forum question. UCP (the User Control Panel) and the admin GUI are served by the same Apache, so publishing one easily publishes both. We added an Apache access file to our FreePBX 17 lab and tested it from a server on the internet.

Why this matters now

Several FreePBX advisories in August and September 2026 only needed a UCP login, and one UCP issue needed no login at all; see FreePBX security updates, August to September 2026. Update the modules before you expose UCP anywhere.

Option 1: VPN

Users connect to the office VPN (WireGuard, OpenVPN or the firewall’s own VPN) and open UCP on its LAN address. Nothing on the PBX is published. This is the only option that also protects SIP phones and the admin GUI from the internet in one step.

Option 2: publish FreePBX UCP, keep the admin GUI private

Do this only after the modules are updated (the check script in the security updates guide exits 0), and where you can, also limit port 443 in the firewall to the networks your users connect from. Publishing UCP to the whole internet is the riskiest form of this setup.

Step 1: stop fail2ban from locking you out. The access file below makes Apache deny /admin from outside, and a jail on our lab banned the first address that tried it (see the fail2ban trap). Add your office, VPN and monitoring addresses to ignoreip before you switch the file on:

cp -p /etc/fail2ban/jail.local /root/jail.local.bak
grep -n '^ignoreip' /etc/fail2ban/jail.local     # an existing line: add your addresses to it
# no line yet: add one under [DEFAULT], e.g.
#   ignoreip = 127.0.0.1/8 ::1 203.0.113.10 198.51.100.0/24
fail2ban-client -t && fail2ban-client reload
fail2ban-client get apache-tcpwrapper ignoreip

Step 2: the access file. Create /etc/apache2/conf-available/pbx-access.conf (Debian, FreePBX 17) and adjust the ranges to your LAN and VPN:

# FreePBX: admin GUI from the LAN/VPN only; UCP over HTTPS only.
<Location "/admin">
    Require ip 127.0.0.1 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
</Location>
<If "%{HTTPS} != 'on' && %{REQUEST_URI} =~ m#^/ucp#">
    Redirect permanent "https://%{HTTP_HOST}%{REQUEST_URI}"
</If>
# Visitors from outside who open the bare address go to UCP, not to the (denied) admin GUI.
<If "%{REQUEST_URI} == '/' && ! -R '10.0.0.0/8' && ! -R '172.16.0.0/12' && ! -R '192.168.0.0/16' && ! -R '127.0.0.1'">
    Redirect "https://%{HTTP_HOST}/ucp/"
</If>
a2enconf pbx-access
if apache2ctl configtest; then systemctl reload apache2
else a2disconf pbx-access; echo "config error: pbx-access disabled again, Apache not reloaded"; fi

Apache is only reloaded when the configuration test passes; with a deliberately broken file on our lab, the file was switched off again and Apache kept running with the old configuration. To undo the whole change:

a2disconf pbx-access && apache2ctl configtest && systemctl reload apache2
cp -p /root/jail.local.bak /etc/fail2ban/jail.local && fail2ban-client reload   # only if you want the old ignoreip back
Request from the internetResult on our lab
http://PBX/admin/config.php and https://PBX/admin/config.php403
http://PBX/ucp/301 to https://PBX/ucp/ (query string kept)
https://PBX/ucp/200
http://PBX/ and https://PBX/302 to https://PBX/ucp/
Same requests from the PBX itself (127.0.0.1)/admin 200; / still goes to /admin

Apache’s <If> directive makes the conditions possible. A first attempt that put a Redirect inside <LocationMatch "^/ucp"> did not redirect at all; the server-level <If> above did. Use a real certificate for the HTTPS name your users type; see FreePBX firewall and intrusion detection for the firewall side.

The fail2ban trap

Our lab’s /etc/fail2ban/jail.local had an apache-tcpwrapper jail: filter apache-auth, action iptables-allports, maxretry = 3, bantime = 1800. Apache logs every denied /admin request as AH01630: client denied by server configuration, and that filter counts them. After our first two test requests to /admin (plus the page’s own ajax.php call), our test server was blocked on every TCP port for 30 minutes, including SSH.

  • That is good against attackers, but it also catches your own staff who try the admin URL from outside. The redirect for / above keeps UCP users from landing on /admin by accident.
  • That is why step 1 puts your office, VPN and monitoring addresses in ignoreip before the access file goes live.
  • To lift a ban: fail2ban-client set apache-tcpwrapper unbanip 203.0.113.10.
fail2ban-client status
fail2ban-client status apache-tcpwrapper
grep -A6 '^\[apache-tcpwrapper\]' /etc/fail2ban/jail.local

UCP live updates (ports 8001 and 8003)

UCP’s Node.js server handles live updates and listens on 8001 (HTTP) and 8003 (HTTPS); on our lab the Advanced Settings NODEJSBINDADDRESS and NODEJSHTTPSBINDADDRESS were ::, all addresses. If you publish UCP, allow only 8003, and only to the networks that need it. We did not test UCP’s live features from outside.

How we tested

  • FreePBX 17.0.33.2 on Debian 12 with Apache 2.4, 20–21 October 2026; requests with curl from a separate server on the internet and from the PBX itself.
  • The fail2ban ban happened during the test and was lifted with unbanip; the access file was removed from the lab afterwards.
  • On 21 October we re-ran steps 1 and 2 as published (fail2ban 1.0.2): the test address appeared in the jail’s ignoreip after the reload, the access file loaded, a broken copy was switched off without reloading Apache, and the undo commands restored the original state.
  • Not tested: UCP live updates and chat from outside, FreePBX’s commercial SysAdmin VPN, and FreePBX 16.

FAQ

Is it safe to open FreePBX UCP to the internet?

A VPN is the safe default. Publish UCP only after the modules from the 2026 advisories are updated, and then use HTTPS only, keep the admin GUI on the LAN or VPN, limit port 443 to known networks where you can, and keep fail2ban running with your own addresses in ignoreip.

Why did my IP get blocked after opening the FreePBX admin page?

The apache-tcpwrapper fail2ban jail counts denied requests. On our lab three in ten minutes meant a 30-minute block on all TCP ports. Add your address to ignoreip.

Which ports does UCP need?

443 for the web interface, plus 8003 for live updates if you want them. Keep 80 only for the redirect to HTTPS.

At a glance

FreePBX UCP from Outside the Office, Safely: Keep the Admin GUI Private (Tested) summary card: The safest way to use FreePBX UCP from outside is a VPN. If you publish it instead, serve UCP over HTTPS only, keep /adm…
In short: The safest way to use FreePBX UCP from outside is a VPN. If you publish it instead, serve UCP over HTTPS only, keep /admin limited to your LAN or VPN in Apache, and add your own addresses to…

Share this guide

Free website test

Is your website set up right?

Check SSL, security headers, redirects, robots.txt, sitemap, llms.txt and security.txt in one test. It takes about 30 seconds.