summaryrefslogtreecommitdiff
path: root/templates/service
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-10-17 18:09:50 +0100
committerAlex Harpin <development@landsofshadow.co.uk>2015-10-17 19:56:26 +0100
commit1ae65419448153a611e5804e539d8d127788a513 (patch)
tree40b605bd21bcf673fd6ff692620a4f9f842dc2e8 /templates/service
parent7ab0b09d138d17571523dba4177e70b98c9001d0 (diff)
downloadvyatta-cfg-system-1ae65419448153a611e5804e539d8d127788a513.tar.gz
vyatta-cfg-system-1ae65419448153a611e5804e539d8d127788a513.zip
vyatta-cfg-system: add listen-address and port checks for telnet
Check that both the listen-address is a valid local address and that the port given is available for use before commiting the telnet service configuation. Bug #43 http://bugzilla.vyos.net/show_bug.cgi?id=43
Diffstat (limited to 'templates/service')
-rw-r--r--templates/service/telnet/listen-address/node.def3
-rw-r--r--templates/service/telnet/port/node.def2
2 files changed, 5 insertions, 0 deletions
diff --git a/templates/service/telnet/listen-address/node.def b/templates/service/telnet/listen-address/node.def
index 9faea595..cd016628 100644
--- a/templates/service/telnet/listen-address/node.def
+++ b/templates/service/telnet/listen-address/node.def
@@ -2,3 +2,6 @@ type: ipv4,ipv6
help: Local addresses telnet should listen on
val_help: ipv4: IP address to listen for incoming connections
val_help: ipv6: IPv6 address to listen for incoming connections
+
+commit:expression: exec "/opt/vyatta/sbin/local_ip $VAR(@)"; \
+ "IP address $VAR(@) doesn\'t exist on this system"
diff --git a/templates/service/telnet/port/node.def b/templates/service/telnet/port/node.def
index b15d4b6a..c4db688a 100644
--- a/templates/service/telnet/port/node.def
+++ b/templates/service/telnet/port/node.def
@@ -5,3 +5,5 @@ help: Port for TELNET service
val_help: u32:1-65535; Numeric IP port
syntax:expression: $VAR(@) > 0 && $VAR(@) <= 65535 ; \
"Port number must be in range 1 to 65535"
+commit:expression: exec "sudo /opt/vyatta/sbin/is_port_available.pl $VAR(@)"; \
+ "Port $VAR(@) is already in use!"