INNER CODE UNIT · Go

RedeemTrustToken

terraform-lxd/terraform-provider-lxd · internal/acctest/checks.go:320

func RedeemTrustToken(t *testing.T, token string, clientCert string, clientKey string) {
	// The token can only be redeemed on the server that issued it.
	address := PreCheckLocalServerHTTPS(t)

	// The client is not trusted yet, so the server certificate cannot be verified against a previously
	// accepted fingerprint.
	args := &lxd.ConnectionArgs{
		TLSClientCert:      clientCert,
		TLSClientKey:       clientKey,
		InsecureSkipVerify: true,
	}

	untrustedServer, err := lxd.ConnectLXD(address, args)
	if err != nil {
		t.Fatalf("Failed to connect to LXD server as an untrusted client: %v", err)
	}

	// Only the trust token may be provided.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…