Skip to content
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

Add tls support to frontend connection #6

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ dev: $(KIND) $(KUBECTL)
@sudo $(KIND) create cluster --name=$(PROJECT_NAME)-dev --kubeconfig=$(USER_DIR)/.kube/config
@$(KUBECTL) cluster-info --context kind-$(PROJECT_NAME)-dev
@$(INFO) Installing Crossplane CRDs
@$(KUBECTL) create -k https://github.com/crossplane/crossplane//cluster?ref=master
@$(KUBECTL) create -k https://github.com/crossplane/crossplane//cluster?ref=v1.16.2
@$(INFO) Installing Provider temporal CRDs
@$(KUBECTL) apply -R -f package/crds
@$(INFO) Start Provider temporal via: $(GO) run cmd/provider/main.go --debug
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ spec:
name: provider-temporal-config-creds
key: credentials
```

Provider Credentials with TLS:
```
{
"HostPort": "temporal:7233",
"UseTLS": true,
"CACert": "-----BEGIN CERTIFICATE-----\nhere insert CA certificate\n-----END CERTIFICATE-----",
"CertFile": "-----BEGIN CERTIFICATE-----\nhere insert certificate\n-----END CERTIFICATE-----",
"KeyFile": "-----BEGIN RSA PRIVATE KEY-----\nhere insert key\n-----END RSA PRIVATE KEY-----",
}
```
# Troubleshooting
Create a DeploymentRuntimeConfig and set the arg `--debug` on the package-runtime container:

Expand Down Expand Up @@ -193,4 +204,15 @@ guide may also be of use.
Start temporal environment for tests
```
sudo docker-compose -f tests/docker-compose.yaml up
```
```
## TLS

In case test certificates are expired, run `bash certs/generate-test-certs.sh` and new certificates will be created.

Then, edit `internal/clients/service_test.go` and update the new test certificates to `jsonConfig` after you replace the newlines with `\n`.

```
awk 'NR > 1 {printf "\\n"} {printf "%s", $0} END {printf ""}' certs/client.pem
awk 'NR > 1 {printf "\\n"} {printf "%s", $0} END {printf ""}' certs/client.key
awk 'NR > 1 {printf "\\n"} {printf "%s", $0} END {printf ""}' certs/ca.crt
```
31 changes: 31 additions & 0 deletions certs/ca.cert
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFRTCCAy2gAwIBAgIUTfLoHTSYNEx0LXYnju+wJF6EP4EwDQYJKoZIhvcNAQEL
BQAwMjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAldBMRYwFAYDVQQKDA1UZXN0IENB
LCBJbmMuMB4XDTI0MDkyMDExMzY1OFoXDTI1MDkyMDExMzY1OFowMjELMAkGA1UE
BhMCVVMxCzAJBgNVBAgMAldBMRYwFAYDVQQKDA1UZXN0IENBLCBJbmMuMIICIjAN
BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAq2+PV/h7kTWoUI3KhadR5yvrnqW4
/NiBAV6TToxMK97KSs2J5EAIKjtg3o+1vL2Tkc6mOAegqGLsVWwpxUCTChBPDjiM
LsBx1c7uTU0m7eDIBoMDMNy5Vy+tvT5vey+pdM4KORdzHIkjctilWWdJuUF+qRzp
ijgIruNsEj5CbYz57xXoS3wErfJlUu9GX+LFizR2OQMvIiF09dTbTyQ1a2bOmQYD
8nVz7yo7ENCJlPonQYkSBfVuXIyR5LTouPsv2DYNGlT63rwEY3t0aq23Datmv9QP
2k1jCMz3HcTUFHa+ErSd6opJYr9Fw+J6k/Ifho8xq3R6iJ5D9Wk15ozPA9tdZt/T
vBmDb0QD9SvIirLuDBZ2eHbdCG2uLq/tLf87f04y3Q4VcAa0CCp+mGCMil9pnSki
LqmcD0iAApQU3RtdX6uqV1TC9oK7UYomJY4nB2EwneI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IFICATE-----
17 changes: 17 additions & 0 deletions certs/client-cert.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[req]
default_bits = 4096
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[dn]
C = US
ST = WA
O = Test Client, Inc.
CN = localhost
[req_ext]
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
IP.1 = ::1
IP.2 = 127.0.0.1
52 changes: 52 additions & 0 deletions certs/client.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC30pL4KBqpqPVh
1DDQ+TNveWKPciq3fulYxbGKqj/y6NRhHE52HP0nfbTAFUKpQQ2dqDxu9eYnGZFp
4ELusILGg1fGwS5YBT6I3h0m+aNJvIn7Gh71LI1+j8PgHFW26EbEGnWDp2guekLr
2muIgreTu68/RuE/yFJqFKK3gV1eDmZ7jOrUUdZtMn0DDkLHzHakQ288DCOGA48X
taEnZDDRvlpI/ZvMmIo9GzA4pTewKpuSKj3dGGShN9f1KVShi7AgLRQ7X72/ys0j
8DNpco4Vh8Z/zCjvp5wT9NI6t9uBtwVtwd8OL+LblnaTP4HfeuG7wHWGCo6xwMsp
sijlzel0w+yQvsbdpzg6DcwvKa/KBheLaELZbdSkfWd6uCGvBE1aiFOcscDBTpT+
L1CMYjlY0CiSK1gk1q471ryvSc/bV5aluMJUs6xlqg3luXGWfNWkjILwgU+kqA/j
byKK8CoDjdZ5OjXN4fZkbDcrNP5QMIG+CSB5lC0jgdpxdKQwPJ8bAW8MAdtffXL3
8WuN5p38GwGvwNDFWpT54xrjo6ZF7LmNwqz8pSDkwDAtApysHWavmQlWBKQECyAE
Ghe8HTlL20zhg+AeP93ntTZeQ4nymnwyygLpWXBCsIYL9QyeTT/Mhy2MmzN1DrIZ
VB4QkSlBC697z5VscHDPq7Kvzn74IQIDAQABAoICAEIwzmASHMuzvav82pkc6qL8
u/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Ne4ks/CLkS/ygi8yrsPx1N8eMnYz0aGJbPVk/zxfor1vrIBpUMKFMR2KhWC
hCXz2TenOYcujc7KFJq828Ku5O6REfdo6CYFT8ag2PwZOVQwp6Okm1ehUq+f+QMN
DrmxZadj5zL9qjMf2QXnQ5J1ihfDmuX0e36DarAq9f3jujblKFMEkAx+hocXoMmj
mru+V50PbFH2uc4t/dcmCWMPm/BX7zrQwkJffatj7lwwcyIPbIPwSObLgWfSEI1d
jLG9z3ZTkwHuHm/qkFZG/RKSsOgw
-----END PRIVATE KEY-----
32 changes: 32 additions & 0 deletions certs/client.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFejCCA2KgAwIBAgIUEI7nS+4t8W3HYGNShYOTzlIIdoUwDQYJKoZIhvcNAQEL
BQAwMjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAldBMRYwFAYDVQQKDA1UZXN0IENB
LCBJbmMuMB4XDTI0MDkyMDExMzY1OFoXDTI1MDkyMDExMzY1OFowSjELMAkGA1UE
BhMCVVMxCzAJBgNVBAgMAldBMRowGAYDVQQKDBFUZXN0IENsaWVudCwgSW5jLjES
MBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC
AgEAt9KS+Cgaqaj1YdQw0Pkzb3lij3Iqt37pWMWxiqo/8ujUYRxOdhz9J320wBVC
qUENnag8bvXmJxmRaeBC7rCCxoNXxsEuWAU+iN4dJvmjSbyJ+xoe9SyNfo/D4BxV
tuhGxBp1g6doLnpC69priIK3k7uvP0bhP8hSahSit4FdXg5me4zq1FHWbTJ9Aw5C
x8x2pENvPAwjhgOPF7WhJ2Qw0b5aSP2bzJiKPRswOKU3sCqbkio93RhkoTfX9SlU
oYuwIC0UO1+9v8rNI/AzaXKOFYfGf8wo76ecE/TSOrfbgbcFbcHfDi/i25Z2kz+B
33rhu8B1hgqOscDLKbIo5c3pdMPskL7G3ac4Og3MLymvyg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urpX20FxiHJeC3T49p/SiryixxK6fp+hnJNOfY75
QfccXTAFYngqrs7UGkiDn7AYEl2Ffv44CvWRvACIiL1TqxRgPdJZHceYqLwCfbgV
cmoFO2F27/Uo4XmKOgw=
-----END CERTIFICATE-----
16 changes: 16 additions & 0 deletions certs/cluster-cert.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[req]
default_bits = 4096
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[dn]
C = US
ST = WA
O = Test Cluster, Inc.
CN = localhost
[req_ext]
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
IP.1 = ::1
52 changes: 52 additions & 0 deletions certs/cluster.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCr6sj3mqlaOH9q
r9fBRcHJoNjlY0ViSaNqwtQNmbxY3EMBe3t5OA2DP4NTQiGxFfzt3ffxXxYN9sfi
icVO0kRXf7KDJfwV88eroqR2RXyK085BWp7WlS71RjrhoNR6Nqg5fL1vSYRxPSfy
a3O3PrgwwQ7gSBDFBzkmu0J+flNRVI4nUAdPypCv74mRxrJi+plkG/JUwAE0T8eZ
jdSF9q7MmCHkhxX5YANiTM+blWKGeZOkYdu6C+bxTNGlZFEDLOogLVruQrHjIzwY
Gra7gcNKmGaPXHypa/9QuXRSli32MyObV9z7FK3j+EWw9uBNG49fJEYmmP0RvWQa
wlXuA8dyF1L0AGduSVzKKVi+VY++CGGxWOxIGfa0t7f+WH0icmfEM+t+qqs9BnEE
wSPOl8bVUiAnGwumoWEZ5QgHaxZJhYmPHnpP/EaEaxNUbdW4tsNz0dq4A1MeFHky
Dw6/F+XjijBBn3TSTrdvsLooGR8mgpekqBAFbJ5ewaoZjXjbj5I9shbMKo/0QcJW
TP0KWVgk20OPuHLRFb3rFZXWznUx0e/+ELqEaNRI/pYTuicy9nfapy69Pxxe37GU
x9KN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RZPYz6Th/UVaCPlNok3qcy2h8wh4wYGDBKmLlSs5aS3isHCRxkv
72ECggEAZ2TD9Q2WekzjSDwhVgXARtWsd5lPE0o4hvN2gwbRy+DL90HOHsVXfIZZ
OvtVrSwd+Jq5MtuJV2DVx7AsyafqMkNL+l6eitHTJjfItMQYK1zjDJGkDwNRl3T3
zWu0qrga308JwMu8jvncaX0qCIPCdY2l56tIVquqSxviEC899o83U7tosHqOxS+5
Et7VPl+vtw/uT379zudbuxRRlSibdg8Y29Td9KbJGystrtU/lXJ1fUxmVrz1At33
lrTVMpeOr9UjHsnVC9xngnGnfFBTkctvhBvdDlylTbZ0z84mF0Vhq1wuVoI0AZgu
2/GlTo9c9RvB9guyoeGhG7n9TqqSxQ==
-----END PRIVATE KEY-----
32 changes: 32 additions & 0 deletions certs/cluster.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFdTCCA12gAwIBAgIUEI7nS+4t8W3HYGNShYOTzlIIdoQwDQYJKoZIhvcNAQEL
BQAwMjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAldBMRYwFAYDVQQKDA1UZXN0IENB
LCBJbmMuMB4XDTI0MDkyMDExMzY1OFoXDTI1MDkyMDExMzY1OFowSzELMAkGA1UE
BhMCVVMxCzAJBgNVBAgMAldBMRswGQYDVQQKDBJUZXN0IENsdXN0ZXIsIEluYy4x
EjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
ggIBAKvqyPeaqVo4f2qv18FFwcmg2OVjRWJJo2rC1A2ZvFjcQwF7e3k4DYM/g1NC
IbEV/O3d9/FfFg32x+KJxU7SRFd/soMl/BXzx6uipHZFfIrTzkFantaVLvVGOuGg
1Ho2qDl8vW9JhHE9J/Jrc7c+uDDBDuBIEMUHOSa7Qn5+U1FUjidQB0/KkK/viZHG
smL6mWQb8lTAATRPx5mN1IX2rsyYIeSHFflgA2JMz5uVYoZ5k6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m
+y7QK80XCICajr4iKJQSm7kqsoEA5HawZGH0LcaO7+zp+Jnka4bB6RIbfbAePkYx
r8dF3vs69JdPAkklRcW6NIWUA3tQT/RcFBQlG8+dO8MynrTsrWQh+VuqSdZBtcyk
/AYAfXJPKO2JrzwE9PnN32FFvbvhJ967C3WVcDB0nTw7sQDvr42GGT8pfqOkN1z6
qvjteAgbOceRsnR/Zl/SjENo5By67n7EmKFIznWffGeZurtoA5KM7YuhCdnd51uS
LwpXS8CJoWtJ
-----END CERTIFICATE-----
22 changes: 22 additions & 0 deletions certs/generate-test-certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This scripts generates test keys and certificates for the sample.
# In a production environment such artifacts should be genrated
# by a proper certificate authority and handled in a secure manner.

CERTS_DIR=./certs
mkdir $CERTS_DIR

# Generate a private key and a certificate for a test certificate authority
openssl genrsa -out $CERTS_DIR/ca.key 4096
openssl req -new -x509 -key $CERTS_DIR/ca.key -sha256 -subj "/C=US/ST=WA/O=Test CA, Inc." -days 365 -out $CERTS_DIR/ca.cert

# Generate a private key and a certificate for cluster
openssl genrsa -out $CERTS_DIR/cluster.key 4096
openssl req -new -key $CERTS_DIR/cluster.key -out $CERTS_DIR/cluster.csr -config $CERTS_DIR/cluster-cert.conf
openssl x509 -req -in $CERTS_DIR/cluster.csr -CA $CERTS_DIR/ca.cert -CAkey $CERTS_DIR/ca.key -CAcreateserial -out $CERTS_DIR/cluster.pem -days 365 -sha256 -extfile $CERTS_DIR/cluster-cert.conf -extensions req_ext

# Generate a private key and a certificate for clients
openssl req -newkey rsa:4096 -nodes -keyout "$CERTS_DIR/client.key" -out "$CERTS_DIR/client.csr" -config $CERTS_DIR/client-cert.conf
openssl x509 -req -in $CERTS_DIR/client.csr -CA $CERTS_DIR/ca.cert -CAkey $CERTS_DIR/ca.key -CAcreateserial -out $CERTS_DIR/client.pem -days 365 -sha256 -extfile $CERTS_DIR/client-cert.conf -extensions req_ext
# Export to .pfx
# "-keypbe NONE -certpbe NONE -passout pass:" specifies an unencrypted archive
openssl pkcs12 -export -out $CERTS_DIR/client.pfx -inkey $CERTS_DIR/client.key -in $CERTS_DIR/client.pem -keypbe NONE -certpbe NONE -passout pass:
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ require (
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/grpc v1.61.0
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
68 changes: 68 additions & 0 deletions internal/clients/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ func createTemporalNamespaceService(t *testing.T) *TemporalServiceImpl {
return temporalService
}

func createTemporalNamespaceServiceTLS(t *testing.T) *TemporalServiceImpl {
temporalService := createTemporalServiceTLS(t)

_, err := temporalService.DeleteAllNamespaces(context.Background())
if err != nil {
t.Fatal(err)
}
return temporalService
}

func createDefaultNamespaceParametersWithName(name string) *core.TemporalNamespaceParameters {
desc := "Desc1"
mail := "[email protected]"
Expand Down Expand Up @@ -234,6 +244,64 @@ func TestCreateDelete(t *testing.T) {
assertNamespacesCount(t, temporalService, 0)
}

func TestCreateTLS(t *testing.T) {
skipIfIsShort(t)

temporalService := createTemporalNamespaceServiceTLS(t)
testNamespace := createDefaultNamespaceParametersWithName("TestTLS007")

err := temporalService.CreateNamespace(context.Background(), testNamespace)
if err != nil {
t.Fatal(err)
}

created, err := temporalService.DescribeNamespaceByName(context.Background(), testNamespace.Name)
if err != nil {
t.Fatal(err)
}

assertNamespaceAreEqual(t, temporalService, created, testNamespace)
assertNamespacesCount(t, temporalService, 1)

_, err = temporalService.DeleteNamespaceByName(context.Background(), testNamespace.Name)
if err != nil {
t.Fatal(err)
}

assertNamespacesCount(t, temporalService, 0)
}

func TestCreateDeleteTLS(t *testing.T) {
skipIfIsShort(t)

temporalService := createTemporalNamespaceServiceTLS(t)
testNamespace1 := createDefaultNamespaceParametersWithName("TestTLS004")

err1 := temporalService.CreateNamespace(context.Background(), testNamespace1)
if err1 != nil {
t.Fatal(err1)
}

created1, err1 := temporalService.DescribeNamespaceByName(context.Background(), testNamespace1.Name)
if err1 != nil {
t.Fatal(err1)
}

assertNamespaceAreEqual(t, temporalService, created1, testNamespace1)
assertNamespacesCount(t, temporalService, 1)

deleted, err1 := temporalService.DeleteNamespaceByName(context.Background(), created1.Name)
if err1 != nil {
t.Fatal(err1)
}

if deleted == nil {
t.Fatal("Namespace " + created1.Name + " not deleted")
}
t.Logf("Deleted: %s", *deleted)
assertNamespacesCount(t, temporalService, 0)
}

func assertNamespaceAreEqual(t *testing.T, temporalService NamespaceService, actual *core.TemporalNamespaceObservation, expected *core.TemporalNamespaceParameters) {
mappedActual, err := temporalService.MapToNamespaceCompare(actual)
if err != nil {
Expand Down
Loading
Loading