1 module ietf-ssh-server {
3 namespace "urn:ietf:params:xml:ns:yang:ietf-ssh-server";
6 import iana-crypt-hash {
9 "RFC 7317: A YANG Data Model for System Management";
12 import ietf-netconf-acm {
15 "RFC 8341: Network Configuration Access Control Model";
18 import ietf-crypto-types {
21 "RFC AAAA: YANG Data Types and Groupings for Cryptography";
24 import ietf-truststore {
27 "RFC BBBB: A YANG Data Model for a Truststore";
30 import ietf-keystore {
33 "RFC CCCC: A YANG Data Model for a Keystore";
36 import ietf-ssh-common {
39 "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
43 "IETF NETCONF (Network Configuration) Working Group";
46 "WG Web: https://datatracker.ietf.org/wg/netconf
47 WG List: NETCONF WG list <mailto:netconf@ietf.org>
48 Author: Kent Watsen <mailto:kent+ietf@watsen.net>";
51 "This module defines a reusable grouping for SSH servers that
52 can be used as a basis for specific SSH server instances.
54 Copyright (c) 2023 IETF Trust and the persons identified
55 as authors of the code. All rights reserved.
57 Redistribution and use in source and binary forms, with
58 or without modification, is permitted pursuant to, and
59 subject to the license terms contained in, the Revised
60 BSD License set forth in Section 4.c of the IETF Trust's
61 Legal Provisions Relating to IETF Documents
62 (https://trustee.ietf.org/license-info).
64 This version of this YANG module is part of RFC EEEE
65 (https://www.rfc-editor.org/info/rfcEEEE); see the RFC
66 itself for full legal notices.
68 The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
69 'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
70 'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
71 are to be interpreted as described in BCP 14 (RFC 2119)
72 (RFC 8174) when, and only when, they appear in all
73 capitals, as shown here.";
79 "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
84 feature ssh-server-keepalives {
86 "Per socket SSH keepalive parameters are configurable for
87 SSH servers on the server implementing this feature.";
90 feature local-users-supported {
92 "Indicates that the configuration for users can be
93 configured herein, as opposed to in an application
97 feature local-user-auth-publickey {
98 if-feature "local-users-supported";
100 "Indicates that the 'publickey' authentication type,
101 per RFC 4252, is supported for locally-defined users.
103 The 'publickey' authentication type is required by
104 RFC 4252, but common implementations enable it to
108 The Secure Shell (SSH) Authentication Protocol";
111 feature local-user-auth-password {
112 if-feature "local-users-supported";
114 "Indicates that the 'password' authentication type,
115 per RFC 4252, is supported for locally-defined users.";
118 The Secure Shell (SSH) Authentication Protocol";
121 feature local-user-auth-hostbased {
122 if-feature "local-users-supported";
124 "Indicates that the 'hostbased' authentication type,
125 per RFC 4252, is supported for locally-defined users.";
128 The Secure Shell (SSH) Authentication Protocol";
130 feature local-user-auth-none {
131 if-feature "local-users-supported";
133 "Indicates that the 'none' authentication type, per
134 RFC 4252, is supported. It is NOT RECOMMENDED to
135 enable this feature.";
138 The Secure Shell (SSH) Authentication Protocol";
143 grouping ssh-server-grouping {
145 "A reusable grouping for configuring a SSH server without
146 any consideration for how underlying TCP sessions are
149 Note that this grouping uses fairly typical descendant
150 node names such that a nesting of 'uses' statements will
151 have name conflicts. It is intended that the consuming
152 data model will resolve the issue (e.g., by wrapping
153 the 'uses' statement in a container called
154 'ssh-server-parameters'). This model purposely does
155 not do this itself so as to provide maximum flexibility
156 to consuming models.";
158 container server-identity {
159 nacm:default-deny-write;
161 "The list of host keys the SSH server will present when
162 establishing a SSH connection.";
168 "An ordered list of host keys (see RFC 4251) the SSH
169 server will use to construct its ordered list of
170 algorithms, when sending its SSH_MSG_KEXINIT message,
171 as defined in Section 7.1 of RFC 4253.";
173 "RFC 4251: The Secure Shell (SSH) Protocol Architecture
174 RFC 4253: The Secure Shell (SSH) Transport Layer
179 "An arbitrary name for this host key";
181 choice host-key-type {
184 "The type of host key being specified";
185 container public-key {
187 "A locally-defined or referenced asymmetric key pair
188 to be used for the SSH server's host key.";
190 "RFC CCCC: A YANG Data Model for a Keystore";
191 uses ks:inline-or-keystore-asymmetric-key-grouping {
192 refine "inline-or-keystore/inline/inline-definition" {
193 must 'derived-from-or-self(public-key-format,'
194 + ' "ct:ssh-public-key-format")';
197 refine "inline-or-keystore/keystore/"
198 + "keystore-reference" {
199 must 'derived-from-or-self(deref(.)/../ks:public-'
200 + 'key-format, "ct:ssh-public-key-format")';
204 container certificate {
205 if-feature "sshcmn:ssh-x509-certs";
207 "A locally-defined or referenced end-entity
208 certificate to be used for the SSH server's
211 "RFC CCCC: A YANG Data Model for a Keystore";
213 ks:inline-or-keystore-end-entity-cert-with-key-grouping{
214 refine "inline-or-keystore/inline/inline-definition" {
215 must 'derived-from-or-self(public-key-format,'
216 + ' "ct:subject-public-key-info-format")';
218 refine "inline-or-keystore/keystore/keystore-reference"
219 + "/asymmetric-key" {
221 'derived-from-or-self(deref(.)/../ks:public-key-'
222 + 'format, "ct:subject-public-key-info-format")';
228 } // container server-identity
230 container client-authentication {
231 nacm:default-deny-write;
233 "Specifies how the SSH server can be configured to
234 authenticate SSH clients. See RFC 4252 for a general
235 discussion about SSH authentication.";
237 "RFC 4252: The Secure Shell (SSH) Transport Layer";
239 if-feature "local-users-supported";
241 "A list of locally configured users.";
245 "A locally configured user.
247 The server SHOULD derive the list of authentication
248 'method names' returned to the SSH client from the
249 descendant nodes configured herein, per Sections
250 5.1 and 5.2 in RFC 4252.
252 The authentication methods are unordered. Clients
253 must authenticate to all configured methods.
254 Whenever a choice amongst methods arises,
255 implementations SHOULD use a default ordering
256 that prioritizes automation over human-interaction.";
260 "The 'user name' for the SSH client, as defined in
261 the SSH_MSG_USERAUTH_REQUEST message in RFC 4253.";
263 "RFC 4253: The Secure Shell (SSH) Transport Layer
266 container public-keys {
267 if-feature "local-user-auth-publickey";
269 "Indicates that public keys have been configured.
270 This statement is present so the mandatory descendant
271 nodes do not imply that this node must be
274 "A set of SSH public keys may be used by the SSH
275 server to authenticate this user. A user is
276 authenticated if its public key is an exact
277 match to a configured public key.";
279 "RFC BBBB: A YANG Data Model for a Truststore";
280 uses ts:inline-or-truststore-public-keys-grouping {
281 refine "inline-or-truststore/inline/inline-definition/"
283 must 'derived-from-or-self(public-key-format,'
284 + ' "ct:ssh-public-key-format")';
286 refine "inline-or-truststore/truststore/truststore-"
288 must 'not(deref(.)/../ts:public-key/ts:public-key-'
289 + 'format[not(derived-from-or-self(., "ct:ssh-'
290 + 'public-key-format"))])';
295 if-feature "local-user-auth-password";
296 type ianach:crypt-hash;
298 "The password for this user.";
300 container hostbased {
301 if-feature "local-user-auth-hostbased";
303 "Indicates that hostbased [RFC4252] keys have been
304 configured. This statement is present so the
305 mandatory descendant nodes do not imply that this
306 node must be configured.";
308 "A set of SSH host keys used by the SSH server to
309 authenticate this user's host. A user's host is
310 authenticated if its host key is an exact match
311 to a configured host key.";
313 "RFC 4252: The Secure Shell (SSH) Transport Layer
314 RFC BBBB: A YANG Data Model for a Truststore";
315 uses ts:inline-or-truststore-public-keys-grouping {
316 refine "inline-or-truststore/inline/inline-definition/"
318 must 'derived-from-or-self(public-key-format,'
319 + ' "ct:ssh-public-key-format")';
321 refine "inline-or-truststore/truststore/truststore-"
323 must 'not(deref(.)/../ts:public-key/ts:public-key-'
324 + 'format[not(derived-from-or-self(., "ct:ssh-'
325 + 'public-key-format"))])';
330 if-feature "local-user-auth-none";
333 "Indicates that the 'none' method is configured
336 "RFC 4252: The Secure Shell (SSH) Authentication
342 if-feature "sshcmn:ssh-x509-certs";
344 "Indicates that CA certificates have been configured.
345 This statement is present so the mandatory descendant
346 nodes do not imply this node must be configured.";
348 "A set of certificate authority (CA) certificates used by
349 the SSH server to authenticate SSH client certificates.
350 A client certificate is authenticated if it has a valid
351 chain of trust to a configured CA certificate.";
353 "RFC BBBB: A YANG Data Model for a Truststore";
354 uses ts:inline-or-truststore-certs-grouping;
357 if-feature "sshcmn:ssh-x509-certs";
359 "Indicates that EE certificates have been configured.
360 This statement is present so the mandatory descendant
361 nodes do not imply this node must be configured.";
363 "A set of client certificates (i.e., end entity
364 certificates) used by the SSH server to authenticate
365 the certificates presented by SSH clients. A client
366 certificate is authenticated if it is an exact match
367 to a configured end-entity certificate.";
369 "RFC BBBB: A YANG Data Model for a Truststore";
370 uses ts:inline-or-truststore-certs-grouping;
372 } // container client-authentication
374 container transport-params {
375 nacm:default-deny-write;
376 if-feature "sshcmn:transport-params";
378 "Configurable parameters of the SSH transport layer.";
379 uses sshcmn:transport-params-grouping;
380 } // container transport-params
382 container keepalives {
383 nacm:default-deny-write;
384 if-feature "ssh-server-keepalives";
386 "Indicates that the SSH server proactively tests the
387 aliveness of the remote SSH client.";
389 "Configures the keep-alive policy, to proactively test
390 the aliveness of the SSH client. An unresponsive SSH
391 client is dropped after approximately max-wait *
392 max-attempts seconds. Per Section 4 of RFC 4254,
393 the SSH server SHOULD send an SSH_MSG_GLOBAL_REQUEST
394 message with a purposely nonexistent 'request name'
395 value (e.g., keepalive@ietf.org) and the 'want reply'
398 "RFC 4254: The Secure Shell (SSH) Connection Protocol";
406 "Sets the amount of time in seconds after which
407 if no data has been received from the SSH client,
408 a SSH-level message will be sent to test the
409 aliveness of the SSH client.";
415 "Sets the maximum number of sequential keep-alive
416 messages that can fail to obtain a response from
417 the SSH client before assuming the SSH client is
421 } // grouping ssh-server-grouping