blob: 44c4674f89526a109e1bbe6c1072a2a7c8245d7e [file] [log] [blame]
Gaurav Agrawal28920d82017-10-06 17:39:42 +05301module iana-crypt-hash {
2 namespace "urn:ietf:params:xml:ns:yang:iana-crypt-hash";
3 prefix ianach;
4
5 organization "IANA";
6 contact
7 " Internet Assigned Numbers Authority
8
9 Postal: ICANN
10 12025 Waterfront Drive, Suite 300
11 Los Angeles, CA 90094-2536
12 United States
13
14 Tel: +1 310 301 5800
15 E-Mail: iana@iana.org>";
16 description
17 "This YANG module defines a type for storing passwords
18 using a hash function and features to indicate which hash
19 functions are supported by an implementation.
20
21 The latest revision of this YANG module can be obtained from
22 the IANA web site.
23
24 Requests for new values should be made to IANA via
25 email (iana@iana.org).
26
27 Copyright (c) 2014 IETF Trust and the persons identified as
28 authors of the code. All rights reserved.
29
30 Redistribution and use in source and binary forms, with or
31 without modification, is permitted pursuant to, and subject
32 to the license terms contained in, the Simplified BSD License
33 set forth in Section 4.c of the IETF Trust's Legal Provisions
34 Relating to IETF Documents
35 (http://trustee.ietf.org/license-info).
36
37 The initial version of this YANG module is part of RFC 7317;
38 see the RFC itself for full legal notices.";
39
40 revision 2014-08-06 {
41 description
42 "Initial revision.";
43 reference
44 "RFC 7317: A YANG Data Model for System Management";
45 }
46
47 typedef crypt-hash {
48 type string {
49 pattern
50 '$0$.*'
51 + '|$1$[a-zA-Z0-9./]{1,8}$[a-zA-Z0-9./]{22}'
52 + '|$5$(rounds=\d+$)?[a-zA-Z0-9./]{1,16}$[a-zA-Z0-9./]{43}'
53 + '|$6$(rounds=\d+$)?[a-zA-Z0-9./]{1,16}$[a-zA-Z0-9./]{86}';
54 }
55 description
56 "The crypt-hash type is used to store passwords using
57 a hash function. The algorithms for applying the hash
58 function and encoding the result are implemented in
59 various UNIX systems as the function crypt(3).
60
61 A value of this type matches one of the forms:
62
63 $0$<clear text password>
64 $<id>$<salt>$<password hash>
65 $<id>$<parameter>$<salt>$<password hash>
66
67 The '$0$' prefix signals that the value is clear text. When
68 such a value is received by the server, a hash value is
69 calculated, and the string '$<id>$<salt>$' or
70 $<id>$<parameter>$<salt>$ is prepended to the result. This
71 value is stored in the configuration data store.
72 If a value starting with '$<id>$', where <id> is not '0', is
73 received, the server knows that the value already represents a
74 hashed value and stores it 'as is' in the data store.
75
76 When a server needs to verify a password given by a user, it
77 finds the stored password hash string for that user, extracts
78 the salt, and calculates the hash with the salt and given
79 password as input. If the calculated hash value is the same
80 as the stored value, the password given by the client is
81 accepted.
82
83 This type defines the following hash functions:
84
85 id | hash function | feature
86 ---+---------------+-------------------
87 1 | MD5 | crypt-hash-md5
88 5 | SHA-256 | crypt-hash-sha-256
89 6 | SHA-512 | crypt-hash-sha-512
90
91 The server indicates support for the different hash functions
92 by advertising the corresponding feature.";
93 reference
94 "IEEE Std 1003.1-2008 - crypt() function
95 RFC 1321: The MD5 Message-Digest Algorithm
96 FIPS.180-4.2012: Secure Hash Standard (SHS)";
97 }
98
99 feature crypt-hash-md5 {
100 description
101 "Indicates that the device supports the MD5
102 hash function in 'crypt-hash' values.";
103 reference "RFC 1321: The MD5 Message-Digest Algorithm";
104 }
105
106 feature crypt-hash-sha-256 {
107 description
108 "Indicates that the device supports the SHA-256
109 hash function in 'crypt-hash' values.";
110 reference "FIPS.180-4.2012: Secure Hash Standard (SHS)";
111 }
112
113 feature crypt-hash-sha-512 {
114 description
115 "Indicates that the device supports the SHA-512
116 hash function in 'crypt-hash' values.";
117 reference "FIPS.180-4.2012: Secure Hash Standard (SHS)";
118 }
119
120}