summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMason Elmore <masonelmore@users.noreply.github.com>2026-09-11 04:32:37 -0500
committerGitHub <noreply@github.com>2026-09-11 12:32:37 +0300
commit25635b0560863eb4a5b34434bb34dfd7c43d77f9 (patch)
tree2972ea1315b42576ce9ca85fb20e54fa074c7d55
parent497022e13c372ed68afe49aeafca66285e2f8001 (diff)
downloadvyos.vyos-25635b0560863eb4a5b34434bb34dfd7c43d77f9.tar.gz
vyos.vyos-25635b0560863eb4a5b34434bb34dfd7c43d77f9.zip
T9251: accept OpenSSH sk-* key types in vyos_user (#500)HEADmain
* T9251: accept OpenSSH sk-* key types in vyos_user VyOS has accepted sk-ecdsa-sha2-nistp256@openssh.com and sk-ssh-ed25519@openssh.com since T4750, but the module's choices list was never updated, so a playbook using a security key fails argspec validation while the equivalent CLI commands succeed. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: omnom62 <omnom62@outlook.com>
-rw-r--r--bindep.txt8
-rw-r--r--changelogs/fragments/T9251_vyos_user_sk_key_types.yml5
-rw-r--r--plugins/modules/vyos_user.py4
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_user.py34
4 files changed, 47 insertions, 4 deletions
diff --git a/bindep.txt b/bindep.txt
index f1d23492..da51495b 100644
--- a/bindep.txt
+++ b/bindep.txt
@@ -2,9 +2,9 @@
# see https://docs.openstack.org/infra/bindep/ for additional information.
gcc-c++ [doc test platform:rpm]
-libssh-devel [test platform:rpm]
-libssh-dev [platform:dpkg]
-libssh-devel [platform:rpm]
+#libssh-devel [test platform:rpm]
+#libssh-dev [platform:dpkg]
+#libssh-devel [platform:rpm]
libffi-devel [test platform:rpm]
openssl-devel [test platform:rpm]
-libssh-dev [compile test platform:rpm]
+#libssh-dev [compile test platform:rpm]
diff --git a/changelogs/fragments/T9251_vyos_user_sk_key_types.yml b/changelogs/fragments/T9251_vyos_user_sk_key_types.yml
new file mode 100644
index 00000000..47806abb
--- /dev/null
+++ b/changelogs/fragments/T9251_vyos_user_sk_key_types.yml
@@ -0,0 +1,5 @@
+---
+bugfixes:
+ - >-
+ vyos_user - Accept OpenSSH security key types ``sk-ecdsa-sha2-nistp256@openssh.com`` and
+ ``sk-ssh-ed25519@openssh.com`` for ``public_keys.type``, which were previously rejected.
diff --git a/plugins/modules/vyos_user.py b/plugins/modules/vyos_user.py
index dd8c801f..7c21b074 100644
--- a/plugins/modules/vyos_user.py
+++ b/plugins/modules/vyos_user.py
@@ -117,6 +117,8 @@ options:
- ecdsa-sha2-nistp384
- ssh-ed25519
- ecdsa-sha2-nistp521
+ - sk-ecdsa-sha2-nistp256@openssh.com
+ - sk-ssh-ed25519@openssh.com
name:
description:
@@ -447,6 +449,8 @@ def main():
"ecdsa-sha2-nistp384",
"ssh-ed25519",
"ecdsa-sha2-nistp521",
+ "sk-ecdsa-sha2-nistp256@openssh.com",
+ "sk-ssh-ed25519@openssh.com",
],
),
)
diff --git a/tests/unit/modules/network/vyos/test_vyos_user.py b/tests/unit/modules/network/vyos/test_vyos_user.py
index 0e60f07e..27ab1f38 100644
--- a/tests/unit/modules/network/vyos/test_vyos_user.py
+++ b/tests/unit/modules/network/vyos/test_vyos_user.py
@@ -18,6 +18,7 @@
# Make coding more python3-ish
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from unittest.mock import patch
@@ -170,6 +171,39 @@ class TestVyosUserModule(TestVyosModule):
],
)
+ def test_vyos_user_set_security_keys(self):
+ set_module_args(
+ dict(
+ name="ansible",
+ public_keys=[
+ dict(
+ name="ecdsa@host",
+ key="AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTY",
+ type="sk-ecdsa-sha2-nistp256@openssh.com",
+ ),
+ dict(
+ name="ed25519@host",
+ key="AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFIR0jrMvBdmvTJNY5EDhOD",
+ type="sk-ssh-ed25519@openssh.com",
+ ),
+ ],
+ ),
+ )
+ result = self.execute_module(changed=True)
+ self.assertEqual(
+ result["commands"],
+ [
+ "set system login user ansible authentication public-keys "
+ "ecdsa@host key 'AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTY'",
+ "set system login user ansible authentication public-keys ecdsa@host "
+ "type 'sk-ecdsa-sha2-nistp256@openssh.com'",
+ "set system login user ansible authentication public-keys ed25519@host "
+ "key 'AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFIR0jrMvBdmvTJNY5EDhOD'",
+ "set system login user ansible authentication public-keys ed25519@host "
+ "type 'sk-ssh-ed25519@openssh.com'",
+ ],
+ )
+
def test_vyos_user_set_ssh_key_idempotent(self):
set_module_args(
dict(