summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2019-11-28 08:53:54 -0800
committerDaniil Baturin <daniil@baturin.org>2020-04-12 15:08:13 +0200
commita42081066d3488650e1c3e249908242435737591 (patch)
tree5b393031c0de6a4dc64db55b1bdcb18c879d9905
parent7156762ed3b0a37bc6baf21bf5f4ef1730f2ba1b (diff)
downloadvyos-1x-a42081066d3488650e1c3e249908242435737591.tar.gz
vyos-1x-a42081066d3488650e1c3e249908242435737591.zip
syslog: T1828: implemented missing completion help and add input constraints
syslog: Improved constraint for host/IP check
-rw-r--r--interface-definitions/syslog.xml53
1 files changed, 50 insertions, 3 deletions
diff --git a/interface-definitions/syslog.xml b/interface-definitions/syslog.xml
index 3c8d2ebe2..f8ed31efa 100644
--- a/interface-definitions/syslog.xml
+++ b/interface-definitions/syslog.xml
@@ -27,6 +27,10 @@
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
+ <constraint>
+ <regex>(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
@@ -127,6 +131,10 @@
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
+ <constraint>
+ <regex>(emerg|alert|crit|err|warning|notice|info|debug|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
@@ -173,10 +181,10 @@
<properties>
<help>Logging to a remote host</help>
<constraint>
- <!-- at least let's make sure whitespace isn't allowed, ideally it should be checked for IPv4/IPv6 address or fqdn/hostname -->
- <regex>[^ ]{1,63}</regex>
+ <validator name="ip-address" />
+ <regex>(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)</regex>
</constraint>
- <constraintErrorMessage>illegal characters in user</constraintErrorMessage>
+ <constraintErrorMessage>Invalid host FQDN or IP address</constraintErrorMessage>
<valueHelp>
<format>x.x.x.x or host.domain.tld</format>
<description>Remote host name or IP address</description>
@@ -189,6 +197,10 @@
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
+ <constraint>
+ <regex>(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
@@ -294,6 +306,13 @@
<format>tcp</format>
<description>send log messages to remote syslog server over tdp</description>
</valueHelp>
+ <completionHelp>
+ <list>udp tcp</list>
+ </completionHelp>
+ <constraint>
+ <regex>(udp|tcp)</regex>
+ </constraint>
+ <constraintErrorMessage>invalid protocol name</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="level">
@@ -302,6 +321,10 @@
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
+ <constraint>
+ <regex>(emerg|alert|crit|err|warning|notice|info|debug|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
@@ -380,6 +403,10 @@
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
+ <constraint>
+ <regex>(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
@@ -480,6 +507,10 @@
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
+ <constraint>
+ <regex>(emerg|alert|crit|err|warning|notice|info|debug|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
@@ -583,6 +614,10 @@
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
+ <constraint>
+ <regex>(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
@@ -683,6 +718,10 @@
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
+ <constraint>
+ <regex>(emerg|alert|crit|err|warning|notice|info|debug|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
@@ -736,6 +775,10 @@
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
+ <constraint>
+ <regex>(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
@@ -836,6 +879,10 @@
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
+ <constraint>
+ <regex>(emerg|alert|crit|err|warning|notice|info|debug|all)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>