Skip to content

Commit 4edae94

Browse files
authored
Merge pull request #227 from jrha/shadow-hashes
pan/types: Add type for crypt format password hashes
2 parents eb69761 + cf20bc5 commit 4edae94

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pan/types.pan

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,3 +1074,15 @@ type type_octal_mode = string with to_long(SELF, 8) >= 0 && to_long(SELF, 8) <=
10741074
}
10751075
type caf_serviceaction = choice("restart", "reload", "stop_sleep_start");
10761076

1077+
1078+
@documentations{
1079+
desc = Password hashes in crypt format. Accepted methods are yescrypt, scrypt, sha512crypt, and sha256crypt
1080+
}
1081+
type string_crypt_hash = string with match(SELF,
1082+
'^(' + join('|', list(
1083+
'\$y\$[./A-Za-z0-9]+\$[./A-Za-z0-9]{0,86}\$[./A-Za-z0-9]{43}', # yescrypt
1084+
'\$7\$[./A-Za-z0-9]{11,97}\$[./A-Za-z0-9]{43}', # scrypt
1085+
'\$6\$(rounds=[1-9][0-9]+\$)?[^$:\n]{1,16}\$[./0-9A-Za-z]{86}', # sha512crypt
1086+
'\$5\$(rounds=[1-9][0-9]+\$)?[^$:\n]{1,16}\$[./0-9A-Za-z]{43}', # sha256crypt
1087+
)) + ')$'
1088+
);

0 commit comments

Comments
 (0)