-
Notifications
You must be signed in to change notification settings - Fork 5
fix(go): support tls connections and validate over tls #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Mandukhai-Alimaa
merged 5 commits into
adbc-drivers:main
from
Mandukhai-Alimaa:fix/tls-connections
Jul 3, 2026
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a75419c
fix(go): support tls connections and validate over tls
Mandukhai-Alimaa c456928
improvements
Mandukhai-Alimaa 5b9abdd
fix permission
Mandukhai-Alimaa 7562893
use unhashed string as custom client name
Mandukhai-Alimaa 9a659de
cleanup
Mandukhai-Alimaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,5 @@ | |
|
|
||
| generated/ | ||
| validation-report.xml | ||
| ci/docker/certs/ca.crt | ||
| ci/docker/certs/localhost.p12 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Copyright (c) 2026 ADBC Drivers Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Generate the self-signed CA certificate and PKCS#12 keystore used by the | ||
| # local Trino Docker Compose HTTPS setup. | ||
|
|
||
| set -eu | ||
|
|
||
| CERT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) | ||
| CA_CONFIG="${CERT_DIR}/openssl-ca.cnf" | ||
| SERVER_CONFIG="${CERT_DIR}/openssl-server.cnf" | ||
|
|
||
| CA_CERT="${CERT_DIR}/ca.crt" | ||
| KEYSTORE="${CERT_DIR}/localhost.p12" | ||
|
|
||
| if [ -f "${CA_CERT}" ] && [ -f "${KEYSTORE}" ] && [ "${TRINO_FORCE_REGENERATE_CERTS:-0}" != "1" ]; then | ||
| echo "Trino TLS assets already exist" | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ ! -f "${CA_CONFIG}" ] || [ ! -f "${SERVER_CONFIG}" ]; then | ||
| echo "Missing OpenSSL config under ${CERT_DIR}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/trino-certs.XXXXXX") | ||
| cleanup() { | ||
| rm -rf "${TMP_DIR}" | ||
| } | ||
| trap cleanup EXIT INT TERM | ||
|
|
||
| run_openssl() { | ||
| log_file="${TMP_DIR}/openssl.log" | ||
| if ! openssl "$@" > /dev/null 2>"${log_file}"; then | ||
| cat "${log_file}" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| CA_KEY="${TMP_DIR}/ca.key" | ||
| SERVER_KEY="${TMP_DIR}/localhost.key" | ||
| SERVER_CSR="${TMP_DIR}/localhost.csr" | ||
| CA_SERIAL="${TMP_DIR}/ca.srl" | ||
| TMP_CA_CERT="${TMP_DIR}/ca.crt" | ||
| TMP_SERVER_CERT="${TMP_DIR}/localhost.crt" | ||
| TMP_KEYSTORE="${TMP_DIR}/localhost.p12" | ||
|
|
||
| run_openssl req \ | ||
| -x509 \ | ||
| -newkey rsa:2048 \ | ||
| -days 3650 \ | ||
| -nodes \ | ||
| -keyout "${CA_KEY}" \ | ||
| -out "${TMP_CA_CERT}" \ | ||
| -config "${CA_CONFIG}" | ||
|
|
||
| run_openssl req \ | ||
| -new \ | ||
| -newkey rsa:2048 \ | ||
| -nodes \ | ||
| -keyout "${SERVER_KEY}" \ | ||
| -out "${SERVER_CSR}" \ | ||
| -config "${SERVER_CONFIG}" | ||
|
|
||
| run_openssl x509 \ | ||
| -req \ | ||
| -days 3650 \ | ||
| -in "${SERVER_CSR}" \ | ||
| -CA "${TMP_CA_CERT}" \ | ||
| -CAkey "${CA_KEY}" \ | ||
| -CAcreateserial \ | ||
| -CAserial "${CA_SERIAL}" \ | ||
| -out "${TMP_SERVER_CERT}" \ | ||
| -extfile "${SERVER_CONFIG}" \ | ||
| -extensions v3_req | ||
|
|
||
| run_openssl pkcs12 \ | ||
| -export \ | ||
| -out "${TMP_KEYSTORE}" \ | ||
| -inkey "${SERVER_KEY}" \ | ||
| -in "${TMP_SERVER_CERT}" \ | ||
| -certfile "${TMP_CA_CERT}" \ | ||
| -name trino-dev \ | ||
| -passout pass:trino-dev | ||
|
|
||
| cp "${TMP_CA_CERT}" "${CA_CERT}" | ||
| cp "${TMP_KEYSTORE}" "${KEYSTORE}" | ||
| chmod 0644 "${CA_CERT}" "${KEYSTORE}" | ||
|
|
||
| echo "Generated Trino TLS assets in ${CERT_DIR}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Copyright (c) 2026 ADBC Drivers Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # OpenSSL config for the self-signed CA certificate used to trust the local | ||
| # Trino HTTPS endpoint during development and CI validation. | ||
|
|
||
| [ req ] | ||
| default_bits = 2048 | ||
| prompt = no | ||
| default_md = sha256 | ||
| distinguished_name = dn | ||
| x509_extensions = v3_ca | ||
|
|
||
| [ dn ] | ||
| CN = Trino Local Test CA | ||
|
|
||
| [ v3_ca ] | ||
| basicConstraints = critical, CA:true | ||
| keyUsage = critical, keyCertSign, cRLSign | ||
| subjectKeyIdentifier = hash | ||
| authorityKeyIdentifier = keyid:always,issuer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Copyright (c) 2026 ADBC Drivers Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # OpenSSL config for the localhost server certificate signed by the local test | ||
| # CA and packaged into the PKCS#12 keystore mounted into the Trino container. | ||
|
|
||
| [ req ] | ||
| default_bits = 2048 | ||
| prompt = no | ||
| default_md = sha256 | ||
| distinguished_name = dn | ||
| req_extensions = v3_req | ||
|
|
||
| [ dn ] | ||
| CN = localhost | ||
|
|
||
| [ v3_req ] | ||
| basicConstraints = critical, CA:false | ||
| keyUsage = critical, digitalSignature, keyEncipherment | ||
| extendedKeyUsage = serverAuth | ||
| subjectAltName = @alt_names | ||
|
|
||
| [ alt_names ] | ||
| DNS.1 = localhost | ||
| IP.1 = 127.0.0.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Copyright (c) 2026 ADBC Drivers Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Keep HTTP enabled for the existing validation flow, and add HTTPS for | ||
| # self-signed certificate testing from the host. | ||
| coordinator=true | ||
| node-scheduler.include-coordinator=true | ||
| http-server.http.port=8080 | ||
| http-server.https.enabled=true | ||
| http-server.https.port=8443 | ||
| http-server.https.keystore.path=/etc/trino/certs/localhost.p12 | ||
| http-server.https.keystore.key=trino-dev | ||
| discovery.uri=http://localhost:8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.