1
0
Fork
You've already forked fusionpbx-debian
0
No description
2024年12月18日 22:06:45 +07:00
images add user, extension, and gateway sections 2024年12月18日 21:59:01 +07:00
README.md add bash code block styling 2024年12月18日 22:06:45 +07:00

Triển khai fusionPBX trên Debian 12

Các lệnh ở các phần sau được thực hiện dưới quyền root.

Cấu hình SSH daemon

Phần này không bắt buộc, nếu muốn thực hiện cần cài đặt ssh client ở phía máy cá nhân.

Để ngăn chặn brute force attack, cấu hình kết nối đến máy chủ chỉ bằng ssh keys:

Tạo ssh key ở phía máy cá nhân và chọn đường dẫn để lưu file:

ssh-keygen -C "fusionpbx-debian"

Ở đây chọn đường dẫn là /home/kakapt/.ssh/fusion

SSH keys generation

Copy file public key /home/kakapt/.ssh/fusion.pbx vừa tạo lên server:

ssh-copy-id -i ~/.ssh/fusion.pub root@45.77.33.187

Copying ssh public key to server

Tạo file /etc/ssh/sshd_config.d/20-force_publickey_auth.conf trên server:

cat << eof > /etc/ssh/sshd_config.d/20-force_publickey_auth.conf
PasswordAuthentication no
AuthenticationMethods publickey

Sau đó, reboot lại server:

reboot

Cài đặt FusionPBX

Chạy 3 lệnh sau ở phía server:

apt update && apt upgrade
wget -O - https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/debian/pre-install.sh | sh;
cd /usr/src/fusionpbx-install.sh/debian && ./install.sh

Sau khi cài đặt thành công, thông tin đăng nhập website của server sẽ hiện ra như sau:

Installation has completed.
Use a web browser to login.
 domain name: https://000.000.000.000
 username: admin
 password: zxP5yatwMxejKXd
The domain name in the browser is used by default as part of the authentication.
If you need to login to a different domain then use username@domain.
 username: admin@x.x.x.x
Additional information.
 https://fusionpbx.com/support.php
 https://www.fusionpbx.com
 http://docs.fusionpbx.com
 https://www.fusionpbx.com/training.php

Cấu hình fail2ban để ngăn DDOS

Kích hoạt 3 jail [ssh], [freeswitch-ip][auth-challenge-ip]:

sed -i.bak '/\(ssh\)\|\(freeswitch-ip\)\|\(auth-challenge-ip\)/ {
 n
 /enabled/ s/false/true/
}' /etc/fail2ban/jail.local

Reload lại cấu hình cho fail2ban daemon:

systemctl reload fail2ban.service

Cấu hình TLS/SSL với Let's Encrypt

Trỏ tên miền về địa chỉ IP của server và chạy script sau để cài đặt:

/usr/src/fusionpbx-install.sh/debian/resources/letsencrypt.sh

Đoạn script sẽ yêu cầu điền 2 trường là Domain NameEmail Address

TLS/SSL configuration

Tạo domain để quản lý từng doanh nghiệp

Vào Advanced > Domains > Add, sau đó điền các thông tin:

Adding domain

  • Name ở đây là có thể là domain khác của doanh nghiệp hoặc subdomain từ domain chính.
  • Nếu là domain của doanh nghiệp của doanh nghiệp thì cần trỏ nó về địa chỉ IP của server.

Cấu hình SIP profile

Vào Advanced > SIP Profiles, ta cần cấu hình 2 phần là internalexternal:

SIP Profiles preview

Cấu hình rtp-ipsip-ip của 2 phần là địa chỉ IP của server cho cả 2 phần:

SIP Profiles configuration

Sau đó thực hiện các bước sau:

  1. Vào Status > SIP Status
  2. Chọn nút Restart ở 2 phần sofia status profile externalsofia status profile internal
  3. Chọn nút Refresh ở góc phải trên

SIP reload

Tạo user

Để tạo user, trước tiên ta cần chọn domain ở sidebar bên phải:

Selecting Domain

Vào Account > Users > Add và điền các trường thông tin:

User creation

Tạo extension

Vào Account > Extensions > Add và điền các trường thông tin:

Extension creation

Tạo gateway để kết nối đến SIP provider

Vào Account > Gateways > Add và điền các trường thông tin do SIP provider cung cấp:

Gateway creation