aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2014-06-01 14:20:09 +0400
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2014-06-01 14:20:09 +0400
commit9a0d77571d5bc6c1a6303e075ebab822d963fe1f (patch)
tree722f1bd619c47d21d4d3fea477b15de8717d7216 /src
parentSign 'Record-Route' in order to proxy unauthorized ACKs (diff)
Add global static shared_key option
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_config.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl
index 06db8b569..c0b78d9ba 100644
--- a/src/ejabberd_config.erl
+++ b/src/ejabberd_config.erl
@@ -68,8 +68,15 @@ start() ->
%% This start time is used by mod_last:
{MegaSecs, Secs, _} = now(),
UnixTime = MegaSecs*1000000 + Secs,
+ SharedKey = case erlang:get_cookie() of
+ nocookie ->
+ p1_sha:sha(randoms:get_string());
+ Cookie ->
+ p1_sha:sha(jlib:atom_to_binary(Cookie))
+ end,
State1 = set_option({node_start, global}, UnixTime, State),
- set_opts(State1).
+ State2 = set_option({shared_key, global}, SharedKey, State1),
+ set_opts(State2).
%% @doc Get the filename of the ejabberd configuration file.
%% The filename can be specified with: erl -config "/path/to/ejabberd.yml".