Skip to content
Open
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
65 changes: 65 additions & 0 deletions test/autest/gold_tests/basic/sni-based-configuration.replay.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
meta:
version: "1.0"

# Testing configuration based upon sni.
txn_box:
global:
- when: txn-open
do:
- with: inbound-sni
select:
- none-of:
- tld: "avoid_configuration.com"
do:
- txn-conf<proxy.config.http.insert_forwarded>: "by=unknown"

sessions:
- protocol: [ { name: ip, version : 4} , { name: "tls", sni: "server1.avoid_configuration.com" } ]
transactions:
- client-request:
version: "1.1"
method: "GET"
url: "https://server1.avoid_configuration.com/candy"
headers:
fields:
- [ Host, server1.avoid_configuration.com ]
- [ uuid, 1 ]

# The inserted_forwarded should not be engaged for this SNI.
proxy-request:
headers:
fields:
- [ Forwarded, { as: absent } ]

server-response:
status: 200
reason: OK
headers:
fields:
- [ Content-Type, html/plaintext ]
- [ Content-Length, 234 ]

- protocol: [ { name: ip, version : 4} , { name: "tls", sni: "server1.configure_me.com" } ]
transactions:
- client-request:
version: "1.1"
method: "GET"
url: "https://server1.configure_me.com/candy"
headers:
fields:
- [ Host, server1.configure_me.com ]
- [ uuid, 2 ]

# The inserted_forwarded should be engaged for this SNI.
proxy-request:
headers:
fields:
- [ Forwarded, { value: "by=unknown", as: equal } ]

server-response:
status: 200
reason: OK
headers:
fields:
- [ Content-Type, html/plaintext ]
- [ Content-Length, 234 ]
38 changes: 38 additions & 0 deletions test/autest/gold_tests/basic/sni-based-configuration.test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# @file
#
# Copyright 2022, Verizon Media
# SPDX-License-Identifier: Apache-2.0
#

import os

"""SNI-based configuration test."""

Test.Summary = "Test SNI-based configuration."

tr = Test.TxnBoxTestAndRun(
"Test SNI based configuration"
, "sni-based-configuration.replay.yaml"
, config_path='Auto'
, config_key="meta.txn_box.global"
, verifier_client_args="--verbose diag"
, verifier_server_args="--verbose diag"
, enable_tls=True
)

ts = tr.Variables.TS
ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 1
, 'proxy.config.diags.debug.tags': 'txn_box|ssl|http'

# TLS configuration.
, 'proxy.config.ssl.server.cert.path': f'{ts.Variables.CONFIGDIR}'
, 'proxy.config.ssl.server.private_key.path': f'{ts.Variables.CONFIGDIR}'
, 'proxy.config.http.server_ports': f'{ts.Variables.port} {ts.Variables.ssl_port}:ssl'
, 'proxy.config.ssl.client.verify.server.policy': 'DISABLED'
})
ts.Setup.Copy("../../ssl/server.key", os.path.join(ts.Variables.CONFIGDIR, "server.key"))
ts.Setup.Copy("../../ssl/server.pem", os.path.join(ts.Variables.CONFIGDIR, "server.pem"))
ts.Disk.ssl_multicert_config.AddLine(
'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key'
)