ab0930313b
- Why I did it Yang Model about password hardening feature, the sonic CLI of this feature was autogenerated from this Yang model - How I did it Create new Yang model in src/sonic-yang-models/yang-models/sonic-passwh.yang. - How to verify it There are unitests(yang test) in this P.R covering all the passwords policies with good and bad values cases. Or is possible manually using the config/show password commands that were autogenerated from this Yang model. (this CLI code added in sonic-utilities)
77 lines
2.5 KiB
YANG
Executable File
77 lines
2.5 KiB
YANG
Executable File
module sonic-passwh {
|
|
yang-version 1.1;
|
|
namespace "http://github.com/Azure/sonic-passwh";
|
|
prefix password;
|
|
|
|
description "PASSWORD HARDENING YANG Module for SONiC OS";
|
|
|
|
revision 2022-05-03 {
|
|
description "First Revision";
|
|
}
|
|
|
|
container sonic-passwh {
|
|
|
|
typedef feature_state {
|
|
type enumeration {
|
|
enum enabled;
|
|
enum disabled;
|
|
}
|
|
}
|
|
|
|
container PASSW_HARDENING {
|
|
description "PASSWORD HARDENING part of config_db.json";
|
|
container POLICIES {
|
|
leaf state {
|
|
description "state of the feature";
|
|
type feature_state;
|
|
default "disabled";
|
|
}
|
|
leaf expiration {
|
|
description "expiration time (days unit)";
|
|
type uint16 {
|
|
range 1..365;
|
|
}
|
|
}
|
|
leaf expiration_warning {
|
|
description "expiration warning time (days unit)";
|
|
type uint8 {
|
|
range 1..30;
|
|
}
|
|
}
|
|
leaf history_cnt {
|
|
description "num of old password that the system will recorded";
|
|
type uint8 {
|
|
range 1..100;
|
|
}
|
|
}
|
|
leaf len_min {
|
|
description "password min length";
|
|
type uint8 {
|
|
range 1..32;
|
|
}
|
|
}
|
|
leaf reject_user_passw_match{
|
|
description "username password match";
|
|
type boolean;
|
|
}
|
|
leaf lower_class{
|
|
description "password lower chars policy";
|
|
type boolean;
|
|
}
|
|
leaf upper_class{
|
|
description "password upper chars policy";
|
|
type boolean;
|
|
}
|
|
leaf digits_class{
|
|
description "password digits chars policy";
|
|
type boolean;
|
|
}
|
|
leaf special_class{
|
|
description "password special chars policy";
|
|
type boolean;
|
|
}
|
|
}/*container policies */
|
|
} /* container PASSWH */
|
|
}/* container sonic-passwh */
|
|
}/* end of module sonic-passwh */
|