Skip to content

Commit 5cb5592

Browse files
committed
Apply changes from upstream ejabberd 24.07
1 parent e7ff12e commit 5cb5592

File tree

3 files changed

+159
-69
lines changed

3 files changed

+159
-69
lines changed

ecs/bin/ejabberdctl

100755100644
Lines changed: 71 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# define default configuration
44
POLL=true
5-
SMP=enable
65
ERL_MAX_PORTS=32000
76
ERL_PROCESSES=250000
87
ERL_MAX_ETS_TABLES=1400
@@ -95,9 +94,12 @@ ERL_CRASH_DUMP="$LOGS_DIR"/erl_crash_$(date "+%Y%m%d-%H%M%S").dump
9594
ERL_INETRC="$ETC_DIR"/inetrc
9695

9796
# define ejabberd parameters
98-
EJABBERD_OPTS="$EJABBERD_OPTS\
99-
$(sed '/^log_rotate_size/!d;s/:[ \t]*\([0-9]\{1,\}\).*/ \1/;s/:[ \t]*\(infinity\).*/ \1/;s/^/ /' "$EJABBERD_CONFIG_PATH")\
100-
$(sed '/^log_rotate_count/!d;s/:[ \t]*\([0-9]*\).*/ \1/;s/^/ /' "$EJABBERD_CONFIG_PATH")"
97+
EJABBERD_OPTS="\
98+
$(sed '/^log_rotate_size/!d;s/:[ \t]*\([0-9]\{1,\}\).*/ \1/;s/:[ \t]*\(infinity\).*/ \1 /;s/^/ /' "$EJABBERD_CONFIG_PATH")\
99+
$(sed '/^log_rotate_count/!d;s/:[ \t]*\([0-9]*\).*/ \1 /;s/^/ /' "$EJABBERD_CONFIG_PATH")\
100+
$(sed '/^log_burst_limit_count/!d;s/:[ \t]*\([0-9]*\).*/ \1 /;s/^/ /' "$EJABBERD_CONFIG_PATH")\
101+
$(sed '/^log_burst_limit_window_time/!d;s/:[ \t]*\([0-9]*[a-z]*\).*/ \1 /;s/^/ /' "$EJABBERD_CONFIG_PATH")\
102+
$EJABBERD_OPTS"
101103
[ -n "$EJABBERD_OPTS" ] && EJABBERD_OPTS="-ejabberd $EJABBERD_OPTS"
102104
EJABBERD_OPTS="-mnesia dir \"$SPOOL_DIR\" $MNESIA_OPTIONS $EJABBERD_OPTS -s ejabberd"
103105

@@ -148,14 +150,6 @@ exec_iex()
148150
# usage
149151
debugwarning()
150152
{
151-
if [ "$OSTYPE" != "cygwin" ] && [ "$OSTYPE" != "win32" ] ; then
152-
if [ "a$TERM" = "a" ] || [ "$TERM" = "dumb" ] ; then
153-
echo "Terminal type not supported."
154-
echo "You may have to set the TERM environment variable to fix this."
155-
exit 8
156-
fi
157-
fi
158-
159153
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
160154
echo "--------------------------------------------------------------------"
161155
echo ""
@@ -169,11 +163,13 @@ debugwarning()
169163
echo "To exit and detach this shell from ejabberd, press:"
170164
echo " control+g and then q"
171165
echo ""
166+
#vt100 echo "Please do NOT use control+c in this debug shell !"
167+
#vt100 echo ""
172168
echo "--------------------------------------------------------------------"
173169
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
174170
echo " EJABBERD_BYPASS_WARNINGS=true"
175171
echo "Press return to continue"
176-
read -r input
172+
read -r _
177173
echo ""
178174
fi
179175
}
@@ -196,8 +192,41 @@ livewarning()
196192
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
197193
echo " EJABBERD_BYPASS_WARNINGS=true"
198194
echo "Press return to continue"
199-
read -r input
195+
read -r _
196+
echo ""
197+
fi
198+
}
199+
200+
check_etop_result()
201+
{
202+
result=$?
203+
if [ $result -eq 1 ] ; then
200204
echo ""
205+
echo "It seems there was some problem running 'ejabberdctl etop'."
206+
echo "Is the error message something like this?"
207+
echo " Failed to load module 'etop' because it cannot be found..."
208+
echo "Then probably ejabberd was compiled with development tools disabled."
209+
echo "To use 'etop', recompile ejabberd with: ./configure --enable-tools"
210+
echo ""
211+
exit $result
212+
fi
213+
}
214+
215+
check_iex_result()
216+
{
217+
result=$?
218+
if [ $result -eq 127 ] ; then
219+
echo ""
220+
echo "It seems there was some problem finding 'iex' binary from Elixir."
221+
echo "Probably ejabberd was compiled with Rebar3 and Elixir disabled, like:"
222+
echo " ./configure"
223+
echo "which is equivalent to:"
224+
echo " ./configure --with-rebar=rebar3 --disable-elixir"
225+
echo "To use 'iex', recompile ejabberd enabling Elixir or using Mix:"
226+
echo " ./configure --enable-elixir"
227+
echo " ./configure --with-rebar=mix"
228+
echo ""
229+
exit $result
201230
fi
202231
}
203232

@@ -229,15 +258,34 @@ help()
229258
}
230259

231260
# dynamic node name helper
232-
uid()
233-
{
234-
uuid=$(uuidgen 2>/dev/null)
235-
[ -z "$uuid" ] && [ -f /proc/sys/kernel/random/uuid ] && uuid=$(cat /proc/sys/kernel/random/uuid)
236-
[ -z "$uuid" ] && uuid=$(printf "%X" "${RANDOM:-$$}$(date +%M%S)")
237-
uuid=$(printf '%s' $uuid | sed 's/^\(...\).*$/\1/')
238-
[ $# -eq 0 ] && echo "${uuid}-${ERLANG_NODE}"
239-
[ $# -eq 1 ] && echo "${uuid}-${1}-${ERLANG_NODE}"
240-
[ $# -eq 2 ] && echo "${uuid}-${1}@${2}"
261+
uid() {
262+
ERTSVERSION="$("$ERL" -version 2>&1 | sed 's|.*\([0-9][0-9]\).*|\1|g')"
263+
if [ $ERTSVERSION -lt 11 ] ; then # otp 23.0 includes erts 11.0
264+
# Erlang/OTP lower than 23, which doesn's support dynamic node code
265+
N=1
266+
PF=$(( $$ % 97 ))
267+
while
268+
case $# in
269+
0) NN="${PF}-${N}-${ERLANG_NODE}"
270+
;;
271+
1) NN="${PF}-${N}-${1}-${ERLANG_NODE}"
272+
;;
273+
2) NN="${PF}-${N}-${1}@${2}"
274+
;;
275+
esac
276+
N=$(( N + 1 + ( $$ % 5 ) ))
277+
"$EPMD" -names 2>/dev/null | grep -q " ${NN%@*} "
278+
do :; done
279+
echo $NN
280+
else
281+
# Erlang/OTP 23 or higher: use native dynamic node code
282+
# https://www.erlang.org/patches/otp-23.0#OTP-13812
283+
if [ "$ERLANG_NODE" != "${ERLANG_NODE%.*}" ]; then
284+
echo "undefined@${ERLANG_NODE#*@}"
285+
else
286+
echo "undefined"
287+
fi
288+
fi
241289
}
242290

243291
# stop epmd if there is no other running node

ecs/conf/ejabberd.yml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
hosts:
1818
- localhost
1919

20-
loglevel: 4
20+
loglevel: info
2121
log_rotate_size: 10485760
2222
log_rotate_date: ""
2323
log_rotate_count: 1
@@ -49,25 +49,26 @@ listen:
4949
ip: "::"
5050
module: ejabberd_s2s_in
5151
max_stanza_size: 524288
52+
shaper: s2s_shaper
5253
-
5354
port: 5443
5455
ip: "::"
5556
module: ejabberd_http
5657
tls: true
5758
request_handlers:
58-
"/admin": ejabberd_web_admin
59-
"/api": mod_http_api
60-
"/bosh": mod_bosh
61-
"/captcha": ejabberd_captcha
62-
"/upload": mod_http_upload
63-
"/ws": ejabberd_http_ws
64-
"/oauth": ejabberd_oauth
59+
/admin: ejabberd_web_admin
60+
/api: mod_http_api
61+
/bosh: mod_bosh
62+
/captcha: ejabberd_captcha
63+
/upload: mod_http_upload
64+
/ws: ejabberd_http_ws
65+
/oauth: ejabberd_oauth
6566
-
6667
port: 5280
6768
ip: "::"
6869
module: ejabberd_http
6970
request_handlers:
70-
"/admin": ejabberd_web_admin
71+
/admin: ejabberd_web_admin
7172
-
7273
port: 1883
7374
ip: "::"
@@ -156,22 +157,25 @@ access_rules:
156157

157158
api_permissions:
158159
"console commands":
159-
from:
160-
- ejabberd_ctl
160+
from: ejabberd_ctl
161161
who: all
162162
what: "*"
163+
"webadmin commands":
164+
from: ejabberd_web_admin
165+
who: admin
166+
what: "*"
163167
"admin access":
164168
who:
165169
access:
166170
allow:
167-
acl: loopback
168-
acl: admin
171+
- acl: loopback
172+
- acl: admin
169173
oauth:
170174
scope: "ejabberd:admin"
171175
access:
172176
allow:
173-
acl: loopback
174-
acl: admin
177+
- acl: loopback
178+
- acl: admin
175179
what:
176180
- "*"
177181
- "!stop"
@@ -184,8 +188,10 @@ api_permissions:
184188
- connected_users_number
185189

186190
shaper:
187-
normal: 1000
188-
fast: 50000
191+
normal:
192+
rate: 3000
193+
burst_size: 20000
194+
fast: 100000
189195

190196
shaper_rules:
191197
max_user_sessions: 10
@@ -220,14 +226,18 @@ modules:
220226
mod_http_api: {}
221227
mod_http_upload:
222228
put_url: https://@HOST@:5443/upload
229+
custom_headers:
230+
"Access-Control-Allow-Origin": "https://@HOST@"
231+
"Access-Control-Allow-Methods": "GET,HEAD,PUT,OPTIONS"
232+
"Access-Control-Allow-Headers": "Content-Type"
223233
mod_last: {}
224234
mod_mam:
225235
## Mnesia is limited to 2GB, better to use an SQL backend
226236
## For small servers SQLite is a good fit and is very easy
227237
## to configure. Uncomment this when you have SQL configured:
228238
## db_type: sql
229239
assume_mam_usage: true
230-
default: never
240+
default: always
231241
mod_mqtt: {}
232242
mod_muc:
233243
access:
@@ -240,7 +250,7 @@ modules:
240250
- allow
241251
default_room_options:
242252
allow_subscription: true # enable MucSub
243-
mam: false
253+
mam: true
244254
mod_muc_admin: {}
245255
mod_offline:
246256
access_max_user_messages: max_user_offline_messages

0 commit comments

Comments
 (0)