Let’t EncryptによるSSL/TLS証明書の利用について
Certbotで取得したLet’s EncryptによるTLS証明書は以下のケースで利用します。
- Coturn:TLS listening ポート443
- Nginx:HTTPS ポート443
- FreeSwitch:SIPS ポート5081
- FreeSwitch:WSS ポート7443
CoturnとNginxについては、Certbotで取得したファイルをそのまま利用できますが、FreeSwitchについては、取得したファイル群から新たなファイルを作成する必要があります。
Let's Encrypt
からの取得ファイル
# ls /etc/letsencrypt/live/www.example.com
cert.pem chain.pem fullchain.pem privkey.pem
wss.pem
の作成
# cd /etc/letsencrypt/live/www.example.com
# cat cert.pem privkey.pem fullchain.pem > wss.pem
agent.pem
の作成
# cat cert.pem privkey.pem > agent.pem
Note) Let’s Encryptの認証ファイルから作成した wss.pem は、SIPのTLS認証にも利用できますが、別ファイル名で指定する必要があるようです。wss.pem
からのリンクファイルを agent.pem, tls.pem, dtls-srtp.pem
として作成して下さい。
FreeSwitchセキュアウェブソケットWSS、SIPS対応
下記Docker Composeファイルの FreeSwitch
サービスの volumes:
セクションに wss
に必要なTLS/SSL証明書ディレクトリを追加
freeswitch:
......
......
volumes:
- ./conf/sip_profiles:/etc/freeswitch/sip_profiles/external
- ./conf/dialplan_public:/etc/freeswitch/dialplan/public_docker
- vol-freeswitch:/var/freeswitch/meetings
## added for wss: secure web socket. see the below "nginx" service "volumes"
- /etc/letsencrypt/live/${DOMAIN}:/etc/freeswitch/tls
......
......
mod/freeswitch/conf/sip_profiles/external.xml
.....
.....
<!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
<param name="tls-cert-dir" value="/etc/freeswitch/tls"/>
.....
.....
mod/freeswitch/conf/sip_profiles/external-ipv6.xml
.....
.....
<!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
<param name="tls-cert-dir" value="/etc/freeswitch/tls"/>
.....
.....
mod/freeswitch/conf/vars.xml.tmpl
<!-- external_rtp_ip
Can be an one of:
ip address: "12.34.56.78"
a stun server lookup: "stun:stun.server.com"
a DNS name: "host:host.server.com"
where fs.mydomain.com is a DNS A record-useful when fs is on
a dynamic IP address, and uses a dynamic DNS updater.
If unspecified, the bind_server_ip value is used.
Used by: sofia.conf.xml dingaling.conf.xml
-->
<X-PRE-PROCESS cmd="set" data="external_rtp_ip={{ .Env.EXTERNAL_IPv4 }}"/>
<!-- external_sip_ip
Used as the public IP address for SDP.
Can be an one of:
ip address: "12.34.56.78"
a stun server lookup: "stun:stun.server.com"
a DNS name: "host:host.server.com"
where fs.mydomain.com is a DNS A record-useful when fs is on
a dynamic IP address, and uses a dynamic DNS updater.
If unspecified, the bind_server_ip value is used.
Used by: sofia.conf.xml dingaling.conf.xml
-->
<X-PRE-PROCESS cmd="set" data="external_sip_ip={{ .Env.EXTERNAL_IPv4 }}"/>
.....
.....
<X-PRE-PROCESS cmd="set" data="external_ssl_enable=true"/>
.....
.....