Commit Graph

230 Commits

Author SHA1 Message Date
Evgeniy Khramtsov 672c2f75d3 Introduce option 'validate_stream'
If set to `true`, all incoming XML packets are fully validated
against known schemas. If an error occurs, the packet will be bounced
with the corresponding error reason. The default value is `false`.
The option might be useful to protect client software from sofisticated
bugs related to XML validation as well as for client developers
who want to catch validation errors at early stage of development.

Note that the option might have slight performance impact, so use it
with care on loaded machines.
2018-02-09 18:12:50 +03:00
Paweł Chmielowski ddf6076328 Fix elixir tests 2018-01-29 18:28:02 +01:00
Paweł Chmielowski dc601610b6 Don't return undefined from ejabberd_config:get_myhosts() 2018-01-29 11:05:59 +01:00
Paweł Chmielowski c47366ba97 Restore original return value to ejabberd_config:add_option 2018-01-29 09:46:11 +01:00
Evgeniy Khramtsov ba2b650464 Introduce new gen_mod callback: mod_options/1
The callback is supposed to provide known options and their default
values, as long as the documentation. Passing default values into
get_mod functions is now deprecated: all defaults should be provided
by the Mod:mod_options/1 callback.
2018-01-23 10:54:52 +03:00
Evgeniy Khramtsov cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Evgeniy Khramtsov fbd6ea8a48 Move 'certfile' based options in a single place 2017-11-23 11:04:47 +03:00
Christophe Romain 00e32ee4b6 Allow writing custom modules in own path (#1327)
in ejabberdctl, just add this to EJABBERD_OPTS
external_beams /path/to/my/beams

then all beams file /path/to/my/beams/*.beam will be known
by ejabberd_config, and allowed to be loaded.
2017-11-16 14:48:47 +01:00
Evgeniy Khramtsov 35b7203e01 Introduce 'certfiles' global option
The option is supposed to replace existing options 'c2s_certfile',
's2s_certfile' and 'domain_certfile'. The option accepts a list
of file paths (optionally with wildcards "*") containing either
PEM certificates or PEM private keys. At startup, ejabberd sorts
the certificates, finds matching private keys and rebuilds full
certificates chains which can be used by fast_tls. Example:

certfiles:
  - "/etc/letsencrypt/live/example.org/*.pem"
  - "/etc/letsencrypt/live/example.com/*.pem"
2017-11-01 00:20:27 +03:00
Evgeniy Khramtsov 9bd099013f Don't attempt to access(2) a certificate file
Fixes #1375
2017-08-17 14:33:41 +03:00
Evgeniy Khramtsov 6691c59a7a Clean up database code related to mod_vcard_xupdate 2017-05-17 19:29:19 +03:00
Evgeniy Khramtsov d3c8fb7705 Check presence of some files during option validation 2017-05-12 09:34:57 +03:00
Evgeniy Khramtsov 5d7a704ca5 Remove forgotten 'export_all' 2017-05-08 17:23:29 +03:00
Evgeniy Khramtsov 6b6d07745d Split some functions in smaller ones 2017-05-08 16:29:01 +03:00
Evgeniy Khramtsov 01a2c9fe12 Add type specs for Module:opt_type/1 2017-05-08 12:59:28 +03:00
Evgeniy Khramtsov 2b63d07329 Merge branch 'new-option-validation' 2017-04-29 11:48:57 +03:00
Evgeniy Khramtsov b82b93f8f0 Don't validate an option in ejabberd_config:get_option() functions
The commit introduces the following changes:
* Now there is no need to pass validating function in
  ejabberd_config:get_option() functions, because the configuration
  keeps already validated values.
* New function ejabberd_config:get_option/1 is introduced
* Function ejabberd_config:get_option/3 is deprecated. If the function
  is still called, the second argument (validating function) is simply
  ignored.
* The second argument for ejabberd_config:get_option/2 is now
  a default value, not a validating function.
2017-04-29 11:39:40 +03:00
Evgeniy Khramtsov 7129aebe76 Don't re-define validation functions in multiple places 2017-04-28 13:23:32 +03:00
Paweł Chmielowski 2bcf822637 Fix elixir tests 2017-04-28 10:08:09 +02:00
Evgeniy Khramtsov 0b93cb7ece Store options using p1_options module 2017-04-27 19:44:58 +03:00
Evgeniy Khramtsov 9a93acc62a Improve Mnesia tables creation and transformation 2017-04-23 16:37:58 +03:00
Evgeniy Khramtsov 02790b105e Speedup Mnesia tables initialization 2017-04-21 12:27:15 +03:00
Evgeniy Khramtsov f496d22074 Improve logging message 2017-04-16 23:56:12 +03:00
Evgeniy Khramtsov 86b680a3ad Move compile_exprs() to misc module 2017-04-16 20:05:46 +03:00
Evgeniy Khramtsov 78dba217bf Speedup configuration options lookup
We now avoid excessive ETS lookups; instead, we use dynamically
compiled module 'ejabberd_options' keeping the configuration options
2017-04-16 15:29:10 +03:00
Evgeniy Khramtsov 878c762cdf Log human readable description when configuration file is not found 2017-04-16 01:22:55 +03:00
Evgeniy Khramtsov 920f2678ac Report configuration file location on startup 2017-04-16 01:02:46 +03:00
Evgeniy Khramtsov e40baf0bda Use cache in front of Redis/SQL RAM backends 2017-04-14 13:57:52 +03:00
Christophe Romain b1acd1183f Rename aux.erl as misc.erl
Thanks Microsoft Windows to not support some filenames
2017-04-11 12:13:58 +02:00
Evgeniy Khramtsov 6fa55e7c38 Set 'read_concurrency' for some ETS tables 2017-04-05 15:10:18 +03:00
Evgeniy Khramtsov 7bcbea2108 Deprecate jlib.erl in favor of aux.erl
Since the main goal of jlib.erl is lost, all auxiliary functions
are now moved to aux.erl, and the whole jlib.erl is now deprecated.
2017-03-30 14:17:13 +03:00
Evgeniy Khramtsov e30d41e5f0 Merge branch 'new_queue'
Conflicts:
	rebar.config
	src/mod_muc_admin.erl
2017-03-24 13:27:56 +03:00
Alexey Shchepin 069d28b1ed Get rid of p1_sha calls 2017-03-14 02:31:51 +03:00
Evgeniy Khramtsov 02064ae12a Add support for file-based queues
It's now possible to use files as internal packet queues.
The following options are introduced:

* queue_type: the option can be set to `ram` (default) or `file`.
  The option can be set per virtual host.
* queue_dir: path to the directory where queues will be allocated.
  The default is 'queue' directory inside Mnesia directory.
  This is a global option and cannot be set per virtual host.
2017-03-10 15:12:43 +03:00
Paweł Chmielowski 6808865068 Return ok from start/2 2017-02-27 10:05:35 +01:00
Evgeniy Khramtsov 7a9fa52e91 Change loglevel on configuration reload 2017-02-27 11:11:29 +03:00
Evgeniy Khramtsov 03e2b0f0bf Remove previous options when the config gets reloaded 2017-02-24 17:03:11 +03:00
Evgeniy Khramtsov 7d68112265 Start/stop virtual hosts when reloading configuration file 2017-02-23 10:12:19 +03:00
Evgeniy Khramtsov 3c4057ff55 Reload modules when reloading configuration file 2017-02-22 19:46:47 +03:00
Evgeniy Khramtsov 940ca9311d Fix some dialyzer warnings 2017-02-18 09:36:27 +03:00
Peter Lemenkov 1a2dd3680f Mark local/global config functions as deprecated
See discussion in PR #1548.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
2017-02-17 19:20:44 +03:00
Evgeniy Khramtsov d5d906184f Merge branch 'new_stream'
Conflicts:
	src/cyrsasl.erl
	src/ejabberd_c2s.erl
	src/ejabberd_cluster.erl
	src/ejabberd_frontend_socket.erl
	src/ejabberd_node_groups.erl
	src/ejabberd_router.erl
	src/mod_bosh.erl
	src/mod_ip_blacklist.erl
	src/mod_muc_mnesia.erl
	src/mod_offline.erl
	src/mod_proxy65_sm.erl
2017-01-20 19:35:46 +03:00
Evgeniy Khramtsov 02f96d0f41 Implement database backend interface for ejabberd_router 2017-01-11 16:25:43 +03:00
Evgeniy Khramtsov 08d482b064 Allow old-stype mod_vcard_ldap in the config (#1410) 2017-01-10 11:29:01 +03:00
Badlop 5fdd1c39fe Update copyright date automatically (#1442) 2017-01-02 21:42:06 +01:00
Paweł Chmielowski 769975f6d7 Remove mod_http_bind and migration code to mod_bosh 2017-01-02 15:53:25 +01:00
Evgeniy Khramtsov 309bdfbe28 Add xmpp_stream_out behaviour and rewrite s2s/SM code 2016-12-28 09:47:11 +03:00
Christophe Romain 92db9ff105 Improve handling of mnesia schema 2016-11-30 11:09:17 +01:00
Paweł Chmielowski 62db030942 Merge mod_opt_type from db sub-modules to main module mod_opt_type 2016-11-04 12:58:08 +01:00
Paweł Chmielowski 98e0123ca4 New api permissions framework 2016-10-05 13:21:11 +02:00
Paweł Chmielowski 4bd45bada7 Start elixir config code only if elixir was enabled in configure script 2016-09-08 16:29:45 +02:00
gabrielgatu 803270fc6b
Support for Elixir configuration file #1208
Contribution for Google Summer of code 2016 by Gabriel Gatu
2016-09-08 11:37:14 +02:00
Christophe Romain 7a538bb88b Enforce pathtype use with config path (#1264) 2016-09-07 17:38:35 +02:00
Evgeniy Khramtsov 71f27ee7d4 Get rid of warnings 2016-07-07 12:17:38 +03:00
Paweł Chmielowski 0737958b45 Fix compilation issues on R19 2016-07-01 21:20:10 +02:00
Paweł Chmielowski 4b9613e8fe Allow {mod_}opt_type to transform values passed to it, and for better error reporting 2016-06-21 12:25:29 +02:00
Paweł Chmielowski c55319c81e Do not call transform_terms multiple times on configs when merging them 2016-05-26 11:08:53 +02:00
Evgeniy Khramtsov 068db1a2d9 Handle Redis connection in a separate module 2016-05-09 08:36:30 +03:00
Paweł Chmielowski 53e1100cc4 Don't halt program when include_config_file is missing/can't be read 2016-05-02 14:52:23 +02:00
Evgeniy Khramtsov c585f74730 Better formatting of configuration problem log message 2016-04-28 09:03:05 +03:00
Evgeniy Khramtsov 9c369b7a8c Improve detection of databases supported by modules (#1092) 2016-04-27 17:10:50 +03:00
Evgeniy Khramtsov 52fde758b3 Get rid of "internal" DB type. This also fixes #1092 2016-04-27 09:44:32 +03:00
Evgeniy Khramtsov 1aae8a9fda Rename odbc to sql everywhere 2016-04-20 13:25:42 +03:00
Mickael Remond 67b9b82261 We need to set hosts in options to be able to retrieve 'MYHOSTS' 2016-04-06 12:59:27 +02:00
Mickael Remond a3a33bd5fc Allow running test groups independently
We need to be able to run only a few test groups, even if we do not have all
database backends installed and configured locally.

ejabberd test suite configures a specific host per backend. I changed ejabberd
to allow ignoring some hosts from config file on start, by providing the exact
list of hosts we want to start.

This is done by setting an ejabberd app Erlang environment variable 'hosts' and
passing the list of hosts we want to actually define.

When doing so, the backend specific hosts defined in ejabberd test configuration file
are simply ignored. As a result, we do not try to connect to unavailable backends.

I linked that part to CT run test by defining the hosts list based on environment variable
CT_BACKENDS. This variable is expected to be a comma separated list of available backends.

When Erlang Common Tests are run with that environment variable set, only the host matching
the name of the backend will be set, plus the default "localhost", common to many tests.

This can be combined with rebar ct groups list.

Example commands to run tests:
CT_BACKENDS=riak,mnesia rebar ct suites=ejabberd
CT_BACKENDS=mnesia rebar ct suites=ejabberd groups=mnesia
2016-03-24 10:02:13 +01:00
Elias Rohrer 8b03c0a385 Minimal auth_method ordering fix 2016-03-10 17:52:55 +01:00
Elias Rohrer 8e6a301026 Fixed type specifications for 'rebar doc'
- Fixed type @specs and -specs to remove 'rebar doc' errors
- Removed a lot of wrong and deprecated documentation in ejabberd_piefxis.erl
2016-03-07 15:06:19 +01:00
Mickael Remond 0de222d998 Convert code to use Fast YAML 2016-02-03 11:30:48 +01:00
Badlop f448ff608a Update copyright to 2016 (#901) 2016-01-13 12:29:14 +01:00
Paweł Chmielowski da45a064a8 Fix handling of some options in old style configs
This fixes issue #893.
2016-01-04 22:06:19 +01:00
Paweł Chmielowski 0a846d03bf More now() removal 2015-12-06 15:58:46 +01:00
Evgeniy Khramtsov 95265dd3ad Move JID related functions to jid.erl (#847) 2015-11-24 18:44:13 +03:00
Paweł Chmielowski b5ac0db895 Be able to merge old style configs with {listen,...} 2015-10-08 13:07:00 +02:00
Paweł Chmielowski 6d25db6600 Handler module shouldn't be used for differentiating listeners when merging configs 2015-10-07 16:45:07 +02:00
Christophe Romain 6aeb9dcb38 cosmetic cleanup 2015-10-07 14:18:38 +02:00
Paweł Chmielowski 67d3b50598 Switch macros resolving in config files to be global instead of per file 2015-10-01 14:34:48 +02:00
Christophe Romain 23a1aceac0 Improve external module configuration management (EJAB-1746) 2015-09-22 12:49:55 +02:00
Paweł Chmielowski 5593ebbbca Properly handle define_macros in merged config files 2015-09-16 12:20:07 +02:00
Badlop a50f00f9e8 Include ext_mod modules when checking accepted options (ejabberd-contrib#116) 2015-09-10 20:11:02 +02:00
Badlop 1bc2c8cbb1 Add verification of hide_sensitive_log_data global option 2015-09-02 13:46:03 +02:00
Paweł Chmielowski e24bfe7b62 Fix problem with merging same port, different ip listeners in config files
Also switch to function used by ejabberd_listener to extract that
information instead of rolling our own code for that.
2015-09-01 10:57:48 +02:00
Paweł Chmielowski 6f0ee83317 Don't overwrite listeners for different transports in config merging
Before this having listeners on same port for both tcp and udp would after
config merging step left only one of them.

Many thanks to Holger Weiß for noticing this.
2015-08-19 10:14:39 +02:00
Paweł Chmielowski c71d57a05d Handle merging of append_host_config as is done for host_config 2015-08-06 17:53:18 +02:00
Paweł Chmielowski 5a1ac4faf1 Add ability to override main config file options with data from included files 2015-08-06 17:12:15 +02:00
Paweł Chmielowski 76104cd117 Fix problem with merging values from multiple config files 2015-07-24 15:46:08 +02:00
Christophe Romain 32fc586c08 Allow contribution to include .yml or .yaml config file 2015-07-24 14:30:31 +02:00
Mickael Remond 0770252e9b Fix dialyzer warning
The function is call with binary format from ejabberd_c2s.
2015-07-05 13:33:34 +02:00
Evgeniy Khramtsov 3c12d1a960 Do not rely on behaviour info when doing config validation 2015-06-29 22:50:34 +03:00
Badlop 1cf2dfe63a New hide_sensitive_log_data option to hide client IP in log (#452 #471) 2015-06-17 11:32:42 +02:00
Evgeniy Khramtsov 9a9633dbc5 Do not ignore unknown options so far 2015-06-03 16:21:22 +03:00
Evgeniy Khramtsov fb6267f38e Add config validation at startup 2015-06-01 15:38:27 +03:00
Paweł Chmielowski 3af507cc43 Fix merging of not yaml config files 2015-05-25 15:37:46 +02:00
Holger Weiss 61afd668c2 Fix indentation 2015-05-15 15:50:43 +02:00
Paweł Chmielowski de7ff536b2 Load config snippets for modules installed with ext_mod (EJAB-1741) 2015-05-15 12:30:15 +02:00
Mickael Remond 47537aa901 Make sure Mnesia dir environment and log file are list, not binary
This is useful for Elixir configuration, as binary is the more natural data type.
Closes #514
2015-04-06 11:36:16 +02:00
Mickael Remond ea8db9967f ejabberd can be embedded in an Elixir application 2015-04-04 17:42:12 +02:00
Badlop e575f401cd Accept configuration file with .yaml extension (#290) 2015-03-04 17:18:57 +01:00
Mickaël Rémond 01e1f677c7 Add Elixir support to ejabberd 2015-02-10 17:56:44 +01:00
Holger Weiss d00f0fb1f4 Don't convert configuration values to strings 2015-02-09 01:08:01 +01:00
Badlop 87d2eb5f9a Support for "> ." in YAML configuration files 2015-01-28 17:16:10 +01:00