diff options
author | root <root@io.vyatta.com> | 2008-07-14 14:59:07 -0700 |
---|---|---|
committer | root <root@io.vyatta.com> | 2008-07-14 14:59:07 -0700 |
commit | 2d9868a5b7d97cd493c7035b9057784125f0fe9c (patch) | |
tree | 91c1feaf4153ed7a33a4a4013c9ee13cf6815629 /templates/service | |
parent | cb3ee94fd5e082b139ce6bfeee6130af195a6651 (diff) | |
download | vyatta-cfg-quagga-2d9868a5b7d97cd493c7035b9057784125f0fe9c.tar.gz vyatta-cfg-quagga-2d9868a5b7d97cd493c7035b9057784125f0fe9c.zip |
Fix 3359: changing telnet setting drops other telnet sessions.
Diffstat (limited to 'templates/service')
-rw-r--r-- | templates/service/ssh/allow-root/node.def | 3 | ||||
-rw-r--r-- | templates/service/telnet/allow-root/node.def | 56 | ||||
-rw-r--r-- | templates/service/telnet/node.def | 45 |
3 files changed, 64 insertions, 40 deletions
diff --git a/templates/service/ssh/allow-root/node.def b/templates/service/ssh/allow-root/node.def index f476087d..9aa98826 100644 --- a/templates/service/ssh/allow-root/node.def +++ b/templates/service/ssh/allow-root/node.def @@ -1,6 +1,7 @@ -type: bool +type: txt 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/ diff --git a/templates/service/telnet/allow-root/node.def b/templates/service/telnet/allow-root/node.def index d1a25f4e..347a9476 100644 --- a/templates/service/telnet/allow-root/node.def +++ b/templates/service/telnet/allow-root/node.def @@ -1,24 +1,36 @@ -type: bool +type: txt default: false help: Enable/disable root login -update:expression: " \ - if ! env | grep -q SSH_TTY=; then \ - if [[ \"`tty`\" == /dev/pts/* ]]; then \ - echo \"Please configure telnet settings via ssh or console.\"; \ - exit 1; \ - fi; \ - fi; \ - 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:expression: " \ - if ! env | grep -q SSH_TTY=; then \ - if [[ \"`tty`\" == /dev/pts/* ]]; then \ - echo \"Please configure telnet settings via ssh or console.\"; \ - exit 1; \ - fi; \ - fi; \ - sudo mv -f /etc/securetty.allow-root /etc/securetty >&/dev/null ; \ - /bin/true" + +syntax:expression: $VAR(@) in "true", "false" ; "must be true or false" + +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 diff --git a/templates/service/telnet/node.def b/templates/service/telnet/node.def index 5976addd..399f25ac 100644 --- a/templates/service/telnet/node.def +++ b/templates/service/telnet/node.def @@ -1,18 +1,29 @@ help: Enable/disable Network Virtual Terminal Protocol (TELNET) protocol -delete:expression: " \ - if ! env | grep -q SSH_TTY=; then \ - if [[ \"`tty`\" == /dev/pts/* ]]; then \ - echo \"Please configure telnet settings via ssh or console.\"; \ - exit 1; \ - fi; \ - fi; \ - sudo /opt/vyatta/sbin/telnetd.init stop" -end:expression: " \ - if ! env | grep -q SSH_TTY=; then \ - if [[ \"`tty`\" == /dev/pts/* ]]; then \ - echo \"Please configure telnet settings via ssh or console.\"; \ - exit 1; \ - fi; \ - fi; \ - if [ -z \"$VAR(port/@)\" ]; then exit 0; fi; \ - sudo /opt/vyatta/sbin/telnetd.init restart $VAR(port/@)" + +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/@) |