Cleanup License statement
[oam/tr069-adapter.git] / netconf-server / schemas / common / ietf-netconf-acm.yang
1 module ietf-netconf-acm {\r
2 \r
3   namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-acm";\r
4 \r
5   prefix nacm;\r
6 \r
7   import ietf-yang-types {\r
8     prefix yang;\r
9   }\r
10 \r
11   organization\r
12     "IETF NETCONF (Network Configuration) Working Group";\r
13 \r
14   contact\r
15     "WG Web:   <https://datatracker.ietf.org/wg/netconf/>\r
16      WG List:  <mailto:netconf@ietf.org>\r
17      Author:   Andy Bierman\r
18                <mailto:andy@yumaworks.com>\r
19      Author:   Martin Bjorklund\r
20                <mailto:mbj@tail-f.com>";\r
21 \r
22   description\r
23     "Network Configuration Access Control Model.\r
24      Copyright (c) 2012 - 2018 IETF Trust and the persons\r
25      identified as authors of the code.  All rights reserved.\r
26      Redistribution and use in source and binary forms, with or\r
27      without modification, is permitted pursuant to, and subject\r
28      to the license terms contained in, the Simplified BSD\r
29      License set forth in Section 4.c of the IETF Trust's\r
30      Legal Provisions Relating to IETF Documents\r
31      (https://trustee.ietf.org/license-info).\r
32      This version of this YANG module is part of RFC 8341; see\r
33      the RFC itself for full legal notices.";\r
34 \r
35   revision "2018-02-14" {\r
36     description\r
37       "Added support for YANG 1.1 actions and notifications tied to\r
38        data nodes.  Clarified how NACM extensions can be used by\r
39        other data models.";\r
40     reference\r
41       "RFC 8341: Network Configuration Access Control Model";\r
42   }\r
43 \r
44   revision "2012-02-22" {\r
45     description\r
46       "Initial version.";\r
47     reference\r
48       "RFC 6536: Network Configuration Protocol (NETCONF)\r
49                  Access Control Model";\r
50   }\r
51 \r
52   /*\r
53    * Extension statements\r
54    */\r
55 \r
56   extension default-deny-write {\r
57     description\r
58       "Used to indicate that the data model node\r
59        represents a sensitive security system parameter.\r
60        If present, the NETCONF server will only allow the designated\r
61        'recovery session' to have write access to the node.  An\r
62        explicit access control rule is required for all other users.\r
63        If the NACM module is used, then it must be enabled (i.e.,\r
64        /nacm/enable-nacm object equals 'true'), or this extension\r
65        is ignored.\r
66        The 'default-deny-write' extension MAY appear within a data\r
67        definition statement.  It is ignored otherwise.";\r
68   }\r
69 \r
70   extension default-deny-all {\r
71     description\r
72       "Used to indicate that the data model node\r
73        controls a very sensitive security system parameter.\r
74        If present, the NETCONF server will only allow the designated\r
75        'recovery session' to have read, write, or execute access to\r
76        the node.  An explicit access control rule is required for all\r
77        other users.\r
78        If the NACM module is used, then it must be enabled (i.e.,\r
79        /nacm/enable-nacm object equals 'true'), or this extension\r
80        is ignored.\r
81        The 'default-deny-all' extension MAY appear within a data\r
82        definition statement, 'rpc' statement, or 'notification'\r
83        statement.  It is ignored otherwise.";\r
84   }\r
85 \r
86   /*\r
87    * Derived types\r
88    */\r
89 \r
90   typedef user-name-type {\r
91     type string {\r
92       length "1..max";\r
93     }\r
94     description\r
95       "General-purpose username string.";\r
96   }\r
97 \r
98   typedef matchall-string-type {\r
99     type string {\r
100       pattern '\*';\r
101     }\r
102     description\r
103       "The string containing a single asterisk '*' is used\r
104        to conceptually represent all possible values\r
105        for the particular leaf using this data type.";\r
106   }\r
107 \r
108   typedef access-operations-type {\r
109     type bits {\r
110       bit create {\r
111         description\r
112           "Any protocol operation that creates a\r
113            new data node.";\r
114       }\r
115       bit read {\r
116         description\r
117           "Any protocol operation or notification that\r
118            returns the value of a data node.";\r
119       }\r
120       bit update {\r
121         description\r
122           "Any protocol operation that alters an existing\r
123            data node.";\r
124       }\r
125       bit delete {\r
126         description\r
127           "Any protocol operation that removes a data node.";\r
128       }\r
129       bit exec {\r
130         description\r
131           "Execution access to the specified protocol operation.";\r
132       }\r
133     }\r
134     description\r
135       "Access operation.";\r
136   }\r
137 \r
138   typedef group-name-type {\r
139     type string {\r
140       length "1..max";\r
141       pattern '[^\*].*';\r
142     }\r
143     description\r
144       "Name of administrative group to which\r
145        users can be assigned.";\r
146   }\r
147 \r
148   typedef action-type {\r
149     type enumeration {\r
150       enum permit {\r
151         description\r
152           "Requested action is permitted.";\r
153       }\r
154       enum deny {\r
155         description\r
156           "Requested action is denied.";\r
157       }\r
158     }\r
159     description\r
160       "Action taken by the server when a particular\r
161        rule matches.";\r
162   }\r
163 \r
164   typedef node-instance-identifier {\r
165     type yang:xpath1.0;\r
166     description\r
167       "Path expression used to represent a special\r
168        data node, action, or notification instance-identifier\r
169        string.\r
170        A node-instance-identifier value is an\r
171        unrestricted YANG instance-identifier expression.\r
172        All the same rules as an instance-identifier apply,\r
173        except that predicates for keys are optional.  If a key\r
174        predicate is missing, then the node-instance-identifier\r
175        represents all possible server instances for that key.\r
176        This XML Path Language (XPath) expression is evaluated in the\r
177        following context:\r
178           o  The set of namespace declarations are those in scope on\r
179              the leaf element where this type is used.\r
180           o  The set of variable bindings contains one variable,\r
181              'USER', which contains the name of the user of the\r
182              current session.\r
183           o  The function library is the core function library, but\r
184              note that due to the syntax restrictions of an\r
185              instance-identifier, no functions are allowed.\r
186           o  The context node is the root node in the data tree.\r
187        The accessible tree includes actions and notifications tied\r
188        to data nodes.";\r
189   }\r
190 \r
191   /*\r
192    * Data definition statements\r
193    */\r
194 \r
195   container nacm {\r
196     nacm:default-deny-all;\r
197 \r
198     description\r
199       "Parameters for NETCONF access control model.";\r
200 \r
201     leaf enable-nacm {\r
202       type boolean;\r
203       default "true";\r
204       description\r
205         "Enables or disables all NETCONF access control\r
206          enforcement.  If 'true', then enforcement\r
207          is enabled.  If 'false', then enforcement\r
208          is disabled.";\r
209     }\r
210 \r
211     leaf read-default {\r
212       type action-type;\r
213       default "permit";\r
214       description\r
215         "Controls whether read access is granted if\r
216          no appropriate rule is found for a\r
217          particular read request.";\r
218     }\r
219 \r
220     leaf write-default {\r
221       type action-type;\r
222       default "deny";\r
223       description\r
224         "Controls whether create, update, or delete access\r
225          is granted if no appropriate rule is found for a\r
226          particular write request.";\r
227     }\r
228 \r
229     leaf exec-default {\r
230       type action-type;\r
231       default "permit";\r
232       description\r
233         "Controls whether exec access is granted if no appropriate\r
234          rule is found for a particular protocol operation request.";\r
235     }\r
236 \r
237     leaf enable-external-groups {\r
238       type boolean;\r
239       default "true";\r
240       description\r
241         "Controls whether the server uses the groups reported by the\r
242          NETCONF transport layer when it assigns the user to a set of\r
243          NACM groups.  If this leaf has the value 'false', any group\r
244          names reported by the transport layer are ignored by the\r
245          server.";\r
246     }\r
247 \r
248     leaf denied-operations {\r
249       type yang:zero-based-counter32;\r
250       config false;\r
251       mandatory true;\r
252       description\r
253         "Number of times since the server last restarted that a\r
254          protocol operation request was denied.";\r
255     }\r
256 \r
257     leaf denied-data-writes {\r
258       type yang:zero-based-counter32;\r
259       config false;\r
260       mandatory true;\r
261       description\r
262         "Number of times since the server last restarted that a\r
263          protocol operation request to alter\r
264          a configuration datastore was denied.";\r
265     }\r
266 \r
267     leaf denied-notifications {\r
268       type yang:zero-based-counter32;\r
269       config false;\r
270       mandatory true;\r
271       description\r
272         "Number of times since the server last restarted that\r
273          a notification was dropped for a subscription because\r
274          access to the event type was denied.";\r
275     }\r
276 \r
277     container groups {\r
278       description\r
279         "NETCONF access control groups.";\r
280 \r
281       list group {\r
282         key name;\r
283 \r
284         description\r
285           "One NACM group entry.  This list will only contain\r
286            configured entries, not any entries learned from\r
287            any transport protocols.";\r
288 \r
289         leaf name {\r
290           type group-name-type;\r
291           description\r
292             "Group name associated with this entry.";\r
293         }\r
294 \r
295         leaf-list user-name {\r
296           type user-name-type;\r
297           description\r
298             "Each entry identifies the username of\r
299              a member of the group associated with\r
300              this entry.";\r
301         }\r
302       }\r
303     }\r
304 \r
305     list rule-list {\r
306       key name;\r
307       ordered-by user;\r
308       description\r
309         "An ordered collection of access control rules.";\r
310 \r
311       leaf name {\r
312         type string {\r
313           length "1..max";\r
314         }\r
315         description\r
316           "Arbitrary name assigned to the rule-list.";\r
317       }\r
318       leaf-list group {\r
319         type union {\r
320           type matchall-string-type;\r
321           type group-name-type;\r
322         }\r
323         description\r
324           "List of administrative groups that will be\r
325            assigned the associated access rights\r
326            defined by the 'rule' list.\r
327            The string '*' indicates that all groups apply to the\r
328            entry.";\r
329       }\r
330 \r
331       list rule {\r
332         key name;\r
333         ordered-by user;\r
334         description\r
335           "One access control rule.\r
336            Rules are processed in user-defined order until a match is\r
337            found.  A rule matches if 'module-name', 'rule-type', and\r
338            'access-operations' match the request.  If a rule\r
339            matches, the 'action' leaf determines whether or not\r
340            access is granted.";\r
341 \r
342         leaf name {\r
343           type string {\r
344             length "1..max";\r
345           }\r
346           description\r
347             "Arbitrary name assigned to the rule.";\r
348         }\r
349 \r
350         leaf module-name {\r
351           type union {\r
352             type matchall-string-type;\r
353             type string;\r
354           }\r
355           default "*";\r
356           description\r
357             "Name of the module associated with this rule.\r
358              This leaf matches if it has the value '*' or if the\r
359              object being accessed is defined in the module with the\r
360              specified module name.";\r
361         }\r
362         choice rule-type {\r
363           description\r
364             "This choice matches if all leafs present in the rule\r
365              match the request.  If no leafs are present, the\r
366              choice matches all requests.";\r
367           case protocol-operation {\r
368             leaf rpc-name {\r
369               type union {\r
370                 type matchall-string-type;\r
371                 type string;\r
372               }\r
373               description\r
374                 "This leaf matches if it has the value '*' or if\r
375                  its value equals the requested protocol operation\r
376                  name.";\r
377             }\r
378           }\r
379           case notification {\r
380             leaf notification-name {\r
381               type union {\r
382                 type matchall-string-type;\r
383                 type string;\r
384               }\r
385               description\r
386                 "This leaf matches if it has the value '*' or if its\r
387                  value equals the requested notification name.";\r
388             }\r
389           }\r
390 \r
391           case data-node {\r
392             leaf path {\r
393               type node-instance-identifier;\r
394               mandatory true;\r
395               description\r
396                 "Data node instance-identifier associated with the\r
397                  data node, action, or notification controlled by\r
398                  this rule.\r
399                  Configuration data or state data\r
400                  instance-identifiers start with a top-level\r
401                  data node.  A complete instance-identifier is\r
402                  required for this type of path value.\r
403                  The special value '/' refers to all possible\r
404                  datastore contents.";\r
405             }\r
406           }\r
407         }\r
408 \r
409         leaf access-operations {\r
410           type union {\r
411             type matchall-string-type;\r
412             type access-operations-type;\r
413           }\r
414           default "*";\r
415           description\r
416             "Access operations associated with this rule.\r
417              This leaf matches if it has the value '*' or if the\r
418              bit corresponding to the requested operation is set.";\r
419         }\r
420 \r
421         leaf action {\r
422           type action-type;\r
423           mandatory true;\r
424           description\r
425             "The access control action associated with the\r
426              rule.  If a rule has been determined to match a\r
427              particular request, then this object is used\r
428              to determine whether to permit or deny the\r
429              request.";\r
430         }\r
431 \r
432         leaf comment {\r
433           type string;\r
434           description\r
435             "A textual description of the access rule.";\r
436         }\r
437       }\r
438     }\r
439   }\r
440 }\r