Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions data/templates/ssh/sshd_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ HostKeyAlgorithms {{ hostkey_algorithm | join(',') }}
PubkeyAcceptedAlgorithms {{ pubkey_accepted_algorithm | join(',') }}
{% endif %}

{% if fido is vyos_defined %}
{% set configured_pubkey_options = [] %}
{% if fido.pin_required is vyos_defined %}
{{ configured_pubkey_options.append('verify-required') }}
{% endif %}
{% if fido.touch_required is vyos_defined %}
{{ configured_pubkey_options.append('touch-required') }}
{% endif %}
{% if configured_pubkey_options | length > 0 %}
# Sets one or more public key authentication options.
PubkeyAuthOptions {{ configured_pubkey_options | join(',') }}
{% endif %}
{% endif %}

{% if mac is vyos_defined %}
# Specifies the available MAC (message authentication code) algorithms
MACs {{ mac | join(',') }}
Expand Down
19 changes: 19 additions & 0 deletions interface-definitions/service_ssh.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@
<valueless/>
</properties>
</leafNode>
<node name="fido">
<properties>
<help>FIDO2 SSH options</help>
</properties>
<children>
<leafNode name="pin-required">
<properties>
<help>Require FIDO2 keys to attest that a user has been verified (e.g. via a PIN)</help>
<valueless/>
</properties>
</leafNode>
<leafNode name="touch-required">
<properties>
<help>Require FIDO2 keys to attest that a user is physically present</help>
<valueless/>
</properties>
</leafNode>
</children>
</node>
<node name="dynamic-protection">
<properties>
<help>Allow dynamic protection</help>
Expand Down
17 changes: 17 additions & 0 deletions smoketest/scripts/cli/test_service_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,5 +495,22 @@ def test_ssh_trusted_user_ca(self):
self.assertNotIn('none', authorize_principals_file_config)
self.assertFalse(os.path.exists(f'/home/{test_user}/.ssh/authorized_principals'))

def test_ssh_fido(self):
# Order does matter for this test because of how the template
# collects and maps the options.
opt_map = {
'pin-required': 'verify-required',
'touch-required': 'touch-required',
}
expected = 'PubkeyAuthOptions '
for k, v in opt_map.items():
self.cli_set(base_path + ['fido', k])
expected = f'{expected}{v},'
expected = expected[:-1]
self.cli_commit()
tmp_sshd_conf = read_file(SSHD_CONF)
self.assertIn(expected, tmp_sshd_conf)


if __name__ == '__main__':
unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on())
Loading