summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-06-13 14:53:05 +0100
committerDaniil Baturin <daniil@baturin.org>2017-09-14 14:07:27 +0200
commita52ac9a28e4de15ae5c78a7de6d7ff35ec528f4b (patch)
treee18228690f50f1a57727e6a49361c7b9cf2a2ca7
parent881a3667a924fe7396c6b975d6535bef0e9a02c3 (diff)
downloadvyatta-cfg-system-a52ac9a28e4de15ae5c78a7de6d7ff35ec528f4b.tar.gz
vyatta-cfg-system-a52ac9a28e4de15ae5c78a7de6d7ff35ec528f4b.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
-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