Giter Club home page Giter Club logo

Comments (3)

Sylvain303 avatar Sylvain303 commented on August 30, 2024

Wouldn't leak the mysql root passwords?

Not more than in the pillar, nor in other place you may need to store it:

  • root password is stored in debconf database as well, as seen in #43
  • on debian, you can have root privileges with: mysql --defaults-file=/etc/mysql/debian.cnf mysql
  • also by restarting the mysql server without grant tables:
  • service mysql stop
  • /usr/bin/mysqld_safe --skip-grant-tables

A person who has root on that box does not necessarily know the MySQL root password:
Drawback, it exposes root password to any root shell users.

A boolean in the pillar will be required to enable this feature.

(pillar suggestion)

mysql:
  server:
    enable_root_my_cnf: True

Any security suggestion are welcome.

from mysql-formula.

Sylvain303 avatar Sylvain303 commented on August 30, 2024

Other way to fetch mysql's root password with shell root access:

for admin knowing the pillar structure can be fetched on the minion:

salt-call config.get mysql:server:root_password

Also, the following confirms that debian-sys-maint user has all privileges on debian jessie, mariadb 10.0, here is the SQL query for creating this system user:

from: /var/lib/dpkg/info/mariadb-server-10.0.postinst

    replace_query=`/bin/echo -e \
        "USE mysql;\n" \
        "SET sql_mode='';\n" \
        "REPLACE INTO user SET " \
        "  host='localhost', user='debian-sys-maint', password=password('$pass'), " \
        "  Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \
        "  Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \
        "  Process_priv='Y',  File_priv='Y', Grant_priv='Y', References_priv='Y', " \
        "  Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\
        "  Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\
        "  Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\
        "  Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\
        "  Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y',"\
        "  ssl_cipher='', x509_issuer='', x509_subject='';"`;

Which can be reseted, simply by:

GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'password from debian.cnf' WITH GRANT OPTION;

from mysql-formula.

Sylvain303 avatar Sylvain303 commented on August 30, 2024

Another case where the password is visible, and could be hidden:

salt-call -ldebug state.apply mysql.database

can output

          ID: mysql_db_0_load
    Function: cmd.wait
        Name: mysql -u root -hlocalhost -psomepass foo < /etc/mysql/foo.schema
      Result: False
     Comment: One or more requisite failed: mysql.database.mysql_db_0_schema
     Started: 
    Duration: 
     Changes:  

from mysql-formula.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.