1MYSQL_SSL_RSA_SETUP(1) MySQL Database System MYSQL_SSL_RSA_SETUP(1)
2
3
4
6 mysql_ssl_rsa_setup - create SSL/RSA files
7
9 mysql_ssl_rsa_setup [options]
10
12 This program creates the SSL certificate and key files and RSA key-pair
13 files required to support secure connections using SSL and secure
14 password exchange using RSA over unencrypted connections, if those
15 files are missing. mysql_ssl_rsa_setup can also be used to create new
16 SSL files if the existing ones have expired.
17
18 Note
19 mysql_ssl_rsa_setup uses the openssl command, so its use is
20 contingent on having OpenSSL installed on your machine.
21
22 Another way to generate SSL and RSA files, for MySQL distributions
23 compiled using OpenSSL, is to have the server generate them
24 automatically. See Section 6.3.3.1, “Creating SSL and RSA
25 Certificates and Keys using MySQL”.
26
27 Important
28 mysql_ssl_rsa_setup helps lower the barrier to using SSL by making
29 it easier to generate the required files. However, certificates
30 generated by mysql_ssl_rsa_setup are self-signed, which is not very
31 secure. After you gain experience using the files created by
32 mysql_ssl_rsa_setup, consider obtaining a CA certificate from a
33 registered certificate authority.
34
35 Invoke mysql_ssl_rsa_setup like this:
36
37 mysql_ssl_rsa_setup [options]
38
39 Typical options are --datadir to specify where to create the files, and
40 --verbose to see the openssl commands that mysql_ssl_rsa_setup
41 executes.
42
43 mysql_ssl_rsa_setup attempts to create SSL and RSA files using a
44 default set of file names. It works as follows:
45
46 1. mysql_ssl_rsa_setup checks for the openssl binary at the locations
47 specified by the PATH environment variable. If openssl is not
48 found, mysql_ssl_rsa_setup does nothing. If openssl is present,
49 mysql_ssl_rsa_setup looks for default SSL and RSA files in the
50 MySQL data directory specified by the --datadir option, or the
51 compiled-in data directory if the --datadir option is not given.
52
53 2. mysql_ssl_rsa_setup checks the data directory for SSL files with
54 the following names:
55
56 ca.pem
57 server-cert.pem
58 server-key.pem
59
60 3. If any of those files are present, mysql_ssl_rsa_setup creates no
61 SSL files. Otherwise, it invokes openssl to create them, plus some
62 additional files:
63
64 ca.pem Self-signed CA certificate
65 ca-key.pem CA private key
66 server-cert.pem Server certificate
67 server-key.pem Server private key
68 client-cert.pem Client certificate
69 client-key.pem Client private key
70
71 These files enable secure client connections using SSL; see
72 Section 6.3.1, “Configuring MySQL to Use Encrypted Connections”.
73
74 4. mysql_ssl_rsa_setup checks the data directory for RSA files with
75 the following names:
76
77 private_key.pem Private member of private/public key pair
78 public_key.pem Public member of private/public key pair
79
80 5. If any of these files are present, mysql_ssl_rsa_setup creates no
81 RSA files. Otherwise, it invokes openssl to create them. These
82 files enable secure password exchange using RSA over unencrypted
83 connections for accounts authenticated by the sha256_password or
84 caching_sha2_password plugin; see Section 6.4.1.3, “SHA-256
85 Pluggable Authentication”, and Section 6.4.1.2, “Caching SHA-2
86 Pluggable Authentication”.
87
88 For information about the characteristics of files created by
89 mysql_ssl_rsa_setup, see Section 6.3.3.1, “Creating SSL and RSA
90 Certificates and Keys using MySQL”.
91
92 At startup, the MySQL server automatically uses the SSL files created
93 by mysql_ssl_rsa_setup to enable SSL if no explicit SSL options are
94 given other than --ssl (possibly along with ssl_cipher). If you prefer
95 to designate the files explicitly, invoke clients with the --ssl-ca,
96 --ssl-cert, and --ssl-key options at startup to name the ca.pem,
97 server-cert.pem, and server-key.pem files, respectively.
98
99 The server also automatically uses the RSA files created by
100 mysql_ssl_rsa_setup to enable RSA if no explicit RSA options are given.
101
102 If the server is SSL-enabled, clients use SSL by default for the
103 connection. To specify certificate and key files explicitly, use the
104 --ssl-ca, --ssl-cert, and --ssl-key options to name the ca.pem,
105 client-cert.pem, and client-key.pem files, respectively. However, some
106 additional client setup may be required first because
107 mysql_ssl_rsa_setup by default creates those files in the data
108 directory. The permissions for the data directory normally enable
109 access only to the system account that runs the MySQL server, so client
110 programs cannot use files located there. To make the files available,
111 copy them to a directory that is readable (but not writable) by
112 clients:
113
114 • For local clients, the MySQL installation directory can be used.
115 For example, if the data directory is a subdirectory of the
116 installation directory and your current location is the data
117 directory, you can copy the files like this:
118
119 cp ca.pem client-cert.pem client-key.pem ..
120
121 • For remote clients, distribute the files using a secure channel to
122 ensure they are not tampered with during transit.
123
124 If the SSL files used for a MySQL installation have expired, you can
125 use mysql_ssl_rsa_setup to create new ones:
126
127 1. Stop the server.
128
129 2. Rename or remove the existing SSL files. You may wish to make a
130 backup of them first. (The RSA files do not expire, so you need not
131 remove them. mysql_ssl_rsa_setup can see that they exist and does
132 not overwrite them.)
133
134 3. Run mysql_ssl_rsa_setup with the --datadir option to specify where
135 to create the new files.
136
137 4. Restart the server.
138
139 mysql_ssl_rsa_setup supports the following command-line options, which
140 can be specified on the command line or in the [mysql_ssl_rsa_setup]
141 and [mysqld] groups of an option file. For information about option
142 files used by MySQL programs, see Section 4.2.2.2, “Using Option
143 Files”.
144
145 • --help, ? Display a help message and exit.
146
147 • --datadir=dir_name The path to the directory that
148 mysql_ssl_rsa_setup should check for default SSL and RSA files and
149 in which it should create files if they are missing. The default is
150 the compiled-in data directory.
151
152 • --suffix=str The suffix for the Common Name attribute in X.509
153 certificates. The suffix value is limited to 17 characters. The
154 default is based on the MySQL version number.
155
156 • --uid=name, -v The name of the user who should be the owner of any
157 created files. The value is a user name, not a numeric user ID. In
158 the absence of this option, files created by mysql_ssl_rsa_setup
159 are owned by the user who executes it. This option is valid only if
160 you execute the program as root on a system that supports the
161 chown() system call.
162
163 • --verbose, -v Verbose mode. Produce more output about what the
164 program does. For example, the program shows the openssl commands
165 it runs, and produces output to indicate whether it skips SSL or
166 RSA file creation because some default file already exists.
167
168 • --version, -V Display version information and exit.
169
171 Copyright © 1997, 2021, Oracle and/or its affiliates.
172
173 This documentation is free software; you can redistribute it and/or
174 modify it only under the terms of the GNU General Public License as
175 published by the Free Software Foundation; version 2 of the License.
176
177 This documentation is distributed in the hope that it will be useful,
178 but WITHOUT ANY WARRANTY; without even the implied warranty of
179 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
180 General Public License for more details.
181
182 You should have received a copy of the GNU General Public License along
183 with the program; if not, write to the Free Software Foundation, Inc.,
184 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
185 http://www.gnu.org/licenses/.
186
187
189 For more information, please refer to the MySQL Reference Manual, which
190 may already be installed locally and which is also available online at
191 http://dev.mysql.com/doc/.
192
194 Oracle Corporation (http://dev.mysql.com/).
195
196
197
198MySQL 8.0 03/07/2021 MYSQL_SSL_RSA_SETUP(1)