-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#579]: feature(h2c): optional certificates for TLS
- Loading branch information
Showing
7 changed files
with
179 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 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,19 @@ | ||
version: '3' | ||
|
||
rpc: | ||
listen: tcp://127.0.0.1:6001 | ||
|
||
server: | ||
command: "php ../php_test_files/worker.php" | ||
|
||
temporal: | ||
address: "localhost:4433" | ||
cache_size: 10 | ||
activities: | ||
num_workers: 1 | ||
tls: | ||
use_h2c: true | ||
|
||
logs: | ||
mode: development | ||
level: debug |
This file contains 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 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,63 @@ | ||
static_resources: | ||
listeners: | ||
- name: listener_0 | ||
address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 443 # Public-facing TLS port | ||
filter_chains: | ||
- filter_chain_match: {} | ||
filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
stat_prefix: ingress_http | ||
codec_type: AUTO | ||
route_config: | ||
name: local_route | ||
virtual_hosts: | ||
- name: grpc_service | ||
domains: | ||
- "*" # Allows all domains to access | ||
routes: | ||
- match: | ||
prefix: "/" | ||
route: | ||
cluster: grpc_backend | ||
timeout: 0s | ||
http_filters: | ||
- name: envoy.filters.http.router | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
upgrade_configs: | ||
- upgrade_type: h2c # Enables h2c upgrade for cleartext HTTP/2 | ||
transport_socket: # Move this out to align with filter_chains | ||
name: envoy.transport_sockets.tls | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext | ||
common_tls_context: | ||
alpn_protocols: "h2" | ||
tls_certificates: | ||
- certificate_chain: | ||
filename: "/etc/envoy/client.pem" | ||
private_key: | ||
filename: "/etc/envoy/client.key" | ||
validation_context: | ||
trusted_ca: | ||
filename: "/etc/envoy/ca.cert" | ||
|
||
clusters: | ||
- name: grpc_backend | ||
connect_timeout: 5s | ||
type: LOGICAL_DNS | ||
lb_policy: ROUND_ROBIN | ||
load_assignment: | ||
cluster_name: grpc_backend | ||
endpoints: | ||
- lb_endpoints: | ||
- endpoint: | ||
address: | ||
socket_address: | ||
address: temporal # Temporal service hostname | ||
port_value: 7233 # Temporal service port | ||
http2_protocol_options: {} # Enables HTTP/2 for cleartext h2c communication |
This file contains 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,52 @@ | ||
package tests | ||
|
||
import ( | ||
"context" | ||
"sync" | ||
"testing" | ||
"time" | ||
|
||
"tests/helpers" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"go.temporal.io/sdk/client" | ||
) | ||
|
||
func Test_H2CWithoutCerts(t *testing.T) { | ||
stopCh := make(chan struct{}, 1) | ||
wg := &sync.WaitGroup{} | ||
wg.Add(1) | ||
s := helpers.NewTestServer(t, stopCh, wg, "../configs/.rr-h2c.yaml") | ||
|
||
w, err := s.Client.ExecuteWorkflow( | ||
context.Background(), | ||
client.StartWorkflowOptions{ | ||
TaskQueue: "default", | ||
}, | ||
"HistoryLengthWorkflow") | ||
assert.NoError(t, err) | ||
|
||
time.Sleep(time.Second) | ||
var result any | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) | ||
defer cancel() | ||
assert.NoError(t, w.Get(ctx, &result)) | ||
|
||
res := []float64{3, 8, 8, 15} | ||
out := result.([]interface{}) | ||
|
||
for i := 0; i < len(res); i++ { | ||
if res[i] != out[i].(float64) { | ||
t.Fail() | ||
} | ||
} | ||
|
||
we, err := s.Client.DescribeWorkflowExecution(context.Background(), w.GetID(), w.GetRunID()) | ||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, "Completed", we.WorkflowExecutionInfo.Status.String()) | ||
stopCh <- struct{}{} | ||
wg.Wait() | ||
time.Sleep(time.Second) | ||
} |
This file contains 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