@jerrm @tbrummell @jbcameraguy @Hometech With special thanks to the Clearly Anywhere folks (Tony and Brian) for solving this, we now have PUBLIC server access working as intended.
By default, PUBLIC server web access to all apps including FreePBX, UCP, AvantFax, AsteriDex, and Reminders is limited to whitelisted IP addresses. For some implementations, particularly those using Clearly Anywhere, this may not be ideal as UCP can assist with user management of the PBX as well as QR code provisioning of Clearly Anywhere. The Apache web server can be used to manage web access so long as you understand the need to apply Apache security patches in a timely manner.
Assign the same FQDN that you use for SIP access to port 80 for the UCP application.
Deploy OpenVPN on your server and use the PBX’s OpenVPN IP address for general access to all web applications we listed above. If you’d like public access to the FreePBX GUI, assign web access for it to another random port, e.g. 8080 in our example below. Block web access to your server from the public IP address of your PBX on both port 80 and 8080 in our example below. Here’s how to accomplish that. Create a new file in
/etc/pbx/httpdconf. Create
public.conf with the following contents:
Code:
Listen 8080
<virtualhost *:80>
ServerAdmin [email protected]
ServerName 111.112.113.114
Redirect 403 /
UseCanonicalName Off
UserDir disabled
</virtualhost>
<virtualhost *:8080>
ServerAdmin [email protected]
ServerName 111.112.113.114
Redirect 403 /
UseCanonicalName Off
UserDir disabled
</virtualhost>
<virtualhost *:80>
ServerAdmin [email protected]
ServerName server-fqdn.com
DocumentRoot /var/www/html/ucp
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log common
</virtualhost>
<virtualhost *:80>
ServerAdmin [email protected]
ServerName 10.8.0.123
DocumentRoot /var/www/html
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log common
</virtualhost>
<virtualhost *:8080>
ServerAdmin [email protected]
ServerName server-fqdn.com
DocumentRoot /var/www/html
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log common
</virtualhost>
<virtualhost 127.0.0.1:80>
ServerAdmin [email protected]
ServerName 127.0.0.1
ServerAlias localhost
DocumentRoot /var/www/html
</virtualhost>
In the ServerAdmin lines, insert your email address. Replace 111.112.113.114 with the public IP address of your server. Replace server-fqdn.com with the FQDN assigned for SIP registration access to your PBX. Replace 10.8.0.123 with the OpenVPN private IP address of your PBX. Replace 8080 with the port you chose for FreePBX access to your server. Save the file and then restart Apache: systemctl restart httpd.
Now it should be safe to open TCP port 80 and 8080 (or whatever port you chose) for web access to your server. Let’s also whitelist TCP 2267 for Clearly Anywhere access while we’re at it:
Code:
cd /etc/sysconfig
sed -i 's/10000:20000 -j ACCEPT/&\n-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT/' iptables
sed -i 's/10000:20000 -j ACCEPT/&\n-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT/' iptables
sed -i 's/10000:20000 -j ACCEPT/&\n-A INPUT -p tcp -m tcp --dport 2267 -j ACCEPT/' iptables
iptables-restart