@@ -250,6 +250,67 @@ def configure_mtls_expired_client_cert(context: Context) -> None:
250250 _write_config (config , _LLAMA_STACK_CONFIG )
251251
252252
253+ @given ("Llama Stack is configured with CA certificate and hostname mismatch server" )
254+ def configure_tls_hostname_mismatch (context : Context ) -> None :
255+ """Configure run.yaml to connect to the hostname-mismatch TLS server.
256+
257+ The mock server on port 8445 presents a certificate issued for
258+ "wrong-hostname.example.com", but the client connects to
259+ "mock-tls-inference", causing a hostname verification failure.
260+
261+ Parameters:
262+ context: Behave test context.
263+ """
264+ config , provider = _prepare_tls_provider ()
265+ provider ["config" ]["base_url" ] = "https://mock-tls-inference:8445/v1"
266+ provider ["config" ]["network" ]["tls" ] = {"verify" : "/certs/ca.crt" }
267+ _write_config (config , _LLAMA_STACK_CONFIG )
268+
269+
270+ @given (
271+ "Llama Stack is configured with mutual TLS and hostname mismatch server"
272+ )
273+ def configure_mtls_hostname_mismatch (context : Context ) -> None :
274+ """Configure run.yaml for mTLS against the hostname-mismatch TLS server.
275+
276+ The mock server on port 8445 presents a certificate issued for
277+ "wrong-hostname.example.com". Even though client certs are provided,
278+ the hostname mismatch should cause the connection to fail.
279+
280+ Parameters:
281+ context: Behave test context.
282+ """
283+ config , provider = _prepare_tls_provider ()
284+ provider ["config" ]["base_url" ] = "https://mock-tls-inference:8445/v1"
285+ provider ["config" ]["network" ]["tls" ] = {
286+ "verify" : "/certs/ca.crt" ,
287+ "client_cert" : "/certs/client.crt" ,
288+ "client_key" : "/certs/client.key" ,
289+ }
290+ _write_config (config , _LLAMA_STACK_CONFIG )
291+
292+
293+ @given (
294+ 'Llama Stack is configured with TLS minimum version "{version}" and hostname mismatch server'
295+ )
296+ def configure_tls_min_version_hostname_mismatch (
297+ context : Context , version : str
298+ ) -> None :
299+ """Configure run.yaml with TLS min version against the hostname-mismatch server.
300+
301+ Parameters:
302+ context: Behave test context.
303+ version: The TLS version (e.g., "TLSv1.2", "TLSv1.3").
304+ """
305+ config , provider = _prepare_tls_provider ()
306+ provider ["config" ]["base_url" ] = "https://mock-tls-inference:8445/v1"
307+ provider ["config" ]["network" ]["tls" ] = {
308+ "verify" : "/certs/ca.crt" ,
309+ "min_version" : version ,
310+ }
311+ _write_config (config , _LLAMA_STACK_CONFIG )
312+
313+
253314@given (
254315 'Llama Stack is configured with TLS minimum version "{version}" and CA certificate path "{path}"'
255316)
0 commit comments