MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / _generate_self_signed_cert

Function _generate_self_signed_cert

e2e/python/test_security_tls.py:66–93  ·  view source on GitHub ↗

Generate a self-signed cert+key pair that is NOT signed by the cluster CA.

(
    tmpdir: pathlib.Path,
)

Source from the content-addressed store, hash-verified

64
65
66def _generate_self_signed_cert(
67 tmpdir: pathlib.Path,
68) -> tuple[pathlib.Path, pathlib.Path]:
69 """Generate a self-signed cert+key pair that is NOT signed by the cluster CA."""
70 cert_path = tmpdir / "rogue.crt"
71 key_path = tmpdir / "rogue.key"
72 subprocess.run(
73 [
74 "openssl",
75 "req",
76 "-x509",
77 "-sha256",
78 "-nodes",
79 "-days",
80 "1",
81 "-newkey",
82 "rsa:2048",
83 "-subj",
84 "/O=rogue/CN=rogue-client",
85 "-keyout",
86 str(key_path),
87 "-out",
88 str(cert_path),
89 ],
90 check=True,
91 capture_output=True,
92 )
93 return cert_path, key_path
94
95
96# ---------------------------------------------------------------------------

Callers 1

Calls 1

runMethod · 0.45

Tested by

no test coverage detected