Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to require SSL for all remote users

Given a MySQL system with multiple remote users (users of the form 'joecool'@'192.168.1.2'); is there a SQL statement I can use to REQUIRE SSL for all the remote users?

The single user command is:

GRANT USAGE ON *.* TO 'joecool'@'192.168.1.2' REQUIRE SSL; 

Having an "all user" version would be especially useful because phpMyAdmin doesn't support the REQUIRE SSL flag when creating or modifying users.

like image 348
docwhat Avatar asked Apr 20 '13 13:04

docwhat


People also ask

What is require SSL in IIS?

You may need to enable Secure Socket Layer (SSL) for the website hosting the search hubs. To enable basic authentication in IIS 7. On the IIS server, start the IIS Manager (on the Windows taskbar, select Start > Administrative Tools > Internet Information Services (IIS) Manager).

What will happen if we set the SSL Enable option to on?

On setting the SSL Enabled property to True, you will now find the SSL URL property auto populated with the new https URL. Now that you have enabled SSL and possess the new https URL, attempting to access this URL on a browser results in a 'Your connection is not private' error.


2 Answers

You can configure mysqld with require_secure_transport.

[mysqld] ... ssl-ca = ... ssl-cert = ... ssl-key = ... ... require-secure-transport = ON 

This capability supplements per-account SSL requirements, which take precedence. For example, if an account is defined with REQUIRE SSL, enabling require_secure_transport does not make it possible to use the account to connect using a Unix socket file.

like image 23
Italo Borssatto Avatar answered Sep 17 '22 17:09

Italo Borssatto


The (formerly) accepted answer by Honza seems incorrect, see its comments. It seems not possible to use a GRANT query to alter multiple users at once since MySQL does not support wildcards for user names.

As you suggested yourself you can alter records in the mysql.user table directly using an UPDATE query and as Marc Delisle suggested, afterwards flush priviliges with:

FLUSH PRIVILEGES; 

Also see dba.stackexchange.com > How to grant multiple users privileges.

like image 117
lmeurs Avatar answered Sep 20 '22 17:09

lmeurs