diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2007-09-25 15:55:26 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2007-09-25 15:55:26 -0700 |
commit | e9a79a249cec69fc178098d2f75db9389068510a (patch) | |
tree | 0e366094b7fecd3988c243fbbb574015e0c900c8 /templates | |
download | vyatta-cfg-e9a79a249cec69fc178098d2f75db9389068510a.tar.gz vyatta-cfg-e9a79a249cec69fc178098d2f75db9389068510a.zip |
initial import (from eureka /cli) plus new build system.upstream
Diffstat (limited to 'templates')
68 files changed, 488 insertions, 0 deletions
diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def new file mode 100644 index 0000000..b5a320e --- /dev/null +++ b/templates/interfaces/ethernet/node.def @@ -0,0 +1,8 @@ +tag: +type: txt +help: "Ethernet interface name" +syntax: exec " \ + if [ -z \"`ip addr | grep $(@) `\" ]; then \ + echo ethernet interface $(@) doesn\\'t exist on this system ; \ + exit 1 ; \ + fi ; " diff --git a/templates/interfaces/ethernet/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/address/node.def new file mode 100644 index 0000000..41a0b06 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/address/node.def @@ -0,0 +1,5 @@ +multi: +type: ipv4net +help: "Set IPv4 address and prefix for this interface" +create: "ip addr add $(@) dev $(../@)"; "error setting address $(@) on dev $(../@)" +delete: "ip addr del $(@) dev $(../@)"; "error deleting address $(@) on dev $(../@)" diff --git a/templates/interfaces/ethernet/node.tag/description/node.def b/templates/interfaces/ethernet/node.tag/description/node.def new file mode 100644 index 0000000..abd0a26 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/description/node.def @@ -0,0 +1,2 @@ +type: txt +help: "description for this interface" diff --git a/templates/interfaces/ethernet/node.tag/duplex/node.def b/templates/interfaces/ethernet/node.tag/duplex/node.def new file mode 100644 index 0000000..e15ef39 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/duplex/node.def @@ -0,0 +1,6 @@ +type: txt +help: "set the duplex for this interface" +syntax: $(@) in "half", "full"; "duplex must be half or full" +commit: $(../speed) != ""; "if duplex is hardcoded, speed must also be hardcoded" +create: "ethtool -s $(../@) speed $(../speed/@) duplex $(@) autoneg off" +delete: "ethtool -s $(../@) autoneg on" diff --git a/templates/interfaces/ethernet/node.tag/enable/node.def b/templates/interfaces/ethernet/node.tag/enable/node.def new file mode 100644 index 0000000..2b74d58 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/enable/node.def @@ -0,0 +1,3 @@ +help: "enable interface" +create: "ip link set $(../@) up"; "error enabling dev $(../@)" +delete: "ip link set $(../@) down"; "error disabling dev $(../@)" diff --git a/templates/interfaces/ethernet/node.tag/hw-id/node.def b/templates/interfaces/ethernet/node.tag/hw-id/node.def new file mode 100644 index 0000000..6097cff --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/hw-id/node.def @@ -0,0 +1,2 @@ +type: macaddr +help: "set the original MAC address for this interface" diff --git a/templates/interfaces/ethernet/node.tag/mac/node.def b/templates/interfaces/ethernet/node.tag/mac/node.def new file mode 100644 index 0000000..41e4313 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/mac/node.def @@ -0,0 +1,4 @@ +type: macaddr +help: "set the MAC address for this interface" +create: "ip link set $(../@) address $(@)"; "error setting MAC address on dev $(../@)" +delete: "ip link set $(../@) address $(../hw-id/@)"; "error setting MAC address on dev $(../@) to $(../hw-id/@)" diff --git a/templates/interfaces/ethernet/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/mtu/node.def new file mode 100644 index 0000000..33b1238 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/mtu/node.def @@ -0,0 +1,5 @@ +type: u32 +help: "set the MTU address for this interface" +syntax: $(@) >= 1 && $(@) <= 1500; "MTU must be between 1 and 1500" +create: "ip link set $(../@) mtu $(@)"; "error setting MAC address on dev $(../@)" +delete: "ip link set $(../@) mtu 1500"; "error deleteing MAC address on dev $(../@)" diff --git a/templates/interfaces/ethernet/node.tag/speed/node.def b/templates/interfaces/ethernet/node.tag/speed/node.def new file mode 100644 index 0000000..6983355 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/speed/node.def @@ -0,0 +1,6 @@ +type: txt +help: "set the speed for this interface" +syntax: $(@) in "10", "100", "1000"; "Speed must be 10, 100, or 1000" +commit: $(../duplex/@) != ""; "if speed is hardcoded, duplex must also be hardcoded" +create: "ethtool -s $(../@) speed $(@) duplex $(../duplex/@) autoneg off" +delete: "ethtool -s $(../@) autoneg on" diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def new file mode 100644 index 0000000..06ee1c0 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.def @@ -0,0 +1,7 @@ +tag: +type: u32 +help: "vlan ID" +syntax: $(@) >= 0 && $(@) <= 4095; "vlan ID must be between 0 and 4095" +create: "modprobe 8021q"; "error loading 802.1q driver" +create: "vconfig add $(../@) $(@)"; "error adding vlan id $(@) to dev $(../@)" +delete: "vconfig rem $(../@) $(@)"; "error removing vlan id $(@) from dev $(../@)" diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def new file mode 100644 index 0000000..345a29e --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def @@ -0,0 +1,5 @@ +multi: +type: ipv4net +help: "Set IPv4 address and prefix for this interface" +create: "ip addr add $(@) dev $(../../@)"; "error setting address $(@) on dev $(../../@)" +delete: "ip addr del $(@) dev $(../../@)"; "error deleteing address $(@) on dev $(../../@)" diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/description/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/description/node.def new file mode 100644 index 0000000..abd0a26 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/description/node.def @@ -0,0 +1,2 @@ +type: txt +help: "description for this interface" diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/enable/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/enable/node.def new file mode 100644 index 0000000..1e1879f --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/enable/node.def @@ -0,0 +1,3 @@ +help: "enable interface" +create: "ip link set $(../../@) up"; "error enabling dev $(../../@)" +delete: "ip link set $(../../@) down"; "error disabling dev $(../../@)" diff --git a/templates/interfaces/loopback/node.def b/templates/interfaces/loopback/node.def new file mode 100644 index 0000000..50df935 --- /dev/null +++ b/templates/interfaces/loopback/node.def @@ -0,0 +1,8 @@ +tag: +type: txt +help: "loopback interface name" +syntax: exec " \ + if [ -z \"`ip addr | grep $(@) `\" ]; then \ + echo loopback interface $(@) doesn\\'t exist on this system ; \ + exit 1 ; \ + fi ; " diff --git a/templates/interfaces/loopback/node.tag/address/node.def b/templates/interfaces/loopback/node.tag/address/node.def new file mode 100644 index 0000000..2e7e106 --- /dev/null +++ b/templates/interfaces/loopback/node.tag/address/node.def @@ -0,0 +1,6 @@ +multi: +type: ipv4net +help: "Set IPv4 address and prefix for this interface" +# TODO make sure 127.0.0.0/8 not in here. +create: "ip addr add $(@) dev $(../@)"; "error setting address $(@) on dev $(../@)" +delete: "ip addr del $(@) dev $(../@)"; "error deleteing address $(@) on dev $(../@)" diff --git a/templates/interfaces/loopback/node.tag/description/node.def b/templates/interfaces/loopback/node.tag/description/node.def new file mode 100644 index 0000000..abd0a26 --- /dev/null +++ b/templates/interfaces/loopback/node.tag/description/node.def @@ -0,0 +1,2 @@ +type: txt +help: "description for this interface" diff --git a/templates/interfaces/node.def b/templates/interfaces/node.def new file mode 100644 index 0000000..297604a --- /dev/null +++ b/templates/interfaces/node.def @@ -0,0 +1 @@ +help: "Network interface configuration" diff --git a/templates/system/domain-name/node.def b/templates/system/domain-name/node.def new file mode 100644 index 0000000..8f9d457 --- /dev/null +++ b/templates/system/domain-name/node.def @@ -0,0 +1,15 @@ +type: txt +help: "Configure system domain name" +syntax: pattern $(@) "^[-a-zA-Z0-9.]{0,63}$" ; "invalid domain name $(@)" +create: "sh -c \"if [ x$(@) == x ]; then exit 0; fi && \ +touch /etc/resolv.conf && \ +sed -i '/domain/d' /etc/resolv.conf && \ +echo \\\"domain\t $(@)\\\" >> /etc/resolv.conf\" " +# also add localhost line into /etc/hosts (see host-name template)? +update: "sh -c \"if [ x$(@) == x ]; then exit 0; fi && \ +touch /etc/resolv.conf && \ +sed -i '/domain/d' /etc/resolv.conf && \ +echo \\\"domain\t $(@)\\\" >> /etc/resolv.conf\" " +# also update localhost line in /etc/hosts (see host-name template)? +delete: "sh -c \"touch /etc/resolv.conf && \ +sed -i '/domain\\\\t $(@)/d' /etc/resolv.conf\" " diff --git a/templates/system/domain-search/domain/node.def b/templates/system/domain-search/domain/node.def new file mode 100644 index 0000000..d4e6c3c --- /dev/null +++ b/templates/system/domain-search/domain/node.def @@ -0,0 +1,12 @@ +multi: +type: txt +help: "Configure DNS domain completion order" +syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid domain name $(@)" +create: "sh -c \"touch /etc/resolv.conf && \ +if grep -q 'search\t $(@)' /etc/resolv.conf; then exit 0; \ +else echo \\\"search\t $(@)\\\" >> /etc/resolv.conf; fi\" " +update: "sh -c \"touch /etc/resolv.conf && \ +if grep -q 'search\t $(@)' /etc/resolv.conf; then exit 0; \ +else echo \\\"search\t $(@)\\\" >> /etc/resolv.conf; fi\" " +delete: "sh -c \"touch /etc/resolv.conf && \ +sed -i '/search\\\\t $(@)/d' /etc/resolv.conf\" " diff --git a/templates/system/gateway-address/node.def b/templates/system/gateway-address/node.def new file mode 100644 index 0000000..c82e3fe --- /dev/null +++ b/templates/system/gateway-address/node.def @@ -0,0 +1,17 @@ +type: txt +help: "Configure default gateway" +create: "sh -c \"echo \ +'static_routes/static_routes/0.1/add_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=0.0.0.0/0&nexthop:ipv4=$(@)&metric:u32=1' \ +>> /tmp/cli.log && \ +/opt/vyatta/libexec/xorp/call_xrl 'static_routes/static_routes/0.1/add_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=0.0.0.0/0&nexthop:ipv4=$(@)&metric:u32=1' >> /tmp/cli.log ; \ +echo \\$? >> /tmp/cli.log\" " +update: "sh -c \"echo \ +'static_routes/static_routes/0.1/replace_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=0.0.0.0/0&nexthop:ipv4=$(@)&metric:u32=1' \ +>> /tmp/cli.log && \ +/opt/vyatta/libexec/xorp/call_xrl 'static_routes/static_routes/0.1/replace_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=0.0.0.0/0&nexthop:ipv4=$(@)&metric:u32=1' >> /tmp/cli.log ; \ +echo \\$? >> /tmp/cli.log\" " +delete: "sh -c \"echo \ +'static_routes/static_routes/0.1/delete_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=0.0.0.0/0&nexthop:ipv4=0.0.0.0' \ +>> /tmp/cli.log && \ +/opt/vyatta/libexec/xorp/call_xrl 'static_routes/static_routes/0.1/delete_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=0.0.0.0/0&nexthop:ipv4=0.0.0.0' >> /tmp/cli.log ; \ +echo \\$? >> /tmp/cli.log\" " diff --git a/templates/system/host-name/node.def b/templates/system/host-name/node.def new file mode 100644 index 0000000..fc7c91b --- /dev/null +++ b/templates/system/host-name/node.def @@ -0,0 +1,24 @@ +type: txt +help: "Configure system host name" +default: "vyatta" +syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $(@)" +create: "sh -c \"hostname '$(@)' && \ +touch /etc/hosts && \ +sed -i '/localhost/d' /etc/hosts && \ +echo \\\"127.0.0.1\t localhost $(@)\t #vyatta entry\\\" >> /etc/hosts && \ +if [ x$(../domain-name/@) != x ]; then \ +echo \\\"127.0.0.1\t localhost $(@).$(../domain-name/@)\t #vyatta entry\\\" \>> /etc/hosts; fi\" " +# do we need to add ntpd restart here? +update: "sh -c \"hostname '$(@)' && \ +touch /etc/hosts && \ +sed -i '/localhost/d' /etc/hosts && \ +echo \\\"127.0.0.1\t localhost $(@)\t #vyatta entry\\\" >> /etc/hosts && \ +if [ x$(../domain-name/@) != x ]; then \ +echo \\\"127.0.0.1\t localhost $(@).$(../domain-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; fi\" " +# do we need to add ntpd restart here? +delete: "sh -c \"echo > /etc/hostname.conf && hostname '' && \ +touch /etc/hosts && \ +sed -i '/localhost.*#vyatta entry/d' /etc/hosts && \ +if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ +/opt/vyatta/sbin/ntpd.init restart; fi\" " diff --git a/templates/system/login/node.def b/templates/system/login/node.def new file mode 100644 index 0000000..1246514 --- /dev/null +++ b/templates/system/login/node.def @@ -0,0 +1,3 @@ +help: "Configure user access" +delete: "sh -c \"echo User root cannot be deleted 1>&2 && exit 1\" " + diff --git a/templates/system/login/radius-server/node.def b/templates/system/login/radius-server/node.def new file mode 100644 index 0000000..d12be76 --- /dev/null +++ b/templates/system/login/radius-server/node.def @@ -0,0 +1,14 @@ +tag: +type: ipv4 +help: "Radius server authentication configuration" +# need mandatory secret. also need port & timeout (default values?) +create: "sh -c \"touch /etc/raddb/server && \ +sed -i '/$(@)/d' /etc/raddb/server && \ +echo \\\"$(@):$(port/@)\t$(secret/@)\t$(timeout/@)\\\" \ +>> /etc/raddb/server\" " +update: "sh -c \"touch /etc/raddb/server && \ +sed -i '/$(@)/d' /etc/raddb/server && \ +echo \\\"$(@):$(port/@)\t$(secret/@)\t$(timeout/@)\\\" \ +>> /etc/raddb/server\" " +delete: "sh -c \"touch /etc/raddb/server && \ +sed -i '/$(@)/d' /etc/raddb/server\" " diff --git a/templates/system/login/radius-server/node.tag/port/node.def b/templates/system/login/radius-server/node.tag/port/node.def new file mode 100644 index 0000000..8c856e7 --- /dev/null +++ b/templates/system/login/radius-server/node.tag/port/node.def @@ -0,0 +1,4 @@ +type: u32 +help: "Configure radius port" +syntax: ($(@) > 0 && $(@) < 65536) ; "port must be between 1 and 65535" +default: 1812 diff --git a/templates/system/login/radius-server/node.tag/secret/node.def b/templates/system/login/radius-server/node.tag/secret/node.def new file mode 100644 index 0000000..eb08eca --- /dev/null +++ b/templates/system/login/radius-server/node.tag/secret/node.def @@ -0,0 +1,2 @@ +type: txt +help: "Secret for radius access" diff --git a/templates/system/login/radius-server/node.tag/timeout/node.def b/templates/system/login/radius-server/node.tag/timeout/node.def new file mode 100644 index 0000000..84bb442 --- /dev/null +++ b/templates/system/login/radius-server/node.tag/timeout/node.def @@ -0,0 +1,3 @@ +type: u32 +help: "Timeout for radius session" +default: 2 diff --git a/templates/system/login/user/node.def b/templates/system/login/user/node.def new file mode 100644 index 0000000..0d09c4d --- /dev/null +++ b/templates/system/login/user/node.def @@ -0,0 +1,17 @@ +tag: +type: txt +help: "User account information" +syntax: pattern $(@) "^[a-zA-Z_][a-zA-Z0-9_-]*\\$?$" ; "invalid user name $(@)" +# line continuation and $() expansion are done by cli, not sh. +# need mandatory encrypted password. +end: "if [ -d /tmp/vyatta-delete-system-login-user-$(@).\\\$PPID ]; \ +then rm -rf /tmp/vyatta-delete-system-login-user-$(@).\\\$PPID && exit 0; \ +fi && \ +/opt/vyatta/sbin/vyatta_update_login_user.pl \ +'$(@)' '$(full-name/@)' '$(authentication/encrypted-password/@)'" +delete: "if [ x$(@) == x ]; then exit 1; fi && \ +if [ x$(@) == xroot ]; then echo Cannot delete user \"root\" 1>&2 && exit 2; \ +fi && \ +if mkdir /tmp/vyatta-delete-system-login-user-$(@).\\\$PPID >& /dev/null; \ +then /opt/vyatta/sbin/vyatta_update_login_user.pl -d '$(@)'; \ +else exit 1; fi" diff --git a/templates/system/login/user/node.tag/authentication/encrypted-password/node.def b/templates/system/login/user/node.tag/authentication/encrypted-password/node.def new file mode 100644 index 0000000..33a87f5 --- /dev/null +++ b/templates/system/login/user/node.tag/authentication/encrypted-password/node.def @@ -0,0 +1,2 @@ +type: txt +help: "Configure encrypted password" diff --git a/templates/system/login/user/node.tag/authentication/node.def b/templates/system/login/user/node.tag/authentication/node.def new file mode 100644 index 0000000..8b0f312 --- /dev/null +++ b/templates/system/login/user/node.tag/authentication/node.def @@ -0,0 +1 @@ +help: "Authentication password" diff --git a/templates/system/login/user/node.tag/authentication/plaintext-password/node.def b/templates/system/login/user/node.tag/authentication/plaintext-password/node.def new file mode 100644 index 0000000..78619d7 --- /dev/null +++ b/templates/system/login/user/node.tag/authentication/plaintext-password/node.def @@ -0,0 +1,9 @@ +type: txt +help: "Configure plaintext password for encryption" +# if plaintext is empty, assume this is left-over from blanking the plaintext +# and do nothing. to set password to empty, user needs to set the +# "encrypted-password" to an empty string (which actually allows login without +# password). +update: $(@) == "" \ +|| ($(../encrypted-password/@) = `/opt/vyatta/sbin/rl_passwd '$(@)' dummy` \ + && $(@) = "") diff --git a/templates/system/login/user/node.tag/full-name/node.def b/templates/system/login/user/node.tag/full-name/node.def new file mode 100644 index 0000000..86b7c8d --- /dev/null +++ b/templates/system/login/user/node.tag/full-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: "Full name of the user (use quotes for names with spaces)" diff --git a/templates/system/name-server/node.def b/templates/system/name-server/node.def new file mode 100644 index 0000000..2afe0b0 --- /dev/null +++ b/templates/system/name-server/node.def @@ -0,0 +1,17 @@ +multi: +type: ipv4 +help: "Configure domain name server" +create: "sh -c \"touch /etc/resolv.conf && \ +if grep -q '$(@)' /etc/resolv.conf; then exit 0; \ +else echo \\\"nameserver\t $(@)\\\" >> /etc/resolv.conf; fi && \ +if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ +/opt/vyatta/sbin/ntpd.init restart; fi\" " +update: "sh -c \"touch /etc/resolv.conf && \ +if grep -q '$(@)' /etc/resolv.conf; then exit 0; \ +else echo \\\"nameserver\t $(@)\\\" >> /etc/resolv.conf; fi && \ +if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ +/opt/vyatta/sbin/ntpd.init restart; fi\" " +delete: "sh -c \"touch /etc/resolv.conf && \ +sed -i '/$(@)/d' /etc/resolv.conf && \ +if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \ +/opt/vyatta/sbin/ntpd.init restart; fi\" " diff --git a/templates/system/ntp-server/node.def b/templates/system/ntp-server/node.def new file mode 100644 index 0000000..9f828e1 --- /dev/null +++ b/templates/system/ntp-server/node.def @@ -0,0 +1,16 @@ +multi: +type: txt +help: "IP address of NTP server" +# should help be "domain name" instead of "ip address", or change type to ipv4? +create: "sh -c \"touch /etc/ntp/ntp.conf && \ +if ! grep -q 'server.*$(@)' /etc/ntp/ntp.conf; then \ +echo \\\"server $(@)\\\" >> /etc/ntp/ntp.conf && \ +/opt/vyatta/sbin/ntpd.init restart; fi\" " +update: "sh -c \"touch /etc/ntp/ntp.conf && \ +if ! grep -q 'server.*$(@)' /etc/ntp/ntp.conf; then \ +echo \\\"server $(@)\\\" >> /etc/ntp/ntp.conf && \ +/opt/vyatta/sbin/ntpd.init restart; fi\" " +delete: "sh -c \"touch /etc/ntp/ntp.conf && \ +if grep -q 'server.*$(@)' /etc/ntp/ntp.conf; then \ +sed -i '/server $(@)/d' /etc/ntp/ntp.conf && \ +/opt/vyatta/sbin/ntpd.init restart; fi\" " diff --git a/templates/system/options/node.def b/templates/system/options/node.def new file mode 100644 index 0000000..1e49ee5 --- /dev/null +++ b/templates/system/options/node.def @@ -0,0 +1 @@ +help: "Configure system options" diff --git a/templates/system/options/reboot-on-panic/node.def b/templates/system/options/reboot-on-panic/node.def new file mode 100644 index 0000000..d84abc7 --- /dev/null +++ b/templates/system/options/reboot-on-panic/node.def @@ -0,0 +1,16 @@ +type: bool +help: "Configure if kernel panic causes reboot" +default: true +create: "sh -c \"if [ x$(@) == xfalse ]; \ +then \ + echo 0 > /proc/sys/kernel/panic; \ +else \ + echo 60 > /proc/sys/kernel/panic; \ +fi\" " +update: "sh -c \"if [ x$(@) == xfalse ]; \ +then \ + echo 0 > /proc/sys/kernel/panic; \ +else \ + echo 60 > /proc/sys/kernel/panic; \ +fi\" " +delete: "sh -c \"echo 60 > /proc/sys/kernel/panic\" " diff --git a/templates/system/package/auto-sync/node.def b/templates/system/package/auto-sync/node.def new file mode 100644 index 0000000..59f3e1e --- /dev/null +++ b/templates/system/package/auto-sync/node.def @@ -0,0 +1,15 @@ +# this will set APT::Periodic::Update-Package-Lists in /etc/apt/apt.conf +# apt.conf is in turn read by the apt cron file loacted in /etc/cron.daily/apt +# the /etc/crontab file must have the daily line for daily to be run +type: u32 +default: 1 +help: "Update the the repository cache every n days. 0 disables auto-update." +syntax: $(@) >= 0 && $(@) < 32 ; "auto-sync must be between 0 and 32 days" +create: "sh -c \"touch /etc/apt/apt.conf && \ +sed -i '/APT::Periodic::Update-Package-Lists*/d' /etc/apt/apt.conf && \ +echo \\\"APT::Periodic::Update-Package-Lists \\\"$(@)\\\";\\\" >> /etc/apt/apt.conf\" " +update: "sh -c \"touch /etc/apt/apt.conf && \ +sed -i '/APT::Periodic::Update-Package-Lists*/d' /etc/apt/apt.conf && \ +echo \\\"APT::Periodic::Update-Package-Lists \\\"$(@)\\\";\\\" >> /etc/apt/apt.conf\" " +delete: "sh -c \"touch /etc/apt/apt.conf && \ +sed -i '/APT::Periodic::Update-Package-Lists*/d' /etc/apt/apt.conf\" " diff --git a/templates/system/package/node.def b/templates/system/package/node.def new file mode 100644 index 0000000..ce185fa --- /dev/null +++ b/templates/system/package/node.def @@ -0,0 +1 @@ +help: "Package Update Repository Configuration" diff --git a/templates/system/package/repository/node.def b/templates/system/package/repository/node.def new file mode 100644 index 0000000..104089a --- /dev/null +++ b/templates/system/package/repository/node.def @@ -0,0 +1,14 @@ +tag: +type: txt +help: "Repository name" +# bug 1847: remove the previous repo line before adding new line. +# need to prohibit '!' in repo name (sed delimiter) +syntax: pattern $(@) "^[^!]+$" ; "Do not use '!' in repository name" +create: "sh -c \"touch /etc/apt/sources.list && \ +sed -i '\\!/ $(@) !d' /etc/apt/sources.list && \ +echo \\\"deb $(url/@)/ $(@) $(component/@)\\\" >> /etc/apt/sources.list\" " +update: "sh -c \"touch /etc/apt/sources.list && \ +sed -i '\\!/ $(@) !d' /etc/apt/sources.list && \ +echo \\\"deb $(url/@)/ $(@) $(component/@)\\\" >> /etc/apt/sources.list\" " +delete: "sh -c \"touch /etc/apt/sources.list && \ +sed -i '\\! $(@) $(component/@)!d' /etc/apt/sources.list\" " diff --git a/templates/system/package/repository/node.tag/component/node.def b/templates/system/package/repository/node.tag/component/node.def new file mode 100644 index 0000000..e87f88d --- /dev/null +++ b/templates/system/package/repository/node.tag/component/node.def @@ -0,0 +1,2 @@ +type: txt +help: "Repository component names" diff --git a/templates/system/package/repository/node.tag/description/node.def b/templates/system/package/repository/node.tag/description/node.def new file mode 100644 index 0000000..9ce7dac --- /dev/null +++ b/templates/system/package/repository/node.tag/description/node.def @@ -0,0 +1,2 @@ +type: txt +help: "Repository description" diff --git a/templates/system/package/repository/node.tag/url/node.def b/templates/system/package/repository/node.tag/url/node.def new file mode 100644 index 0000000..0e304b9 --- /dev/null +++ b/templates/system/package/repository/node.tag/url/node.def @@ -0,0 +1,2 @@ +type: txt +help: "Repository URL" diff --git a/templates/system/static-host-mapping/host-name/node.def b/templates/system/static-host-mapping/host-name/node.def new file mode 100644 index 0000000..ea0000a --- /dev/null +++ b/templates/system/static-host-mapping/host-name/node.def @@ -0,0 +1,4 @@ +tag: +type: txt +help: "Map DNS names to system interfaces" +syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $(@)" 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 new file mode 100644 index 0000000..b6f897f --- /dev/null +++ b/templates/system/static-host-mapping/host-name/node.tag/alias/node.def @@ -0,0 +1,33 @@ +multi: +type: txt +help: "Alias for this address" +create: "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\" " +update: "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: "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 new file mode 100644 index 0000000..192273c --- /dev/null +++ b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def @@ -0,0 +1,30 @@ +type: ipv4 +help: "Internet address" +create: "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\" " +update: "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: "sh -c \"touch /etc/hosts && \ +sed -i '/ $(../@) .*#vyatta entry/{/localhost/!d}' /etc/hosts\" " diff --git a/templates/system/static-host-mapping/node.def b/templates/system/static-host-mapping/node.def new file mode 100644 index 0000000..736413f --- /dev/null +++ b/templates/system/static-host-mapping/node.def @@ -0,0 +1 @@ +help: "Map DNS names to system interfaces" diff --git a/templates/system/syslog/console/facility/node.def b/templates/system/syslog/console/facility/node.def new file mode 100644 index 0000000..bfe3856 --- /dev/null +++ b/templates/system/syslog/console/facility/node.def @@ -0,0 +1,11 @@ +tag: +type: txt +help: "Configure facility for console logging" +create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' '\\/dev\\/console' \ +\\\"$(@).\\\\\$LVL\t/dev/console\n\\\"\" " +update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' '\\/dev\\/console' \ +\\\"$(@).\\\\\$LVL\t/dev/console\n\\\"\" " +delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ +'$(@)\\.' '\\/dev\\/console' ''\" " diff --git a/templates/system/syslog/console/facility/node.tag/level/node.def b/templates/system/syslog/console/facility/node.tag/level/node.def new file mode 100644 index 0000000..9be459c --- /dev/null +++ b/templates/system/syslog/console/facility/node.tag/level/node.def @@ -0,0 +1,3 @@ +type: txt +help: "Configure the logging level" +default: "err" diff --git a/templates/system/syslog/console/node.def b/templates/system/syslog/console/node.def new file mode 100644 index 0000000..e30721d --- /dev/null +++ b/templates/system/syslog/console/node.def @@ -0,0 +1 @@ +help: "Configure console logging" diff --git a/templates/system/syslog/file/node.def b/templates/system/syslog/file/node.def new file mode 100644 index 0000000..d62d261 --- /dev/null +++ b/templates/system/syslog/file/node.def @@ -0,0 +1,4 @@ +tag: +type: txt +help: "Name of the syslog file to save log messages to" +syntax: pattern $(@) "^[-a-zA-Z0-9_.]+$" ; "invalid file name $(@)" diff --git a/templates/system/syslog/file/node.tag/archive/files/node.def b/templates/system/syslog/file/node.tag/archive/files/node.def new file mode 100644 index 0000000..ca2bf17 --- /dev/null +++ b/templates/system/syslog/file/node.tag/archive/files/node.def @@ -0,0 +1,3 @@ +type: u32 +help: "Number of saved files" +default: 5 diff --git a/templates/system/syslog/file/node.tag/archive/node.def b/templates/system/syslog/file/node.tag/archive/node.def new file mode 100644 index 0000000..d0b0e23 --- /dev/null +++ b/templates/system/syslog/file/node.tag/archive/node.def @@ -0,0 +1,8 @@ +help: "Configure log file size and rotation characteristics" +# need mandatory files & size +create: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +'$(../@)' '$(files/@)' '$(size/@)' 1\" " +update: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +'$(../@)' '$(files/@)' '$(size/@)' 1\" " +delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +'$(../@)' '$(files/@)' '$(size/@)' 0\" " diff --git a/templates/system/syslog/file/node.tag/archive/size/node.def b/templates/system/syslog/file/node.tag/archive/size/node.def new file mode 100644 index 0000000..a5ace52 --- /dev/null +++ b/templates/system/syslog/file/node.tag/archive/size/node.def @@ -0,0 +1,3 @@ +type: u32 +help: "Size of log files (kbytes)" +default: 0 diff --git a/templates/system/syslog/file/node.tag/facility/node.def b/templates/system/syslog/file/node.tag/facility/node.def new file mode 100644 index 0000000..3ef56e3 --- /dev/null +++ b/templates/system/syslog/file/node.tag/facility/node.def @@ -0,0 +1,13 @@ +tag: +type: txt +help: "Configure facility for file logging" +create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ +'\\/var\\/log\\/user\\/$(../@)' \ +\\\"$(@).\\\\\$LVL\t/var/log/user/$(../@) \n\\\"\" " +update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ +'\\/var\\/log\\/user\\/$(../@)' \ +\\\"$(@).\\\\\$LVL\t/var/log/user/$(../@) \n\\\"\" " +delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ +'\\/var\\/log\\/user\\/$(../@)' ''\" " diff --git a/templates/system/syslog/file/node.tag/facility/node.tag/level/node.def b/templates/system/syslog/file/node.tag/facility/node.tag/level/node.def new file mode 100644 index 0000000..9be459c --- /dev/null +++ b/templates/system/syslog/file/node.tag/facility/node.tag/level/node.def @@ -0,0 +1,3 @@ +type: txt +help: "Configure the logging level" +default: "err" diff --git a/templates/system/syslog/global/archive/files/node.def b/templates/system/syslog/global/archive/files/node.def new file mode 100644 index 0000000..ca2bf17 --- /dev/null +++ b/templates/system/syslog/global/archive/files/node.def @@ -0,0 +1,3 @@ +type: u32 +help: "Number of saved files" +default: 5 diff --git a/templates/system/syslog/global/archive/node.def b/templates/system/syslog/global/archive/node.def new file mode 100644 index 0000000..dcfc244 --- /dev/null +++ b/templates/system/syslog/global/archive/node.def @@ -0,0 +1,8 @@ +help: "Configure log file size and rotation characteristics" +# need mandatory files & size +create: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +'$(files/@)' '$(size/@)' 1\" " +update: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +'$(files/@)' '$(size/@)' 1\" " +delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_logrotate.pl \ +'$(files/@)' '$(size/@)' 0\" " diff --git a/templates/system/syslog/global/archive/size/node.def b/templates/system/syslog/global/archive/size/node.def new file mode 100644 index 0000000..3c8da6e --- /dev/null +++ b/templates/system/syslog/global/archive/size/node.def @@ -0,0 +1,3 @@ +type: u32 +help: "Size of log files (kbytes)" +default: 250 diff --git a/templates/system/syslog/global/facility/node.def b/templates/system/syslog/global/facility/node.def new file mode 100644 index 0000000..cd037f6 --- /dev/null +++ b/templates/system/syslog/global/facility/node.def @@ -0,0 +1,11 @@ +tag: +type: txt +help: "Configure facility for system logging" +create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl '' '\\/var\\/log\\/messages' \ +\\\"$(@).\\\\\$LVL\t/var/log/messages \n\\\"\" " +update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl '' '\\/var\\/log\\/messages' \ +\\\"$(@).\\\\\$LVL\t/var/log/messages \n\\\"\" " +delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ +'' '\\/var\\/log\\/messages' '*.warning\t/var/log/messages \n'\" " diff --git a/templates/system/syslog/global/facility/node.tag/level/node.def b/templates/system/syslog/global/facility/node.tag/level/node.def new file mode 100644 index 0000000..9be459c --- /dev/null +++ b/templates/system/syslog/global/facility/node.tag/level/node.def @@ -0,0 +1,3 @@ +type: txt +help: "Configure the logging level" +default: "err" diff --git a/templates/system/syslog/global/node.def b/templates/system/syslog/global/node.def new file mode 100644 index 0000000..b516645 --- /dev/null +++ b/templates/system/syslog/global/node.def @@ -0,0 +1 @@ +help: "Configure system logging" diff --git a/templates/system/syslog/host/node.def b/templates/system/syslog/host/node.def new file mode 100644 index 0000000..a349582 --- /dev/null +++ b/templates/system/syslog/host/node.def @@ -0,0 +1,3 @@ +tag: +type: txt +help: "IP address or hostname of remote syslog server" diff --git a/templates/system/syslog/host/node.tag/facility/node.def b/templates/system/syslog/host/node.tag/facility/node.def new file mode 100644 index 0000000..2dc56e6 --- /dev/null +++ b/templates/system/syslog/host/node.tag/facility/node.def @@ -0,0 +1,11 @@ +tag: +type: txt +help: "Configure facility for host logging" +create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' '@$(../@) ' \ +\\\"$(@).\\\\\$LVL\t@$(../@) \n\\\"\" " +update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' '@$(../@) ' \ +\\\"$(@).\\\\\$LVL\t@$(../@) \n\\\"\" " +delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl '$(@)\\.' \ +'@$(../@) ' ''\" " diff --git a/templates/system/syslog/host/node.tag/facility/node.tag/level/node.def b/templates/system/syslog/host/node.tag/facility/node.tag/level/node.def new file mode 100644 index 0000000..9be459c --- /dev/null +++ b/templates/system/syslog/host/node.tag/facility/node.tag/level/node.def @@ -0,0 +1,3 @@ +type: txt +help: "Configure the logging level" +default: "err" diff --git a/templates/system/syslog/node.def b/templates/system/syslog/node.def new file mode 100644 index 0000000..04d3675 --- /dev/null +++ b/templates/system/syslog/node.def @@ -0,0 +1,3 @@ +help: "Configure syslog daemon" +delete: "sh -c \"/opt/vyatta/sbin/vyatta_update_syslog.pl \ +'' '\\/var\\/log\\/messages' '*.warning\t/var/log/messages \n'\" " diff --git a/templates/system/syslog/user/node.def b/templates/system/syslog/user/node.def new file mode 100644 index 0000000..ba731ca --- /dev/null +++ b/templates/system/syslog/user/node.def @@ -0,0 +1,3 @@ +tag: +type: txt +help: "Configure syslog user account output" diff --git a/templates/system/syslog/user/node.tag/facility/node.def b/templates/system/syslog/user/node.tag/facility/node.def new file mode 100644 index 0000000..1b22747 --- /dev/null +++ b/templates/system/syslog/user/node.tag/facility/node.def @@ -0,0 +1,14 @@ +tag: +type: txt +help: "Configure facility for user logging" +create: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"$(@)\\.\\\\\$LVL\\\" \ +' $(../@) ' \ +\\\"$(@).\\\\\$LVL $(../@) \n\\\"\" " +update: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"$(@)\\.\\\\\$LVL\\\" \ +' $(../@) ' \ +\\\"$(@).\\\\\$LVL $(../@) \n\\\"\" " +delete: "sh -c \"LVL=`echo -n $(level/@) | tr '[a-z]' '[A-Z]'` && \ +/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"$(@)\\.\\\\\$LVL\\\" \ +' $(../@) ' ''\" " diff --git a/templates/system/syslog/user/node.tag/facility/node.tag/level/node.def b/templates/system/syslog/user/node.tag/facility/node.tag/level/node.def new file mode 100644 index 0000000..9be459c --- /dev/null +++ b/templates/system/syslog/user/node.tag/facility/node.tag/level/node.def @@ -0,0 +1,3 @@ +type: txt +help: "Configure the logging level" +default: "err" diff --git a/templates/system/time-zone/node.def b/templates/system/time-zone/node.def new file mode 100644 index 0000000..00da013 --- /dev/null +++ b/templates/system/time-zone/node.def @@ -0,0 +1,16 @@ +type: txt +help: "Configure local timezone" +default: "GMT" +update: "LTF=\"/usr/share/zoneinfo\" && \ +case \"$(@)\" in \ + [Ll][Oo][Ss]*) LTF=\"\\\$LTF/US/Pacific\" ;; \ + [Dd][Ee][Nn]*) LTF=\"\\\$LTF/US/Mountain\" ;; \ + [Hh][Oo][Nn]*) LTF=\"\\\$LTF/US/Hawaii\" ;; \ + [Nn][Ee][Ww]*) LTF=\"\\\$LTF/US/Eastern\" ;; \ + [Cc][Hh][Ii]*) LTF=\"\\\$LTF/US/Central\" ;; \ + [Aa][Nn][Cc]*) LTF=\"\\\$LTF/US/Alaska\" ;; \ + [Pp][Hh][Oo]*) LTF=\"\\\$LTF/US/Arizona\" ;; \ + *) LTF=\"\\\$LTF/Etc/$(@)\" ;; \ +esac && \ +ln -fs \\\$LTF /etc/localtime" +delete: "ln -fs /usr/share/zoneinfo/GMT /etc/localtime" |