Jitsi-meet
Jitsi 是一组开源项目,允许您轻松构建和部署安全的视频会议解决方案。Jitsi 的核心是 Jitsi Videobridge 和 Jitsi Meet,它们让您能够在互联网上进行会议,而来自社区的其他项目则实现了音频、拨入、录制和同步播送等其他功能。
安装
Jitsi-meet 由多个组件组成
- jitsi-meetAUR:Web 界面文件,通过 Web 服务器提供访问
- jitsi-meet-prosodyAUR:用于 Jitsi 的 Prosody 插件
- jitsi-meet-turnserverAUR:运行 STUN/TURN 服务器的配置示例
- jitsi-videobridgeAUR:视频桥接服务,为所有参与者提供视频流
- jicofoAUR:Jitsi 会议焦点,用于确定谁在发言
- Prosody:一个免费的 XMPP 服务器,作为整个安装的基础
关于用户接口以及组件之间接口的图形化概述请参阅 上游文档。
运行独立服务器需要以下可选软件包
配置
如果您的服务器名称是 example.com,那么 Jitsi 的一个常见选择是 meet.example.com,但您可以随意选择。不过,从安全角度来看,强烈建议将 Web 应用托管在自己的子域名下。您需要更新服务器的 DNS 记录,添加所选子域名的条目(在上述示例中为 meet)。接下来的内容假设您已经完成了此操作。
此外,您应该为 meet.example.com 域名准备 SSL/TLS 证书,关于如何获取免费证书,请参阅 certbot。
在接下来的内容中,使用了以下占位符
JITSIFQDN:您的jitsi-meet域名,例如meet.example.comSECRET_JVB_USER:视频桥接 (videobridge) 的密码SECRET_FOCUS_USER:身份验证器 (authenticator) 的密码
密码应通过安全方式获取,例如通过 mktemp -u XXXXXXXX 或通过 pwgen。请务必使用不同且安全的密码!
配置路径
| 软件包 (Package) | 配置路径 |
|---|---|
| jitsi-meetAUR | /etc/webapps/jitsi-meet
|
| jitsi-meet-prosodyAUR | /usr/lib/jitsi-meet-prosody
|
| jitsi-meet-turnserverAUR | /usr/share/doc/jitsi-meet-turnserver
|
| jicofoAUR | /etc/jicofo
|
| jitsi-videobridgeAUR | /etc/jitsi-videobridge
|
回环地址 (Loopback)
让 jitsi-meet 组件通过本地 IP 相互访问。即使您的域名处于像 Cloudflare 这样不返回服务器真实 IP 的代理之后,此方法依然有效。
在 /etc/hosts 中
127.0.0.1 JITSIFQDN auth.JITSIFQDN ::1 JITSIFQDN auth.JITSIFQDN
配置 prosody
prosody 是前提条件,您需要为其添加 Jitsi 服务的配置。如果您还没有安装 prosody 服务器,请现在安装 prosody 和 lua52-sec。其余的 prosody 配置假设您已经在本地安装了 prosody。
软件包 jitsi-meet-prosodyAUR 提供了一个您可以轻松自定义的配置
# cd /etc/prosody # mkdir conf.d # cp /usr/share/doc/jitsi-meet-prosody/prosody.cfg.lua-jvb.example conf.d/jitsi.cfg.lua
然后将此内容添加到末尾
/etc/prosody/prosody.cfg.lua
Include "conf.d/*.cfg.lua"
自定义您的配置
/etc/prosody/conf.d/jitsi.cfg.lua
-- replace all occurences of jitmeet.example.com by JITSIFQDN
-- replace all occurences of focusUser by focus
-- then add or update those section
VirtualHost "JITSIFQDN"
ssl = {
key = "/etc/prosody/certs/JITSIFQDN.key";
certificate = "/etc/prosody/certs/JITSIFQDN.crt";
}
VirtualHost "auth.JITSIFQDN"
ssl = {
key = "/etc/prosody/certs/auth.JITSIFQDN.key";
certificate = "/etc/prosody/certs/auth.JITSIFQDN.crt";
}
authentication = "internal_hashed"
/etc/prosody/conf.d/jitsi.cfg.lua
-- Proxy to jicofo's user JID, so that it does not have to register as a component.
Component "focus.JITSIFQDN" "client_proxy"
target_address = "focus@auth.JITSIFQDN"
您现在需要为 JITSIFQDN 和 auth.JITSIFQDN 生成证书。
如果您使用 certbot,可以使用以下命令导入证书
# prosodyctl --root cert import /etc/letsencrypt/live
如果您想使用自生成证书,可以使用
[prosody]$ prosodyctl cert generate JITSIFQDN
[prosody]$ prosodyctl cert generate auth.JITSIFQDN
# mv /var/lib/prosody/*.{crt,cnf,key} /etc/prosody/certs/
# trust anchor /etc/prosody/certs/JITSIFQDN.crt
# trust anchor /etc/prosody/certs/auth.JITSIFQDN.crt
# update-ca-trust
让我们注册用户 jvb 和 focus
# prosodyctl register jvb auth.JITSIFQDN SECRET_JVB_USER # prosodyctl register focus auth.JITSIFQDN SECRET_FOCUS_USER # prosodyctl mod_roster_command subscribe focus.JITSIFQDN focus@auth.JITSIFQDN
然后 重启 prosody.service(如果刚安装,请 启动/启用)。
配置 jitsi-videobridge
jitsi-videobridge 的配置。
对于 MUC_NICKNAME,请使用 uuidgen 命令
/etc/jitsi-videobridge/sip-communicator.properties
org.jitsi.videobridge.xmpp.user.shard.DOMAIN=auth.JITSIFQDN org.jitsi.videobridge.xmpp.user.shard.PASSWORD=SECRET_JVB_USER org.jitsi.videobridge.xmpp.user.shard.MUC_JIDS=JvbBrewery@internal.auth.JITSIFQDN org.jitsi.videobridge.xmpp.user.shard.MUC_NICKNAME=UUIDGEN_RESULT
然后 启动/启用 jitsi-videobridge.service。
配置 jicofo
jicofo 的配置。
/etc/jicofo/jicofo.conf
jicofo {
xmpp: {
client: {
client-proxy: "focus.JITSIFQDN"
xmpp-domain: "JITSIFQDN"
domain: "auth.JITSIFQDN"
username: "focus"
password: "SECRET_FOCUS_USER"
conference-muc-jid = conference.JITSIFQDN
}
trusted-domains: [ "recorder.JITSIFQDN" ]
}
bridge: {
brewery-jid: "JvbBrewery@internal.auth.JITSIFQDN"
}
}
然后 启动/启用 jicofo.service。
配置 jitsi-meet
jitsi-meet Web 应用的配置。
/etc/webapps/jitsi-meet/config.js
var config = {
hosts: {
domain: 'JITSIFQDN',
// ...
muc: 'conference.JITSIFQDN'
},
bosh: '//JITSIFQDN/http-bind',
// ...
}
配置 nginx
按照 nginx#TLS 中描述的方式配置具有 TLS 的 nginx。
让我们复制提供的示例。
# cd /etc/nginx # mkdir sites # cp /usr/share/doc/jitsi-meet/jitsi-meet.example sites/jitsi.conf
然后将其包含在您的主配置中
/etc/nginx/nginx.conf
http {
// ...
// this should be placed near to the close bracket of the http block
include sites/*.conf;
}
然后将 jitsi 配置更改为您的配置
/etc/nginx/sites/jitsi.conf
server {
# ...
server_name JITSIFQDN;
# ...
# use prosody path directly
ssl_certificate /etc/prosody/certs/JITSIFQDN.crt;
ssl_certificate_key /etc/prosody/certs/JITSIFQDN.key;
# or use letencrypt path
ssl_certificate /etc/letsencrypt/live/JITSIFQDN/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/JITSIFQDN/privkey.pem;
# set the config path
# replace alias /etc/jitsi/meet/jitmeet.example.com-config.js by
location = /config.js {
alias /etc/webapps/jitsi-meet/config.js;
}
# ...
location ~ ^/([^/?&:'"]+)/config.js$
{
set $subdomain "$1.";
set $subdir "$1/";
alias /etc/webapps/jitsi-meet/config.js;
}
}
然后 重启 nginx.service。
技巧与提示
在 NAT 后运行服务器
以下端口需要转发到您的服务器
HTTPS
- TCP/443
Jitsi Videobridge
- UDP/10000
Jitsi 到 SIP 的网关 (Jigasi)
为了让 Jitsi-meet 会议与传统的 SIP 对接,请安装 jigasiAUR 或 jigasi-gitAUR 并编辑 prosody 配置
/etc/prosody/prosody.cfg.lua
Component "callcontrol.JITSIFQDN"
component_secret = "SECRET_JIGASI_USER"
填写 SIP 访问凭据 (SIPUSER SIPSERVER 和 SIPPASSWORD)
/opt/jigasi/jigasi-home/sip-communicator.properties
net.java.sip.communicator.impl.protocol.sip.acc1403273890647.ACCOUNT_UID=SIP\:"SIPUSER@SIPSERVER" net.java.sip.communicator.impl.protocol.sip.acc1403273890647.PASSWORD=SIPPASSWORD net.java.sip.communicator.impl.protocol.sip.acc1403273890647.SERVER_ADDRESS=SIPSERVER net.java.sip.communicator.impl.protocol.sip.acc1403273890647.USER_ID=SIPUSER
要更改 SIP 连接的默认房间名称,请更改上述配置中的 org.jitsi.jigasi.DEFAULT_JVB_ROOM_NAME。
然后编辑 jigasi 配置
/etc/jitsi/jigasi/config
JIGASI_HOST=callcontrol.JITSIFQDN JIGASI_HOSTNAME=jitsi-videobridge.JITSIFQDN JIGASI_SECRET=SECRET_JIGASI_USER JIGASI_OPTS="" LOGFILE=/var/log/jitsi/jigasi.log
/opt/jitsi-meet/config.js
hosts.call_control = 'callcontrol.meet.jit.si'
然后 启动/启用 jigasi.service。
创建会议室的访问限制
要将视频会议室的创建权限限制为经过身份验证的用户,可以执行以下步骤。请注意,会议的参与者仍然不需要身份验证!
在 prosody 中为 jitsi 域名添加身份验证,并为访客添加一个新的虚拟主机
/etc/prosody/conf.d/jitsi.cfg.lua
-- change authentification of your domain
VirtualHost "JITSIFQDN"
authentification = "internal_plain"
-- add guest virtual host to allow anonymous user to join your room
VirtualHost "guest.JITSIFQDN"
authentication = "jitsi-anonymous"
c2s_require_encryption = false
modules_enabled = {
-- copy the content of the modules_enabled
-- of the VirtualHost "JITSIFQDN"
-- remove only the module "muc_lobby_rooms" of the list
-- example:
"bosh";
"pubsub";
"ping"; -- Enable mod_ping
"speakerstats";
"external_services";
"conference_duration";
}
编辑 jitsi-meet 的配置文件
/etc/webapps/jitsi-meet/config.js
var config = {
host: {
// anonymous users need to use a dedicated muc without authentication
anonymousdomain: 'guest.JITSIFQDN',
},
}
为 jicofo 添加身份验证
/etc/jicofo/jicofo.conf
jicofo {
authentication {
enabled = true
type = XMPP
login-url = JITSIFQDN
enable-auto-login = true
}
}
然后通过以下方式创建所需用户
# prosodyctl register <username> JITSIFQDN <password>
仅当您使用 jigasi 时(如果您不知道,那么您大概率没在用),编辑 SIP 接口以不允许匿名身份验证
/etc/jitsi/jigasi/sip-communicator.properties
org.jitsi.jigasi.xmpp.acc.ANONYMOUS_AUTH=false
这些步骤摘自 此指南。
使用 JWT 令牌的访问限制
要将视频会议室的创建权限限制为使用 JWT 令牌(外部身份验证服务)验证的用户,可以执行以下步骤。请注意,会议的参与者仍然不需要身份验证!
安装以下依赖项
在 prosody 中为 jitsi 域名添加身份验证,并为访客添加一个新的虚拟主机
/etc/prosody/conf.d/jitsi.cfg.lua
-- change authentification of your domain
VirtualHost "JITSIFQDN"
authentification = "token"
app_id = "APP_ID"
app_secret = "APP_SECRET"
allow_empty_token = false
modules_enabled = {
-- keep existing modules and add
"presence_identity";
}
c2s_require_encryption = false
-- add guest virtual host to allow anonymous user to join your room
VirtualHost "guest.JITSIFQDN"
authentication = "jitsi-anonymous"
c2s_require_encryption = false
modules_enabled = {
-- copy the content of the modules_enabled
-- of the VirtualHost "JITSIFQDN"
-- remove only the module "muc_lobby_rooms" of the list
-- example:
"bosh";
"pubsub";
"ping"; -- Enable mod_ping
"speakerstats";
"external_services";
"conference_duration";
"presence_identity";
}
Component "conference.JITSIFQDN" "muc"
modules_enabled = {
-- add this to the modules_enabled
"token_verification";
}
编辑 jitsi-meet 的配置文件
/etc/webapps/jitsi-meet/config.js
var config = {
host: {
// anonymous users need to use a dedicated muc without authentication
anonymousdomain: 'guest.JITSIFQDN',
},
}
为 jicofo 添加身份验证
/etc/jicofo/jicofo.conf
jicofo {
authentication {
enabled = true
type = JWT
login-url = JITSIFQDN
enable-auto-login = true
}
}
然后 重启 prosody.service(如果刚安装,请 启动/启用)。并且 重启 jicofo.service(如果刚安装,请 启动/启用)。
现在您可以使用 JWT 令牌来验证用户身份。
您可以在此处阅读规范:Jitsi Meet Tokens
这里有一个简单的 nodejs 示例
const jwt = require('jsonwebtoken')
const crypto = require('crypto');
const words = require('random-words')
const yourDomain = "JITSIFQDN"
const appId = "APP_ID"
const appSecret = "APP_SECRET"
const userName = "YOUR_USERNAME"
const userEmail = "YOUR_EMAIL"
function getBody(domain, appId, name, email, room) {
const md5Email = crypto.createHash('md5').update(email).digest("hex");
const id = crypto.createHash('sha1').update(`${name}:${email}`).digest("hex")
return {
context: {
user: {
avatar: `https:/gravatar.com/avatar/${md5Email}`,
name,
email,
id,
},
group: 'users'
},
"aud": "jitsi",
"iss": appId,
"sub": domain,
room,
}
}
const room = process.argv[2] || words({exactly: 3, join: '-'})
const data = getBody(
yourDomain,
appId,
userName,
userEmail,
room,
)
const options = {
algorithm: 'HS256',
expiresIn: '2h',
}
const jwtToken = jwt.sign(data, appSecret, options)
console.log(`https://${yourDomain}/${room}?jwt=${jwtToken}`)
日志评估
对于公网可访问的 IP 地址,上述配置将产生一个公开的视频会议服务器。要监控服务器使用情况,可以使用 journalctl 来大致了解使用情况
# journalctl --unit=jicofo.service --grep="created new conference" --output cat
显示所有新聊天室创建的事件,以及
# journalctl --unit=jicofo.service --grep="Stopped" --output cat
显示所有聊天室销毁的事件。
通过 grep 搜索 'member' 还可以获得关于参与者的(匿名!)信息。
运行自己的 STUN 服务器
默认情况下,Jitsi Meet 使用来自 jitsi.org 的 STUN 服务器。您可以使用 coturn 轻松运行自己的 STUN 服务器,并在 jitsi-meet 的配置中进行设置。
故障排除
检查日志
您可以 停止 所有服务单元(即 prosody.service, jitsi-videobridge.service 和 jicofo.service),然后逐一 启动 它们,并关注每个服务单元在 journal 中的新消息,以查看是否有问题。大多数问题都是由密码或配置问题引起的。
如果您是从一个差异很大的版本升级,或者弄乱了配置,请重新开始。这比试图找出哪个部分出错了要快得多。
在 Matrix 频道寻求帮助
您可以加入 matrix 频道并在那里寻求帮助