GSI Enabled MySQL - Testing
Updated on Fri, 2005-11-25 22:18. Originally created by stargrid on 2005-05-27 12:37.
To Grid-enable MySQL is to allow client authentication using X509 certificates as used in
the Globus Toolkit. Using the X509 certificates issued by the Globus Toolkit CA will alleviate
the need for the client to authenticate separately after issuing the "grid-proxy-init" command.
To do this in MySQL, one needs to connect over an SSL encrypted channel. This document will
outline the steps needed to prepare MySQL for such connections, demonstrate a simple Perl
DBI script which accomplishes the connection, and discuss future plans for testing and
implementation.
Perl DBI/DBD
Perl DBI needs to connect over an SSL encrypted connection. SSL needs to be enabled.
You must configure DBD::mysql with
**Richard A. Casella -
Setup
- MySQL For a more in-depth explanation of the why's and how's, see the MySQL documentation. What is included here are exerpts and observations from that documentation.
- Build MySQL with SSL enabled. The following conditions apply to MySQL 4.0.0 or greater. If you are running an older version, you should definitely check the documentation mentioned above.
- Install OpenSSL Library >= OpenSSL 0.9.6
- Configure and build with options --with-vio --with-openssl
- Check that your server supports OpenSSL by examining if
SHOW VARIABLES LIKE 'have_openssl' returns
YES
- X509 Certificates Check documentation for more detailed explanation of key creation.
- Setup. First create a directory for the keys, copy and modify openssl.cnf
- Certificate Authority openssl req -new -keyout cakey.pem -out $PRIV/cacert.pem -config $DIR/openssl.cnf
- Server Request and Key
- Client Request and Key
- Init Files MySQLd needs to be made aware of the certificates at start-up time. MySQLd reads /etc/my.cnf at start-up time. Add the following lines (be sure to replace $DIR with the actuaal location) to /etc/my.cnf
- Grant Options Again, the MySQL documentation should be consulted, but basically, the following options are added to the grant options in the user table of the mysql database. Not all of the following options have been tested at this time, but they will be before all is said and done. These options are added as needed in the following manner...
DIR=~/openssl
PRIV=$DIR/private
mkdir $DIR $PRIV $DIR/newcerts
cp /usr/share/openssl.cnf $DIR/openssl.cnf
replace .demoCA $DIR -- $DIR/openssl.cnf
openssl req -new -keyout $DIR/server-key.pem -out $DIR/server-req.pem \
-days 3600 -config $DIR/openssl.cnf
openssl rsa -in $DIR/server-key.pem -out $DIR/server-key.pem
openssl ca -policy policy_anything -out $DIR/server-cert.pem \
-config $DIR/openssl.cnf -infiles $DIR/server-req.pem
openssl req -new -keyout $DIR/client-key.pem -out $DIR/client-req.pem \
-days 3600 -config $DIR/openssl.cnf
openssl rsa -in $DIR/client-key.pem -out $DIR/client-key.pem
openssl ca -policy policy_anything -out $DIR/client-cert.pem \
-config $DIR/openssl.cnf -infiles $DIR/client-req.pem
[server]
ssl-ca=$DIR/cacert.pem
ssl-cert=$DIR/server-cert.pem
ssl-key=$DIR/server-key.pem
[client]
ssl-ca=$DIR/cacert.pem
ssl-cert=$DIR/client-cert.pem
ssl-key=$DIR/client-key.pem
mysql> GRANT ALL PRIVILEGES ON test.* to username@localhost
-> IDENTIFIED BY "secretpass" REQUIRE SSL;
- REQUIRE SSL limits the server to allow only SSL connections
REQUIRE X509 "issuer"
means that the client should have a valid certificate, but we do not care about the exact certificate, issuer or subjectREQUIRE ISSUER
means the client must present a valid X509 certificate issued by issuer "issuer
".REQUIRE SUBJECT "subject"
requires clients to have a valid X509 certificate with the subject "subject
" on it.REQUIRE CIPHER "cipher"
is needed to ensure strong ciphers and keylengths will be used. (ie.REQUIRE CIPHER "EDH-RSA-DES-CBC3-SHA"
)
-ssl
, then build and install it
on the machine where you will be running your Perl code.
Testing
**Richard A. Casella -
»
- Printer-friendly version
- Login or register to post comments