Skip to content

Commit

Permalink
Refs codership/mysql-wsrep#141: this commit
Browse files Browse the repository at this point in the history
  1. Passes wsrep_sst_auth_value to SST scripts via WSREP_SST_OPT_AUTH envronmental variable, so it never appears on the command line
  2. In mysqldump and xtrabackup* SST scripts which rely on MySQL authentication, instead of passing password on the command line, SST script sets MYSQL_PWD environment variable, so that password also never appears on the mysqldump/innobackupex command line.
  • Loading branch information
ayurchen authored and Nirbhay Choubey committed Sep 10, 2015
1 parent 197e9d2 commit 86ee30c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/wsrep_sst_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ readonly WSREP_SST_OPT_AUTH
if ! wsrep_auth_not_set
then
readonly AUTH_VEC=(${WSREP_SST_OPT_AUTH//:/ })
WSREP_SST_OPT_USER="${AUTH_VEC[0]:-}"
WSREP_SST_OPT_PSWD="${AUTH_VEC[1]:-}"
[ -n "${AUTH_VEC[0]}" ] && WSREP_SST_OPT_USER="${AUTH_VEC[0]}"
[ -n "${AUTH_VEC[1]}" ] && WSREP_SST_OPT_PSWD="${AUTH_VEC[1]}"
fi
readonly WSREP_SST_OPT_USER
readonly WSREP_SST_OPT_PSWD
Expand Down
11 changes: 11 additions & 0 deletions scripts/wsrep_sst_mysqldump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ fi
# word, it is arguably more secure than passing password on the command line.
[ -n "$WSREP_SST_OPT_PSWD" ] && export MYSQL_PWD="$WSREP_SST_OPT_PSWD"

# Refs https://github.com/codership/mysql-wsrep/issues/141
# Passing password in MYSQL_PWD environment variable is considered
# "extremely insecure" by MySQL Guidelines for Password Security
# (https://dev.mysql.com/doc/refman/5.6/en/password-security-user.html)
# that is even less secure than passing it on a command line! It is doubtful:
# the whole command line is easily observable by any unprivileged user via ps,
# whereas (at least on Linux) unprivileged user can't see process environment
# that he does not own. So while it may be not secure in the NSA sense of the
# word, it is arguably more secure than passing password on the command line.
[ -n "$WSREP_SST_OPT_PSWD" ] && export MYSQL_PWD="$WSREP_SST_OPT_PSWD"

STOP_WSREP="SET wsrep_on=OFF;"

# mysqldump cannot restore CSV tables, fix this issue
Expand Down
5 changes: 3 additions & 2 deletions sql/wsrep_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,10 @@ env::append(const char* val)
++len_;
env_[len_] = NULL;
}
else errno_ = errno;
}
else errno_ = errno;

/* if either realloc() or strdup() failed, errno had been set */
errno_ = errno;

return errno_;
}
Expand Down

0 comments on commit 86ee30c

Please sign in to comment.