diff options
author | rbalocca <rbalocca@vyatta.com> | 2008-07-16 14:16:29 -0700 |
---|---|---|
committer | rbalocca <rbalocca@vyatta.com> | 2008-07-16 14:16:29 -0700 |
commit | 3633af335f8273ac0ddc8f9cffedbcfa9d69cb44 (patch) | |
tree | 19cd5746b4b25e2a7f81e80128fe21e844702361 /templates/service | |
parent | 325cfa1ed8dfe41aaf393bdf04f38c6b392f7994 (diff) | |
parent | f7f94359f2fccaed84b8c73c1ab743450348eb75 (diff) | |
download | vyatta-cfg-quagga-3633af335f8273ac0ddc8f9cffedbcfa9d69cb44.tar.gz vyatta-cfg-quagga-3633af335f8273ac0ddc8f9cffedbcfa9d69cb44.zip |
Merge branch 'hollywood' into islavista
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/@) |