diff options
Diffstat (limited to 'templates/service/ssh/allow-root/node.def')
-rw-r--r-- | templates/service/ssh/allow-root/node.def | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/templates/service/ssh/allow-root/node.def b/templates/service/ssh/allow-root/node.def index 9aa98826..21c85e59 100644 --- a/templates/service/ssh/allow-root/node.def +++ b/templates/service/ssh/allow-root/node.def @@ -1,16 +1,8 @@ -type: txt +type: bool default: false help: Enable/disable root login over ssh -syntax:expression: $VAR(@) in "true", "false" ; "must be true or false" -update: if [ \"$VAR(@)\" == \"true\" ]; then - sudo ed - /etc/ssh/sshd_config <<-"EOF" - /^PermitRootLogin/s/no/yes/ - wq - EOF - else - sudo ed - /etc/ssh/sshd_config <<-"EOF" - /^PermitRootLogin/s/yes/no/ - wq - EOF +update: if [ "$VAR(@)" == "true" ]; + then regex='/^PermitRootLogin/s/no/yes/' + else regex='/^PermitRootLogin/s/yes/no/' fi - /bin/true + sed -i -e "$regex" /etc/ssh/sshd_config |