diff --git a/pkgs/clan-cli/tests/helpers/validator.py b/pkgs/clan-cli/tests/helpers/validator.py index fefb2e413..18140120a 100644 --- a/pkgs/clan-cli/tests/helpers/validator.py +++ b/pkgs/clan-cli/tests/helpers/validator.py @@ -1,5 +1,4 @@ import subprocess -import tempfile class Error(Exception): @@ -20,25 +19,3 @@ def is_valid_age_key(secret_key: str) -> bool: return True msg = f"Invalid age key: {secret_key}" raise Error(msg) - - -def is_valid_ssh_key(secret_key: str, ssh_pub: str) -> bool: - # create tempfile and write secret_key to it - with tempfile.NamedTemporaryFile() as temp: - temp.write(secret_key.encode("utf-8")) - temp.flush() - # Run the ssh-keygen command with the -y flag to check the key format - result = subprocess.run( - ["ssh-keygen", "-y", "-f", temp.name], - capture_output=True, - text=True, - check=False, - ) - - if result.returncode == 0: - if result.stdout != ssh_pub: - msg = f"Expected '{ssh_pub}' got '{result.stdout}' for ssh key: {secret_key}" - raise Error(msg) - return True - msg = f"Invalid ssh key: {secret_key}" - raise Error(msg) diff --git a/pkgs/clan-cli/tests/test_secrets_generate.py b/pkgs/clan-cli/tests/test_secrets_generate.py index 98e092ccb..51dd64465 100644 --- a/pkgs/clan-cli/tests/test_secrets_generate.py +++ b/pkgs/clan-cli/tests/test_secrets_generate.py @@ -9,7 +9,7 @@ from clan_cli.machines.machines import Machine from clan_cli.secrets.folders import sops_secrets_folder from fixtures_flakes import FlakeForTest from helpers import cli -from helpers.validator import is_valid_age_key, is_valid_ssh_key +from helpers.validator import is_valid_age_key if TYPE_CHECKING: from age_keys import KeyPair @@ -85,7 +85,6 @@ def test_generate_secret( assert store2.exists("", "password-hash") assert store2.exists("", "user-password") assert store2.exists("", "user-password-hash") - assert store2.exists("", "ssh.id_ed25519") assert store2.exists("", "age.key") assert store2.exists("", "zerotier-identity-secret") @@ -97,11 +96,6 @@ def test_generate_secret( assert age_secret.isprintable() assert is_valid_age_key(age_secret) - # Assert that the ssh key is valid - ssh_secret = store2.get("", "ssh.id_ed25519").decode() - ssh_pub = machine_get_fact(test_flake_with_core.path, "vm2", "ssh.id_ed25519.pub") - assert is_valid_ssh_key(ssh_secret, ssh_pub) - # Assert that root-password is valid pwd_secret = store2.get("", "password").decode() assert pwd_secret.isprintable() diff --git a/pkgs/clan-cli/tests/test_secrets_password_store.py b/pkgs/clan-cli/tests/test_secrets_password_store.py index b187735f3..19054bf37 100644 --- a/pkgs/clan-cli/tests/test_secrets_password_store.py +++ b/pkgs/clan-cli/tests/test_secrets_password_store.py @@ -10,7 +10,6 @@ from clan_cli.nix import nix_shell from clan_cli.ssh import HostGroup from fixtures_flakes import ClanFlake from helpers import cli -from helpers.validator import is_valid_ssh_key @pytest.mark.impure @@ -90,14 +89,8 @@ def test_upload_secret( assert store.exists("", "password-hash") assert store.exists("", "user-password") assert store.exists("", "user-password-hash") - assert store.exists("", "ssh.id_ed25519") assert store.exists("", "zerotier-identity-secret") - # Assert that the ssh key is valid - ssh_secret = store.get("", "ssh.id_ed25519").decode() - ssh_pub = machine_get_fact(flake.path, "vm1", "ssh.id_ed25519.pub") - assert is_valid_ssh_key(ssh_secret, ssh_pub) - # Assert that root-password is valid pwd_secret = store.get("", "password").decode() assert pwd_secret.isprintable()