prosody.cfg.lua 12 KB

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