Difference between revisions of "AppSuite:DB user privileges"

(Change of existing privileges)
(Change of existing privileges)
Line 31: Line 31:
 
+--------------------------------------------------------------------------------------------------------+
 
+--------------------------------------------------------------------------------------------------------+
 
| GRANT ALL PRIVILEGES ON *.* TO 'openexchange'@'%' IDENTIFIED BY PASSWORD  
 
| GRANT ALL PRIVILEGES ON *.* TO 'openexchange'@'%' IDENTIFIED BY PASSWORD  
    '*ef14c45205444fdd47b6c1d88b74e1345fd0c394' |
+
                                                            '*ef14c45205444fdd47b6c1d88b74e1345fd0c394' |
 
+--------------------------------------------------------------------------------------------------------+
 
+--------------------------------------------------------------------------------------------------------+
 
1 row in set (0,00 sec)
 
1 row in set (0,00 sec)

Revision as of 06:46, 8 July 2014

How to reduce Open-Xchange database user privileges for existing installations

Summary: This article tells you how to reduce the database user privileges in existing Open-Xchange installations to those at least required ones. Changing the existing ALL PRIVILEDGES to the provided minimum set will have no implications for running the server.

The minimum required set of privileges is: CREATE, LOCK TABLES, REFERENCES, INDEX, DROP, DELETE, ALTER, SELECT, UPDATE, INSERT, CREATE TEMPORARY TABLES, SHOW VIEW, ALTER ROUTINE, CREATE ROUTINE and SHOW DATABASES.

Change of existing privileges

1. Login to master mysql database using root user.

2. Detect the existing Open-Xchange users:

SELECT USER,HOST FROM mysql.user;

The output will look like:

+------------------+-----------+
| user             | host      |
+------------------+-----------+
| openexchange     | %         |
| root             | 127.0.0.1 |

3. Detect all existing privileges for the Open-Xchange user above:

SHOW GRANTS FOR '<openexchange_user_from_table_above>'@'<openexchange_host_from_table_above>';

The output will look like:

+--------------------------------------------------------------------------------------------------------+
| Grants for openexchange@%                                                                              |
+--------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'openexchange'@'%' IDENTIFIED BY PASSWORD 
                                                             '*ef14c45205444fdd47b6c1d88b74e1345fd0c394' |
+--------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)

4. Revoke all existing privileges for the Open-Xchange user above. Be careful to use the database@host pattern provided by the output from #3 (in this case *.*):

REVOKE ALL PRIVILEGES ON *.* FROM '<openexchange_user_from_table_above>'@'<openexchange_host_from_table_above>';

Hint: This must be executed for each database@hostname combination displayed in #3. Without revoking privileges you will have duplicates.

5. Create new privileges:

GRANT CREATE, LOCK TABLES, REFERENCES, INDEX, DROP, DELETE, ALTER, SELECT, UPDATE, INSERT, CREATE TEMPORARY TABLES, SHOW VIEW, ALTER ROUTINE, CREATE ROUTINE, SHOW DATABASES ON *.* TO '<YOUR_CONFIG_DB_USER>'@'%' IDENTIFIED BY '<YOUR_CONFIG_DB_PASS>' WITH GRANT OPTION;

6. Write new privileges:

FLUSH PRIVILEGES;