prosody.cfg.lua 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. {{ $C2S_REQUIRE_ENCRYPTION := .Env.PROSODY_C2S_REQUIRE_ENCRYPTION | default "1" | toBool -}}
  2. {{ $DISABLE_C2S_LIMIT := .Env.PROSODY_DISABLE_C2S_LIMIT | default "0" | toBool -}}
  3. {{ $DISABLE_S2S_LIMIT := .Env.PROSODY_DISABLE_S2S_LIMIT | default "0" | toBool -}}
  4. {{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "0" | toBool -}}
  5. {{ $ENABLE_GUEST_DOMAIN := and $ENABLE_AUTH (.Env.ENABLE_GUESTS | default "0" | toBool) -}}
  6. {{ $ENABLE_IPV6 := .Env.ENABLE_IPV6 | default "true" | toBool -}}
  7. {{ $ENABLE_RECORDING := .Env.ENABLE_RECORDING | default "0" | toBool -}}
  8. {{ $ENABLE_TRANSCRIPTIONS := .Env.ENABLE_TRANSCRIPTIONS | default "0" | toBool -}}
  9. {{ $ENABLE_VISITORS := .Env.ENABLE_VISITORS | default "0" | toBool -}}
  10. {{ $ENABLE_S2S := or $ENABLE_VISITORS ( .Env.PROSODY_ENABLE_S2S | default "0" | toBool ) }}
  11. {{ $GC_TYPE := .Env.GC_TYPE | default "incremental" -}}
  12. {{ $GC_INC_TH := .Env.GC_INC_TH | default 400 -}}
  13. {{ $GC_INC_SPEED := .Env.GC_INC_SPEED | default 250 -}}
  14. {{ $GC_INC_STEP_SIZE := .Env.GC_INC_STEP_SIZE | default 13 -}}
  15. {{ $GC_GEN_MIN_TH := .Env.GC_GEN_MIN_TH | default 20 -}}
  16. {{ $GC_GEN_MAX_TH := .Env.GC_GEN_MAX_TH | default 100 -}}
  17. {{ $LOG_LEVEL := .Env.LOG_LEVEL | default "info" }}
  18. {{ $JIBRI_XMPP_USER := .Env.JIBRI_XMPP_USER | default "jibri" -}}
  19. {{ $JIGASI_XMPP_USER := .Env.JIGASI_XMPP_USER | default "jigasi" -}}
  20. {{ $JVB_AUTH_USER := .Env.JVB_AUTH_USER | default "jvb" -}}
  21. {{ $PROSODY_C2S_LIMIT := .Env.PROSODY_C2S_LIMIT | default "10kb/s" -}}
  22. {{ $PROSODY_METRICS_ALLOWED_CIDR := .Env.PROSODY_METRICS_ALLOWED_CIDR | default "172.16.0.0/12" -}}
  23. {{ $PROSODY_HTTP_PORT := .Env.PROSODY_HTTP_PORT | default "5280" -}}
  24. {{ $PROSODY_ENABLE_METRICS := .Env.PROSODY_ENABLE_METRICS | default "false" | toBool -}}
  25. {{ $PROSODY_ENABLE_STANZA_COUNTS := .Env.PROSODY_ENABLE_STANZA_COUNTS | default "false" | toBool -}}
  26. {{ $PROSODY_ADMINS := .Env.PROSODY_ADMINS | default "" -}}
  27. {{ $PROSODY_ADMIN_LIST := splitList "," $PROSODY_ADMINS | compact -}}
  28. {{ $PROSODY_MODE := .Env.PROSODY_MODE | default "client" -}}
  29. {{ $TRUSTED_PROXIES := .Env.PROSODY_TRUSTED_PROXIES | default "127.0.0.1,::1" -}}
  30. {{ $TRUSTED_PROXY_LIST := splitList "," $TRUSTED_PROXIES | compact -}}
  31. {{ $PROSODY_S2S_LIMIT := .Env.PROSODY_S2S_LIMIT | default "30kb/s" -}}
  32. {{ $S2S_PORT := .Env.PROSODY_S2S_PORT | default "5269" }}
  33. {{ $STUN_HOST := .Env.STUN_HOST | default "" -}}
  34. {{ $STUN_PORT := .Env.STUN_PORT | default "443" -}}
  35. {{ $TURNS_HOST := .Env.TURNS_HOST | default "" -}}
  36. {{ $TURNS_HOSTS := splitList "," $TURNS_HOST | compact -}}
  37. {{ $TURNS_PORT := .Env.TURNS_PORT | default "443" -}}
  38. {{ $TURN_HOST := .Env.TURN_HOST | default "" -}}
  39. {{ $TURN_HOSTS := splitList "," $TURN_HOST | compact -}}
  40. {{ $TURN_PORT := .Env.TURN_PORT | default "443" -}}
  41. {{ $TURN_TRANSPORT := .Env.TURN_TRANSPORT | default "tcp" -}}
  42. {{ $TURN_TRANSPORTS := splitList "," $TURN_TRANSPORT | compact -}}
  43. {{ $TURN_TTL := .Env.TURN_TTL | default "86400" -}}
  44. {{ $VISITORS_MUC_PREFIX := .Env.PROSODY_VISITORS_MUC_PREFIX | default "muc" -}}
  45. {{ $VISITORS_XMPP_DOMAIN := .Env.VISITORS_XMPP_DOMAIN | default "meet.jitsi" -}}
  46. {{ $VISITORS_XMPP_SERVER := .Env.VISITORS_XMPP_SERVER | default "" -}}
  47. {{ $VISITORS_XMPP_SERVERS := splitList "," $VISITORS_XMPP_SERVER | compact -}}
  48. {{ $VISITORS_XMPP_PORT := .Env.VISITORS_XMPP_PORT | default 52220 }}
  49. {{ $XMPP_AUTH_DOMAIN := .Env.XMPP_AUTH_DOMAIN | default "auth.meet.jitsi" -}}
  50. {{ $XMPP_DOMAIN := .Env.XMPP_DOMAIN | default "meet.jitsi" -}}
  51. {{ $XMPP_GUEST_DOMAIN := .Env.XMPP_GUEST_DOMAIN | default "guest.meet.jitsi" -}}
  52. {{ $XMPP_MUC_DOMAIN := .Env.XMPP_MUC_DOMAIN | default "muc.meet.jitsi" -}}
  53. {{ $XMPP_PORT := .Env.XMPP_PORT | default "5222" -}}
  54. {{ $XMPP_HIDDEN_DOMAIN := .Env.XMPP_HIDDEN_DOMAIN | default "hidden.meet.jitsi" -}}
  55. -- Prosody Example Configuration File
  56. --
  57. -- Information on configuring Prosody can be found on our
  58. -- website at http://prosody.im/doc/configure
  59. --
  60. -- Tip: You can check that the syntax of this file is correct
  61. -- when you have finished by running: luac -p prosody.cfg.lua
  62. -- If there are any errors, it will let you know what and where
  63. -- they are, otherwise it will keep quiet.
  64. --
  65. -- The only thing left to do is rename this file to remove the .dist ending, and fill in the
  66. -- blanks. Good luck, and happy Jabbering!
  67. ---------- Server-wide settings ----------
  68. -- Settings in this section apply to the whole server and are the default settings
  69. -- for any virtual hosts
  70. -- This is a (by default, empty) list of accounts that are admins
  71. -- for the server. Note that you must create the accounts separately
  72. -- (see http://prosody.im/doc/creating_accounts for info)
  73. -- Example: admins = { "user1@example.com", "user2@example.net" }
  74. admins = {
  75. {{ if .Env.PROSODY_ADMINS }} {{ range $index, $element := $PROSODY_ADMIN_LIST -}}{{ if $index }}, {{ end }}"{{ $element }}",{{ end }}{{ end }}
  76. {{ if .Env.JIGASI_XMPP_PASSWORD }}
  77. "{{ $JIGASI_XMPP_USER }}@{{ $XMPP_AUTH_DOMAIN }}",
  78. {{ end }}
  79. {{ if .Env.JIBRI_XMPP_PASSWORD }}
  80. "{{ $JIBRI_XMPP_USER }}@{{ $XMPP_AUTH_DOMAIN }}",
  81. {{ end }}
  82. "focus@{{ $XMPP_AUTH_DOMAIN }}",
  83. "{{ $JVB_AUTH_USER }}@{{ $XMPP_AUTH_DOMAIN }}"
  84. }
  85. component_admins_as_room_owners = true
  86. -- Enable use of libevent for better performance under high load
  87. -- For more information see: http://prosody.im/doc/libevent
  88. --use_libevent = true;
  89. -- This is the list of modules Prosody will load on startup.
  90. -- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too.
  91. -- Documentation on modules can be found at: http://prosody.im/doc/modules
  92. modules_enabled = {
  93. -- Generally required
  94. "roster"; -- Allow users to have a roster. Recommended ;)
  95. "saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
  96. "tls"; -- Add support for secure TLS on c2s/s2s connections
  97. "disco"; -- Service discovery
  98. {{- if eq $PROSODY_MODE "client" }}
  99. -- Not essential, but recommended
  100. "private"; -- Private XML storage (for room bookmarks, etc.)
  101. "limits"; -- Enable bandwidth limiting for XMPP connections
  102. -- These are commented by default as they have a performance impact
  103. --"privacy"; -- Support privacy lists
  104. --"compression"; -- Stream compression (Debian: requires lua-zlib module to work)
  105. -- Admin interfaces
  106. -- "admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands
  107. --"admin_telnet"; -- Opens telnet console interface on localhost port 5582
  108. -- Nice to have
  109. "version"; -- Replies to server version requests
  110. {{- end }}
  111. "ping"; -- Replies to XMPP pings with pongs
  112. {{- if eq $PROSODY_MODE "visitors" }}
  113. "limits"; -- Enable bandwidth limiting for XMPP connections
  114. {{- end }}
  115. -- HTTP modules
  116. --"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
  117. --"http_files"; -- Serve static files from a directory over HTTP
  118. -- Other specific functionality
  119. "posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
  120. --"groups"; -- Shared roster support
  121. --"announce"; -- Send announcement to all online users
  122. --"welcome"; -- Welcome users who register accounts
  123. --"watchregistrations"; -- Alert admins of registrations
  124. --"motd"; -- Send a message to users when they log in
  125. --"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
  126. "http_health";
  127. {{ if eq $PROSODY_MODE "brewery" -}}
  128. "firewall"; -- Enable firewalling
  129. "secure_interfaces";
  130. {{ end -}}
  131. {{ if $ENABLE_S2S -}}
  132. "s2s_bidi";
  133. "certs_s2soutinjection";
  134. "s2sout_override";
  135. "s2s_whitelist";
  136. {{ end -}}
  137. {{- if or .Env.TURN_HOST .Env.TURNS_HOST }}
  138. "external_services";
  139. {{- end }}
  140. {{ if $PROSODY_ENABLE_METRICS }}
  141. -- metrics collection functionality
  142. "http_openmetrics";
  143. {{ end -}}
  144. {{ if $PROSODY_ENABLE_STANZA_COUNTS }}
  145. -- Stanza count metrics for monitoring
  146. "measure_stanza_counts";
  147. {{ end -}}
  148. {{ if .Env.GLOBAL_MODULES }}
  149. "{{ join "\";\n\"" (splitList "," .Env.GLOBAL_MODULES | compact) }}";
  150. {{ end }}
  151. };
  152. component_ports = { }
  153. https_ports = { }
  154. trusted_proxies = {
  155. {{ range $index, $proxy := $TRUSTED_PROXY_LIST }}
  156. "{{ $proxy }}";
  157. {{ end }}
  158. }
  159. {{ if eq $PROSODY_MODE "brewery" -}}
  160. firewall_scripts = {
  161. "/config/rules.d/jvb_muc_presence_filter.pfw";
  162. };
  163. {{ end -}}
  164. -- These modules are auto-loaded, but should you want
  165. -- to disable them then uncomment them here:
  166. modules_disabled = {
  167. "offline"; -- Store offline messages
  168. "register";
  169. -- "c2s"; -- Handle client connections
  170. {{ if not $ENABLE_S2S -}}
  171. "s2s"; -- Handle server-to-server connections
  172. {{ end -}}
  173. };
  174. -- Disable account creation by default, for security
  175. -- For more information see http://prosody.im/doc/creating_accounts
  176. allow_registration = false;
  177. {{ if and (ne $PROSODY_MODE "brewery") (or (not $DISABLE_C2S_LIMIT) (not $DISABLE_S2S_LIMIT)) -}}
  178. -- Enable rate limits for incoming connections
  179. limits = {
  180. {{ if not $DISABLE_C2S_LIMIT }}
  181. -- Limit incoming client connections
  182. c2s = {
  183. rate = "{{ $PROSODY_C2S_LIMIT }}";
  184. };
  185. {{ end }}
  186. {{ if not $DISABLE_S2S_LIMIT }}
  187. -- Limit incoming server connections
  188. s2sin = {
  189. rate = "{{ $PROSODY_S2S_LIMIT }}";
  190. };
  191. {{ end }}
  192. }
  193. {{ end -}}
  194. --Prosody garbage collector settings
  195. --For more information see https://prosody.im/doc/advanced_gc
  196. {{ if eq $GC_TYPE "generational" }}
  197. gc = {
  198. mode = "generational";
  199. minor_threshold = {{ $GC_GEN_MIN_TH }};
  200. major_threshold = {{ $GC_GEN_MAX_TH }};
  201. }
  202. {{ else }}
  203. gc = {
  204. mode = "incremental";
  205. threshold = {{ $GC_INC_TH }};
  206. speed = {{ $GC_INC_SPEED }};
  207. step_size = {{ $GC_INC_STEP_SIZE }};
  208. }
  209. {{ end }}
  210. pidfile = "/config/data/prosody.pid";
  211. -- Force clients to use encrypted connections? This option will
  212. -- prevent clients from authenticating unless they are using encryption.
  213. c2s_require_encryption = {{ $C2S_REQUIRE_ENCRYPTION }};
  214. -- set c2s port
  215. c2s_ports = { {{ $XMPP_PORT }} } -- Listen on specific c2s port
  216. {{ if $ENABLE_IPV6 }}
  217. c2s_interfaces = { "*", "::" }
  218. {{ else }}
  219. c2s_interfaces = { "*" }
  220. {{ end }}
  221. {{ if $ENABLE_S2S -}}
  222. -- set s2s port
  223. s2s_ports = { {{ $S2S_PORT }} } -- Listen on specific s2s port
  224. {{ if eq $PROSODY_MODE "visitors" -}}
  225. s2s_whitelist = {
  226. {{- if $ENABLE_VISITORS }}
  227. '{{ $XMPP_MUC_DOMAIN }}'; -- needed for visitors to send messages to main room
  228. 'visitors.{{ $XMPP_DOMAIN }}'; -- needed for sending promotion request to visitors.{{ $XMPP_DOMAIN }} component
  229. '{{ $XMPP_DOMAIN }}'; -- unavailable presences back to main room
  230. {{- end }}
  231. {{- if $ENABLE_GUEST_DOMAIN }}
  232. '{{ $XMPP_GUEST_DOMAIN }}';
  233. {{- end }}
  234. {{ if or $ENABLE_RECORDING $ENABLE_TRANSCRIPTIONS -}}
  235. '{{ $XMPP_HIDDEN_DOMAIN }}';
  236. {{- end }}
  237. {{- if .Env.PROSODY_VISITORS_S2S_VHOSTS }}
  238. '{{ join "';\n '" (splitList "," .Env.PROSODY_VISITORS_S2S_VHOSTS | compact) }}';
  239. {{- end }}
  240. }
  241. {{ end -}}
  242. {{ end -}}
  243. {{ if $ENABLE_VISITORS -}}
  244. {{ if $.Env.VISITORS_XMPP_SERVER -}}
  245. s2sout_override = {
  246. {{ range $index, $element := $VISITORS_XMPP_SERVERS -}}
  247. {{ $SERVER := splitn ":" 2 $element }}
  248. {{ $DEFAULT_PORT := add $VISITORS_XMPP_PORT $index }}
  249. ["{{ $VISITORS_MUC_PREFIX }}.v{{ $index }}.{{ $VISITORS_XMPP_DOMAIN }}"] = "tcp://{{ $SERVER._0 }}:{{ $SERVER._1 | default $DEFAULT_PORT }}";
  250. ["v{{ $index }}.{{ $VISITORS_XMPP_DOMAIN }}"] = "tcp://{{ $SERVER._0 }}:{{ $SERVER._1 | default $DEFAULT_PORT }}";
  251. {{ end -}}
  252. };
  253. {{ if ne $PROSODY_MODE "visitors" -}}
  254. s2s_whitelist = {
  255. {{ range $index, $element := $VISITORS_XMPP_SERVERS -}}
  256. "{{ $VISITORS_MUC_PREFIX }}.v{{ $index }}.{{ $VISITORS_XMPP_DOMAIN }}";
  257. {{ end -}}
  258. };
  259. {{ end -}}
  260. {{ end -}}
  261. {{ end -}}
  262. -- Force certificate authentication for server-to-server connections?
  263. -- This provides ideal security, but requires servers you communicate
  264. -- with to support encryption AND present valid, trusted certificates.
  265. -- NOTE: Your version of LuaSec must support certificate verification!
  266. -- For more information see http://prosody.im/doc/s2s#security
  267. s2s_secure_auth = false
  268. -- Many servers don't support encryption or have invalid or self-signed
  269. -- certificates. You can list domains here that will not be required to
  270. -- authenticate using certificates. They will be authenticated using DNS.
  271. --s2s_insecure_domains = { "gmail.com" }
  272. -- Even if you leave s2s_secure_auth disabled, you can still require valid
  273. -- certificates for some domains by specifying a list here.
  274. --s2s_secure_domains = { "jabber.org" }
  275. -- Select the authentication backend to use. The 'internal' providers
  276. -- use Prosody's configured data storage to store the authentication data.
  277. -- To allow Prosody to offer secure authentication mechanisms to clients, the
  278. -- default provider stores passwords in plaintext. If you do not trust your
  279. -- server please see http://prosody.im/doc/modules/mod_auth_internal_hashed
  280. -- for information about using the hashed backend.
  281. authentication = "internal_hashed"
  282. -- Select the storage backend to use. By default Prosody uses flat files
  283. -- in its configured data directory, but it also supports more backends
  284. -- through modules. An "sql" backend is included by default, but requires
  285. -- additional dependencies. See http://prosody.im/doc/storage for more info.
  286. --storage = "sql" -- Default is "internal" (Debian: "sql" requires one of the
  287. -- lua-dbi-sqlite3, lua-dbi-mysql or lua-dbi-postgresql packages to work)
  288. -- For the "sql" backend, you can uncomment *one* of the below to configure:
  289. --sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename.
  290. --sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
  291. --sql = { driver = "PostgreSQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
  292. -- Logging configuration
  293. -- For advanced logging see http://prosody.im/doc/logging
  294. --
  295. -- Debian:
  296. -- Logs info and higher to /var/log
  297. -- Logs errors to syslog also
  298. log = {
  299. { levels = {min = "{{ $LOG_LEVEL }}"}, timestamps = "%Y-%m-%d %X", to = "console"};
  300. {{ if .Env.PROSODY_LOG_CONFIG }}
  301. {{ join "\n" (splitList "\\n" .Env.PROSODY_LOG_CONFIG | compact) }}
  302. {{ end }}
  303. }
  304. {{ if $PROSODY_ENABLE_METRICS }}
  305. -- Statistics Provider configuration
  306. statistics = "internal"
  307. statistics_interval = "manual"
  308. openmetrics_allow_cidr = "{{ $PROSODY_METRICS_ALLOWED_CIDR }}"
  309. {{ end }}
  310. {{ if .Env.TURN_CREDENTIALS -}}
  311. external_service_secret = "{{.Env.TURN_CREDENTIALS}}";
  312. {{- end }}
  313. {{ if or .Env.STUN_HOST .Env.TURN_HOST .Env.TURNS_HOST -}}
  314. external_services = {
  315. {{- if $STUN_HOST }}
  316. { type = "stun", host = "{{ $STUN_HOST }}", port = {{ $STUN_PORT }}, transport = "udp" }
  317. {{- end }}
  318. {{- if $TURN_HOST -}}
  319. {{- range $idx1, $host := $TURN_HOSTS -}}
  320. {{- range $idx2, $transport := $TURN_TRANSPORTS -}}
  321. {{- if or $STUN_HOST $idx1 $idx2 -}},{{- end }}
  322. {
  323. type = "turn",
  324. host = "{{ $host }}",
  325. port = {{ $TURN_PORT }},
  326. transport = "{{ $transport }}",
  327. ttl = {{ $TURN_TTL }},
  328. {{ if $.Env.TURN_CREDENTIALS -}}
  329. secret = true,
  330. algorithm = "turn",
  331. {{- end }}
  332. {{ if $.Env.TURN_USERNAME -}}
  333. username = "{{$.Env.TURN_USERNAME}}",
  334. {{- end }}
  335. {{ if $.Env.TURN_PASSWORD -}}
  336. password = "{{$.Env.TURN_PASSWORD}}",
  337. {{- end }}
  338. }
  339. {{- end -}}
  340. {{- end -}}
  341. {{- end -}}
  342. {{- if $TURNS_HOST -}}
  343. {{- range $idx, $host := $TURNS_HOSTS -}}
  344. {{- if or $STUN_HOST $TURN_HOST $idx -}},{{- end }}
  345. {
  346. type = "turns",
  347. host = "{{ $host }}",
  348. port = {{ $TURNS_PORT }},
  349. transport = "tcp",
  350. ttl = {{ $TURN_TTL }},
  351. {{ if $.Env.TURN_CREDENTIALS -}}
  352. secret = true,
  353. algorithm = "turn",
  354. {{- end }}
  355. {{ if $.Env.TURN_USERNAME -}}
  356. username = "{{$.Env.TURN_USERNAME}}",
  357. {{- end }}
  358. {{ if $.Env.TURN_PASSWORD -}}
  359. password = "{{$.Env.TURN_PASSWORD}}",
  360. {{- end }}
  361. }
  362. {{- end }}
  363. {{- end }}
  364. };
  365. {{- end }}
  366. {{ if .Env.GLOBAL_CONFIG }}
  367. {{ join "\n" (splitList "\\n" .Env.GLOBAL_CONFIG | compact) }}
  368. {{ end }}
  369. -- Enable use of native prosody 0.11 support for epoll over select
  370. network_backend = "epoll";
  371. -- Set the TCP backlog to 511 since the kernel rounds it up to the next power of 2: 512.
  372. network_settings = {
  373. tcp_backlog = 511;
  374. }
  375. unbound = {
  376. resolvconf = true
  377. }
  378. http_ports = { {{ $PROSODY_HTTP_PORT }} }
  379. {{ if $ENABLE_IPV6 }}
  380. http_interfaces = { "*", "::" }
  381. {{ else }}
  382. http_interfaces = { "*" }
  383. {{ end }}
  384. data_path = "/config/data"
  385. Include "conf.d/*.cfg.lua"