11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.it-ebooks.infoCHAPTER 29 • SECURING MYSQL3. The db table is examined, identifying which databases this user is allowed tointeract with. Any privileges enabled in this table apply to all tables withinthose authorized databases. If no privileges are enabled, but a matching userand host value are found, then the process jumps to Step 5. If a matching useris found, but no corresponding host value, the process moves on to Step 4.4. If a row in the db table is found to have a matching user but an empty hostvalue, the host table is then examined. If a matching host value is found in thistable, the user is assigned those privileges for that database as indicated in thehost table, and not in the db table. This is intended to allow for host-specificaccess to a specific database.5. Finally, if a user attempts to execute a command that has not been granted inthe user, db, or host tables, the tables_priv and columns_priv tables areexamined to determine whether the user is able to execute that command onthe table(s) or column(s) in question.As you may have gathered from the process breakdown, the system examines privileges by startingwith the very broad and ending with the very specific. Let’s consider a concrete example.■ Note Only as of <strong>MySQL</strong> 4.0.2 was it possible to impose maximum hourly connections, updates, and queries fora user. As of <strong>MySQL</strong> 5.0.3, it’s possible to set the maximum number of simultaneous connections for a user.Tracing a Real-World Connection RequestSuppose user jason connecting from a client host identified by internal.example.com and using thepassword secret would like to insert a new row into the widgets table, found in the company database.<strong>MySQL</strong> first determines whether jason@internal.example.com is authorized to connect to the database,and, if so, determines whether he’s allowed to execute the INSERT request. Let’s consider what happensbehind the scenes when performing both verifications:1. Does user jason@internal.example.com require a secure connection? If yes,and user jason@internal.example.com has attempted to connect without therequired security certificate, deny the request and end the authenticationprocedure. If no, proceed to Step 2.2. Determine whether the jason account has exceeded the maximum allowablenumber of hourly connections, denying the authentication procedure if so.<strong>MySQL</strong> next determines whether the maximum number of simultaneousconnections has been exceeded. If both conditions are deemed to be false,proceed to Step 3. Otherwise, deny the request.3. Does user jason@internal.example.com possess the necessary privileges toconnect to the database server? If yes, proceed to Step 4. If no, deny access.This step ends the authentication component of the privilege controlmechanism.561

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!