escomputers/freepbx-docker
概要
Dockerized FreePBX 17 with Asterisk 22, PHP 8,2, dedicated MariaDB and data persistence
システム・インフラ計測したスター増加
- 24時間
- +12
- 7日間
- +30
- 15日間
- +32
- 1か月
- 更新が遅れています
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルIntroduction
This project provides a Docker Compose deployment of FreePBX and Asterisk, designed to simplify installation, maintenance and security updates.
Upon starting this multi-container application, it will give you a turnkey secure PBX system for SIP calling.
- FreePBX 17.0.21
- PHP 8.2
- Asterisk 22.12
- MariaDB 10.11 LTS
- 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,iptablesandawkcommands- 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
- 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
To complete postfix configuration, set the
relayhostin postfix/main.cf to match your SMTP server defined insasl_passwd.txt.To require TLS for outgoing mail, set
smtp_tls_security_level = encryptin/etc/postfix/main.cfand reload Postfix withsudo docker compose exec freepbx postfix reload.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.
OPTION B: if you want to use the pre-built image on Docker Hub, jump to the next step directly
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
- 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.
See the image changelog for the changes in each release.
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.
関連プロジェクトを探す
読み込み中…