prosody.cfg.lua 12 KB

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