8000 Add support for SHA256 auth plugin by elemount · Pull Request #583 · PyMySQL/PyMySQL · GitHub
[go: up one dir, main page]

Skip to content

Add support for SHA256 auth plugin #583

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'master' into master
  • Loading branch information
methane authored Jun 7, 2018
commit 803bdcacb99c3d9ab588f000fde4439622a3d860
21 changes: 9 additions & 12 deletions .travis.yml
8000
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@ matrix:
- DB=mariadb:10.2
python: "2.7"
- env:
- DB=5.6.37
addons:
apt:
packages:
- libaio-dev
python: "3.3"

- DB=mariadb:10.3
python: "3.7-dev"
- env:
- DB=mysql:5.5
python: "3.5"
- env:
- DB=mysql:5.6
python: "3.6"
- env:
- DB=5.7.19
addons:
apt:
packages:
- libaio-dev
- DB=mysql:5.7
python: "3.4"
- env:
- DB=mysql:8.0
Expand Down
49 changes: 18 additions & 31 deletions .travis/initializedb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,24 @@ set -v

if [ ! -z "${DB}" ]; then
# disable existing database server in case of accidential connection
mysql -u root -e 'drop user travis@localhost; drop user root@localhost; drop user travis; create user super@localhost; grant all on *.* to super@localhost with grant option'
mysql -u super -e 'drop user root'
F=mysql-${DB}-linux-glibc2.12-x86_64
mkdir -p ${HOME}/mysql
P=${HOME}/mysql/${F}
if [ ! -d "${P}" ]; then
wget http://cdn.mysql.com/Downloads/MySQL-${DB%.*}/${F}.tar.gz -O - | tar -zxf - --directory=${HOME}/mysql
fi
if [ -f "${P}"/my.cnf ]; then
O="--defaults-file=${P}/my.cnf"
fi
if [ -x "${P}"/scripts/mysql_install_db ]; then
I=${P}/scripts/mysql_install_db
O="--defaults-file=${P}/my.cnf"
else
I=${P}/bin/mysqld
IO=" --initialize "
O="--no-defaults "
fi
${I} ${O} ${IO} --basedir=${P} --datadir=${HOME}/db-"${DB}" --log-error=/tmp/mysql.err
PWLINE=$(grep 'A temporary password is generated for root@localhost:' /tmp/mysql.err)
PASSWD=${PWLINE##* }
if [ -x ${P}/bin/mysql_ssl_rsa_setup ]; then
${P}/bin/mysql_ssl_rsa_setup --datadir=${HOME}/db-"${DB}"
fi
# sha256 password auth keys:
openssl genrsa -out "${P}"/private_key.pem 2048
openssl rsa -in "${P}"/private_key.pem -pubout -out "${P}"/public_key.pem
${P}/bin/mysqld_safe ${O} --ledir=/ --mysqld=${P}/bin/mysqld --datadir=${HOME}/db-${DB} --socket=/tmp/mysql.sock --port 3307 --innodb-buffer-pool-size=200M --lc-messages-dir=${P}/share --plugin-dir=${P}/lib/plugin/ --log-error=/tmp/mysql.err &
while [ ! -S /tmp/mysql.sock ]; do
sleep 2
sudo service mysql stop

docker pull ${DB}
docker run -it --name=mysqld -d -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 ${DB}
sleep 10

mysql() {
docker exec mysqld mysql "${@}"
}
while :
do
sleep 5
mysql -e 'select version()'
if [ $? = 0 ]; then
break
fi
echo "server logs"
docker logs --tail 5 mysqld
done

mysql -e 'select VERSION()'
Expand Down
3 changes: 2 additions & 1 deletion pymysql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def __init__(self, host=None, user=None, password="",
autocommit=False, db=None, passwd=None, local_infile=False,
max_allowed_packet=16*1024*1024, defer_connect=False,
auth_plugin_map={}, read_timeout=None, write_timeout=None,
server_public_key='', bind_address=None):
bind_address=None, binary_prefix=False, server_public_key=''):
if no_delay is not None:
warnings.warn("no_delay option is deprecated", DeprecationWarning)

Expand Down Expand Up @@ -704,6 +704,7 @@ def _config(key, arg):
if b"sha256_password" not in self._auth_plugin_map:
self._auth_plugin_map[b"sha256_password"] = _auth.SHA256PasswordPlugin
self.server_public_key = server_public_key
self._binary_prefix = binary_prefix
if defer_connect:
self._sock = None
else:
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0