summaryrefslogtreecommitdiff
path: root/templates/service/telnet
diff options
context:
space:
mode:
Diffstat (limited to 'templates/service/telnet')
-rw-r--r--templates/service/telnet/allow-root/node.def28
-rw-r--r--templates/service/telnet/node.def20
2 files changed, 38 insertions, 10 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"
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/@)"