summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-16 15:31:49 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2009-07-17 14:56:04 -0700
commit5ec82316b089d0be4f544937fbd3ed5d3333c829 (patch)
tree9e29e450cbb1cdb392e358f88373c6e227f6f15d /templates
parent3f05a5d8e5fed097dc3ddd3139ae72b4208cdccc (diff)
downloadvyatta-cfg-quagga-5ec82316b089d0be4f544937fbd3ed5d3333c829.tar.gz
vyatta-cfg-quagga-5ec82316b089d0be4f544937fbd3ed5d3333c829.zip
Make telnet management smarter
Bug 4591 Consolidate check for telnet login Don't remove /etc/securetty edit it (cherry picked from commit c6c477f2ffb0f2fd4cf12882f22c2c44ab57cc46)
Diffstat (limited to 'templates')
-rw-r--r--templates/service/telnet/allow-root/node.def35
-rw-r--r--templates/service/telnet/node.def34
2 files changed, 7 insertions, 62 deletions
diff --git a/templates/service/telnet/allow-root/node.def b/templates/service/telnet/allow-root/node.def
index b853fc42..1065df48 100644
--- a/templates/service/telnet/allow-root/node.def
+++ b/templates/service/telnet/allow-root/node.def
@@ -1,40 +1,7 @@
type: bool
default: false
help: Enable/disable root login
-
-update: pids=`who -u | awk -F " " '{print $7}'`
- for i in $pids
- do
- ppid=`ps -p $i -o ppid=`
- if ps -p $ppid -o cmd= | grep -q telnetd
- then
- echo "Please configure telnet settings via ssh or console."
- exit 1
- fi
- done
- if [ "$VAR(@)" == "true" ]
- then
- sudo mv -f /etc/securetty /etc/securetty.allow-root >&/dev/null
- else
- sudo mv -f /etc/securetty.allow-root /etc/securetty >&/dev/null
- fi
- /bin/true
-
-delete: pids=`who -u | awk -F " " '{print $7}'`
- for i in $pids
- do
- ppid=`ps -p $i -o ppid=`
- if ps -p $ppid -o cmd= | grep -q telnetd
- then
- echo "Please configure telnet settings via ssh or console."
- exit 1
- fi
- done
- sudo mv -f /etc/securetty.allow-root /etc/securetty >&/dev/null
- /bin/true
-
+update: /opt/vyatta/sbin/vyatta_update_telnet allow-root $VAR(@)
comp_help: possible completions:
true Enable root login over telnet
false Disable root login over telnet
-
-allowed: echo "true false"
diff --git a/templates/service/telnet/node.def b/templates/service/telnet/node.def
index 399f25ac..eefb3b4a 100644
--- a/templates/service/telnet/node.def
+++ b/templates/service/telnet/node.def
@@ -1,29 +1,7 @@
help: Enable/disable Network Virtual Terminal Protocol (TELNET) protocol
-
-delete: pids=`who -u | awk -F " " '{print $7}'`
- for i in $pids
- do
- ppid=`ps -p $i -o ppid=`
- if ps -p $ppid -o cmd= | grep -q telnetd
- then
- echo "Please configure telnet settings via ssh or console."
- exit 1
- fi
- done
- sudo /opt/vyatta/sbin/telnetd.init stop
-
-end: pids=`who -u | awk -F " " '{print $7}'`
- for i in $pids
- do
- ppid=`ps -p $i -o ppid=`
- if ps -p $ppid -o cmd= | grep -q telnetd
- then
- echo "Please configure telnet settings via ssh or console."
- exit 1
- fi
- done
- if [ -z "$VAR(port/@)" ]
- then
- exit 0
- fi
- sudo /opt/vyatta/sbin/telnetd.init restart $VAR(port/@)
+create: touch /tmp/vyatta-telnet.$PPID
+delete: /opt/vyatta/sbin/vyatta_update_telnet disable
+end: if [ -f /tmp/vyatta-telnet.$PPID ]; then
+ rm -f /tmp/vyatta-telnet.$PPID
+ /opt/vyatta/sbin/vyatta_update_telnet enable $VAR(port/@)
+ fi