summaryrefslogtreecommitdiff
path: root/templates/service/telnet
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-12-10 17:58:23 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2007-12-10 17:58:23 -0800
commitdd8813677e1864d8fe45db79c9fa6392dfe3f245 (patch)
tree7cd83db5d7bfca8a5bd4e545ffd56fffd790716b /templates/service/telnet
parent5ba8cf8393030d75c03a15551a57831f3f0908a4 (diff)
downloadvyatta-cfg-system-dd8813677e1864d8fe45db79c9fa6392dfe3f245.tar.gz
vyatta-cfg-system-dd8813677e1864d8fe45db79c9fa6392dfe3f245.zip
fix for bug 2524: telnet settings can only be set via ssh or console.
Diffstat (limited to 'templates/service/telnet')
-rw-r--r--templates/service/telnet/node.def20
1 files changed, 17 insertions, 3 deletions
diff --git a/templates/service/telnet/node.def b/templates/service/telnet/node.def
index 5f4c1c7c..844aec98 100644
--- a/templates/service/telnet/node.def
+++ b/templates/service/telnet/node.def
@@ -1,4 +1,18 @@
help: "Enable/disable telnet protocol"
-delete: "sudo /opt/vyatta/sbin/telnetd.init stop"
-end: "if [ -z \"$(port/@)\" ]; then exit 0; fi; \
- sudo /opt/vyatta/sbin/telnetd.init restart $(port/@)"
+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 /opt/vyatta/sbin/telnetd.init stop"
+end: " \
+ 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 \"$(port/@)\" ]; then exit 0; fi; \
+ sudo /opt/vyatta/sbin/telnetd.init restart $(port/@)"