blob: 00f32f4e207bdb04914f2b603613d5bb14d7d1fe [file] [log] [blame]
romanc1d2b092023-02-02 08:58:27 +01001module 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) 2022 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 2022-07-18 {
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 descending
121 preference. The configured host key algorithms should
122 be compatible with the algorithm used by the configured
123 private key. Please see Section 5 of RFC EEEE for
124 valid combinations.
125
126 If this leaf-list is not configured (has zero elements)
127 the acceptable host key algorithms are implementation-
128 defined.";
129 reference
130 "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
131 }
132 }
133 container key-exchange {
134 description
135 "Parameters regarding key exchange.";
136 leaf-list key-exchange-alg {
137 type identityref {
138 base sshkea:key-exchange-alg-base;
139 }
140 ordered-by user;
141 description
142 "Acceptable key exchange algorithms in order of descending
143 preference.
144
145 If this leaf-list is not configured (has zero elements)
146 the acceptable key exchange algorithms are implementation
147 defined.";
148 }
149 }
150 container encryption {
151 description
152 "Parameters regarding encryption.";
153 leaf-list encryption-alg {
154 type identityref {
155 base sshea:encryption-alg-base;
156 }
157 ordered-by user;
158 description
159 "Acceptable encryption algorithms in order of descending
160 preference.
161
162 If this leaf-list is not configured (has zero elements)
163 the acceptable encryption algorithms are implementation
164 defined.";
165 }
166 }
167 container mac {
168 description
169 "Parameters regarding message authentication code (MAC).";
170 leaf-list mac-alg {
171 type identityref {
172 base sshma:mac-alg-base;
173 }
174 ordered-by user;
175 description
176 "Acceptable MAC algorithms in order of descending
177 preference.
178
179 If this leaf-list is not configured (has zero elements)
180 the acceptable MAC algorithms are implementation-
181 defined.";
182 }
183 }
184 }
185
186 // Protocol-accessible Nodes
187
188 rpc generate-public-key {
189 if-feature "public-key-generation";
190 description
191 "Requests the device to generate an public key using
192 the specified key algorithm.";
193 input {
194 leaf algorithm {
195 type sshpka:public-key-algorithm-ref;
196 mandatory true;
197 description
198 "The algorithm to be used when generating the key.";
199 }
200 leaf bits {
201 type uint16;
202 description
203 "Specifies the number of bits in the key to create.
204 For RSA keys, the minimum size is 1024 bits and
205 the default is 3072 bits. Generally, 3072 bits is
206 considered sufficient. DSA keys must be exactly 1024
207 bits as specified by FIPS 186-2. For ECDSA keys, the
208 'bits' value determines the key length by selecting
209 from one of three elliptic curve sizes: 256, 384 or
210 521 bits. Attempting to use bit lengths other than
211 these three values for ECDSA keys will fail. ECDSA-SK,
212 Ed25519 and Ed25519-SK keys have a fixed length and
213 the 'bits' value, if specified, will be ignored.";
214 }
215 choice private-key-encoding {
216 default cleartext;
217 description
218 "A choice amongst optional private key handling.";
219 case cleartext {
220 leaf cleartext {
221 type empty;
222 description
223 "Indicates that the private key is to be returned
224 as a cleartext value.";
225 }
226 }
227 case encrypt {
228 if-feature "ct:private-key-encryption";
229 container encrypt-with {
230 description
231 "Indicates that the key is to be encrypted using
232 the specified symmetric or asymmetric key.";
233 uses ks:encrypted-by-choice-grouping;
234 }
235 }
236 case hide {
237 if-feature "ct:hidden-keys";
238 leaf hide {
239 type empty;
240 description
241 "Indicates that the private key is to be hidden.
242
243 Unlike the 'cleartext' and 'encrypt' options, the
244 key returned is a placeholder for an internally
245 stored key. See the 'Support for Built-in Keys'
246 section in RFC CCCC for information about hidden
247 keys.";
248 }
249 }
250 }
251 }
252 output {
253 uses ct:asymmetric-key-pair-grouping;
254 }
255 } // end generate-public-key
256
257}