Limit username length and pattern in system yang model

Deviation in ietf-system.yang
'replace' username type from general string to a string
with length and pattern restrictions inline with the
BusyBox 'adduser' tool.

Note, chk_sr_user_update is more restrictive, which should
be handled.
This commit is contained in:
Jon-Olov Vatn
2023-07-12 08:51:27 +02:00
committed by Joachim Wiberg
parent 5c4982e388
commit a43bdd94ab
+17 -3
View File
@@ -14,9 +14,10 @@ module infix-system {
revision 2023-07-04 {
description "Updating/adding deviation specifications:
- timezone-utc-offset (updated)
- radius (added)
- dns-resolver port (added)";
- timezone-utc-offset (updated path for 'not-supported')
- radius ('not-supported')
- dns-resolver port ('not-supported')
- authentication username (limit length and pattern)";
reference "internal";
}
@@ -25,6 +26,13 @@ module infix-system {
reference "internal";
}
typedef username {
type string {
length "1..256";
pattern "[_a-zA-Z0-9][-._a-zA-Z0-9]*$?";
}
}
augment "/sys:system" {
description "Augments to ietf-system not found in any other model.";
leaf motd {
@@ -44,4 +52,10 @@ module infix-system {
deviation "/sys:system/sys:dns-resolver/sys:server/sys:transport/sys:udp-and-tcp/sys:udp-and-tcp/sys:port" {
deviate not-supported;
}
deviation "/sys:system/sys:authentication/sys:user/sys:name" {
deviate replace {
type infix-sys:username;
}
}
}