2
0

prosody.cfg.lua 11 KB

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