saltstack / saltstack/salt

[BUG] In state mysql_user, mysql.user_chpass is not called with password_column

Open
#65,371 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
With multiple mysql configuration, when using mysql_user.present, in case of password change needed,
the salt["mysql.user_chpass"] fonction is called.

But parameters are:
name,
host,
password,
password_hash,
allow_passwordless,
unix_socket,
**connection_args

On the use_chpass side, there is:
user,
host="localhost",
password=None,
password_hash=None,
allow_passwordless=False,
unix_socket=None,
password_column=None,
auth_plugin="mysql_native_password",
**connection_args

The "column name" is not passed, so, in case of a not global mysql connexion, the password_column field in the mysql_user.present is not taken into account.

It give a
Failed to change password for user xxxxx@yyyyyy (MySQL Error 1054: Unknown column 'Password' in 'field list')

** To fix **

Add parameter password_column and maybe auth_plugin into the call of salt["mysql.user_chpass"]

Setup
A mysql > 5.7 database with a smith account with password

smith-user-in-mysql-57:
mysql_user.present:
- name: smith
- password_column: authentication_string
- password_hash: "*A_NEW_HASH_DIFFERENT"
- host: "myhost.domain"
- allow_passwordless: False
- connection_user: "root"
- connection_pass: "MyBeautifulPassword"
- connection_host: "myDbHost"

Please be as specific as possible and give set-up details.

salt-call 3006.3 (Sulfur)

**Versions Report**

Salt Version:
Salt: 3006.3

Python Version:
Python: 3.10.13 (main, Sep 6 2023, 02:11:27) [GCC 11.2.0]

Dependency Versions:
cffi: 1.14.6
cherrypy: unknown
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.2
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.9.8
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.13.10
smmap: Not Installed
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4

System Versions:
dist: debian 11 bullseye
locale: utf-8
machine: x86_64
release: 5.10.0-22-amd64
system: Linux
version: Debian GNU/Linux 11 bullseye

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the mysql_user.present state and the mysql.user_chpass execution path described in the issue. Reproduce the Salt 3006.3 setup against MySQL 5.7 or newer with password_column set to authentication_string, then verify that changing the password no longer queries the wrong column. Done means the reported Unknown column 'Password' error is resolved and the configured password column is honored.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, python
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.