summaryrefslogtreecommitdiff
path: root/templates/service
diff options
context:
space:
mode:
Diffstat (limited to 'templates/service')
-rw-r--r--templates/service/dns/dynamic/interface/node.def31
-rw-r--r--templates/service/dns/dynamic/interface/node.tag/service/node.def23
-rw-r--r--templates/service/dns/dynamic/interface/node.tag/service/node.tag/host-name/node.def3
-rw-r--r--templates/service/dns/dynamic/interface/node.tag/service/node.tag/login/node.def2
-rw-r--r--templates/service/dns/dynamic/interface/node.tag/service/node.tag/password/node.def2
-rw-r--r--templates/service/dns/dynamic/node.def2
-rw-r--r--templates/service/dns/forwarding/cache-size/node.def4
-rw-r--r--templates/service/dns/forwarding/dhcp/node.def8
-rw-r--r--templates/service/dns/forwarding/listen-on/node.def20
-rw-r--r--templates/service/dns/forwarding/name-server/node.def3
-rw-r--r--templates/service/dns/forwarding/node.def9
-rw-r--r--templates/service/dns/forwarding/system/node.def2
-rw-r--r--templates/service/dns/node.def1
-rw-r--r--templates/service/ssh/allow-root/node.def18
14 files changed, 115 insertions, 13 deletions
diff --git a/templates/service/dns/dynamic/interface/node.def b/templates/service/dns/dynamic/interface/node.def
new file mode 100644
index 00000000..bbf0c310
--- /dev/null
+++ b/templates/service/dns/dynamic/interface/node.def
@@ -0,0 +1,31 @@
+tag:
+help: Set interface to send DDNS updates for
+type: txt
+syntax:expression: exec "
+ intf_array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev))
+ intf_array_len=${#intf_array[*]}
+ i=0
+ while [ $i -lt $intf_array_len ]; do
+ temp=${intf_array[$i]%:*}
+ if [ \"$temp\" == \"$VAR(@)\" ] ; then
+ exit 0
+ fi
+ let i++
+ done
+ echo Invalid interface [$VAR(@)]
+ exit 1 "
+
+allowed: local -a array ;
+ array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev));
+ echo -n ${array[@]%:*}
+
+commit:expression: $VAR(./@/service/@@) != ""; "Atleast one service must be set to send DDNS updates for $VAR(@)"
+
+delete:expression: "touch /tmp/ddclient_$VAR(@).$PPID"
+
+end:expression: "if [ -f \"/tmp/ddclient_$VAR(@).$PPID\" ]; then \
+ sudo /opt/vyatta/sbin/vyatta-dynamic-dns.pl --stop-dynamicdns --interface $VAR(@) \
+ rm /tmp/ddclient_$VAR(@).$PPID; \
+ else \
+ sudo /opt/vyatta/sbin/vyatta-dynamic-dns.pl --update-dynamicdns --interface $VAR(@); \
+ fi; "
diff --git a/templates/service/dns/dynamic/interface/node.tag/service/node.def b/templates/service/dns/dynamic/interface/node.tag/service/node.def
new file mode 100644
index 00000000..a515351e
--- /dev/null
+++ b/templates/service/dns/dynamic/interface/node.tag/service/node.def
@@ -0,0 +1,23 @@
+tag:
+help: Set service being used for Dynamic DNS
+type: txt
+syntax:expression: exec "
+ service_array=(dnspark dslreports dyndns easydns namecheap sitelutions zoneedit)
+ service_array_len=${#service_array[*]}
+ i=0
+ while [ $i -lt $service_array_len ]; do
+ if [ \"${service_array[$i]}\" == \"$VAR(@)\" ] ; then
+ exit 0
+ fi
+ let i++
+ done
+ echo Invalid service [$VAR(@)]
+ exit 1 "
+
+allowed: local -a array ;
+ array=(dnspark dslreports dyndns easydns namecheap sitelutions zoneedit);
+ echo -n ${array[@]}
+
+commit:expression: $VAR(./@/login) != ""; "Set login for service $VAR(./@) to send DDNS updates for interface $VAR(../@)"
+commit:expression: $VAR(./@/password) != ""; "Set password for service $VAR(./@) to send DDNS updates for interface $VAR(../@)"
+commit:expression: $VAR(./@/host-name) != ""; "Set atleast one host-name registered with service $VAR(./@) to send DDNS updates for interface $VAR(../@)"
diff --git a/templates/service/dns/dynamic/interface/node.tag/service/node.tag/host-name/node.def b/templates/service/dns/dynamic/interface/node.tag/service/node.tag/host-name/node.def
new file mode 100644
index 00000000..e104ae8f
--- /dev/null
+++ b/templates/service/dns/dynamic/interface/node.tag/service/node.tag/host-name/node.def
@@ -0,0 +1,3 @@
+multi:
+help: Set host-name registered with DDNS service
+type: txt
diff --git a/templates/service/dns/dynamic/interface/node.tag/service/node.tag/login/node.def b/templates/service/dns/dynamic/interface/node.tag/service/node.tag/login/node.def
new file mode 100644
index 00000000..4a6ca920
--- /dev/null
+++ b/templates/service/dns/dynamic/interface/node.tag/service/node.tag/login/node.def
@@ -0,0 +1,2 @@
+help: Set login for DDNS service
+type: txt
diff --git a/templates/service/dns/dynamic/interface/node.tag/service/node.tag/password/node.def b/templates/service/dns/dynamic/interface/node.tag/service/node.tag/password/node.def
new file mode 100644
index 00000000..9dceae00
--- /dev/null
+++ b/templates/service/dns/dynamic/interface/node.tag/service/node.tag/password/node.def
@@ -0,0 +1,2 @@
+help: Set password for DDNS service
+type: txt
diff --git a/templates/service/dns/dynamic/node.def b/templates/service/dns/dynamic/node.def
new file mode 100644
index 00000000..d713fc1c
--- /dev/null
+++ b/templates/service/dns/dynamic/node.def
@@ -0,0 +1,2 @@
+help: Configure Dynamic DNS
+commit:expression: $VAR(./interface/@@) != ""; "Atleast one interface must be set to send DDNS updates for"
diff --git a/templates/service/dns/forwarding/cache-size/node.def b/templates/service/dns/forwarding/cache-size/node.def
new file mode 100644
index 00000000..3a73f308
--- /dev/null
+++ b/templates/service/dns/forwarding/cache-size/node.def
@@ -0,0 +1,4 @@
+type: u32
+default:150
+help: Set DNS forwarding cache size
+syntax:expression: ($VAR(@) >=0 && $VAR(@) < 10001) ; "Cache size must be between 0 and 10000"
diff --git a/templates/service/dns/forwarding/dhcp/node.def b/templates/service/dns/forwarding/dhcp/node.def
new file mode 100644
index 00000000..8ce8c83f
--- /dev/null
+++ b/templates/service/dns/forwarding/dhcp/node.def
@@ -0,0 +1,8 @@
+multi:
+type: txt
+help: Set to use nameservers received from DHCP server for specified interface
+commit:expression: exec "/opt/vyatta/sbin/vyatta-dns-forwarding.pl --dhcp-interface $VAR(@)"
+allowed:
+ local -a array ;
+ array=( /var/lib/dhcp3/eth* /var/lib/dhcp3/br* ) ;
+ echo -n ${array[@]##*/}
diff --git a/templates/service/dns/forwarding/listen-on/node.def b/templates/service/dns/forwarding/listen-on/node.def
new file mode 100644
index 00000000..9510cebe
--- /dev/null
+++ b/templates/service/dns/forwarding/listen-on/node.def
@@ -0,0 +1,20 @@
+multi:
+type: txt
+help: Set interface to listen for DNS queries
+syntax:expression: exec "
+ intf_array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev))
+ intf_array_len=${#intf_array[*]}
+ i=0
+ while [ $i -lt $intf_array_len ]; do
+ temp=${intf_array[$i]%:*}
+ if [ \"$temp\" == \"$VAR(@)\" ] ; then
+ exit 0
+ fi
+ let i++
+ done
+ echo Invalid interface [$VAR(@)]
+ exit 1 "
+
+allowed: local -a array ;
+ array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev));
+ echo -n ${array[@]%:*}
diff --git a/templates/service/dns/forwarding/name-server/node.def b/templates/service/dns/forwarding/name-server/node.def
new file mode 100644
index 00000000..ad67c6de
--- /dev/null
+++ b/templates/service/dns/forwarding/name-server/node.def
@@ -0,0 +1,3 @@
+multi:
+type: ipv4
+help: Set DNS server to forward queries
diff --git a/templates/service/dns/forwarding/node.def b/templates/service/dns/forwarding/node.def
new file mode 100644
index 00000000..d3c32bb1
--- /dev/null
+++ b/templates/service/dns/forwarding/node.def
@@ -0,0 +1,9 @@
+help: Configure DNS forwarding
+commit:expression: $VAR(./listen-on) != ""; "Atleast one interface must be configured for DNS forwarding parameter 'listen-on'"
+delete:expression: "touch /tmp/dnsmasq.$PPID"
+end:expression: "if [ -f \"/tmp/dnsmasq.$PPID\" ]; then \
+ sudo /opt/vyatta/sbin/vyatta-dns-forwarding.pl --stop-dnsforwarding \
+ rm /tmp/dnsmasq.$PPID; \
+ else \
+ sudo /opt/vyatta/sbin/vyatta-dns-forwarding.pl --update-dnsforwarding; \
+ fi; "
diff --git a/templates/service/dns/forwarding/system/node.def b/templates/service/dns/forwarding/system/node.def
new file mode 100644
index 00000000..e92a7ad6
--- /dev/null
+++ b/templates/service/dns/forwarding/system/node.def
@@ -0,0 +1,2 @@
+help: Set DNS forwarding to system nameservers
+commit:expression: exec "/opt/vyatta/sbin/vyatta-dns-forwarding.pl --system-nameserver"
diff --git a/templates/service/dns/node.def b/templates/service/dns/node.def
new file mode 100644
index 00000000..d7040d0d
--- /dev/null
+++ b/templates/service/dns/node.def
@@ -0,0 +1 @@
+help: Configure Domain Name Server (DNS) parameters
diff --git a/templates/service/ssh/allow-root/node.def b/templates/service/ssh/allow-root/node.def
index 9aa98826..87ff1ded 100644
--- a/templates/service/ssh/allow-root/node.def
+++ b/templates/service/ssh/allow-root/node.def
@@ -1,16 +1,8 @@
-type: txt
+type: bool
default: false
help: Enable/disable root login over ssh
-syntax:expression: $VAR(@) in "true", "false" ; "must be true or false"
-update: if [ \"$VAR(@)\" == \"true\" ]; then
- sudo ed - /etc/ssh/sshd_config <<-"EOF"
- /^PermitRootLogin/s/no/yes/
- wq
- EOF
- else
- sudo ed - /etc/ssh/sshd_config <<-"EOF"
- /^PermitRootLogin/s/yes/no/
- wq
- EOF
+update: if [ "$VAR(@)" == "true" ];
+ then regex='/^PermitRootLogin/s/no/yes/'
+ else regex='/^PermitRootLogin/s/yes/no/'
fi
- /bin/true
+ sudo sed -i -e "$regex" /etc/ssh/sshd_config