summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/dynamic-dns/ddclient.conf.j22
-rw-r--r--data/templates/mdns-repeater/avahi-daemon.j26
-rw-r--r--data/templates/ocserv/ocserv_config.j213
-rw-r--r--data/templates/rsyslog/rsyslog.conf.j22
-rw-r--r--interface-definitions/container.xml.in3
-rw-r--r--interface-definitions/dns-domain-name.xml.in7
-rw-r--r--interface-definitions/dns-forwarding.xml.in3
-rw-r--r--interface-definitions/flow-accounting-conf.xml.in6
-rw-r--r--interface-definitions/high-availability.xml.in9
-rw-r--r--interface-definitions/https.xml.in3
-rw-r--r--interface-definitions/include/bgp/neighbor-update-source.xml.i3
-rw-r--r--interface-definitions/include/bgp/protocol-common-config.xml.i3
-rw-r--r--interface-definitions/include/constraint/alpha-numeric-hyphen-underscore.xml.i2
-rw-r--r--interface-definitions/include/constraint/host-name.xml.i2
-rw-r--r--interface-definitions/include/constraint/interface-name-with-wildcard.xml.i2
-rw-r--r--interface-definitions/include/constraint/interface-name.xml.i2
-rw-r--r--interface-definitions/include/interface/dhcp-options.xml.i4
-rw-r--r--interface-definitions/include/ipsec/local-address.xml.i3
-rw-r--r--interface-definitions/include/ipsec/remote-address.xml.i3
-rw-r--r--interface-definitions/include/listen-address-single.xml.i3
-rw-r--r--interface-definitions/include/listen-address-vrf.xml.i3
-rw-r--r--interface-definitions/include/listen-address.xml.i3
-rw-r--r--interface-definitions/include/name-server-ipv4-ipv6-port.xml.i3
-rw-r--r--interface-definitions/include/name-server-ipv4-ipv6.xml.i3
-rw-r--r--interface-definitions/include/radius-server-ipv4-ipv6.xml.i3
-rw-r--r--interface-definitions/include/static/static-route-bfd.xml.i41
-rw-r--r--interface-definitions/interfaces-openvpn.xml.in3
-rw-r--r--interface-definitions/interfaces-virtual-ethernet.xml.in1
-rw-r--r--interface-definitions/ntp.xml.in3
-rw-r--r--interface-definitions/policy.xml.in6
-rw-r--r--interface-definitions/protocols-bfd.xml.in6
-rw-r--r--interface-definitions/protocols-rpki.xml.in3
-rw-r--r--interface-definitions/service-mdns-repeater.xml.in26
-rw-r--r--interface-definitions/service-upnp.xml.in3
-rw-r--r--interface-definitions/snmp.xml.in9
-rw-r--r--interface-definitions/system-config-mgmt.xml.in3
-rw-r--r--interface-definitions/system-sflow.xml.in6
-rw-r--r--interface-definitions/vpn-l2tp.xml.in3
-rw-r--r--interface-definitions/vpn-openconnect.xml.in52
-rw-r--r--python/vyos/base.py3
-rw-r--r--python/vyos/ifconfig/ethernet.py9
-rw-r--r--python/vyos/ifconfig/interface.py2
-rwxr-xr-xsmoketest/scripts/cli/test_service_dns_dynamic.py18
-rwxr-xr-xsrc/conf_mode/dynamic_dns.py3
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py9
-rwxr-xr-xsrc/conf_mode/system-syslog.py7
-rwxr-xr-xsrc/conf_mode/vpn_openconnect.py14
47 files changed, 215 insertions, 111 deletions
diff --git a/data/templates/dynamic-dns/ddclient.conf.j2 b/data/templates/dynamic-dns/ddclient.conf.j2
index c2c9b1dd6..e8ef5ac90 100644
--- a/data/templates/dynamic-dns/ddclient.conf.j2
+++ b/data/templates/dynamic-dns/ddclient.conf.j2
@@ -34,7 +34,9 @@ zone={{ config.zone }}
# DynDNS provider configuration for {{ service }}, {{ dns_record }}
protocol={{ config.protocol }},
max-interval=28d,
+{% if config.login is vyos_defined %}
login={{ config.login }},
+{% endif %}
password='{{ config.password }}',
{% if config.server is vyos_defined %}
server={{ config.server }},
diff --git a/data/templates/mdns-repeater/avahi-daemon.j2 b/data/templates/mdns-repeater/avahi-daemon.j2
index 65bb5a306..3aaa7fc82 100644
--- a/data/templates/mdns-repeater/avahi-daemon.j2
+++ b/data/templates/mdns-repeater/avahi-daemon.j2
@@ -2,6 +2,9 @@
use-ipv4=yes
use-ipv6=yes
allow-interfaces={{ interface | join(', ') }}
+{% if browse_domain is vyos_defined and browse_domain | length %}
+browse-domains={{ browse_domain | join(', ') }}
+{% endif %}
disallow-other-stacks=no
[wide-area]
@@ -16,3 +19,6 @@ publish-workstation=no
[reflector]
enable-reflector=yes
+{% if allow_service is vyos_defined and allow_service | length %}
+reflect-filters={{ allow_service | join(', ') }}
+{% endif %}
diff --git a/data/templates/ocserv/ocserv_config.j2 b/data/templates/ocserv/ocserv_config.j2
index aa1073bca..1401b8b26 100644
--- a/data/templates/ocserv/ocserv_config.j2
+++ b/data/templates/ocserv/ocserv_config.j2
@@ -16,6 +16,12 @@ acct = "radius [config=/run/ocserv/radiusclient.conf]"
{% if "radius" in authentication.mode %}
auth = "radius [config=/run/ocserv/radiusclient.conf{{ ',groupconfig=true' if authentication.radius.groupconfig is vyos_defined else '' }}]"
+{% if authentication.identity_based_config.disabled is not vyos_defined %}
+{% if "group" in authentication.identity_based_config.mode %}
+config-per-group = {{ authentication.identity_based_config.directory }}
+default-group-config = {{ authentication.identity_based_config.default_config }}
+{% endif %}
+{% endif %}
{% elif "local" in authentication.mode %}
{% if authentication.mode.local == "password-otp" %}
auth = "plain[passwd=/run/ocserv/ocpasswd,otp=/run/ocserv/users.oath]"
@@ -28,6 +34,13 @@ auth = "plain[/run/ocserv/ocpasswd]"
auth = "plain[/run/ocserv/ocpasswd]"
{% endif %}
+{% if "identity_based_config" in authentication %}
+{% if "user" in authentication.identity_based_config.mode %}
+config-per-user = {{ authentication.identity_based_config.directory }}
+default-user-config = {{ authentication.identity_based_config.default_config }}
+{% endif %}
+{% endif %}
+
{% if ssl.certificate is vyos_defined %}
server-cert = /run/ocserv/cert.pem
server-key = /run/ocserv/cert.key
diff --git a/data/templates/rsyslog/rsyslog.conf.j2 b/data/templates/rsyslog/rsyslog.conf.j2
index 0460ae5f0..5352fc367 100644
--- a/data/templates/rsyslog/rsyslog.conf.j2
+++ b/data/templates/rsyslog/rsyslog.conf.j2
@@ -49,7 +49,7 @@ $outchannel {{ file_name }},/var/log/user/{{ file_name }},{{ file_options.archiv
{% set _ = tmp.append(facility.replace('all', '*') + '.' + facility_options.level) %}
{% endfor %}
{% if host_options.protocol is vyos_defined('tcp') %}
-{% if host_options.oct_count is vyos_defined %}
+{% if host_options.format.octet_counted is vyos_defined %}
{{ tmp | join(';') }} @@(o){{ host_name | bracketize_ipv6 }}:{{ host_options.port }};RSYSLOG_SyslogProtocol23Format
{% else %}
{{ tmp | join(';') }} @@{{ host_name | bracketize_ipv6 }}:{{ host_options.port }}
diff --git a/interface-definitions/container.xml.in b/interface-definitions/container.xml.in
index 9b6d2369d..6651fc642 100644
--- a/interface-definitions/container.xml.in
+++ b/interface-definitions/container.xml.in
@@ -201,8 +201,7 @@
<description>IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
<multi/>
</properties>
diff --git a/interface-definitions/dns-domain-name.xml.in b/interface-definitions/dns-domain-name.xml.in
index e93c49ebd..ef34ecbf5 100644
--- a/interface-definitions/dns-domain-name.xml.in
+++ b/interface-definitions/dns-domain-name.xml.in
@@ -23,8 +23,7 @@
</valueHelp>
<multi/>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
#include <include/constraint/interface-name.xml.i>
</constraint>
</properties>
@@ -74,9 +73,9 @@
<properties>
<help>Host name for static address mapping</help>
<constraint>
- <regex>[A-Za-z0-9][-.A-Za-z0-9]*[A-Za-z0-9]</regex>
+ #include <include/constraint/host-name.xml.i>
</constraint>
- <constraintErrorMessage>invalid hostname</constraintErrorMessage>
+ <constraintErrorMessage>Host-name must be alphanumeric and can contain hyphens</constraintErrorMessage>
</properties>
<children>
<leafNode name="alias">
diff --git a/interface-definitions/dns-forwarding.xml.in b/interface-definitions/dns-forwarding.xml.in
index de6991e06..ced1c9c31 100644
--- a/interface-definitions/dns-forwarding.xml.in
+++ b/interface-definitions/dns-forwarding.xml.in
@@ -670,8 +670,7 @@
</valueHelp>
<multi/>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<defaultValue>0.0.0.0 ::</defaultValue>
diff --git a/interface-definitions/flow-accounting-conf.xml.in b/interface-definitions/flow-accounting-conf.xml.in
index 878566b3f..40a9bb423 100644
--- a/interface-definitions/flow-accounting-conf.xml.in
+++ b/interface-definitions/flow-accounting-conf.xml.in
@@ -230,8 +230,7 @@
<description>IPv6 server to export NetFlow</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
@@ -408,8 +407,7 @@
<description>IPv6 server to export sFlow</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
diff --git a/interface-definitions/high-availability.xml.in b/interface-definitions/high-availability.xml.in
index 94253def3..c5e46ed38 100644
--- a/interface-definitions/high-availability.xml.in
+++ b/interface-definitions/high-availability.xml.in
@@ -129,8 +129,7 @@
<description>IPv6 ping target address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
</leafNode>
@@ -156,8 +155,7 @@
<description>IPv6 hello source address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
</leafNode>
@@ -173,8 +171,7 @@
<description>IPv6 unicast peer address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
</leafNode>
diff --git a/interface-definitions/https.xml.in b/interface-definitions/https.xml.in
index cf30ab2be..5430193b5 100644
--- a/interface-definitions/https.xml.in
+++ b/interface-definitions/https.xml.in
@@ -36,8 +36,7 @@
<description>any</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
<regex>\*</regex>
</constraint>
</properties>
diff --git a/interface-definitions/include/bgp/neighbor-update-source.xml.i b/interface-definitions/include/bgp/neighbor-update-source.xml.i
index c6aa776c2..92e817166 100644
--- a/interface-definitions/include/bgp/neighbor-update-source.xml.i
+++ b/interface-definitions/include/bgp/neighbor-update-source.xml.i
@@ -20,8 +20,7 @@
<description>Interface as route source</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
#include <include/constraint/interface-name.xml.i>
</constraint>
</properties>
diff --git a/interface-definitions/include/bgp/protocol-common-config.xml.i b/interface-definitions/include/bgp/protocol-common-config.xml.i
index 527eaf991..2d36f7de6 100644
--- a/interface-definitions/include/bgp/protocol-common-config.xml.i
+++ b/interface-definitions/include/bgp/protocol-common-config.xml.i
@@ -940,8 +940,7 @@
<description>Interface name</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
#include <include/constraint/interface-name.xml.i>
</constraint>
</properties>
diff --git a/interface-definitions/include/constraint/alpha-numeric-hyphen-underscore.xml.i b/interface-definitions/include/constraint/alpha-numeric-hyphen-underscore.xml.i
index eb568d7d9..ba097c6b5 100644
--- a/interface-definitions/include/constraint/alpha-numeric-hyphen-underscore.xml.i
+++ b/interface-definitions/include/constraint/alpha-numeric-hyphen-underscore.xml.i
@@ -1,3 +1,3 @@
-<!-- include start from include/constraint/alpha-numeric-hyphen-underscore.xml.in -->
+<!-- include start from include/constraint/alpha-numeric-hyphen-underscore.xml.i -->
<regex>[-_a-zA-Z0-9]+</regex>
<!-- include end -->
diff --git a/interface-definitions/include/constraint/host-name.xml.i b/interface-definitions/include/constraint/host-name.xml.i
index 202c200f4..cc9740c16 100644
--- a/interface-definitions/include/constraint/host-name.xml.i
+++ b/interface-definitions/include/constraint/host-name.xml.i
@@ -1,3 +1,3 @@
-<!-- include start from constraint/host-name.xml.in -->
+<!-- include start from constraint/host-name.xml.i -->
<regex>[A-Za-z0-9][-.A-Za-z0-9]*[A-Za-z0-9]</regex>
<!-- include end -->
diff --git a/interface-definitions/include/constraint/interface-name-with-wildcard.xml.i b/interface-definitions/include/constraint/interface-name-with-wildcard.xml.i
index 09867b380..adff530b6 100644
--- a/interface-definitions/include/constraint/interface-name-with-wildcard.xml.i
+++ b/interface-definitions/include/constraint/interface-name-with-wildcard.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from constraint/interface-name-with-wildcard.xml.in -->
+<!-- include start from constraint/interface-name-with-wildcard.xml.i -->
<regex>(bond|br|dum|en|ersp|eth|gnv|ifb|lan|l2tp|l2tpeth|macsec|peth|ppp|pppoe|pptp|sstp|tun|veth|vti|vtun|vxlan|wg|wlan|wwan)([0-9]?)(\*?)(.+)?|lo</regex>
<validator name="file-path --lookup-path /sys/class/net --directory"/>
<!-- include end -->
diff --git a/interface-definitions/include/constraint/interface-name.xml.i b/interface-definitions/include/constraint/interface-name.xml.i
index e540e4418..1b14eabf5 100644
--- a/interface-definitions/include/constraint/interface-name.xml.i
+++ b/interface-definitions/include/constraint/interface-name.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from constraint/interface-name.xml.in -->
+<!-- include start from constraint/interface-name.xml.i -->
<regex>(bond|br|dum|en|ersp|eth|gnv|ifb|lan|l2tp|l2tpeth|macsec|peth|ppp|pppoe|pptp|sstp|tun|veth|vti|vtun|vxlan|wg|wlan|wwan)[0-9]+(.\d+)?|lo</regex>
<validator name="file-path --lookup-path /sys/class/net --directory"/>
<!-- include end -->
diff --git a/interface-definitions/include/interface/dhcp-options.xml.i b/interface-definitions/include/interface/dhcp-options.xml.i
index 2ed5fd403..8027769ff 100644
--- a/interface-definitions/include/interface/dhcp-options.xml.i
+++ b/interface-definitions/include/interface/dhcp-options.xml.i
@@ -12,6 +12,10 @@
<leafNode name="host-name">
<properties>
<help>Override system host-name sent to DHCP server</help>
+ <constraint>
+ #include <include/constraint/host-name.xml.i>
+ </constraint>
+ <constraintErrorMessage>Host-name must be alphanumeric and can contain hyphens</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="mtu">
diff --git a/interface-definitions/include/ipsec/local-address.xml.i b/interface-definitions/include/ipsec/local-address.xml.i
index 9d267f3f7..71f514950 100644
--- a/interface-definitions/include/ipsec/local-address.xml.i
+++ b/interface-definitions/include/ipsec/local-address.xml.i
@@ -19,8 +19,7 @@
<description>Allow any IPv4 address present on the system to be used for VPN</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
<regex>(any)</regex>
</constraint>
</properties>
diff --git a/interface-definitions/include/ipsec/remote-address.xml.i b/interface-definitions/include/ipsec/remote-address.xml.i
index ba96290d0..91decba3c 100644
--- a/interface-definitions/include/ipsec/remote-address.xml.i
+++ b/interface-definitions/include/ipsec/remote-address.xml.i
@@ -19,8 +19,7 @@
<description>Allow any IP address of the remote peer</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
<validator name="fqdn"/>
<regex>(any)</regex>
</constraint>
diff --git a/interface-definitions/include/listen-address-single.xml.i b/interface-definitions/include/listen-address-single.xml.i
index 30293b338..6cc5aef0a 100644
--- a/interface-definitions/include/listen-address-single.xml.i
+++ b/interface-definitions/include/listen-address-single.xml.i
@@ -14,8 +14,7 @@
<description>IPv6 address to listen for incoming connections</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
<validator name="ipv6-link-local"/>
</constraint>
</properties>
diff --git a/interface-definitions/include/listen-address-vrf.xml.i b/interface-definitions/include/listen-address-vrf.xml.i
index 8c2bdce70..23ecc2476 100644
--- a/interface-definitions/include/listen-address-vrf.xml.i
+++ b/interface-definitions/include/listen-address-vrf.xml.i
@@ -14,8 +14,7 @@
<description>IPv6 address to listen for incoming connections</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
diff --git a/interface-definitions/include/listen-address.xml.i b/interface-definitions/include/listen-address.xml.i
index 48003dbf2..2454f43ff 100644
--- a/interface-definitions/include/listen-address.xml.i
+++ b/interface-definitions/include/listen-address.xml.i
@@ -15,8 +15,7 @@
</valueHelp>
<multi/>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
<validator name="ipv6-link-local"/>
</constraint>
</properties>
diff --git a/interface-definitions/include/name-server-ipv4-ipv6-port.xml.i b/interface-definitions/include/name-server-ipv4-ipv6-port.xml.i
index fb0a4f4ae..b326a6537 100644
--- a/interface-definitions/include/name-server-ipv4-ipv6-port.xml.i
+++ b/interface-definitions/include/name-server-ipv4-ipv6-port.xml.i
@@ -11,8 +11,7 @@
<description>Domain Name Server (DNS) IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
diff --git a/interface-definitions/include/name-server-ipv4-ipv6.xml.i b/interface-definitions/include/name-server-ipv4-ipv6.xml.i
index 14973234b..cf483e5d9 100644
--- a/interface-definitions/include/name-server-ipv4-ipv6.xml.i
+++ b/interface-definitions/include/name-server-ipv4-ipv6.xml.i
@@ -11,8 +11,7 @@
<description>Domain Name Server (DNS) IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
<multi/>
</properties>
diff --git a/interface-definitions/include/radius-server-ipv4-ipv6.xml.i b/interface-definitions/include/radius-server-ipv4-ipv6.xml.i
index c593512b4..efd418bb2 100644
--- a/interface-definitions/include/radius-server-ipv4-ipv6.xml.i
+++ b/interface-definitions/include/radius-server-ipv4-ipv6.xml.i
@@ -16,8 +16,7 @@
<description>RADIUS server IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
diff --git a/interface-definitions/include/static/static-route-bfd.xml.i b/interface-definitions/include/static/static-route-bfd.xml.i
index a05a08d12..d588b369f 100644
--- a/interface-definitions/include/static/static-route-bfd.xml.i
+++ b/interface-definitions/include/static/static-route-bfd.xml.i
@@ -10,28 +10,27 @@
<help>Use BFD multi hop session</help>
</properties>
<children>
- <tagNode name="source">
- <properties>
- <help>Use source for BFD session</help>
- <valueHelp>
- <format>ipv4</format>
- <description>IPv4 source address</description>
- </valueHelp>
- <valueHelp>
- <format>ipv6</format>
- <description>IPv6 source address</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
- </constraint>
- </properties>
- <children>
- #include <include/bfd/profile.xml.i>
- </children>
- </tagNode>
+ <tagNode name="source">
+ <properties>
+ <help>Use source for BFD session</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>IPv4 source address</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>IPv6 source address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ip-address"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/bfd/profile.xml.i>
+ </children>
+ </tagNode>
</children>
</node>
</children>
</node>
-<!-- include end --> \ No newline at end of file
+<!-- include end -->
diff --git a/interface-definitions/interfaces-openvpn.xml.in b/interface-definitions/interfaces-openvpn.xml.in
index cf0ff497c..4e061c3e6 100644
--- a/interface-definitions/interfaces-openvpn.xml.in
+++ b/interface-definitions/interfaces-openvpn.xml.in
@@ -333,8 +333,7 @@
<description>Remote end IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
<multi/>
</properties>
diff --git a/interface-definitions/interfaces-virtual-ethernet.xml.in b/interface-definitions/interfaces-virtual-ethernet.xml.in
index a5702bfc0..864f658da 100644
--- a/interface-definitions/interfaces-virtual-ethernet.xml.in
+++ b/interface-definitions/interfaces-virtual-ethernet.xml.in
@@ -22,7 +22,6 @@
#include <include/interface/dhcpv6-options.xml.i>
#include <include/interface/disable.xml.i>
#include <include/interface/vrf.xml.i>
- #include <include/interface/netns.xml.i>
<leafNode name="peer-name">
<properties>
<help>Virtual ethernet peer interface name</help>
diff --git a/interface-definitions/ntp.xml.in b/interface-definitions/ntp.xml.in
index 558204a06..2275dd61c 100644
--- a/interface-definitions/ntp.xml.in
+++ b/interface-definitions/ntp.xml.in
@@ -25,8 +25,7 @@
<description>Fully qualified domain name of NTP server</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
<validator name="fqdn"/>
</constraint>
</properties>
diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in
index 02828c4f6..aa39950c2 100644
--- a/interface-definitions/policy.xml.in
+++ b/interface-definitions/policy.xml.in
@@ -966,8 +966,7 @@
<description>Peer IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
</leafNode>
@@ -1533,8 +1532,7 @@
<description>IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
</leafNode>
diff --git a/interface-definitions/protocols-bfd.xml.in b/interface-definitions/protocols-bfd.xml.in
index edbac8d0e..9048cf5c2 100644
--- a/interface-definitions/protocols-bfd.xml.in
+++ b/interface-definitions/protocols-bfd.xml.in
@@ -21,8 +21,7 @@
<description>BFD peer IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
@@ -48,8 +47,7 @@
<description>Local IPv6 address used to connect to the peer</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
</leafNode>
diff --git a/interface-definitions/protocols-rpki.xml.in b/interface-definitions/protocols-rpki.xml.in
index c41fa54f2..e9fd04b5f 100644
--- a/interface-definitions/protocols-rpki.xml.in
+++ b/interface-definitions/protocols-rpki.xml.in
@@ -23,8 +23,7 @@
<description>Fully qualified domain name of RPKI server</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
<validator name="fqdn"/>
</constraint>
</properties>
diff --git a/interface-definitions/service-mdns-repeater.xml.in b/interface-definitions/service-mdns-repeater.xml.in
index 9a94f1488..2cd92dbf2 100644
--- a/interface-definitions/service-mdns-repeater.xml.in
+++ b/interface-definitions/service-mdns-repeater.xml.in
@@ -15,6 +15,32 @@
<children>
#include <include/generic-disable-node.xml.i>
#include <include/generic-interface-multi.xml.i>
+ <leafNode name="browse-domain">
+ <properties>
+ <help>mDNS browsing domains in addition to the default one</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>mDNS browsing domain</description>
+ </valueHelp>
+ <constraint>
+ <validator name="fqdn"/>
+ </constraint>
+ <multi/>
+ </properties>
+ </leafNode>
+ <leafNode name="allow-service">
+ <properties>
+ <help>Allowed mDNS services to be repeated</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>mDNS service</description>
+ </valueHelp>
+ <constraint>
+ #include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
+ </constraint>
+ <multi/>
+ </properties>
+ </leafNode>
<leafNode name="vrrp-disable">
<properties>
<help>Disables mDNS repeater on VRRP interfaces not in MASTER state</help>
diff --git a/interface-definitions/service-upnp.xml.in b/interface-definitions/service-upnp.xml.in
index 1b2e00d91..20e01bfbd 100644
--- a/interface-definitions/service-upnp.xml.in
+++ b/interface-definitions/service-upnp.xml.in
@@ -120,9 +120,8 @@
<multi/>
<constraint>
#include <include/constraint/interface-name.xml.i>
- <validator name="ipv4-address"/>
+ <validator name="ip-address"/>
<validator name="ipv4-prefix"/>
- <validator name="ipv6-address"/>
<validator name="ipv6-prefix"/>
</constraint>
</properties>
diff --git a/interface-definitions/snmp.xml.in b/interface-definitions/snmp.xml.in
index 6527cabd6..0851b8389 100644
--- a/interface-definitions/snmp.xml.in
+++ b/interface-definitions/snmp.xml.in
@@ -94,8 +94,7 @@
<description>IPv6 address to listen for incoming SNMP requests</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
@@ -166,8 +165,7 @@
<description>IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
</leafNode>
@@ -183,8 +181,7 @@
<description>IPv6 address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
diff --git a/interface-definitions/system-config-mgmt.xml.in b/interface-definitions/system-config-mgmt.xml.in
index 716332d2a..de5a8cc16 100644
--- a/interface-definitions/system-config-mgmt.xml.in
+++ b/interface-definitions/system-config-mgmt.xml.in
@@ -30,8 +30,7 @@
<properties>
<help>Source address or interface for archive server connections</help>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
#include <include/constraint/interface-name.xml.i>
</constraint>
</properties>
diff --git a/interface-definitions/system-sflow.xml.in b/interface-definitions/system-sflow.xml.in
index 9c748c24a..c5152abe9 100644
--- a/interface-definitions/system-sflow.xml.in
+++ b/interface-definitions/system-sflow.xml.in
@@ -25,8 +25,7 @@
<description>sFlow IPv6 agent address</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
<validator name="ipv6-link-local"/>
</constraint>
</properties>
@@ -97,8 +96,7 @@
<description>IPv6 server to export sFlow</description>
</valueHelp>
<constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
+ <validator name="ip-address"/>
</constraint>
</properties>
<children>
diff --git a/interface-definitions/vpn-l2tp.xml.in b/interface-definitions/vpn-l2tp.xml.in
index ec186cd23..ee0edc3e3 100644
--- a/interface-definitions/vpn-l2tp.xml.in
+++ b/interface-definitions/vpn-l2tp.xml.in
@@ -38,8 +38,9 @@
<properties>
<help>Sent to the client (LAC) in the Host-Name attribute</help>
<constraint>
- <regex>[A-Za-z0-9][-.A-Za-z0-9]*[A-Za-z0-9]</regex>
+ #include <include/constraint/host-name.xml.i>
</constraint>
+ <constraintErrorMessage>Host-name must be alphanumeric and can contain hyphens</constraintErrorMessage>
</properties>
</leafNode>
</children>
diff --git a/interface-definitions/vpn-openconnect.xml.in b/interface-definitions/vpn-openconnect.xml.in
index a426f604d..75c64a99a 100644
--- a/interface-definitions/vpn-openconnect.xml.in
+++ b/interface-definitions/vpn-openconnect.xml.in
@@ -71,6 +71,58 @@
</leafNode>
</children>
</node>
+ <node name="identity-based-config">
+ <properties>
+ <help>Include configuration file by username or RADIUS group attribute</help>
+ </properties>
+ <children>
+ #include <include/generic-disable-node.xml.i>
+ <leafNode name="mode">
+ <properties>
+ <help>Select per user or per group configuration file - ignored if authentication group is configured</help>
+ <completionHelp>
+ <list>user group</list>
+ </completionHelp>
+ <valueHelp>
+ <format>user</format>
+ <description>Match configuration file on username</description>
+ </valueHelp>
+ <valueHelp>
+ <format>group</format>
+ <description>Match RADIUS response class attribute as file name</description>
+ </valueHelp>
+ <constraint>
+ <regex>(user|group)</regex>
+ </constraint>
+ <constraintErrorMessage>Invalid mode, must be either user or group</constraintErrorMessage>
+ </properties>
+ </leafNode>
+ <leafNode name="directory">
+ <properties>
+ <help>Directory to containing configuration files</help>
+ <valueHelp>
+ <format>path</format>
+ <description>Path to configuration directory, must be under /config/auth</description>
+ </valueHelp>
+ <constraint>
+ <validator name="file-path" argument="--directory --parent-dir /config/auth --strict"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="default-config">
+ <properties>
+ <help>Default configuration if discrete config could not be found</help>
+ <valueHelp>
+ <format>filename</format>
+ <description>Default configuration filename, must be under /config/auth</description>
+ </valueHelp>
+ <constraint>
+ <validator name="file-path" argument="--file --parent-dir /config/auth --strict"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
<leafNode name="group">
<properties>
<help>Group that a client is allowed to select (from a list). Maps to RADIUS Class attribute.</help>
diff --git a/python/vyos/base.py b/python/vyos/base.py
index c1acfd060..9b93cb2f2 100644
--- a/python/vyos/base.py
+++ b/python/vyos/base.py
@@ -1,4 +1,4 @@
-# Copyright 2018-2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2018-2022 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -41,6 +41,7 @@ class BaseWarning:
isfirstmessage = False
initial_indent = self.standardindent
print(f'{mes}')
+ print('')
class Warning():
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index 6a49c022a..30bea3b86 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -374,10 +374,11 @@ class EthernetIf(Interface):
self.set_tso(dict_search('offload.tso', config) != None)
# Set physical interface speed and duplex
- if {'speed', 'duplex'} <= set(config):
- speed = config.get('speed')
- duplex = config.get('duplex')
- self.set_speed_duplex(speed, duplex)
+ if 'speed_duplex_changed' in config:
+ if {'speed', 'duplex'} <= set(config):
+ speed = config.get('speed')
+ duplex = config.get('duplex')
+ self.set_speed_duplex(speed, duplex)
# Set interface ring buffer
if 'ring_buffer' in config:
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 2f1d5eb96..f62b9f7d2 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -532,7 +532,7 @@ class Interface(Control):
return None
# As a PoC we only allow 'dummy' interfaces
- if not ('dum' in self.ifname or 'veth' in self.ifname):
+ if 'dum' not in self.ifname:
return None
# Check if interface realy exists in namespace
diff --git a/smoketest/scripts/cli/test_service_dns_dynamic.py b/smoketest/scripts/cli/test_service_dns_dynamic.py
index 57705e26f..a3aa41f94 100755
--- a/smoketest/scripts/cli/test_service_dns_dynamic.py
+++ b/smoketest/scripts/cli/test_service_dns_dynamic.py
@@ -45,22 +45,32 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
def test_dyndns_service(self):
+ from itertools import product
ddns = ['interface', interface, 'service']
+ users = [None, 'vyos_user']
services = ['cloudflare', 'afraid', 'dyndns', 'zoneedit']
- for service in services:
- user = 'vyos_user'
+ for user, service in product(users, services):
password = 'vyos_pass'
zone = 'vyos.io'
self.cli_delete(base_path)
self.cli_set(base_path + ddns + [service, 'host-name', hostname])
- self.cli_set(base_path + ddns + [service, 'login', user])
+ if user is not None:
+ self.cli_set(base_path + ddns + [service, 'login', user])
self.cli_set(base_path + ddns + [service, 'password', password])
self.cli_set(base_path + ddns + [service, 'zone', zone])
# commit changes
if service == 'cloudflare':
self.cli_commit()
+ elif user is None:
+ # not set user is only allowed for cloudflare
+ with self.assertRaises(ConfigSessionError):
+ # remove zone to test not set user
+ self.cli_delete(base_path + ddns + [service, 'zone', 'vyos.io'])
+ self.cli_commit()
+ # this case is fininshed, user not set is not allowed when service isn't cloudflare
+ continue
else:
# zone option only works on cloudflare, an exception is raised
# for all others
@@ -72,7 +82,7 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
# we can only read the configuration file when we operate as 'root'
protocol = get_config_value('protocol')
- login = get_config_value('login')
+ login = None if user is None else get_config_value('login')
pwd = get_config_value('password')
# some services need special treatment
diff --git a/src/conf_mode/dynamic_dns.py b/src/conf_mode/dynamic_dns.py
index 06a2f7e15..426e3d693 100755
--- a/src/conf_mode/dynamic_dns.py
+++ b/src/conf_mode/dynamic_dns.py
@@ -108,7 +108,8 @@ def verify(dyndns):
raise ConfigError(f'"host-name" {error_msg}')
if 'login' not in config:
- raise ConfigError(f'"login" (username) {error_msg}')
+ if service != 'cloudflare' and ('protocol' not in config or config['protocol'] != 'cloudflare'):
+ raise ConfigError(f'"login" (username) {error_msg}, unless using CloudFlare')
if 'password' not in config:
raise ConfigError(f'"password" {error_msg}')
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index b49c945cd..31cfab368 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -22,6 +22,7 @@ from sys import exit
from vyos.base import Warning
from vyos.config import Config
from vyos.configdict import get_interface_dict
+from vyos.configdict import is_node_changed
from vyos.configverify import verify_address
from vyos.configverify import verify_dhcpv6
from vyos.configverify import verify_eapol
@@ -66,11 +67,17 @@ def get_config(config=None):
get_first_key=True, no_tag_node_value_mangle=True)
base = ['interfaces', 'ethernet']
- _, ethernet = get_interface_dict(conf, base)
+ ifname, ethernet = get_interface_dict(conf, base)
if 'deleted' not in ethernet:
if pki: ethernet['pki'] = pki
+ tmp = is_node_changed(conf, base + [ifname, 'speed'])
+ if tmp: ethernet.update({'speed_duplex_changed': {}})
+
+ tmp = is_node_changed(conf, base + [ifname, 'duplex'])
+ if tmp: ethernet.update({'speed_duplex_changed': {}})
+
return ethernet
def verify(ethernet):
diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py
index e646fb0ae..cf34bad2e 100755
--- a/src/conf_mode/system-syslog.py
+++ b/src/conf_mode/system-syslog.py
@@ -111,9 +111,9 @@ def verify(syslog):
def generate(syslog):
if not syslog:
if os.path.exists(rsyslog_conf):
- os.path.unlink(rsyslog_conf)
+ os.unlink(rsyslog_conf)
if os.path.exists(logrotate_conf):
- os.path.unlink(logrotate_conf)
+ os.unlink(logrotate_conf)
return None
@@ -126,9 +126,10 @@ def generate(syslog):
return None
def apply(syslog):
+ systemd_socket = 'syslog.socket'
systemd_service = 'syslog.service'
if not syslog:
- call(f'systemctl stop {systemd_service}')
+ call(f'systemctl stop {systemd_service} {systemd_socket}')
return None
# we need to restart the service if e.g. the VRF name changed
diff --git a/src/conf_mode/vpn_openconnect.py b/src/conf_mode/vpn_openconnect.py
index 68da70d7d..83021a3e6 100755
--- a/src/conf_mode/vpn_openconnect.py
+++ b/src/conf_mode/vpn_openconnect.py
@@ -17,6 +17,7 @@
import os
from sys import exit
+from vyos.base import Warning
from vyos.config import Config
from vyos.configdict import dict_merge
from vyos.pki import wrap_certificate
@@ -173,6 +174,19 @@ def verify(ocserv):
users_wo_pswd.append(user)
if users_wo_pswd:
raise ConfigError(f'password required for users:\n{users_wo_pswd}')
+
+ # Validate that if identity-based-config is configured all child config nodes are set
+ if 'identity_based_config' in ocserv["authentication"]:
+ if 'disabled' not in ocserv["authentication"]["identity_based_config"]:
+ Warning("Identity based configuration files is a 3rd party addition. Use at your own risk, this might break the ocserv daemon!")
+ if 'mode' not in ocserv["authentication"]["identity_based_config"]:
+ raise ConfigError('OpenConnect radius identity-based-config enabled but mode not selected')
+ elif 'group' in ocserv["authentication"]["identity_based_config"]["mode"] and "radius" not in ocserv["authentication"]["mode"]:
+ raise ConfigError('OpenConnect config-per-group must be used with radius authentication')
+ if 'directory' not in ocserv["authentication"]["identity_based_config"]:
+ raise ConfigError('OpenConnect identity-based-config enabled but directory not set')
+ if 'default_config' not in ocserv["authentication"]["identity_based_config"]:
+ raise ConfigError('OpenConnect identity-based-config enabled but default-config not set')
else:
raise ConfigError('openconnect authentication mode required')
else: