diff options
author | Tom Grennan <tgrennan@io.vyatta.com> | 2007-12-13 18:36:03 -0800 |
---|---|---|
committer | Tom Grennan <tgrennan@io.vyatta.com> | 2007-12-13 18:36:03 -0800 |
commit | 6ea2c7979320d032c2213d271309d6026d57775b (patch) | |
tree | 003bec6fbbc6cf54598bc8a5dda5e1efea4c702c | |
parent | e6ed55f7593a0f4bc2700bc7b90903bb012e27f6 (diff) | |
parent | 7f5f7bedf4f47a42fcb7e32538ccf2d78c75234b (diff) | |
download | vyatta-cfg-system-6ea2c7979320d032c2213d271309d6026d57775b.tar.gz vyatta-cfg-system-6ea2c7979320d032c2213d271309d6026d57775b.zip |
Merge branch 'master' of http://phuket.vyatta.com/vyatta-cfg-system
6 files changed, 54 insertions, 51 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/@)" diff --git a/templates/system/host-name/node.def b/templates/system/host-name/node.def index aeed3986..e1370b70 100644 --- a/templates/system/host-name/node.def +++ b/templates/system/host-name/node.def @@ -2,21 +2,18 @@ type: txt help: "Configure system host name" default: "vyatta" syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $(@)" -# do we need to add ntpd restart here? update: "sudo sh -c \"hostname '$(@)' && \ +echo '$(@)' > /etc/hostname && \ touch /etc/hosts && \ -sed -i '/localhost/d' /etc/hosts && \ -echo \\\"127.0.0.1\t localhost $(@)\t #vyatta entry\\\" >> /etc/hosts && \ +sed -i '/^127.0.1.1/d' /etc/hosts && \ +echo \\\"127.0.1.1\t $(@)\t #vyatta entry\\\" >> /etc/hosts && \ if [ x$(../domain-name/@) != x ]; then \ -echo \\\"127.0.0.1\t localhost $(@).$(../domain-name/@)\t #vyatta entry\\\" \ +echo \\\"127.0.1.1\t $(@).$(../domain-name/@)\t #vyatta entry\\\" \ >> /etc/hosts; fi\" " -# do we need to add ntpd restart here? -delete: "sudo sh -c \"echo > /etc/hostname.conf && hostname 'vyatta' && \ +delete: "sudo sh -c \"echo 'vyatta' > /etc/hostname && hostname 'vyatta' && \ touch /etc/hosts && \ -sed -i '/localhost.*#vyatta entry/d' /etc/hosts && \ -echo \\\"127.0.0.1\t localhost vyatta\t #vyatta entry\\\" >> /etc/hosts && \ +sed -i '/^127.0.1.1/d' /etc/hosts && \ +echo \\\"127.0.1.1\t vyatta\t #vyatta entry\\\" >> /etc/hosts && \ if [ x$(../domain-name/@) != x ]; then \ -echo \\\"127.0.0.1\t localhost vyatta.$(../domain-name/@)\t #vyatta entry\\\" \ ->> /etc/hosts; fi && \ -if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ -/opt/vyatta/sbin/ntpd.init restart; fi\" " +echo \\\"127.0.1.1\t vyatta.$(../domain-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; fi\" " diff --git a/templates/system/static-host-mapping/host-name/node.def b/templates/system/static-host-mapping/host-name/node.def index ea0000af..275aa867 100644 --- a/templates/system/static-host-mapping/host-name/node.def +++ b/templates/system/static-host-mapping/host-name/node.def @@ -2,3 +2,10 @@ tag: type: txt help: "Map DNS names to system interfaces" syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $(@)" +commit: $(./inet) != ""; "IP address for the static mapping must be set" +end: "sudo sh -c \"\ + touch /etc/hosts; \ + sed -i '/ $(@) .*#vyatta entry/d' /etc/hosts; \ + if [ -z \"$(./inet/@)\" ]; then exit 0; fi; \ + declare -a aliases=( $(alias/@@) ); \ + echo \\\"$(inet/@)\t $(@) \\\\\${aliases[*]} \t #vyatta entry\\\" \ >> /etc/hosts\" " diff --git a/templates/system/static-host-mapping/host-name/node.tag/alias/node.def b/templates/system/static-host-mapping/host-name/node.tag/alias/node.def index c8f5cdef..e9f1de7c 100644 --- a/templates/system/static-host-mapping/host-name/node.tag/alias/node.def +++ b/templates/system/static-host-mapping/host-name/node.tag/alias/node.def @@ -1,18 +1,3 @@ multi: type: txt help: "Alias for this address" -update: "sudo sh -c \"touch /etc/hosts && \ -sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ - /etc/hosts && \ -echo \\\"$(../inet/@)\t $(../@) $(@) \t #vyatta entry\\\" \ - >> /etc/hosts && \ -if [ x$(../../../domain-name/@) == x ]; then \ - echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ - >> /etc/hosts; \ -else \ - echo \\\"127.0.0.1\t localhost \ -$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ - >> /etc/hosts; \ -fi\" " -delete: "sudo sh -c \"touch /etc/hosts && \ -sed -i '/ $(../@) .*#vyatta entry/{/localhost/!d}' /etc/hosts\" " diff --git a/templates/system/static-host-mapping/host-name/node.tag/inet/node.def b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def index 47a84733..4a069d9e 100644 --- a/templates/system/static-host-mapping/host-name/node.tag/inet/node.def +++ b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def @@ -1,16 +1,2 @@ type: ipv4 help: "Internet address" -update: "sudo sh -c \"touch /etc/hosts && \ -sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ - /etc/hosts && \ -echo \\\"$(@)\t $(../@) \t #vyatta entry\\\" >> /etc/hosts && \ -if [ x$(../../../domain-name/@) == x ]; then \ - echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ - >> /etc/hosts; \ -else \ - echo \\\"127.0.0.1\t localhost \ -$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ - >> /etc/hosts; \ -fi\" " -delete: "sudo sh -c \"touch /etc/hosts && \ -sed -i '/ $(../@) .*#vyatta entry/{/localhost/!d}' /etc/hosts\" " |