Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0228 fix ssl dist optfile #10043

Merged
merged 5 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/emqx
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,11 @@ else
## only one emqx node is running, get running args from 'ps -ef' output
tmp_nodename=$(echo -e "$PS_LINE" | $GREP -oE "\s\-s?name.*" | awk '{print $2}' || true)
tmp_cookie=$(echo -e "$PS_LINE" | $GREP -oE "\s\-setcookie.*" | awk '{print $2}' || true)
tmp_dist="$(echo -e "$PS_LINE" | $GREP -oE '\-ssl_dist_optfile\s.+\s' | awk '{print $2}' || true)"
SSL_DIST_OPTFILE="$(echo -e "$PS_LINE" | $GREP -oE '\-ssl_dist_optfile\s.+\s' | awk '{print $2}' || true)"
tmp_ticktime="$(echo -e "$PS_LINE" | $GREP -oE '\s\-kernel\snet_ticktime\s.+\s' | awk '{print $3}' || true)"
# data_dir is actually not needed, but kept anyway
tmp_datadir="$(echo -e "$PS_LINE" | $GREP -oE "\-emqx_data_dir.*" | sed -E 's#.+emqx_data_dir[[:blank:]]##g' | sed -E 's#[[:blank:]]--$##g' || true)"
if [ -z "$tmp_dist" ]; then
if [ -z "$SSL_DIST_OPTFILE" ]; then
tmp_proto='inet_tcp'
else
tmp_proto='inet_tls'
Expand Down Expand Up @@ -945,7 +945,7 @@ if [ -n "${EMQX_NODE_COOKIE:-}" ]; then
fi
COOKIE="${EMQX_NODE__COOKIE:-}"
COOKIE_IN_USE="$(get_boot_config 'node.cookie')"
if [ -n "$COOKIE_IN_USE" ] && [ -n "$COOKIE" ] && [ "$COOKIE" != "$COOKIE_IN_USE" ]; then
if [ "$IS_BOOT_COMMAND" != 'yes' ] && [ -n "$COOKIE_IN_USE" ] && [ -n "$COOKIE" ] && [ "$COOKIE" != "$COOKIE_IN_USE" ]; then
die "EMQX_NODE__COOKIE is different from the cookie used by $NAME"
fi
[ -z "$COOKIE" ] && COOKIE="$COOKIE_IN_USE"
Expand Down
3 changes: 3 additions & 0 deletions changes/ce/fix-10043.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed two bugs introduced in v5.0.18.
* The environment varialbe `SSL_DIST_OPTFILE` was not set correctly for non-boot commands.
* When cookie is overridden from environment variable, EMQX node is unable to start.
3 changes: 3 additions & 0 deletions changes/ce/fix-10043.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
修复 v5.0.18 引入的 2 个bug。
* 环境变量 `SSL_DIST_OPTFILE` 的值设置错误导致节点无法为 Erlang distribution 启用 SSL。
* 当节点的 cookie 从环境变量重载 (而不是设置在配置文件中时),节点无法启动的问题。
8 changes: 4 additions & 4 deletions scripts/test/start-two-nodes-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -euo pipefail
## this is why a docker network is created, and the containers's names have a dot.

# ensure dir
cd -P -- "$(dirname -- "$0")/.."
cd -P -- "$(dirname -- "$0")/../../"

IMAGE1="${1}"
IMAGE2="${2:-${IMAGE1}}"
Expand Down Expand Up @@ -94,7 +94,7 @@ backend emqx_dashboard_back
# Must use a consistent dispatch when EMQX is running on different versions
# because the js files for the dashboard is chunked, having the backends sharing
# load randomly will cause the browser fail to GET some chunks (or get bad chunks if names clash)
balance first
balance source
mode http
server emqx-1 $NODE1:18083
server emqx-2 $NODE2:18083
Expand Down Expand Up @@ -146,7 +146,7 @@ wait_for_emqx() {
container="$1"
wait_limit="$2"
wait_sec=0
while ! docker exec "$container" emqx_ctl status >/dev/null 2>&1; do
while ! docker exec "$container" emqx ctl status; do
wait_sec=$(( wait_sec + 1 ))
if [ $wait_sec -gt "$wait_limit" ]; then
echo "timeout wait for EMQX"
Expand Down Expand Up @@ -182,4 +182,4 @@ wait_for_haproxy 10

echo

docker exec $NODE1 emqx_ctl cluster join "emqx@$NODE2"
docker exec $NODE1 emqx ctl cluster join "emqx@$NODE2"