Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Build
# We used to build on ubuntu-18.04 but that is now deprecated by
# GitHub. Earlier distributions will have to use the musl build.
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: Check out code and submodules into the Go module directory
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Test
# We used to build on ubuntu-18.04 but that is now deprecated by
# GitHub. Earlier distributions will have to use the musl build.
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: Check out code and submodules into the Go module directory
Expand Down
25 changes: 10 additions & 15 deletions vql/networking/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package networking

import (
"context"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -59,14 +60,16 @@ func TestTLSVerification(t *testing.T) {
assert.Error(t, err)
assert.Contains(t, err.Error(), "unknown authority")

cert, err := x509.ParseCertificate(ts.TLS.Certificates[0].Certificate[0])
assert.NoError(t, err)
thumbprint := hashCertificate(cert)

config_obj = &config_proto.ClientConfig{
Crypto: &config_proto.CryptoConfig{
CertificateVerificationMode: "PKI",
// We still ignore the thumbprint because we are in PKI
// mode.
CertificateThumbprints: []string{
"AB:60:19:14:43:6E:58:BA:BB:17:B9:16:61:55:CA:F9:7B:D7:E5:F8:DE:B9:B6:59:BC:DB:66:C5:8B:49:F3:23",
},
CertificateThumbprints: []string{thumbprint},
},
}
_, err = testHTTPConnection(config_obj, ts.URL)
Expand All @@ -77,9 +80,7 @@ func TestTLSVerification(t *testing.T) {
config_obj = &config_proto.ClientConfig{
Crypto: &config_proto.CryptoConfig{
CertificateVerificationMode: "PKI_OR_THUMBPRINT",
CertificateThumbprints: []string{
"AB:60:19:14:43:6E:58:BA:BB:17:B9:16:61:55:CA:F9:7B:D7:E5:F8:DE:B9:B6:59:BC:DB:66:C5:8B:49:F3:23",
},
CertificateThumbprints: []string{thumbprint},
},
}
data, err := testHTTPConnection(config_obj, ts.URL)
Expand All @@ -90,9 +91,7 @@ func TestTLSVerification(t *testing.T) {
config_obj = &config_proto.ClientConfig{
Crypto: &config_proto.CryptoConfig{
CertificateVerificationMode: "THUMBPRINT_ONLY",
CertificateThumbprints: []string{
"AB601914436E58BABB17B9166155CAF97BD7E5F8DEB9B659BCDB66C58B49F323",
},
CertificateThumbprints: []string{thumbprint},
},
}
data, err = testHTTPConnection(config_obj, ts.URL)
Expand All @@ -104,9 +103,7 @@ func TestTLSVerification(t *testing.T) {
config_obj = &config_proto.ClientConfig{
Crypto: &config_proto.CryptoConfig{
CertificateVerificationMode: "THUMBPRINT_ONLY",
CertificateThumbprints: []string{
"AB601914436E58BABB17B9166155CAF97BD7E5F8DEB9B659BCDB66C58B49F323",
},
CertificateThumbprints: []string{thumbprint},
},
}
data, err = testHTTPConnection(config_obj, "https://www.google.com")
Expand All @@ -118,9 +115,7 @@ func TestTLSVerification(t *testing.T) {
config_obj = &config_proto.ClientConfig{
Crypto: &config_proto.CryptoConfig{
CertificateVerificationMode: "THUMBPRINT_ONLY",
CertificateThumbprints: []string{
"AB601914436E58BABB17B9166155CAF97BD7E5F8DEB9B659BCDB66C58B49F323",
},
CertificateThumbprints: []string{thumbprint},
},
FallbackAddresses: map[string]string{
"nosuch-site.example.com:443": strings.TrimPrefix(ts.URL, "https://"),
Expand Down