diff options
author | rbalocca <rbalocca@fugazi.vyatta.com> | 2007-12-18 14:18:21 -0800 |
---|---|---|
committer | rbalocca <rbalocca@fugazi.vyatta.com> | 2007-12-18 14:18:21 -0800 |
commit | 7a4610e0fb11946ba40ac1fe1eafbddd39a15e48 (patch) | |
tree | 7f9dace2de1c4881b2cbbaa7e36fbf61c74bf8eb /templates | |
parent | 94fbe9b07d0f556fcd2d9bcb3b7e00a1fb2df16b (diff) | |
parent | c30fc4752c878c12255101aa928c64f7a3511020 (diff) | |
download | vyatta-cfg-quagga-7a4610e0fb11946ba40ac1fe1eafbddd39a15e48.tar.gz vyatta-cfg-quagga-7a4610e0fb11946ba40ac1fe1eafbddd39a15e48.zip |
Merge branch 'master' into glendale
Diffstat (limited to 'templates')
30 files changed, 132 insertions, 53 deletions
diff --git a/templates/interfaces/bridge/node.def b/templates/interfaces/bridge/node.def new file mode 100644 index 00000000..d85c9afc --- /dev/null +++ b/templates/interfaces/bridge/node.def @@ -0,0 +1,7 @@ +tag: +type: txt +help: "Enter bridge interface name (br0 - br9)" +syntax: $(@) in "br0", "br1", "br2", "br3", "br4", "br5", "br6", "br7", "br8", "br9" ; "Must be (br0 - br9)" +create: "sudo brctl addbr $(@)" +delete: "sudo brctl delbr $(@)" + diff --git a/templates/interfaces/bridge/node.tag/aging/node.def b/templates/interfaces/bridge/node.tag/aging/node.def new file mode 100644 index 00000000..0b1dcd03 --- /dev/null +++ b/templates/interfaces/bridge/node.tag/aging/node.def @@ -0,0 +1,5 @@ +type: u32 +help: "Set the number of seconds a MAC address will be kept in the forwarding database" +default: 300 +update: "sudo brctl setageing $(../@) $(@)" +delete: "sudo brctl setageing $(../@) $(@)" diff --git a/templates/interfaces/bridge/node.tag/description/node.def b/templates/interfaces/bridge/node.tag/description/node.def new file mode 100644 index 00000000..481dce47 --- /dev/null +++ b/templates/interfaces/bridge/node.tag/description/node.def @@ -0,0 +1,2 @@ +type: txt +help: "Add a human-readable description of an interface" diff --git a/templates/interfaces/bridge/node.tag/disable/node.def b/templates/interfaces/bridge/node.tag/disable/node.def new file mode 100644 index 00000000..f72b8af3 --- /dev/null +++ b/templates/interfaces/bridge/node.tag/disable/node.def @@ -0,0 +1,8 @@ +type: bool +help: "Disable the bridge interface" +default: false +update: "if [ x$(@) == xtrue ]; then \ + sudo ip link set $(../@) down; \ + else \ + sudo ip link set $(../@) up; \ + fi; " diff --git a/templates/interfaces/bridge/node.tag/forwarding-delay/node.def b/templates/interfaces/bridge/node.tag/forwarding-delay/node.def new file mode 100644 index 00000000..6634a7cc --- /dev/null +++ b/templates/interfaces/bridge/node.tag/forwarding-delay/node.def @@ -0,0 +1,5 @@ +type: u32 +help: "Set the forwarding delay" +default: 15 +update: "sudo brctl setfd $(../@) $(@)" +delete: "sudo brctl setfd $(../@) $(@)" diff --git a/templates/interfaces/bridge/node.tag/hello-time/node.def b/templates/interfaces/bridge/node.tag/hello-time/node.def new file mode 100644 index 00000000..e7b59ab3 --- /dev/null +++ b/templates/interfaces/bridge/node.tag/hello-time/node.def @@ -0,0 +1,5 @@ +type: u32 +help: "Set the hello packet advertisment interval" +default: 2 +update: "sudo brctl sethello $(../@) $(@)" +delete: "sudo brctl sethello $(../@) $(@)" diff --git a/templates/interfaces/bridge/node.tag/max-age/node.def b/templates/interfaces/bridge/node.tag/max-age/node.def new file mode 100644 index 00000000..7fa3ecbe --- /dev/null +++ b/templates/interfaces/bridge/node.tag/max-age/node.def @@ -0,0 +1,5 @@ +type: u32 +help: "Set the interval at which neighbor bridges are removed" +default: 20 +update: "sudo brctl setmaxage $(../@) $(@)" +delete: "sudo brctl setmaxage $(../@) $(@)" diff --git a/templates/interfaces/bridge/node.tag/node.def b/templates/interfaces/bridge/node.tag/node.def new file mode 100644 index 00000000..07e13e91 --- /dev/null +++ b/templates/interfaces/bridge/node.tag/node.def @@ -0,0 +1 @@ +help: "Set bridge parameters" diff --git a/templates/interfaces/bridge/node.tag/priority/node.def b/templates/interfaces/bridge/node.tag/priority/node.def new file mode 100644 index 00000000..650958ef --- /dev/null +++ b/templates/interfaces/bridge/node.tag/priority/node.def @@ -0,0 +1,5 @@ +type: u32 +help: "Set the priority for this bridge" +default: 0 +update: "sudo brctl setbridgeprio $(../@) $(@)" +delete: "sudo brctl setbridgeprio $(../@) $(@)" diff --git a/templates/interfaces/bridge/node.tag/stp/node.def b/templates/interfaces/bridge/node.tag/stp/node.def new file mode 100644 index 00000000..eb87287b --- /dev/null +++ b/templates/interfaces/bridge/node.tag/stp/node.def @@ -0,0 +1,9 @@ +type: bool +help: "Enable spanning tree protocol" +default: false +update: "if [ x$(@) == xtrue ]; then \ + sudo brctl stp $(../@) on; \ + else \ + sudo brctl stp $(../@) off; \ + fi; " +delete: "sudo brctl stp $(../@) off" diff --git a/templates/interfaces/ethernet/node.tag/bridge-group/bridge/node.def b/templates/interfaces/ethernet/node.tag/bridge-group/bridge/node.def new file mode 100644 index 00000000..f6ca51e4 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/bridge-group/bridge/node.def @@ -0,0 +1,12 @@ +type: txt +help: "Add this interface to a bridge-group" +syntax: exec " \ + if [ -z \"`sudo brctl show | grep $(@) `\" ]; then \ + echo bridge interface $(@) doesn\\'t exist on this system ; \ + exit 1 ; \ + fi ; " +update: "sudo brctl addif $(@) $(../../@)" +delete: "sudo brctl delif $(@) $(../../@)" +#allowed: local -a array ; +# array=( /sys/class/net/br* ) ; +# echo -n ${array[@]##*/} diff --git a/templates/interfaces/ethernet/node.tag/bridge-group/cost/node.def b/templates/interfaces/ethernet/node.tag/bridge-group/cost/node.def new file mode 100644 index 00000000..1c2bbde1 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/bridge-group/cost/node.def @@ -0,0 +1,4 @@ +type: u32 +help: "Set the path cost for this port" +commit: $(../bridge/) != ""; "Must configure bridge interface" +update: "sudo brctl setpathcost $(../../@) $(@)" diff --git a/templates/interfaces/ethernet/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/bridge-group/node.def new file mode 100644 index 00000000..b76b5d71 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/bridge-group/node.def @@ -0,0 +1,2 @@ +help: "Add this interface to a bridge group" +commit: $(./bridge/) != ""; "Must set the bridge interface" diff --git a/templates/interfaces/ethernet/node.tag/bridge-group/priority/node.def b/templates/interfaces/ethernet/node.tag/bridge-group/priority/node.def new file mode 100644 index 00000000..d254b082 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/bridge-group/priority/node.def @@ -0,0 +1,4 @@ +type: u32 +help: "Set the path priority for this port" +commit: $(../bridge/) != ""; "Must configure bridge interface" +update: "sudo brctl setportprio $(../../@) $(@)" diff --git a/templates/interfaces/ethernet/node.tag/vrrp/node.def b/templates/interfaces/ethernet/node.tag/vrrp/node.def index de3253a5..2c8cc58a 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/node.def @@ -1,5 +1,3 @@ help: "Configure VRRP" commit: $(../address/) != ""; "Must define a primary IP address on $(../@)" -commit: $(virtual-address/) != ""; "Must define the virtual-address for vrrp-group $(../vrrp-group/@)" end: "sudo /opt/vyatta/sbin/vyatta-keepalived.pl --vrrp-action update --intf $(../@) " - diff --git a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.def index fe9690d8..dfb9c6a2 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.def @@ -1,4 +1,6 @@ +tag: type: u32 syntax: $(@) >= 0 && $(@) <= 255; "VRRP group must be between 1-255" +commit: $(virtual-address/) != ""; "Must define the virtual-address for vrrp-group $(@)" help: "Configure VRRP group number" delete: "sudo /opt/vyatta/sbin/vyatta-keepalived.pl --vrrp-action delete --intf $(../../@) --group $(@) " diff --git a/templates/interfaces/ethernet/node.tag/vrrp/advertise-interval/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/advertise-interval/node.def index edfbc3a4..edfbc3a4 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/advertise-interval/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/advertise-interval/node.def diff --git a/templates/interfaces/ethernet/node.tag/vrrp/authentication/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/authentication/node.def index e3120d51..e3120d51 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/authentication/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/authentication/node.def diff --git a/templates/interfaces/ethernet/node.tag/vrrp/authentication/password/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/authentication/password/node.def index 87855962..87855962 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/authentication/password/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/authentication/password/node.def diff --git a/templates/interfaces/ethernet/node.tag/vrrp/authentication/type/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/authentication/type/node.def index 72e53f4b..72e53f4b 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/authentication/type/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/authentication/type/node.def diff --git a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/node.def new file mode 100644 index 00000000..a4f3c074 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/node.def @@ -0,0 +1 @@ +help: "VRRP configuration for this VRRP group" diff --git a/templates/interfaces/ethernet/node.tag/vrrp/preempt/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/preempt/node.def index a9869373..a9869373 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/preempt/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/preempt/node.def diff --git a/templates/interfaces/ethernet/node.tag/vrrp/priority/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/priority/node.def index 3f7aacbf..3f7aacbf 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/priority/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/priority/node.def diff --git a/templates/interfaces/ethernet/node.tag/vrrp/virtual-address/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/virtual-address/node.def index badf657e..bcf9392f 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/virtual-address/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/virtual-address/node.def @@ -1,2 +1,3 @@ +multi: type: ipv4 help: "Configure virtual address" 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\" " |