salt icon indicating copy to clipboard operation
salt copied to clipboard

Salt does not change mysql auth plugin type

Open astehlik opened this issue 10 years ago • 3 comments

Description of Issue/Question

I have a simple mysql user salt state that should update the password of the root user:

set-mysql-root-password:
  mysql_user.present:
    - name: root
    - host: localhost
    - password: {{ rootpass }}
    - connection_pass: ""
    - unix_socket: False
    - watch:
      - pkg: install-mysql-server

The problem is, that during the installation of mysql-server on Ubuntu Xenial (16.04) the root@localhost user is created with the auth_socket authentication plugin.

This means that the password change of Salt does not really do anything. It might change the password but you still can only login via Unix Socket.

Steps to Reproduce Issue

Run state.highstate with the above state and a mysql user root@localhost present with auth plugin auth_socket.

Salt tells you everything is fine:

----------
          ID: set-mysql-root-password
    Function: mysql_user.present
        Name: root
      Result: True
     Comment: User root@localhost is already present with the desired password
     Started: 20:02:43.512921
    Duration: 16.678 ms
     Changes:   
----------

You still will not be able to login with that user / password.

Versions Report

Salt is running with salt-call in local mode.

Salt Version:
           Salt: 2016.3.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.3.7
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.12 (default, Jul  1 2016, 15:12:24)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
        machine: x86_64
        release: 4.4.0-34-generic
         system: Linux
        version: Ubuntu 16.04 xenial

astehlik avatar Aug 10 '16 18:08 astehlik

@astehlik I did some research and it looks like we would need to change the plugin and the password at the same time as documented here

So something like this: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';

I'm thinking it might be a good option to add an option to specify a plugin to use.

Ch3LL avatar Aug 12 '16 16:08 Ch3LL

Bumping. Sure would be nice to be able to lock down the password without having to resort to other trickery.

cmarzullo avatar Mar 10 '17 16:03 cmarzullo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Sep 14 '18 22:09 stale[bot]