How to require SSL for all remote users

前端 未结 3 1217
一向
一向 2020-12-29 20:52

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

相关标签:
3条回答
  • 2020-12-29 21:10

    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.

    0 讨论(0)
  • 2020-12-29 21:28

    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.

    0 讨论(0)
  • 2020-12-29 21:29

    Yes, you can modify the mysql.user table directly (be careful). Then you just issue a FLUSH PRIVILEGES statement to apply the changes to the running server.

    0 讨论(0)
提交回复
热议问题