ConfD User Community

Password Validation

Hi Experts,
While Iam creating the user,Iam trying to validate the password as per password policy configured in cdb. Please provide suggestions for user password validation as per pwd policy

Example:

leaf password {
  type string {
    pattern ".*[0-9]+.*"; // at least one digit
    pattern ".*[a-z]+.*"; // at least one lower case alpha
    pattern ".*[A-Z]+.*"; // at least one upper case alpha
    pattern ".*[<>~;:!@#/$%^&*=-]+.*"; // at least one symbol (add more symbols)
    pattern ".* .*" { // no spaces
      modifier invert-match;
    }
    length 8..max;
  }
}

See also for example this post To Include additional escape characters in pattern