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