Refresh IETF client/server models
[netconf.git] / transport / transport-ssh / src / main / yang / ietf-ssh-common@2023-12-28.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) 2023 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 2023-12-28 {
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 public-key-generation {
99     description
100       "Indicates that the server implements the
101        'generate-public-key' RPC.";
102   }
103
104   // Groupings
105
106   grouping transport-params-grouping {
107     description
108       "A reusable grouping for SSH transport parameters.";
109     reference
110       "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
111     container host-key {
112       description
113         "Parameters regarding host key.";
114       leaf-list host-key-alg {
115         type identityref {
116           base sshpka:public-key-alg-base;
117         }
118         ordered-by user;
119         description
120           "Acceptable host key algorithms in order of decreasing
121            preference.
122
123            If this leaf-list is not configured (has zero elements)
124            the acceptable host key algorithms are implementation-
125            defined.";
126         reference
127           "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
128       }
129     }
130     container key-exchange {
131       description
132         "Parameters regarding key exchange.";
133       leaf-list key-exchange-alg {
134         type identityref {
135           base sshkea:key-exchange-alg-base;
136         }
137         ordered-by user;
138         description
139           "Acceptable key exchange algorithms in order of decreasing
140            preference.
141
142            If this leaf-list is not configured (has zero elements)
143            the acceptable key exchange algorithms are implementation
144            defined.";
145       }
146     }
147     container encryption {
148       description
149         "Parameters regarding encryption.";
150       leaf-list encryption-alg {
151         type identityref {
152           base sshea:encryption-alg-base;
153         }
154         ordered-by user;
155         description
156           "Acceptable encryption algorithms in order of decreasing
157            preference.
158
159            If this leaf-list is not configured (has zero elements)
160            the acceptable encryption algorithms are implementation
161            defined.";
162       }
163     }
164     container mac {
165       description
166         "Parameters regarding message authentication code (MAC).";
167       leaf-list mac-alg {
168         type identityref {
169           base sshma:mac-alg-base;
170         }
171         ordered-by user;
172         description
173           "Acceptable MAC algorithms in order of decreasing
174            preference.
175
176            If this leaf-list is not configured (has zero elements)
177            the acceptable MAC algorithms are implementation-
178            defined.";
179       }
180     }
181   }
182
183   // Protocol-accessible Nodes
184
185   rpc generate-public-key {
186     if-feature "public-key-generation";
187     description
188       "Requests the device to generate an public key using
189        the specified key algorithm.";
190     input {
191       leaf algorithm {
192         type sshpka:public-key-algorithm-ref;
193         mandatory true;
194         description
195           "The algorithm to be used when generating the key.";
196       }
197       leaf num-bits {
198         type uint16;
199         description
200           "Specifies the number of bits in the key to create.
201            For RSA keys, the minimum size is 1024 bits and
202            the default is 3072 bits. Generally, 3072 bits is
203            considered sufficient. DSA keys must be exactly 1024
204            bits as specified by FIPS 186-6.  For ECDSA keys, the
205            'num-bits' value determines the key length by selecting
206            from one of three elliptic curve sizes: 256, 384 or
207            521 bits. Attempting to use bit lengths other than
208            these three values for ECDSA keys will fail. ECDSA-SK,
209            Ed25519 and Ed25519-SK keys have a fixed length and
210            thus the 'num-bits' value is not specified.";
211         reference
212           "FIPS 186-6: Digital Signature Standard (DSS)";
213       }
214       container private-key-encoding {
215         description
216           "Indicates how the private key is to be encoded.";
217         choice private-key-encoding {
218           mandatory true;
219           description
220             "A choice amongst optional private key handling.";
221           case cleartext {
222             if-feature "ct:cleartext-private-keys";
223             leaf cleartext {
224               type empty;
225               description
226                 "Indicates that the private key is to be returned
227                  as a cleartext value.";
228             }
229           }
230           case encrypted {
231             if-feature "ct:encrypted-private-keys";
232             container encrypted {
233               description
234                  "Indicates that the private key is to be encrypted
235                   using the specified symmetric or asymmetric key.";
236               uses ks:encrypted-by-grouping;
237             }
238           }
239           case hidden {
240             if-feature "ct:hidden-private-keys";
241             leaf hidden {
242               type empty;
243               description
244                 "Indicates that the private key is to be hidden.
245   
246                  Unlike the 'cleartext' and 'encrypt' options, the
247                  key returned is a placeholder for an internally
248                  stored key.  See the 'Support for Built-in Keys'
249                  section in RFC CCCC for information about hidden
250                  keys.";
251             }
252           }
253         }
254       }
255     }
256     output {
257       uses ct:asymmetric-key-pair-grouping;
258     }
259   } // end generate-public-key
260
261 }