Add the prosody module
[mirror/dsa-puppet.git] / 3rdparty / modules / prosody / templates / prosody.cfg.erb
1 -- Prosody XMPP Server Configuration
2 --
3 -- Information on configuring Prosody can be found on our
4 -- website at https://prosody.im/doc/configure
5 --
6 -- Tip: You can check that the syntax of this file is correct
7 -- when you have finished by running this command:
8 --     prosodyctl check config
9 -- If there are any errors, it will let you know what and where
10 -- they are, otherwise it will keep quiet.
11 --
12 -- Good luck, and happy Jabbering!
13
14
15 ---------- Server-wide settings ----------
16 -- Settings in this section apply to the whole server and are the default settings
17 -- for any virtual hosts
18
19 -- This is a (by default, empty) list of accounts that are admins
20 -- for the server. Note that you must create the accounts separately
21 -- (see https://prosody.im/doc/creating_accounts for info)
22 -- Example: admins = { "user1@example.com", "user2@example.net" }
23 admins = {
24 <% scope.lookupvar('prosody::admins').each do |admin| -%>
25     "<%= admin %>",
26 <% end -%>
27 }
28
29 <% if scope.lookupvar('prosody::user') != '' -%>
30 -- User to run prosody as
31 prosody_user = "<%= scope.lookupvar('prosody::user') %>"
32 <% end -%>
33 <% if scope.lookupvar('prosody::group') != '' -%>
34 -- Group to run prosody as
35 prosody_group = "<%= scope.lookupvar('prosody::group') %>"
36 <% end -%>
37
38 -- Which interfaces (addresses) to listen on
39 interfaces = {
40 <% scope.lookupvar('prosody::interfaces').each do |interface| -%>
41     "<%= interface %>",
42 <% end -%>
43 }
44
45 -- Enable use of libevent for better performance under high load
46 -- For more information see: https://prosody.im/doc/libevent
47 use_libevent = <%= scope.lookupvar('prosody::use_libevent') %>;
48
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: https://prosody.im/doc/modules
52 modules_enabled = {
53
54   -- Base modules
55 <% scope.lookupvar('prosody::modules_base').each do |mod| -%>
56     "<%= mod %>";
57 <% end -%>
58
59   -- Custom modules
60 <% scope.lookupvar('prosody::modules').each do |mod| -%>
61     "<%= mod %>";
62 <% end -%>
63
64 };
65
66 <%- community_modules = scope.lookupvar('prosody::community_modules')
67     if community_modules != [] -%>
68 -- Where to search for plugins/modules
69 plugin_paths = {
70 <%- base_path = scope.lookupvar('prosody::community_modules::path')
71     community_modules.each do |mod| -%>
72     "<%= base_path + '/mod_' + mod %>";
73 <%- end -%>
74 };
75 <%- end -%>
76
77 <%- modules_disabled = scope.lookupvar('prosody::modules_disabled')
78     if modules_disabled != [] -%>
79 -- These modules are auto-loaded, but should you want
80 -- to disable them then uncomment them here:
81 modules_disabled = {
82 <% scope.lookupvar('prosody::modules_disabled').each do |mod| -%>
83     "<%= mod %>";
84 <%- end -%>
85 };
86 <%- end -%>
87
88 -- Disable account creation by default, for security
89 -- For more information see https://prosody.im/doc/creating_accounts
90 allow_registration = <%= scope.lookupvar('prosody::allow_registration') %>;
91
92 -- Debian:
93 --   send the server to background.
94 --
95 daemonize = <%= scope.lookupvar('prosody::daemonize') %>;
96
97 <% if scope.lookupvar('prosody::ssl_custom_config') -%>
98 -- These are the SSL/TLS-related settings. If you don't want
99 -- to use SSL/TLS, you may comment or remove this
100 ssl = {
101   <% unless scope.lookupvar('prosody::ssl_protocol').nil? -%>
102   protocol = "<%= scope.lookupvar('prosody::ssl_protocol') %>";
103   <% end -%>
104   options = {
105   <%- scope.lookupvar('prosody::ssl_options').each do |option| -%>
106     "<%= option %>",
107   <%- end -%>
108   };
109   ciphers = "<%= scope.lookupvar('prosody::ssl_ciphers') %>";
110   curve = "<%= scope.lookupvar('prosody::ssl_curve') %>";
111   <%- dhparam = scope.lookupvar('prosody::ssl_dhparam')
112       if dhparam != '' -%>
113   dhparam = "<%= dhparam %>";
114   <%- end -%>
115   <%- ssl_key = scope.lookupvar('prosody::ssl_key')
116       if ssl_key != :undef -%>
117   key = "<%= ssl_key %>";
118   <%- end -%>
119   <%- ssl_cert = scope.lookupvar('prosody::ssl_cert')
120       if ssl_cert != :undef -%>
121   certificate = "<%= ssl_cert %>";
122   <%- end -%>
123 }
124 <% end -%>
125
126 -- Force clients to use encrypted connections? This option will
127 -- prevent clients from authenticating unless they are using encryption.
128
129 c2s_require_encryption = <%= scope.lookupvar('prosody::c2s_require_encryption') %>
130
131 -- Force servers to use encrypted connections?
132
133 s2s_require_encryption = <%= scope.lookupvar('prosody::s2s_require_encryption') %>
134
135
136 -- Force certificate authentication for server-to-server connections?
137 -- This provides ideal security, but requires servers you communicate
138 -- with to support encryption AND present valid, trusted certificates.
139 -- NOTE: Your version of LuaSec must support certificate verification!
140 -- For more information see https://prosody.im/doc/s2s#security
141
142 s2s_secure_auth = <%= scope.lookupvar('prosody::s2s_secure_auth') %>
143
144 -- Many servers don't support encryption or have invalid or self-signed
145 -- certificates. You can list domains here that will not be required to
146 -- authenticate using certificates. They will be authenticated using DNS.
147
148 s2s_insecure_domains = {
149 <% scope.lookupvar('prosody::s2s_insecure_domains').each do |domain| -%>
150     "<%= domain %>",
151 <% end -%>
152 }
153
154 -- Even if you leave s2s_secure_auth disabled, you can still require valid
155 -- certificates for some domains by specifying a list here.
156
157 s2s_secure_domains = {
158 <% scope.lookupvar('prosody::s2s_secure_domains').each do |domain| -%>
159     "<%= domain %>",
160 <% end -%>
161 }
162
163 ------ Custom config options ------
164
165 <%-
166 def print_recursive(object, indentation = 0)
167   case object
168   when Array
169     '{ "' + object.join('"; "') + '" }'
170   when Hash
171     "{\n" + ' ' * (indentation + 2) + object.map {|k,v| + "#{k} = " + print_recursive(v, indentation + 2)}.join(";\n" + ' ' * (indentation + 2)) + ";\n" + (' ' * indentation) + '}'
172   when TrueClass, FalseClass
173     object.to_s
174   else
175     '"' + object.to_s + '"'
176   end
177 end
178 -%>
179
180 <% scope.lookupvar('prosody::custom_options').sort.each do |option, value| -%>
181 <%= option %> = <%= print_recursive(value) %>
182 <% end -%>
183
184 -- Required for init scripts and prosodyctl
185 pidfile = "<%= scope.lookupvar('prosody::pidfile') %>"
186
187 -- Select the authentication backend to use. The 'internal' providers
188 -- use Prosody's configured data storage to store the authentication data.
189 -- To allow Prosody to offer secure authentication mechanisms to clients, the
190 -- default provider stores passwords in plaintext. If you do not trust your
191 -- server please see https://prosody.im/doc/modules/mod_auth_internal_hashed
192 -- for information about using the hashed backend.
193
194 authentication = "<%= scope.lookupvar('prosody::authentication') %>"
195
196 -- Select the storage backend to use. By default Prosody uses flat files
197 -- in its configured data directory, but it also supports more backends
198 -- through modules. An "sql" backend is included by default, but requires
199 -- additional dependencies. See https://prosody.im/doc/storage for more info.
200
201 <%- storage = scope.lookupvar('prosody::storage')
202     if storage != :undef
203       if storage.is_a?(String) -%>
204 storage = "<%= storage %>"
205   <%- elsif storage.is_a?(Hash) -%>
206 storage = {
207         <%- storage.sort.each do |type,location| -%>
208    <%= type %> = "<%= location %>";
209         <%- end -%>
210 }
211       <%- end -%>
212 <%- end -%>
213
214 <%- sql = scope.lookupvar('prosody::sql')
215 unless sql.nil? -%>
216 sql = { driver = "<%= sql['driver'] %>", database = "<%= sql ['database'] %>", username = "<%= sql['username'] %>", password = "<%= sql['password'] %>", host = "<%= sql['host'] %>" }
217 <%- end -%>
218
219 -- Logging configuration
220 -- For advanced logging see https://prosody.im/doc/logging
221 log = {
222         <%= scope.lookupvar('prosody::log_level') -%> = "<%= scope.lookupvar('prosody::info_log') -%>"; -- Change 'info' to 'debug' for verbose logging
223         error = "<%= scope.lookupvar('prosody::error_log') -%>";
224 <% scope.lookupvar('prosody::log_sinks').each do |sink|  -%>
225         "*<%= sink %>";
226 <% end -%>
227 <% scope.lookupvar('prosody::log_advanced').each do |level, destination|  -%>
228     { levels = { <%= level %> }; to = <%= destination %>; };
229 <% end -%>
230 }
231
232 ------ Components ------
233 -- You can specify components to add hosts that provide special services,
234 -- like multi-user conferences, and transports.
235 -- For more information on components, see https://prosody.im/doc/components
236
237 <% scope.lookupvar('prosody::components').sort.each do |name, component| %>
238 Component "<%= name %>" <% if component.include?('type') then %>"<%= component['type'] %>"<% end %>
239   <%- if component.include?('secret') -%>
240   component_secret = "<%= component['secret'] %>"
241   <%- end -%>
242   <%- if component.include?('options') -%>
243     <%- component['options'].sort.each do |k, v| -%>
244       <%- if ( v.is_a? Array ) -%>
245   <%= k %> = { "<%= v.join('", "') %>" };
246       <%- else -%>
247   <%= k %> = <%= v %>;
248       <%- end -%>
249     <%- end -%>
250   <%- end -%>
251 <% end -%>
252
253 ------ Additional config files ------
254 -- For organizational purposes you may prefer to add VirtualHost and
255 -- Component definitions in their own config files. This line includes
256 -- all config files in /etc/prosody/conf.d/
257
258 Include "conf.d/*.cfg.lua"