tachtler:mariadb_centos_7
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
tachtler:mariadb_centos_7 [2018/04/27 05:47] – [SSL: Server-Zertifikat erstellen] klaus | tachtler:mariadb_centos_7 [2018/04/27 06:38] (aktuell) – [SSL: Client-Zertifikat erstellen] klaus | ||
---|---|---|---|
Zeile 1033: | Zeile 1033: | ||
Die Konfiguration beinhaltet | Die Konfiguration beinhaltet | ||
- Erstellen einer **eignen CA** - **'' | - Erstellen einer **eignen CA** - **'' | ||
- | - Erstellen eines **'' | + | - Erstellen eines **'' |
- Erstellen eines **'' | - Erstellen eines **'' | ||
Zeile 1197: | Zeile 1197: | ||
Organization Name (eg, company) [Default Company Ltd]:Klaus Tachtler | Organization Name (eg, company) [Default Company Ltd]:Klaus Tachtler | ||
Organizational Unit Name (eg, section) []:. | Organizational Unit Name (eg, section) []:. | ||
- | Common Name (eg, your name or your server' | + | Common Name (eg, your name or your server' |
Email Address []: | Email Address []: | ||
Zeile 1268: | Zeile 1268: | ||
CA/ | CA/ | ||
Validity | Validity | ||
- | Not Before: Apr 27 03:43:09 2018 GMT | + | Not Before: Apr 27 04:26:53 2018 GMT |
- | Not After : Apr 23 03:43:09 2028 GMT | + | Not After : Apr 23 04:26:53 2028 GMT |
- | Subject: C=DE, ST=Bayern (Bavaria), L=Muenchen (Munich), O=Klaus Tachtler, CN=MariaDB | + | Subject: C=DE, ST=Bayern (Bavaria), L=Muenchen (Munich), O=Klaus Tachtler, |
- | Server/ | + | CN=db.idmz.tachtler.net/ |
Subject Public Key Info: | Subject Public Key Info: | ||
Public Key Algorithm: rsaEncryption | Public Key Algorithm: rsaEncryption | ||
Public-Key: (2048 bit) | Public-Key: (2048 bit) | ||
Modulus: | Modulus: | ||
- | 00:ea:10:23:47:fb:c8:f0:fb:a0:c3:df:70:a7:ed: | + | 00:c5:81:5c:95:da:2b:19:33:cc:61:ba:b3:ea:bb: |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
Exponent: 65537 (0x10001) | Exponent: 65537 (0x10001) | ||
Signature Algorithm: sha256WithRSAEncryption | Signature Algorithm: sha256WithRSAEncryption | ||
- | 5a:26:f7:27:e9:c7:72:23:58:f9:b0:24:82:be:a1:90:5e:38: | + | 73:c3:cb:a8:4e:4d:fe:82:78:18:72:6f:6d:76:7a:6b:64:25: |
- | 42:cc:cb:a2:ad:d6:e2:28:e9:0f:8c:46:60:e1:88:00:34:ee: | + | b6:f3:08:51:bd:19:f4:75:9e:bd:cc:05:50:d8:6b:2b:93:b5: |
- | a9:82:79:59:76:55:23:b3:ea:f3:73:a2:14:90:78:d4:7b:4e: | + | 35:02:44:ff:ee:4a:b8:a9:db:57:9e:66:9c:25:28:a1:a5:48: |
- | b3:7c:24:10:45:0d:04:88:cb:47:68:b0:a8:51:ce:f2:47:de: | + | 2e:4f:83:d4:1d:cd:c5:7e:4e:70:10:3a:9f:dd:dc:2d:82:c9: |
- | ae:ce:6c:ae:48:6b:08:bd:17:4a:79:f9:28:cc:c4:da:ed:cf: | + | e5:55:84:27:50:51:93:07:06:5e:1f:ae:b2:2c:59:23:ff:4f: |
- | 10:3b:13:bb:19:41:a5:a9:8d:e3:32:3b:0e:17:ab:4c:42:3f: | + | 24:c5:3f:65:07:fc:42:cd:5c:47:2f:2f:54:ca:8a:70:34:9e: |
- | 09:f1:24:e2:a4:e5:59:37:36:98:9a:00:b5:b0:da:9c:a4:1e: | + | 2d:1d:bc:ec:35:9d:d0:7d:64:a5:65:16:9d:f2:77:e5:ee:a3: |
- | 32:62:83:94:3a:88:9d:02:fc:71:f5:13:b8:d4:67:33:a4:47: | + | f1:94:ec:f4:89:fe:a7:95:c6:27:38:6d:ef:44:90:90:03:70: |
- | e2:a2:a2:65:1b:e2:ca:70:1b:4f:cf:7b:43:be:d4:17:f8:f3: | + | aa:cf:1d:57:0e:f1:2b:e5:09:ed:7d:c9:9e:c6:84:9a:77:5c: |
- | 3f:ea:41:56:ae:a8:e8:75:00:ec:da:41:53:6a:cb:fa:23:1e: | + | 0d:9f:4a:d4:e5:43:00:a8:04:51:00:26:4a:23:3b:09:ed:b1: |
- | 21:2a:ab:7d:aa:af:72:a3:75:fd:23:b1:14:4d:e6:de:43:8b: | + | 8a:1f:e8:62:09:5a:83:f6:43:4a:c9:53:4b:06:96:36:55:d1: |
- | a4:6c:b7:0a:ed:97:44:b8:e6:f2:ac:b9:d9:eb:39:d1:f9:35: | + | 0c:f7:1e:59:1a:c2:cb:82:6f:3e:c7:cb:53:9a:62:04:0d:38: |
- | 94:9e:c0:a2:29:5c:69:70:d6:99:af:d1:fb:b0:8b:4e:c9:71: | + | f7:98:95:0c:5e:9f:e3:69:39:a3:c7:e5:b1:e6:b6:5e:52:87: |
- | f4:26:4f:2b:01:6f:c7:6e:a7:45:a7:2a:80:10:a7:3d:2a:a4: | + | 63:05:a2:ba:b0:12:c9:01:9b:0c:38:97:2c:0d:55:3e:06:ef: |
- | 9c:fb:8f:e2 | + | 52:ed:8a:35 |
</ | </ | ||
Zeile 1316: | Zeile 1316: | ||
Nachfolgende Befehle erstellen ein **'' | Nachfolgende Befehle erstellen ein **'' | ||
+ | |||
+ | :!: **HINWEIS** - **Dies kann in Client wie z.B.** | ||
+ | * **[[tachtler: | ||
+ | * **[[tachtler: | ||
+ | **eingebunden werden**. | ||
**__1. Schritt__**: | **__1. Schritt__**: | ||
Zeile 1323: | Zeile 1328: | ||
< | < | ||
# openssl req -newkey rsa:2048 -days 3649 -nodes -keyout / | # openssl req -newkey rsa:2048 -days 3649 -nodes -keyout / | ||
+ | Generating a 2048 bit RSA private key | ||
+ | ............................................................................................................. | ||
+ | ...........................................+++ | ||
+ | ......+++ | ||
+ | writing new private key to '/ | ||
+ | ----- | ||
+ | You are about to be asked to enter information that will be incorporated | ||
+ | into your certificate request. | ||
+ | What you are about to enter is what is called a Distinguished Name or a DN. | ||
+ | There are quite a few fields but you can leave some blank | ||
+ | For some fields there will be a default value, | ||
+ | If you enter ' | ||
+ | ----- | ||
+ | Country Name (2 letter code) [XX]:DE | ||
+ | State or Province Name (full name) []:Bayern (Bavaria) | ||
+ | Locality Name (eg, city) [Default City]: | ||
+ | Organization Name (eg, company) [Default Company Ltd]:Klaus Tachtler | ||
+ | Organizational Unit Name (eg, section) []:. | ||
+ | Common Name (eg, your name or your server' | ||
+ | Email Address []: | ||
+ | Please enter the following ' | ||
+ | to be sent with your certificate request | ||
+ | A challenge password []: | ||
+ | An optional company name []:. | ||
</ | </ | ||
- | Mit nachfolgendem Befehl kann nun überprüft werden, ob der **MariaDB Client Schlüssel** und der **MariaDB | + | Mit nachfolgendem Befehl kann nun überprüft werden, ob der **MariaDB Client Schlüssel** und der **MariaDB |
< | < | ||
# ls -la / | # ls -la / | ||
+ | / | ||
+ | total 16 | ||
+ | drwxr-xr-x 2 root root 118 Apr 27 05:48 . | ||
+ | drwxr-xr-x 4 root root 32 Apr 27 04:44 .. | ||
+ | -rw-r--r-- 1 root root 1460 Apr 27 04:54 mariadb-ca-crt.pem | ||
+ | -rw-r--r-- 1 root root 1078 Apr 27 05:48 mariadb-client-csr.pem | ||
+ | -rw-r--r-- 1 root root 1338 Apr 27 05:43 mariadb-server-crt.pem | ||
+ | -rw-r--r-- 1 root root 1078 Apr 27 05:42 mariadb-server-csr.pem | ||
+ | / | ||
+ | total 12 | ||
+ | drwxr-xr-x 2 root root 89 Apr 27 05:48 . | ||
+ | drwxr-xr-x 4 root root 32 Apr 27 04:44 .. | ||
+ | -rw-r--r-- 1 root root 1675 Apr 27 04:52 mariadb-ca-key.pem | ||
+ | -rw-r--r-- 1 root root 1704 Apr 27 05:48 mariadb-client-key.pem | ||
+ | -rw-r--r-- 1 root root 1679 Apr 27 05:42 mariadb-server-key.pem | ||
</ | </ | ||
Zeile 1338: | Zeile 1382: | ||
</ | </ | ||
- | **__3. Schritt__**: | + | **__3. Schritt__**: |
< | < | ||
- | # openssl x509 -req -in / | + | # # openssl x509 -req -in / |
+ | Signature ok | ||
+ | subject=/ | ||
+ | Getting CA Private Key | ||
</ | </ | ||
Zeile 1347: | Zeile 1393: | ||
< | < | ||
# ls -la / | # ls -la / | ||
+ | / | ||
+ | total 20 | ||
+ | drwxr-xr-x 2 root root 147 Apr 27 05:50 . | ||
+ | drwxr-xr-x 4 root root 32 Apr 27 04:44 .. | ||
+ | -rw-r--r-- 1 root root 1460 Apr 27 04:54 mariadb-ca-crt.pem | ||
+ | -rw-r--r-- 1 root root 1338 Apr 27 05:50 mariadb-client-crt.pem | ||
+ | -rw-r--r-- 1 root root 1078 Apr 27 05:48 mariadb-client-csr.pem | ||
+ | -rw-r--r-- 1 root root 1338 Apr 27 05:43 mariadb-server-crt.pem | ||
+ | -rw-r--r-- 1 root root 1078 Apr 27 05:42 mariadb-server-csr.pem | ||
+ | / | ||
+ | total 12 | ||
+ | drwxr-xr-x 2 root root 89 Apr 27 05:48 . | ||
+ | drwxr-xr-x 4 root root 32 Apr 27 04:44 .. | ||
+ | -rw-r--r-- 1 root root 1675 Apr 27 04:52 mariadb-ca-key.pem | ||
+ | -rw-r--r-- 1 root root 1675 Apr 27 05:49 mariadb-client-key.pem | ||
+ | -rw-r--r-- 1 root root 1679 Apr 27 05:42 mariadb-server-key.pem | ||
</ | </ | ||
Zeile 1353: | Zeile 1415: | ||
< | < | ||
# openssl x509 -noout -text -in / | # openssl x509 -noout -text -in / | ||
+ | Certificate: | ||
+ | Data: | ||
+ | Version: 1 (0x0) | ||
+ | Serial Number: 1 (0x1) | ||
+ | Signature Algorithm: sha256WithRSAEncryption | ||
+ | Issuer: C=DE, ST=Bayern (Bavaria), L=Muenchen (Munich), O=Klaus Tachtler, CN=MariaDB | ||
+ | CA/ | ||
+ | Validity | ||
+ | Not Before: Apr 27 03:50:10 2018 GMT | ||
+ | Not After : Apr 23 03:50:10 2028 GMT | ||
+ | Subject: C=DE, ST=Bayern (Bavaria), L=Muenchen (Munich), O=Klaus Tachtler, CN=MariaDB | ||
+ | Client/ | ||
+ | Subject Public Key Info: | ||
+ | Public Key Algorithm: rsaEncryption | ||
+ | Public-Key: (2048 bit) | ||
+ | Modulus: | ||
+ | 01: | ||
+ | 9e: | ||
+ | 08: | ||
+ | f7: | ||
+ | 93: | ||
+ | 55: | ||
+ | d7: | ||
+ | cb: | ||
+ | 99: | ||
+ | b7: | ||
+ | bc: | ||
+ | a4: | ||
+ | fd: | ||
+ | a6: | ||
+ | 3f: | ||
+ | a8: | ||
+ | ad: | ||
+ | 7d:41 | ||
+ | Exponent: 65537 (0x10001) | ||
+ | Signature Algorithm: sha256WithRSAEncryption | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | ==== /etc/my.cnf ==== | ||
+ | |||
+ | Um den [[https:// | ||
+ | * **ROOT**-Zertifikat aus der **eigenen CA** und das | ||
+ | * **'' | ||
+ | * **'' | ||
+ | in den mit einzubinden. | ||
+ | |||
+ | Die Anpassungen sind in der Konfigurationsdatei **''/ | ||
+ | < | ||
+ | # Tachtler | ||
+ | </ | ||
+ | gekennzeichnet. | ||
+ | |||
+ | Hier eine mögliche Anpassung (**komplette Konfigurationsdatei/ | ||
+ | <code ini> | ||
+ | [mysqld] | ||
+ | # Tachtler | ||
+ | # default: datadir=/ | ||
+ | datadir=/ | ||
+ | socket=/ | ||
+ | # Disabling symbolic-links is recommended to prevent assorted security risks | ||
+ | symbolic-links=0 | ||
+ | # Settings user and group are ignored when systemd is used. | ||
+ | # If you need to run mysqld under a different user or group, | ||
+ | # customize your systemd unit file for mariadb according to the | ||
+ | # instructions in http:// | ||
+ | |||
+ | # Tachtler - ssl - | ||
+ | ssl-ca=/ | ||
+ | ssl-cert=/ | ||
+ | ssl-key=/ | ||
+ | |||
+ | [mysqld_safe] | ||
+ | log-error=/ | ||
+ | pid-file=/ | ||
+ | |||
+ | # | ||
+ | # include all files from the config directory | ||
+ | # | ||
+ | !includedir / | ||
+ | |||
+ | </ | ||
+ | |||
+ | Um überprüfen zu können, ob eine **SSL**-Verschlüsselung nun im [[https:// | ||
+ | <code mysql> | ||
+ | # mysql -h 127.0.0.1 -u root -p | ||
+ | Enter password: | ||
+ | Welcome to the MariaDB monitor. | ||
+ | Your MariaDB connection id is 7 | ||
+ | Server version: 5.5.56-MariaDB MariaDB Server | ||
+ | |||
+ | Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. | ||
+ | |||
+ | Type ' | ||
+ | |||
+ | MariaDB [(none)]> | ||
+ | </ | ||
+ | |||
+ | Anschließend zeigt nachfolgender **SQL**-Befehl die **SSL**-Verschlüsselungseinstellungen an: | ||
+ | <code mysql> | ||
+ | MariaDB [(none)]> | ||
+ | +---------------+-------------------------------------------------+ | ||
+ | | Variable_name | Value | | ||
+ | +---------------+-------------------------------------------------+ | ||
+ | | have_openssl | ||
+ | | have_ssl | ||
+ | | ssl_ca | ||
+ | | ssl_capath | ||
+ | | ssl_cert | ||
+ | | ssl_cipher | ||
+ | | ssl_key | ||
+ | +---------------+-------------------------------------------------+ | ||
+ | 7 rows in set (0.01 sec) | ||
+ | </ | ||
+ | |||
+ | Um die Verbindung zum [[https:// | ||
+ | < | ||
+ | MariaDB [(none)]> | ||
+ | Bye | ||
+ | </ | ||
+ | |||
+ | Nachfolgender Befehl baut eine **SSL**-Verschlüsselte Verbindung zum [[https:// | ||
+ | < | ||
+ | # openssl s_client -connect 127.0.0.1: | ||
+ | CONNECTED(00000003) | ||
+ | 140490808899488: | ||
+ | --- | ||
+ | no peer certificate available | ||
+ | --- | ||
+ | No client certificate CA names sent | ||
+ | --- | ||
+ | SSL handshake has read 7 bytes and written 289 bytes | ||
+ | --- | ||
+ | New, (NONE), Cipher is (NONE) | ||
+ | Secure Renegotiation IS NOT supported | ||
+ | Compression: | ||
+ | Expansion: NONE | ||
+ | No ALPN negotiated | ||
+ | SSL-Session: | ||
+ | Protocol | ||
+ | Cipher | ||
+ | Session-ID: | ||
+ | Session-ID-ctx: | ||
+ | Master-Key: | ||
+ | Key-Arg | ||
+ | Krb5 Principal: None | ||
+ | PSK identity: None | ||
+ | PSK identity hint: None | ||
+ | Start Time: 1524802147 | ||
+ | Timeout | ||
+ | Verify return code: 0 (ok) | ||
+ | --- | ||
</ | </ | ||
tachtler/mariadb_centos_7.1524800855.txt.gz · Zuletzt geändert: 2018/04/27 05:47 von klaus