From b48beb78f51cea17ff967ad693d2380030e629af Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen.hemminger@vyatta.com>
Date: Wed, 15 Oct 2008 14:11:09 -0700
Subject: Fix parsing of allow-root field

Bugfix 3795
The field is boolean and was failing during bootup.
Rework to use sed and do it the simple way
---
 templates/service/ssh/allow-root/node.def | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

(limited to 'templates/service/ssh/allow-root/node.def')

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
-- 
cgit v1.2.3


From 92301fd9eaba31f0b3a3ded1e27663c790914ffa Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen.hemminger@vyatta.com>
Date: Thu, 16 Oct 2008 10:54:25 -0700
Subject: Need sudo when editing ssh config file

---
 templates/service/ssh/allow-root/node.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'templates/service/ssh/allow-root/node.def')

diff --git a/templates/service/ssh/allow-root/node.def b/templates/service/ssh/allow-root/node.def
index 21c85e59..87ff1ded 100644
--- a/templates/service/ssh/allow-root/node.def
+++ b/templates/service/ssh/allow-root/node.def
@@ -5,4 +5,4 @@ update: if [ "$VAR(@)" == "true" ];
 	then regex='/^PermitRootLogin/s/no/yes/'
 	else regex='/^PermitRootLogin/s/yes/no/'
 	fi
-	sed -i -e "$regex" /etc/ssh/sshd_config
+	sudo sed -i -e "$regex" /etc/ssh/sshd_config
-- 
cgit v1.2.3


From dcf88dd71fb7c6464464472ca829a5a59ca4d3b6 Mon Sep 17 00:00:00 2001
From: Stig Thormodsrud <stig@io.vyatta.com>
Date: Thu, 16 Oct 2008 18:22:25 -0700
Subject: Change telnet allow-root type from txt to bool. Fix tab completion on
 bool.

---
 templates/service/ssh/allow-root/node.def    |  6 ++++++
 templates/service/telnet/allow-root/node.def | 10 +++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

(limited to 'templates/service/ssh/allow-root/node.def')

diff --git a/templates/service/ssh/allow-root/node.def b/templates/service/ssh/allow-root/node.def
index 87ff1ded..25a5a97a 100644
--- a/templates/service/ssh/allow-root/node.def
+++ b/templates/service/ssh/allow-root/node.def
@@ -6,3 +6,9 @@ update: if [ "$VAR(@)" == "true" ];
 	else regex='/^PermitRootLogin/s/yes/no/'
 	fi
 	sudo sed -i -e "$regex" /etc/ssh/sshd_config
+
+comp_help: possible completions:
+  true     Enable root login over ssh
+  false    Disable root login over ssh
+
+allowed: echo "true false"
diff --git a/templates/service/telnet/allow-root/node.def b/templates/service/telnet/allow-root/node.def
index 347a9476..b853fc42 100644
--- a/templates/service/telnet/allow-root/node.def
+++ b/templates/service/telnet/allow-root/node.def
@@ -1,9 +1,7 @@
-type: txt
+type: bool
 default: false
 help: Enable/disable root login
 
-syntax:expression: $VAR(@) in "true", "false" ; "must be true or false"
-
 update: pids=`who -u | awk -F " " '{print $7}'`
         for i in $pids
         do
@@ -34,3 +32,9 @@ delete: pids=`who -u | awk -F " " '{print $7}'`
         done
         sudo mv -f /etc/securetty.allow-root /etc/securetty >&/dev/null
         /bin/true
+
+comp_help: possible completions:
+  true     Enable root login over telnet
+  false    Disable root login over telnet
+
+allowed: echo "true false"
-- 
cgit v1.2.3

