summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-06-13 14:53:05 +0100
committerAlex Harpin <development@landsofshadow.co.uk>2015-06-13 14:53:05 +0100
commit593899accdff03af23e6bb6c7189ad4ed05a4d8e (patch)
tree6d92340c4efebed8e4998d4b9602c7427029c5b7 /templates
parent95d0740ae1a3a8b7d348d99e268cc3ded87d4b44 (diff)
downloadvyatta-cfg-system-593899accdff03af23e6bb6c7189ad4ed05a4d8e.tar.gz
vyatta-cfg-system-593899accdff03af23e6bb6c7189ad4ed05a4d8e.zip
vyatta-cfg-system: prevent deletion of all authentication for user
Prevent the deletion of both the encrypted-password and public-keys nodes for a user, ensuring that at least one of the methods is available. Also prevent the deletion of the public keys for a user if the encrypted password is set to "!". Bug #574 http://bugzilla.vyos.net/show_bug.cgi?id=574
Diffstat (limited to 'templates')
-rw-r--r--templates/system/login/user/node.tag/authentication/encrypted-password/node.def3
-rw-r--r--templates/system/login/user/node.tag/authentication/public-keys/node.def4
2 files changed, 7 insertions, 0 deletions
diff --git a/templates/system/login/user/node.tag/authentication/encrypted-password/node.def b/templates/system/login/user/node.tag/authentication/encrypted-password/node.def
index 29ad14a8..a8b3ee54 100644
--- a/templates/system/login/user/node.tag/authentication/encrypted-password/node.def
+++ b/templates/system/login/user/node.tag/authentication/encrypted-password/node.def
@@ -9,3 +9,6 @@ syntax:expression: ($VAR(@) == "*" || $VAR(@) == "!" \
|| ( pattern $VAR(@) "^\\$5\\$[a-zA-Z0-9\./]*\\$[a-zA-Z0-9\./]{43}$" ) \
|| ( pattern $VAR(@) "^\\$6\\$[a-zA-Z0-9\./]*\\$[a-zA-Z0-9\./]{86}$" )) \
; "Not a valid encrypted password for user $VAR(../../@)"
+
+delete:expression: $VAR(../public-keys) != ""
+ ; "either user encrypted password or public keys must be set" \ No newline at end of file
diff --git a/templates/system/login/user/node.tag/authentication/public-keys/node.def b/templates/system/login/user/node.tag/authentication/public-keys/node.def
index 245e7197..d813fb9e 100644
--- a/templates/system/login/user/node.tag/authentication/public-keys/node.def
+++ b/templates/system/login/user/node.tag/authentication/public-keys/node.def
@@ -7,3 +7,7 @@ commit:expression: $VAR(./type/) != "" ; \
"Must configure public key type for $VAR(@)"
commit:expression: $VAR(./key/) != "" ; \
"Must configure public key value for $VAR(@)"
+
+delete:expression: ($VAR(../encrypted-password) != "" &&
+ $VAR(../encrypted-password/@) != "!")
+ ; "either user encrypted password or public keys must be set" \ No newline at end of file