GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - escomputers/freepbx-docker: Dockerized FreePBX 17 with Asterisk 21, PHP 8,2, dedicated MariaDB and data persistence

BranchesTags
Open more actions menu

Latest commit

 

History

129 Commits
129 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
archived/published-images
archived/published-images
 
 
source
source
 
 
tests
tests
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
docker-compose.yaml
docker-compose.yaml
 
 
init.sql
init.sql
 
 
my.cnf
my.cnf
 
 
run.sh
run.sh
 
 

Repository files navigation

Introduction

This is MVP Docker Compose application for having FreePBX - A Voice over IP manager for Asterisk, running in containers.

Upon starting this multi-container application, it will give you a turnkey PBX system for SIP calling.

  • FreePBX 17.0.21
  • PHP 8.2.31
  • Asterisk 21.10.2
  • MariaDB 10.11.14
  • Fail2ban pre-configured with restrictive enforcement rules
  • Email notifications
  • Logrotate configured also for Asterisk and Freepbx
  • Supports data persistence
  • Base image Debian debian:bookworm-slim
  • Apache 2.4.65
  • NodeJS v18.20.4
  • DAHDI channel not supported

Ports

The following ports are exposed via Docker.

Port Description
80/tcp HTTP
443/tcp HTTPS
5060/udp PJSIP

RTP ports e.g. 16384-32767/udp require a particular configuration in order to be properly exposed.
There's a known issue about Docker and its way to expose a large range of ports, since each port exposed loads another process into memory and you may be experiencing a low memory condition.
As a trade-off, those ports are going to be exposed via Docker host iptables manually.
So run.sh will take care of iptables configuration, besides building and running the image.

Host requirements

  • ip, iptables and awk commands
  • iptables rules inside the Docker chains will bypass any firewall rule on the system
  • Iptables rules are temporary, unless you make them persistent in this way (Debian-like):
sudo apt-get update
sudo apt-get install -y iptables-persistent
sudo systemctl enable netfilter-persistent
sudo systemctl restart netfilter-persistent
sudo systemctl status netfilter-persistent

# Every time you make a change to iptables, remember to save to disk
sudo sh -c 'iptables-save > /etc/iptables/rules.v4'
  • Customize Fail2ban preferences by editing the file fail2ban/jail.local. Currently it bans 2 consecutive failed SIP registration attempts within 30 seconds for 1 week.

  • Make sure you have a valid DNS server for Docker containers by adding the following to /etc/docker/daemon.json (restart Docker after saving the file):

    {
      "dns": ["1.1.1.1"]
    }

Usage

  1. Create required passwords:
# for MySQL root user
printf "your-mysql-root-password" > mysql_root_password.txt
printf "yourstrongmysqlfreepbxuserpassword" > freepbxuser_password.txt

# for Postfix
# run this command even if you don't need email notifications
printf "[smtp-server-fqdn]:port [email protected]:your-app-password" > sasl_passwd.txt

# Set proper file permissions
chmod 600 mysql_root_password.txt freepbxuser_password.txt sasl_passwd.txt
  1. To complete postfix configuration, set the relayhost in postfix/main.cf to match your SMTP server defined in sasl_passwd.txt.

  2. OPTION A: build the image from scratch:

sudo docker build -t your-image-name:your-tag ./source

When building from source, the Dockerfile uses a Debian base image pinned by digest and Debian Snapshot repositories fixed to a specific date. It downloads the exact security update packages specified in packages.tsv, verifies their SHA-256 checksums, and installs them in the image. A checksum mismatch stops the build.

Then edit the value of services.freepbx.image in the docker-compose.yaml by setting the proper image version and tag.

  1. OPTION B: if you want to use the pre-built image on Docker Hub, jump to the next step directly

  2. Configure RTP ports on the host and build + run the Compose project:

sudo bash run.sh
# If you want to override the default RTP port range (16384-32767):
sudo bash run.sh --rtp 10000-20000
# NOTE
# If you run the script with the default RTP range 16384-32767 and later rerun it with a different range, the iptables rules from the previous range remain in place and you have to delete those rules manually before or after applying the new range.

# Install Freepbx
sudo bash run.sh --install-freepbx

# Optional, clean up containers, network and volumes
sudo bash run.sh --clean-all
  1. TLS support using Let's Encrypt DNS challenge
# Make sure to have both 80 and 443 TCP ports allowed by the firewall and a valid DNS record A
sudo docker compose exec -it freepbx certbot --apache -d your.domain.com --email [email protected] --agree-tos --redirect -n

Login to the web server's admin URL and start configuring the system!

Maintenance

The maintained image is 17-nofail2ban. The legacy 17 image with integrated Fail2ban is no longer maintained and does not receive security updates.

Numbered tags such as 17-nofail2ban-r1 always keep the same image. To update from a numbered tag, replace it with a newer one in your Compose file.

To update an existing 17-nofail2ban installation to the latest security patches, run the following commands from the project directory:

git pull
sudo docker compose pull freepbx
sudo docker compose up -d --no-deps --wait --wait-timeout 600 freepbx

The existing volumes are reused. During startup, the container installs the required security package updates before starting the services. This may take a few minutes, during which the PBX is unavailable.

Verify image provenance

Images published by the publish-image.yml workflow have a signed GitHub attestation.
Releases r1 and r2 were published without one.

Run gh auth status. If it reports that you are logged in to github.com, continue.
Otherwise, run gh auth login --hostname github.com and complete the sign-in.

Choose Docker Hub or GHCR, then pull the image:

IMAGE='docker.io/escomputers/freepbx'
# or
# IMAGE='ghcr.io/escomputers/freepbx'

docker pull "${IMAGE}:17-nofail2ban"

Set DIGEST to the full sha256:... value from the Digest: line printed by docker pull command.

# Example
DIGEST='sha256:...'

gh attestation verify "oci://${IMAGE}@${DIGEST}" \
  --repo escomputers/freepbx-docker \
  --signer-workflow escomputers/freepbx-docker/.github/workflows/publish-image.yml

Successful verification confirms that this repository's publishing workflow signed the attestation for the exact image digest stored locally.

About

Dockerized FreePBX 17 with Asterisk 21, PHP 8,2, dedicated MariaDB and data persistence

Topics

apache2asteriskcdrcontainersdebian-bookwormdigiumdistributed-systemsdockerdocker-composefreepbxmariadbmysqlnodejs18pbxphonephp8sangomaself-hostedsipvoip

Resources

Readme
Apache-2.0 license
Activity

Stars

130 stars

Watchers

6 watching

Forks

47 forks
Report repository

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.