Refresh IETF client/server models
[netconf.git] / transport / transport-ssh / src / main / yang / ietf-ssh-common@2024-02-08.yang
1 module ietf-ssh-common {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-ssh-common";
4   prefix sshcmn;
5
6   import iana-ssh-encryption-algs {
7     prefix sshea;
8     reference
9       "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
10   }
11
12   import iana-ssh-key-exchange-algs {
13     prefix sshkea;
14     reference
15       "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
16   }
17
18   import iana-ssh-mac-algs {
19     prefix sshma;
20     reference
21       "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
22   }
23
24   import iana-ssh-public-key-algs {
25     prefix sshpka;
26     reference
27       "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
28   }
29
30   import ietf-crypto-types {
31     prefix ct;
32     reference
33       "RFC AAAA: YANG Data Types and Groupings for Cryptography";
34   }
35
36   import ietf-keystore {
37     prefix ks;
38     reference
39       "RFC CCCC: A YANG Data Model for a Keystore";
40   }
41
42   organization
43     "IETF NETCONF (Network Configuration) Working Group";
44
45   contact
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>
49      Author:   Gary Wu <mailto:garywu@cisco.com>";
50
51   description
52     "This module defines a common features and groupings for
53      Secure Shell (SSH).
54
55      Copyright (c) 2024 IETF Trust and the persons identified
56      as authors of the code. All rights reserved.
57
58      Redistribution and use in source and binary forms, with
59      or without modification, is permitted pursuant to, and
60      subject to the license terms contained in, the Revised
61      BSD License set forth in Section 4.c of the IETF Trust's
62      Legal Provisions Relating to IETF Documents
63      (https://trustee.ietf.org/license-info).
64
65      This version of this YANG module is part of RFC EEEE
66      (https://www.rfc-editor.org/info/rfcEEEE); see the RFC
67      itself for full legal notices.
68
69      The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
70      'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
71      'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
72      are to be interpreted as described in BCP 14 (RFC 2119)
73      (RFC 8174) when, and only when, they appear in all
74      capitals, as shown here.";
75
76   revision 2024-02-08 {
77     description
78       "Initial version";
79     reference
80       "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
81   }
82
83   // Features
84
85   feature ssh-x509-certs {
86     description
87       "X.509v3 certificates are supported for SSH.";
88     reference
89       "RFC 6187: X.509v3 Certificates for Secure Shell
90                  Authentication";
91   }
92
93   feature transport-params {
94     description
95       "SSH transport layer parameters are configurable.";
96   }
97
98   feature asymmetric-key-pair-generation {
99     description
100       "Indicates that the server implements the
101        'generate-asymmetric-key-pair' RPC.";
102   }
103
104   feature algorithm-discovery {
105     description
106       "Indicates that the server implements the
107        'supported-algorithms' container.";
108   }
109
110
111   // Groupings
112
113   grouping transport-params-grouping {
114     description
115       "A reusable grouping for SSH transport parameters.";
116     reference
117       "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
118     container host-key {
119       description
120         "Parameters regarding host key.";
121       leaf-list host-key-alg {
122         type identityref {
123           base sshpka:public-key-alg-base;
124         }
125         ordered-by user;
126         description
127           "Acceptable host key algorithms in order of decreasing
128            preference.
129
130            If this leaf-list is not configured (has zero elements)
131            the acceptable host key algorithms are implementation-
132            defined.";
133         reference
134           "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
135       }
136     }
137     container key-exchange {
138       description
139         "Parameters regarding key exchange.";
140       leaf-list key-exchange-alg {
141         type identityref {
142           base sshkea:key-exchange-alg-base;
143         }
144         ordered-by user;
145         description
146           "Acceptable key exchange algorithms in order of decreasing
147            preference.
148
149            If this leaf-list is not configured (has zero elements)
150            the acceptable key exchange algorithms are implementation
151            defined.";
152       }
153     }
154     container encryption {
155       description
156         "Parameters regarding encryption.";
157       leaf-list encryption-alg {
158         type identityref {
159           base sshea:encryption-alg-base;
160         }
161         ordered-by user;
162         description
163           "Acceptable encryption algorithms in order of decreasing
164            preference.
165
166            If this leaf-list is not configured (has zero elements)
167            the acceptable encryption algorithms are implementation
168            defined.";
169       }
170     }
171     container mac {
172       description
173         "Parameters regarding message authentication code (MAC).";
174       leaf-list mac-alg {
175         type identityref {
176           base sshma:mac-alg-base;
177         }
178         ordered-by user;
179         description
180           "Acceptable MAC algorithms in order of decreasing
181            preference.
182
183            If this leaf-list is not configured (has zero elements)
184            the acceptable MAC algorithms are implementation-
185            defined.";
186       }
187     }
188   }
189
190   // Protocol-accessible Nodes
191
192   container supported-algorithms {
193     if-feature "algorithm-discovery";
194     config false;
195     description
196       "Identifies all of the supported algorithms.";
197     container public-key-algorithms {
198       description
199         "A container for a list of public key algorithms
200          supported by the server.";
201       leaf-list supported-algorithm {
202         type sshpka:public-key-algorithm-ref;
203         description
204           "A public key algorithm supported by the server.";
205       }
206     }
207     container encryption-algorithms {
208       description
209         "A container for a list of encryption algorithms
210          supported by the server.";
211       leaf-list supported-algorithm {
212         type sshea:encryption-algorithm-ref;
213         description
214           "An encryption algorithm supported by the server.";
215       }
216     }
217     container key-exchange-algorithms {
218       config false;
219       description
220         "A container for a list of key exchange algorithms
221          supported by the server.";
222       leaf-list supported-algorithm {
223         type sshkea:key-exchange-algorithm-ref;
224         description
225           "A key exchange algorithm supported by the server.";
226       }
227     }
228     container mac-algorithms {
229       config false;
230       description
231         "A container for a list of MAC algorithms
232          supported by the server.";
233       leaf-list supported-algorithm {
234         type sshma:mac-algorithm-ref;
235         description
236           "A MAC algorithm supported by the server.";
237       }
238     }
239   }
240
241   rpc generate-asymmetric-key-pair {
242     if-feature "asymmetric-key-pair-generation";
243     description
244       "Requests the device to generate an public key using
245        the specified key algorithm.";
246     input {
247       leaf algorithm {
248         type sshpka:public-key-algorithm-ref;
249         mandatory true;
250         description
251           "The algorithm to be used when generating the key.";
252       }
253       leaf num-bits {
254         type uint16;
255         description
256           "Specifies the number of bits in the key to create.
257            For RSA keys, the minimum size is 1024 bits and
258            the default is 3072 bits. Generally, 3072 bits is
259            considered sufficient. DSA keys must be exactly 1024
260            bits as specified by FIPS 186-6.  For ECDSA keys, the
261            'num-bits' value determines the key length by selecting
262            from one of three elliptic curve sizes: 256, 384 or
263            521 bits. Attempting to use bit lengths other than
264            these three values for ECDSA keys will fail. ECDSA-SK,
265            Ed25519 and Ed25519-SK keys have a fixed length and
266            thus the 'num-bits' value is not specified.";
267         reference
268           "FIPS 186-6: Digital Signature Standard (DSS)";
269       }
270       container private-key-encoding {
271         description
272           "Indicates how the private key is to be encoded.";
273         choice private-key-encoding {
274           mandatory true;
275           description
276             "A choice amongst optional private key handling.";
277           case cleartext {
278             if-feature "ct:cleartext-private-keys";
279             leaf cleartext {
280               type empty;
281               description
282                 "Indicates that the private key is to be returned
283                  as a cleartext value.";
284             }
285           }
286           case encrypted {
287             if-feature "ct:encrypted-private-keys";
288             container encrypted {
289               description
290                  "Indicates that the private key is to be encrypted
291                   using the specified symmetric or asymmetric key.";
292               uses ks:encrypted-by-grouping;
293             }
294           }
295           case hidden {
296             if-feature "ct:hidden-private-keys";
297             leaf hidden {
298               type empty;
299               description
300                 "Indicates that the private key is to be hidden.
301   
302                  Unlike the 'cleartext' and 'encrypt' options, the
303                  key returned is a placeholder for an internally
304                  stored key.  See the 'Support for Built-in Keys'
305                  section in RFC CCCC for information about hidden
306                  keys.";
307             }
308           }
309         }
310       }
311     }
312     output {
313       uses ct:asymmetric-key-pair-grouping;
314     }
315   } // end generate-asymmetric-key-pair
316
317 }