24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-22 22:23:42 +02:00
Commit Graph

5028 Commits

Author SHA1 Message Date
Evgeniy Khramtsov
87357c700f Do not ignore a certificate containing no domain names
Log a warning instead and assign it to an "empty" domain
2018-06-27 11:27:39 +03:00
Evgeniy Khramtsov
7881c5670c Don't replace valid certificates with invalid ones
When building the certificates chains, if several certificates
are found matching the same domain their validity is checked:

* the invalid one is ignored and the valid one is picked
* if both are valid or both are invalid, then the one with
  sooner expiration is ignored.

Fixes #2454
2018-06-27 10:55:37 +03:00
Evgeniy Khramtsov
881e02632b Improve error formatting in mod_http_upload 2018-06-26 19:32:29 +03:00
Evgeniy Khramtsov
47d117c1bf Support SASL PLAIN by xmpp_stream_out
Also, SASL mechanisms chaining is now supported:
if several mechanisms are supported and authentication
fails, next mechanism in the list is picked, until the
list is exhausted. In the case of a failure, the latest
SASL failure reason is returned within handle_auth_failure/3
callback.
2018-06-25 19:16:33 +03:00
Evgeniy Khramtsov
cf6f540d53 Don't pass sockmod to xmpp_stream_out 2018-06-25 15:28:02 +03:00
Evgeniy Khramtsov
557e6ecdd0 Introduce resolve/2 and connect_options/3 callbacks for xmpp_stream_out 2018-06-25 15:19:49 +03:00
Evgeniy Khramtsov
5dd3f4c22b Allow gen_server process registration 2018-06-25 14:55:33 +03:00
Evgeniy Khramtsov
e7c3b57b8b Allow reconnecting from disconnected state 2018-06-25 14:52:33 +03:00
Evgeniy Khramtsov
c907915695 Intercept EXIT signal 2018-06-25 14:46:31 +03:00
Evgeniy Khramtsov
911ed4a7ca Add Resource Binding support to xmpp_stream_out 2018-06-25 13:50:35 +03:00
Evgeniy Khramtsov
499ae96254 Don't use 'unsupported-version' inside SM <failed/> element
This error condition is defined within stream errors, however,
XEP-0198 says:

> This element SHOULD contain an error condition, which MUST
> be one of the **stanza** error conditions defined in RFC 6120.
2018-06-25 09:56:44 +03:00
Evgeniy Khramtsov
ac31c85866 Use error formatting functions from xmpp library 2018-06-25 09:45:45 +03:00
Evgeniy Khramtsov
c4c91cc956 Generate SASL failures on unencrypted connections only for s2s 2018-06-23 20:31:01 +03:00
Evgeniy Khramtsov
6ffb120fce Fix typo 2018-06-21 15:14:19 +03:00
Evgeniy Khramtsov
55f8aa1b22 Add new options for OOM watchdog
* oom_watermark: 1..100
  Start OOM watchdog only when system memory usage exceeds
  this value in percents. When the usage drops below the value,
  OOM watchdog is stopped. The default is 80 (percents).
  Note that once OOM watchdog is started, it performs full garbage
  collection periodically: this can be seen as spikes in CPU
  utilization and drops in RAM usage. If your system is permanently
  above the watermark, it may cause significant CPU overhead.

* oom_queue: positive integer
  Only trigger OOM killer when total amount of messages in all queues
  of all Erlang processes is above this value. The default is 10000.
  Note that this value only takes effect when `oom_killer` is set
  to `true` (this is the default). Otherwise, only a warning will
  be logged.
2018-06-21 14:35:19 +03:00
Paweł Chmielowski
274e9fe7b5 Guard against pres_last=undefined in mod_offline 2018-06-20 12:16:10 +02:00
Evgeniy Khramtsov
9e83c45b3c Restore forgotten translations from previous commit 2018-06-20 12:50:36 +03:00
Evgeniy Khramtsov
446e6e6f3b Update ejabberd.pot 2018-06-20 12:32:10 +03:00
Evgeniy Khramtsov
3a5d2dbed8 Move mod_irc to ejabberd-contrib 2018-06-20 12:27:44 +03:00
Holger Weiss
23cc0f8c3c mod_push: Include a static body text by default
Set the 'include_body' option to a static text by default.  Some app
servers check for the presence of a 'last-message-body' field to
distinguish between notifications generated for actual chat messages and
notifications triggered by other types of traffic.
2018-06-19 23:12:27 +02:00
Holger Weiss
81f4dd0e6a mod_push_keepalive: Increase default timeout
Set the default session timeout to three days.  This way, sessions will
survive a weekend without traffic, for example.
2018-06-19 22:26:08 +02:00
Paweł Chmielowski
dee3081df1 Fix reset_stream in websocket using pre-rfc protocol 2018-06-19 17:51:09 +02:00
Evgeniy Khramtsov
6acac7c93f Render roomname, allowinvites and allowpm in room disco#info 2018-06-19 14:02:45 +03:00
Holger Weiss
c2f664f941 mod_push_mnesia: Simplify record matching
Omit record fields that aren't used for matching.
2018-06-18 23:12:27 +02:00
Holger Weiss
75127a0deb mod_push_mnesia: Fix lookup of all host sessions 2018-06-18 23:05:08 +02:00
Holger Weiss
bb76da03ea mod_mam: Don't replace existing stanza ID
Preserve the original stanza ID for resent messages.  This avoids
storing duplicates in the MAM archive.
2018-06-16 00:43:22 +02:00
Paweł Chmielowski
3099702039 New shaper implementation 2018-06-15 11:56:46 +02:00
Badlop
3ec623f329 Make connected_users_info and user_sessions_info DB-agnostic (#2448)
The result returned by connected_users_info command has changed,
and is now similar to the result of user_sessions_info.

Notice that num_active_users and process_rosteritems still require Mnesia.
2018-06-15 11:28:57 +02:00
Evgeniy Khramtsov
6c323b729b Improve type spec 2018-06-14 19:51:50 +03:00
Evgeniy Khramtsov
17b05ff4b7 Get rid of all calls to jlib.erl module 2018-06-14 19:49:27 +03:00
Evgeniy Khramtsov
7b04a625be Get rid of jlib.hrl/jlib.erl 2018-06-14 19:11:43 +03:00
Evgeniy Khramtsov
49b08949b1 Do not check for deprecated types
Since we support only Erlang >= OTP-17.5, the check for old-style
dict/queue/etc types is no longer needed
2018-06-14 18:58:35 +03:00
Evgeniy Khramtsov
fd8e07af47 Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse.
Some stuff is moved into scram.hrl and type_compat.hrl.
All macros have been replaced with the corresponding function calls.

TODO: probably type_compat.hrl is not even needed anymore since
we support only Erlang >= OTP 17.5
2018-06-14 14:00:47 +03:00
Evgeniy Khramtsov
c3c75affa9 Log modules startup 2018-06-14 10:18:10 +03:00
Holger Weiss
85f09b365f mod_push: Omit summary for outgoing messages
Don't include a urn:xmpp:push:summary form in push notifications that
are triggered by outgoing messages.  App servers might use the form
fields to generate user-visible notifications directly (as opposed to
just waking the client app).  This is usually not desired for outgoing
messages.
2018-06-13 21:43:40 +02:00
Evgeniy Khramtsov
645f11d79d Advertise disco#info and disco#items features in mod_disco
Fixes #2470
2018-06-13 14:55:06 +03:00
Holger Weiss
0a20e45690 mod_push: Further improve handling of carbons
Also check for carbon-copied messages (with a body) in the queue of
unacknowledged stanzas.
2018-06-13 00:25:14 +02:00
Holger Weiss
0a9f522222 mod_push: Also include sender/body for carbons
If the 'include_sender' and/or 'include_body' options are specified,
also include a urn:xmpp:push:summary form in push notifications that are
generated for carbon-copied messages (with a body).
2018-06-12 22:47:23 +02:00
Evgeniy Khramtsov
6f481e3ceb Avoid lager crash on external authentication failure
Fixes #2463
2018-06-08 09:51:26 +03:00
Paweł Chmielowski
40185b6bd3 Add ability to modify version string 2018-06-07 15:38:33 +02:00
Holger Weiss
a4049d9418 Omit 'xmlns' field from 'feature_csi' record
The 'xmpp' library has been updated to omit the 'xmlns' field from the
'feature_csi' record.
2018-06-04 23:05:11 +02:00
Holger Weiss
ba30ac8ce8 Return detailed error if HTTP upload is too large
If the file size specified in an HTTP upload slot request exceeds the
the configured maximum size, include the limit with the stanza error.
2018-06-04 22:18:56 +02:00
Evgeniy Khramtsov
43c3134f55 Also format gracefully errors returned during module reload 2018-06-03 18:53:30 +03:00
Paweł Chmielowski
67fc2015de Fix problem in commit 548ef7b835 2018-06-01 18:36:39 +02:00
Paweł Chmielowski
548ef7b835 Don't crash in bosh when we receive request with RID < prev_rid 2018-06-01 16:12:22 +02:00
Evgeniy Khramtsov
4337300fce Always display room's xdata in disco#info 2018-06-01 09:07:16 +03:00
Evgeniy Khramtsov
cab8005bf3 Display muc#roomconfig_changesubject in room's disco#info
Fixes #2449
2018-06-01 08:56:56 +03:00
Evgeniy Khramtsov
4fc8d1c4a4 Send trailer and close socket explicitly on stream end 2018-06-01 07:58:03 +03:00
Evgeniy Khramtsov
1261502f6a Improve indentation 2018-05-30 22:53:34 +03:00
Holger Weiss
dacba3ec00 Merge remote-tracking branch 'processone/pr/2446'
* processone/pr/2446:
  Fix authentication for usernames containing uppercase characters
2018-05-30 20:53:11 +02:00
Stu Tomlinson
4f8af723c6 Fix authentication for usernames containing uppercase characters
Applies to authentication methods that compare User (normalized)
and AuthzId (was not being normalized). These are external, ldap & pam.

Fixes #2280
2018-05-30 18:43:26 +01:00
Evgeniy Khramtsov
5e446d50a8 Get rid of direct calls to 'session' Mnesia table
Fixes #2439
2018-05-30 19:21:56 +03:00
Evgeniy Khramtsov
0f9db50c8d Support for roomconfig_lang/roominfo_lang
Now room owners are able to set a preferred language
for the discussions in the room, so other users can
discover rooms based on the language they wish to talk.

TODO: the language format should conform to RFC 5646.
      This check should be implemented in 'xmpp' library.

Fixes #2436
2018-05-30 08:11:58 +03:00
Evgeniy Khramtsov
52b8226671 Use 'list-multi' type for XEP-0157 xdata fields
Thanks to Jonas Wielicki for spotting this
2018-05-29 19:37:24 +03:00
Evgeniy Khramtsov
0381ce1e75 Better report errors of module startup 2018-05-28 09:19:49 +03:00
Evgeniy Khramtsov
fc77051b68 Don't call Mod:function() in xmpp_stream callbacks
If a callback function is not defined by the `Mod` then
a call to code_server process is performed. Under heavy load
this may cause code_server to get overloaded. We now avoid this.
2018-05-26 09:06:24 +03:00
Holger Weiss
bfe2545c01 mod_muc_sql: Fix export to SQL
The "host" column is supposed to hold the MUC host name.
2018-05-24 01:28:29 +02:00
Holger Weiss
c6a9c30f1c mod_push_mnesia: Apply cosmetic changes
Improve the readability of the 'max_user_sessions' check.
2018-05-23 21:40:54 +02:00
Holger Weiss
508f3ef88d mod_push_sql: Check 'max_user_sessions' limit
Remove the oldest push session(s) of a user if the number of enabled
sessions exceeds the 'max_user_sessions' limit.
2018-05-23 20:02:52 +02:00
Paweł Chmielowski
97f7d99007 Handle "Expect: 100-continue" request header in ejabberd_http 2018-05-23 14:52:47 +02:00
Rogério da Silva Yokomizo
4a4cc32650 Export ext_mod:add_sources/1 2018-05-22 16:16:13 +02:00
Evgeniy Khramtsov
d2114be6f3 Correctly calculate remaining bytes on file upload 2018-05-19 18:29:33 +03:00
Christophe Romain
db51d522e8 Add support for REST API custom headers
ext_api_headers can be defined as a single string. Headers are separated
by comma. Definition MUST NOT contain spaces. Example
"X-MyHead:test,X-Token:082748"
2018-05-17 14:47:21 +02:00
Evgeniy Khramtsov
b64e1d95d2 Fix typo file:read() -> file:open() 2018-05-17 12:00:06 +03:00
Paweł Chmielowski
c41bab9ca0 Clean state between requests in ejabberd_http 2018-05-15 14:25:19 +02:00
Evgeniy Khramtsov
063737e4f5 Optimize HTTP requests memory usage
Due to historical reasons, ejabberd loads the whole file/data
into the memory when serving an HTTP request. This is now improved:

1) For GET requests ejabberd uses sendfile(2) if the underlying
   connection is HTTP and falls back to read/write loop with 64kb
   buffer for HTTPS connections. This type of requests are handled
   by mod_http_fileserver, mod_http_upload, ejabberd_captcha, etc
2) POST requests are now limited to 20Mb and are fully downloaded
   into the memory for further processing (by ejabberd_web_admin,
   mod_bosh, etc)
3) PUT requests (e.g. for mod_http_upload) are handled by read/write
   loop with 64kb buffer
2018-05-14 19:39:58 +03:00
Badlop
cb3bb710bd Handle muc_register_nick success correctly (#2415) 2018-05-14 12:24:56 +02:00
Evgeniy Khramtsov
c30715e67b Disable thumbnails creation by default 2018-05-11 18:56:31 +03:00
Evgeniy Khramtsov
27594db029 Support IPv6 connections for PostgreSQL, MySQL and LDAP
Fixes #2411
2018-05-11 16:43:49 +03:00
Paweł Chmielowski
6ac8f6eaee Relax check for valid command name in access_persmissions 2018-05-11 12:24:00 +02:00
Evgeniy Khramtsov
35a076c251 Stop ejabberd initialization on invalid/unknown options
Since now, ejabberd doesn't ignore unknown options and doesn't
allow to have options with malformed values. The rationale for
this is to avoid unexpected behaviour during runtime, i.e. to
conform to "fail early" approach. Note that it's safe to reload
a configuration with potentialy invalid and/or unknown options:
this will not halt ejabberd, but will only prevent the configuration
from loading.

***NOTE FOR PACKAGE BUILDERS***
This new behaviour should be documented in the upgrade notes.
2018-05-09 11:44:24 +03:00
Evgeniy Khramtsov
680384c342 Reduce IQ handler code copying 2018-05-09 10:30:00 +03:00
Evgeniy Khramtsov
11ff2a1ccf Fix a typo 2018-05-09 09:44:26 +03:00
Badlop
de85c1718e Bypass account creation error when password is empty, caused by extauth 2018-05-08 18:19:07 +02:00
Evgeniy Khramtsov
8766854870 Get rid of ?FUNCTION_NAME macro (it's OTP19+ feature) 2018-05-08 12:06:58 +03:00
Evgeniy Khramtsov
61ae0ff02c Improve logging of external authentication failures 2018-05-08 09:36:34 +03:00
Evgeniy Khramtsov
5522403e8e Don't stop on out-of-date requests 2018-05-07 22:43:01 +03:00
Evgeniy Khramtsov
b23d5754e8 Improve robustness of external authentication backends
Now all external ports are attached to supervising processes
and requests are balanced in round-robin manner until the pool
is exhausted.

The commit also deprecates `extauth_instances` option and introduces
`extauth_pool_size` option instead, with the default value of a number
of logical processors (i.e. CPU cores).

Fixes #2403
2018-05-07 19:27:18 +03:00
Paweł Chmielowski
b1a03cc346 Make trusted_proxied ejabberd_http option accept ip masks 2018-05-04 09:53:07 +02:00
Paweł Chmielowski
ca94cbfd31 Teach acl ip matching about ipv4 mapped ipv6 addresses 2018-05-04 09:52:06 +02:00
Holger Weiss
410db89167 ejabberd_auth: Don't use cache if it's disabled
Don't let the check whether a user exists use the cache if caching was
disabled in the configuration.
2018-05-03 00:31:33 +02:00
Holger Weiss
638f2d2e67 mod_blocking: Use #block_item{} record 2018-05-02 22:17:32 +02:00
Evgeniy Khramtsov
4ea481d1dd Add validator for 'accept_interval' listening option 2018-04-30 11:52:00 +03:00
Holger Weiss
538e0d4844 misc: Catch all Base64 decoding errors 2018-04-24 18:29:10 +02:00
Holger Weiss
f3795e9d03 mod_http_upload: Add MIME type for M4A files 2018-04-24 18:16:16 +02:00
Christophe Romain
3df919244c PubSub purge_node must use a transaction (#2231) 2018-04-24 15:58:56 +02:00
Evgeniy Khramtsov
6774418a7f Introduce new mod_muc option: access_register
The option is an ACL rule defining who is able to register
nicknames within the conference service. The default is `all`
(for backward compatibility).
2018-04-24 12:29:59 +03:00
Evgeniy Khramtsov
ad6fcc7865 Get rid of useless memory/disk usage warnings 2018-04-24 12:12:48 +03:00
Evgeniy Khramtsov
ca28faa51a Fix get_affiliation/2 2018-04-24 12:07:10 +03:00
Paweł Chmielowski
5b730cdbf2 Use httpc directly instead of using p1_http wrapper 2018-04-23 17:40:44 +02:00
Paweł Chmielowski
9ed0357760 Use correct headers in rest calls 2018-04-23 12:29:56 +02:00
Evgeniy Khramtsov
06ce884aa8 Add stubs for affiliation-specific backend callbacks 2018-04-23 11:35:43 +03:00
Paweł Chmielowski
3fc0eb4f5b Use correct db backend for remove_mam_for_user_with_peer 2018-04-20 14:06:23 +02:00
Paweł Chmielowski
3bfa683586 Fix mnesia call in mam archive management function 2018-04-20 13:36:54 +02:00
Paweł Chmielowski
5be49cc0fa Add commands for cleaning up mam archive 2018-04-20 13:27:46 +02:00
Christophe Romain
42c029d5f7 Fix type of rest:url/2 2018-04-19 13:21:33 +02:00
Christophe Romain
a567abcfdf Fix deprecated call injected by 265c7b62 2018-04-18 14:16:56 +02:00
Christophe Romain
265c7b62c7 Add flexibility on rest url config 2018-04-18 13:16:08 +02:00
Holger Weiss
332567693c mod_push_keepalive: Reset timeout on messages only
Some mobile apps might only be notified on actual chat messages with
a body, so don't let mod_push_keepalive reset the stream management
timeout on other types of traffic.
2018-04-17 00:27:07 +02:00
Holger Weiss
de7dc4affa mod_push: Optionally include message sender/body
Add 'include_sender' and 'include_body' options.  If one or both of them
are set to 'true', a urn:xmpp:push:summary form with the enabled
field(s) is included in push notifications that are generated for
messages with a body.

The 'include_body' option can instead be set to a static text.  In this
case, the specified text will be included in place of the actual message
body.  This can be useful to signal the push service whether the
notification was triggered by a message with body (as opposed to other
types of traffic) without leaking actual message contents.
2018-04-16 23:18:03 +02:00