Generate a self-signed cert+key pair that is NOT signed by the cluster CA.
(
tmpdir: pathlib.Path,
)
| 64 | |
| 65 | |
| 66 | def _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 | # --------------------------------------------------------------------------- |
no test coverage detected