@@ -79,9 +79,12 @@ openssl req -newkey rsa:2048 -nodes \
7979openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
8080 -days 365 -out server.crt \
8181 -extfile <( printf " subjectAltName=DNS:localhost,IP:127.0.0.1" )
82+
83+ # Only for demo purpose we make key readable by all. On production should be readable only by owner, not even by group.^M
84+ chmod a+r server.key
8285```
8386
84- 2 . Create a ` config.d ` overlay enabling the HTTPS interface, e.g. ` zzz_ssl .xml` :
87+ 2 . Create a ` config.d ` overlay enabling the HTTPS interface, e.g. ` my_ssl .xml` :
8588
8689``` xml
8790<clickhouse >
@@ -105,12 +108,22 @@ openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
105108docker run -d --name clickhouse-ssl -p 8443:8443 \
106109 -v " $PWD /server.crt:/etc/clickhouse-server/certs/server.crt:ro" \
107110 -v " $PWD /server.key:/etc/clickhouse-server/certs/server.key:ro" \
108- -v " $PWD /zzz_ssl.xml:/etc/clickhouse-server/config.d/zzz_ssl.xml:ro" \
111+ -v " $PWD /my_ssl.xml:/etc/clickhouse-server/config.d/my_ssl.xml:ro" \
112+ -e CLICKHOUSE_PASSWORD=" secret" \
109113 clickhouse/clickhouse-server:latest
110114```
111115
1121164 . Run the example in standalone mode with
113117` -DchUrl="jdbc:clickhouse://localhost:8443/default" -DchRootCert="$PWD/ca.crt" ` .
114118
119+ ``` shell
120+ mvn exec:java -Dexec.mainClass=" com.clickhouse.examples.jdbc.SSLExamples" \
121+ -DchUrl=" jdbc:clickhouse:https://localhost:8443/default" \
122+ -DchUser=" default" \
123+ -DchPassword=" secret" \
124+ -DchRootCert=" $PWD /ca.crt"
125+ ```
126+
127+
115128The full description of the server-side TLS configuration is in the official documentation:
116129[ Configuring SSL-TLS] ( https://clickhouse.com/docs/en/guides/sre/configuring-ssl ) .
0 commit comments