%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/auth/ |
Current File : //usr/lib/python2.7/site-packages/salt/auth/mysql.pyo |
� ���^c @@ s d Z d d l m Z m Z m Z d d l Z e j e � Z y8 d d l Z d d l Z d d l Z d d l m Z Wny e k r� yN d d l Z e j � d d l Z d d l Z d d l Z d d l m Z Wq� e k r� d Z q� Xn Xd � Z d � Z d � Z d S( u Provide authentication using MySQL. When using MySQL as an authentication backend, you will need to create or use an existing table that has a username and a password column. To get started, create a simple table that holds just a username and a password. The password field will hold a SHA256 checksum. .. code-block:: sql CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(25) DEFAULT NULL, `password` varchar(70) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; To create a user within MySQL, execute the following statement. .. code-block:: sql INSERT INTO users VALUES (NULL, 'diana', SHA2('secret', 256)) .. code-block:: yaml mysql_auth: hostname: localhost database: SaltStack username: root password: letmein auth_sql: 'SELECT username FROM users WHERE username = "{0}" AND password = SHA2("{1}", 256)' The `auth_sql` contains the SQL that will validate a user to ensure they are correctly authenticated. This is where you can specify other SQL queries to authenticate users. Enable MySQL authentication. .. code-block:: yaml external_auth: mysql: damian: - test.* :depends: - MySQL-python Python module i ( t absolute_importt print_functiont unicode_literalsN( t OperationalErrorc C@ s"