prosody.cfg.lua 11 KB

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