summaryrefslogtreecommitdiff
path: root/templates/service
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-12-10 18:05:13 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2007-12-10 18:05:13 -0800
commit41dce94fe7ce2518a2a83387d3c88384c42ed203 (patch)
treee79f3d24feb21c521f312951fafec08518dc5b9e /templates/service
parentdd8813677e1864d8fe45db79c9fa6392dfe3f245 (diff)
downloadvyatta-cfg-system-41dce94fe7ce2518a2a83387d3c88384c42ed203.tar.gz
vyatta-cfg-system-41dce94fe7ce2518a2a83387d3c88384c42ed203.zip
also check telnet session for "allow-root"
Diffstat (limited to 'templates/service')
-rw-r--r--templates/service/telnet/allow-root/node.def28
1 files changed, 21 insertions, 7 deletions
diff --git a/templates/service/telnet/allow-root/node.def b/templates/service/telnet/allow-root/node.def
index 654023af..9c3ff97d 100644
--- a/templates/service/telnet/allow-root/node.def
+++ b/templates/service/telnet/allow-root/node.def
@@ -1,10 +1,24 @@
type: bool
default: false
help: "Enable/disable root login"
-update: "if [ \"$(@)\" == \"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: "sudo mv -f /etc/securetty.allow-root /etc/securetty >&/dev/null ; \
- /bin/true"
+update: " \
+ 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 [ \"$(@)\" == \"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: " \
+ 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"