<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MySQL Preacher &#187; privileges</title>
	<atom:link href="http://mysqlpreacher.com/wordpress/tag/privileges/feed/" rel="self" type="application/rss+xml" />
	<link>http://mysqlpreacher.com/wordpress</link>
	<description>Because Sharing is Caring</description>
	<lastBuildDate>Tue, 31 Aug 2010 18:12:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Securich &#8211; The MySQL Security Package step by step run through</title>
		<link>http://mysqlpreacher.com/wordpress/2009/06/securich-the-mysql-security-package-step-by-step-run-through/</link>
		<comments>http://mysqlpreacher.com/wordpress/2009/06/securich-the-mysql-security-package-step-by-step-run-through/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 17:02:47 +0000</pubDate>
		<dc:creator>Darren Cassar</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mysql roles]]></category>
		<category><![CDATA[mysql security]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[password history]]></category>
		<category><![CDATA[privileges]]></category>
		<category><![CDATA[roles]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://mysqlpreacher.com/wordpress/?p=195</guid>
		<description><![CDATA[I would like to start off by excusing myself for having had a broken link on <a href="http://www.securich.com/downloads.html">http://www.securich.com/downloads.html</a> when I published the latest blog post about Securich.

The tool is downloadable from there and anyone can use it for free in accordance to GPLv2.

I wanted to throw out tutorial about how to install it and use it (Note this tutorial is for version securich version 0.1.2):]]></description>
			<content:encoded><![CDATA[<p>I would like to start off by excusing myself for having had a broken link on <a href="http://www.securich.com/downloads.html">http://www.securich.com/downloads.html</a> when I published the latest blog post about Securich.</p>
<p>The tool is downloadable from there and anyone can use it for free in accordance to GPLv2.</p>
<p>I wanted to throw out tutorial about how to install it and use it (Note this tutorial is for version securich version 0.1.2):</p>
<p>Steps:<br />
1. Download it,<br />
2. Install it,<br />
3. Create a role named &#39;role1&#39; having privileges: select insert update<br />
4. Check roles,<br />
5. Check role privileges,<br />
6. Create a first user<em> john@machine.domain.com</em> (granting privileges on a whole database employees apart from one table),<br />
7. Create a second user<em> paul@10.0.0.2</em> (granting privileges on all tables in world having word Country in them),<br />
8. Create a third user <em>peter@localhost</em> (granting privileges on the database test),<br />
9. Check user privileges for (<em>paul</em>),<br />
10. Update role created above and see changes (add delete to role 1),<br />
11. Update password (for <em>paul</em>) and see changes,<br />
12. Clone user <em>paul</em> to <em>judas</em>,<br />
13. Check user privileges<br />
14. Check user,<br />
15. Rename user <em>judas</em> to <em>james</em>,<br />
16. Revoke privileges from third user disconnecting any existing connections from that user (useful if a security breach is suspected or if you are a security paranoid thus wanting to make sure the person you are blocking out won&#39;t have any more access as from that point onwards).</p>
<p>1. Go to www.securich.com downloads page and download the install script<br />
2. Untar the install script and run it using ./securich_install.sh and it&#39;ll install everything automatically</p>
<blockquote><p>      dcassar@ubuntu:~/Desktop$ ./securich_install.sh<br />
      Enter version number: 0.1.1<br />
      Which kind of installation would you like to do?<br />
      1. Install from file on disk<br />
      2. Download and install (recommended)<br />
      Enter choice (default 2):</p>
<p>      Installation starting<br />
      &#8211;2009-06-19 16:27:56&#8211;  http://www.securich.com/downloads/securich.0.1.1.tar.gz<br />
      Resolving www.securich.com&#8230; 64.202.163.10<br />
      Connecting to www.securich.com|64.202.163.10|:80&#8230; connected.<br />
      HTTP request sent, awaiting response&#8230; 200 OK<br />
      Length: 29217 (29K) [application/x-tar]<br />
      Saving to: `securich.0.1.1.tar.gz&#39;</p>
<p>      100%[=====================================================================================================>] 29,217      64.7K/s   in 0.4s</p>
<p>      2009-06-19 16:27:59	(64.7 KB/s) &#8211; &#39;securich.0.1.1.tar.gz&#39; saved [29217/29217]</p>
<p>      Enter mysql root Password (default ):<br />
      Enter mysql Hostname/IP (default 127.0.0.1): localhost<br />
      Enter mysql Port (default 3306): 3306<br />
      Installation complete</p></blockquote>
<p>3. #log into mysql<br />
   use securich;<br />
   call create_update_role(&#39;role1&#39;,&#39;select&#39;);<br />
   call create_update_role(&#39;role1&#39;,&#39;insert&#39;);<br />
   call create_update_role(&#39;role1&#39;,&#39;update&#39;);<br />
4. call check_roles();<br />
5. call check_role_privileges(&#39;role1&#39;);<br />
6. call grant_privileges(&#39;john&#39; , &#39;machine.domain.com&#39; , &#39;employees&#39; , &#39;&#39; , &#39;alltables&#39; , &#39;role1&#39; , &#39;john@domain.com&#39;);<br />
   call revoke_privileges(&#39;john&#39; , &#39;machine.domain.com&#39; , &#39;employees&#39; , &#39;salaries&#39; , &#39;table&#39; , &#39;role1&#39; , &#39;N&#39;);<br />
7. call grant_privileges(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;world&#39; , &#39;^Country&#39; , &#39;regexp&#39; , &#39;role1&#39; , &#39;paul@domain.com&#39;);<br />
8. call grant_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;test&#39; , &#39;&#39; , &#39;all&#39; , &#39;role1&#39; , &#39;peter@domain.com&#39;);<br />
9. call check_full_user_entries(&#39;paul&#39;);<br />
10. call create_update_role(&#39;role1&#39;,&#39;delete&#39;);<br />
    call check_full_user_entries(&#39;paul&#39;);<br />
11. call set_password(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;password123&#39;);<br />
12. call clone_user(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;judas&#39; , &#39;10.0.0.2&#39; , &#39;judas@domain.com&#39;);<br />
13. call check_full_user_entries(&#39;judas&#39;);<br />
14. call check_user_privileges(&#39;judas&#39; , &#39;10.0.0.2&#39; , &#39;world&#39; , &#39;role1&#39;);<br />
15. call rename_user(&#39;judas&#39; , &#39;james&#39; , &#39;james@domain.com&#39;);<br />
16. call create_update_role(&#39;role2&#39;,&#39;execute&#39;);<br />
17. call grant_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;securich&#39; , &#39;my_privileges&#39; , &#39;storedprocedure&#39; , &#39;role2&#39; , &#39;peter@domain.com&#39;);</p>
<p>18. #connect to mysql using thirduser peter in another session<br />
    show databases;<br />
    use securich;<br />
    show tables;<br />
    call my_privileges(&#39;test&#39;);<br />
    show processlist;</p>
<p>19. call revoke_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;test&#39; , &#39;&#39; , &#39;&#39; , &#39;role1&#39; , &#39;Y&#39;);</p>
<p>20. #as user peter again from 2nd open instance run<br />
    show processlist;</p>
<blockquote><p>dcassar@ubuntu:~/Desktop$ ./securich_install.sh<br />
Enter version number: 0.1.1<br />
Which kind of installation would you like to do?<br />
1. Install from file on disk<br />
2. Download and install (recommended)<br />
Enter choice (default 2): </p>
<p>Installation starting<br />
&#8211;2009-06-19 16:27:56&#8211;  http://www.securich.com/downloads/securich.0.1.1.tar.gz<br />
Resolving www.securich.com&#8230; 64.202.163.10<br />
Connecting to www.securich.com|64.202.163.10|:80&#8230; connected.<br />
HTTP request sent, awaiting response&#8230; 200 OK<br />
Length: 29217 (29K) [application/x-tar]<br />
Saving to: `securich.0.1.1.tar.gz&#39;</p>
<p>100%[=====================================================================================================>] 29,217      64.7K/s   in 0.4s    </p>
<p>2009-06-19 16:27:59 (64.7 KB/s) &#8211; `securich.0.1.1.tar.gz&#39; saved [29217/29217]</p>
<p>Enter mysql root Password (default ):<br />
Enter mysql Hostname/IP (default 127.0.0.1): localhost<br />
Enter mysql Port (default 3306): 3306<br />
Installation complete<br />
dcassar@ubuntu:~/Desktop$ mysql -u root -p -h 127.0.0.1 -P 3306 Enter password:<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 429<br />
Server version: 5.1.33 MySQL Community Server (GPL)</p>
<p>Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the buffer.</p>
<p>mysql> use securich;<br />
Reading table information for completion of table and column names<br />
You can turn off this feature to get a quicker startup with -A</p>
<p>Database changed<br />
mysql> call create_update_role(&#39;role1&#39;,&#39;select&#39;);<br />
Query OK, 0 rows affected, 5 warnings (0.03 sec)</p>
<p>mysql> call create_update_role(&#39;role1&#39;,&#39;insert&#39;);<br />
Query OK, 0 rows affected (0.04 sec)</p>
<p>mysql> call create_update_role(&#39;role1&#39;,&#39;update&#39;);<br />
Query OK, 0 rows affected (0.04 sec)</p>
<p>mysql> call check_roles();<br />
+&#8212;-+&#8212;&#8212;-+<br />
| ID | ROLE  |<br />
+&#8212;-+&#8212;&#8212;-+<br />
|  1 | read  |<br />
|  2 | write |<br />
|  3 | role1 |<br />
+&#8212;-+&#8212;&#8212;-+<br />
3 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call check_role_privileges(&#39;role1&#39;);<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| PRIVILEGE |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| INSERT    |<br />
| SELECT    |<br />
| UPDATE    |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
3 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call grant_privileges(&#39;john&#39; , &#39;machine.domain.com&#39; , &#39;employees&#39; , &#39;&#39; , &#39;alltables&#39; , &#39;role1&#39; , &#39;john@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| USER_PASSWORD                                                                              |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Password for user &#8212; john &#8212; contactable at &#8212; john@domain.com &#8212; is &#8212; bfcbd8234d9eb44 &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
1 row in set (0.16 sec)</p>
<p>Query OK, 0 rows affected, 1 warning (0.16 sec)</p>
<p>mysql> call revoke_privileges(&#39;john&#39; , &#39;machine.domain.com&#39; , &#39;employees&#39; , &#39;salaries&#39; , &#39;table&#39; , &#39;role1&#39; , &#39;N&#39;);<br />
Query OK, 0 rows affected (0.09 sec)</p>
<p>mysql> call grant_privileges(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;world&#39; , &#39;^Country&#39; , &#39;regexp&#39; , &#39;role1&#39; , &#39;paul@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| USER_PASSWORD                                                                              |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Password for user &#8212; paul &#8212; contactable at &#8212; paul@domain.com &#8212; is &#8212; bc4ab08785e1be6 &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
1 row in set (0.06 sec)</p>
<p>Query OK, 0 rows affected, 1 warning (0.06 sec)</p>
<p>mysql> call grant_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;test&#39; , &#39;&#39; , &#39;all&#39; , &#39;role1&#39; , &#39;peter@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| USER_PASSWORD                                                                             |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Password for user &#8212; peter &#8212; contactable at &#8212; peter@domain.com &#8212; is &#8212; 7b3b4746d04b &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
1 row in set (0.04 sec)</p>
<p>Query OK, 0 rows affected (0.04 sec)</p>
<p>mysql> call check_full_user_entries(&#39;paul&#39;);<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| USERNAME | HOSTNAME | DATABASENAME | TABLENAME       | ROLE  | PRIVILEGE | STATE |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | INSERT    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | SELECT    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | UPDATE    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | INSERT    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | SELECT    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | UPDATE    | A     |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
6 rows in set (0.01 sec)</p>
<p>Query OK, 0 rows affected, 4 warnings (0.01 sec)</p>
<p>mysql> call create_update_role(&#39;role1&#39;,&#39;delete&#39;);<br />
Query OK, 0 rows affected (0.09 sec)</p>
<p>mysql> call check_full_user_entries(&#39;paul&#39;);<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| USERNAME | HOSTNAME | DATABASENAME | TABLENAME       | ROLE  | PRIVILEGE | STATE |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | DELETE    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | INSERT    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | SELECT    | A     |<br />
| paul     | 10.0.0.2 | world        | Country         | role1 | UPDATE    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | DELETE    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | INSERT    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | SELECT    | A     |<br />
| paul     | 10.0.0.2 | world        | CountryLanguage | role1 | UPDATE    | A     |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
8 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call set_password(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;password123&#39;);<br />
Query OK, 1 row affected (0.02 sec)</p>
<p>mysql> call clone_user(&#39;paul&#39; , &#39;10.0.0.2&#39; , &#39;judas&#39; , &#39;10.0.0.2&#39; , &#39;judas@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| USER_PASSWORD                                                                                |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Password for user &#8212; judas &#8212; contactable at &#8212; judas@domain.com &#8212; is &#8212; 70d5b79d80fab04 &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
1 row in set (0.01 sec)</p>
<p>Query OK, 0 rows affected, 1 warning (0.10 sec)</p>
<p>mysql> call check_full_user_entries(&#39;judas&#39;);<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| USERNAME | HOSTNAME | DATABASENAME | TABLENAME       | ROLE  | PRIVILEGE | STATE |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
| judas    | 10.0.0.2 | world        | Country         | role1 | DELETE    | A     |<br />
| judas    | 10.0.0.2 | world        | Country         | role1 | INSERT    | A     |<br />
| judas    | 10.0.0.2 | world        | Country         | role1 | SELECT    | A     |<br />
| judas    | 10.0.0.2 | world        | Country         | role1 | UPDATE    | A     |<br />
| judas    | 10.0.0.2 | world        | CountryLanguage | role1 | DELETE    | A     |<br />
| judas    | 10.0.0.2 | world        | CountryLanguage | role1 | INSERT    | A     |<br />
| judas    | 10.0.0.2 | world        | CountryLanguage | role1 | SELECT    | A     |<br />
| judas    | 10.0.0.2 | world        | CountryLanguage | role1 | UPDATE    | A     |<br />
+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+<br />
8 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call check_user_privileges(&#39;judas&#39; , &#39;10.0.0.2&#39; , &#39;world&#39; , &#39;role1&#39;);<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| PRIVILEGE |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| DELETE    |<br />
| INSERT    |<br />
| SELECT    |<br />
| UPDATE    |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
4 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> call rename_user(&#39;judas&#39; , &#39;james&#39; , &#39;james@domain.com&#39;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| USER_PASSWORD                                                                                |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Password for user &#8212; james &#8212; contactable at &#8212; james@domain.com &#8212; is &#8212; 85c2fc100d83884 &#8212; |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
1 row in set (0.02 sec)</p>
<p>Query OK, 0 rows affected, 1 warning (0.11 sec)</p>
<p>mysql> call create_update_role(&#39;role2&#39;,&#39;execute&#39;);<br />
Query OK, 0 rows affected (0.09 sec)</p>
<p>mysql> call grant_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;securich&#39; , &#39;my_privileges&#39; , &#39;storedprocedure&#39; , &#39;role2&#39; , &#39;peter@domain.com&#39;);<br />
Query OK, 0 rows affected (0.08 sec)</p>
<p>mysql> call revoke_privileges(&#39;peter&#39; , &#39;localhost&#39; , &#39;test&#39; , &#39;&#39; , &#39;&#39; , &#39;role1&#39; , &#39;Y&#39;);<br />
Query OK, 0 rows affected (0.15 sec)</p>
<p>mysql> </p>
<p>dcassar@ubuntu:~/Desktop$ mysql -u peter -p7b3b4746d04b -h 127.0.0.1 -P 3306<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 437<br />
Server version: 5.1.33 MySQL Community Server (GPL)</p>
<p>Type &#39;help;&#39; or &#39;\h&#39; for help. Type &#39;\c&#39; to clear the buffer.</p>
<p>mysql> show processlist;<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| Id  | User  | Host            | db   | Command | Time | State | Info             |<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| 437 | peter | localhost:49022 | NULL | Query   |    0 | NULL  | show processlist |<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>mysql> show databases;<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Database           |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| information_schema |<br />
| securich           |<br />
| test               |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
3 rows in set (0.00 sec)</p>
<p>mysql> use securich;<br />
Database changed<br />
mysql> show tables;<br />
Empty set (0.00 sec)</p>
<p>**** Note that the only privileges peter has on securich is on the stored procedure &#39;my_privileges&#39; and definitely no tables</p>
<p>mysql> call my_privileges(&#39;test&#39;);<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| PRIVILEGE |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
| DELETE    |<br />
| INSERT    |<br />
| SELECT    |<br />
| UPDATE    |<br />
+&#8212;&#8212;&#8212;&#8211;+<br />
4 rows in set (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql> show processlist;<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| Id  | User  | Host            | db   | Command | Time | State | Info             |<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| 437 | peter | localhost:49022 | NULL | Query   |    0 | NULL  | show processlist |<br />
+&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>****** &#8211; In the meantime the dba revoked rights with terminate live connections from peter@localhost</p>
<p>mysql> show processlist;<br />
ERROR 2006 (HY000): MySQL server has gone away<br />
No connection. Trying to reconnect&#8230;<br />
ERROR 1045 (28000): Access denied for user &#39;peter&#39;@&#39;localhost&#39; (using password: YES)<br />
ERROR:<br />
Can&#39;t connect to the server</p>
<p>mysql> </p>
</blockquote>
<p>I truly hope you enjoyed this run through. I excuse myself it&#39;s a tad too long, but I wished to illustrate some of the cool features of this package.</p>
<p>Cheers,<br />
Darren</p>
<p>PS don&#39;t forget to check out <a href="http://www.securich.com">Securich HERE</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mysqlpreacher.com/wordpress/2009/06/securich-the-mysql-security-package-step-by-step-run-through/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
