summaryrefslogtreecommitdiff
path: root/interface-definitions/wireguard.xml
blob: eec7a404b1d7da0d76456354073397bc7f257161 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?xml version="1.0"?>
<interfaceDefinition>
  <node name="interfaces">
    <children>
      <tagNode name="wireguard" owner="${vyos_conf_scripts_dir}/wireguard.py">
        <properties>
          <help>WireGuard interface name</help>
          <priority>459</priority> <!-- subsequent ones may be removed, just make sure ethernet ifs are present -->
          <constraint>
            <regex>^wg[0-9]{1,4}</regex>
          </constraint>
          <constraintErrorMessage>illegal interface name</constraintErrorMessage>
          <valueHelp>
            <format>wgN</format>
            <description>WireGuard interface name</description>
          </valueHelp>
        </properties>
        <children>
          <leafNode name="address">
            <properties>
              <help>IP address</help> 
              <valueHelp>
                <format>ipv4net</format>
                <description>IPv4 address and prefix length</description>
              </valueHelp>
              <valueHelp>
                <format>ipv6net</format>
                <description>IPv6 address and prefix length</description>
              </valueHelp>
              <multi/>
              <constraint>
                <validator name="interface-address"/>
              </constraint>
            </properties>
          </leafNode>
          <leafNode name="description">
            <properties>
              <help>description</help>
              <constraint>
                <regex>.[^ ]{1,100}$</regex>
              </constraint>
              <constraintErrorMessage>interface description is too long (limit 100 characters)</constraintErrorMessage>
            </properties>
          </leafNode>
          <leafNode name="listen-port">
            <properties>
              <help>Local port number to accept connections</help>
            </properties>
          </leafNode>
          <tagNode name="peer">
            <properties>
              <help>Base64 encoded public key</help>
              <constraint>
                <regex>^[0-9a-zA-Z\+/]{43}=$</regex>
              </constraint>
              <constraintErrorMessage>Key is not valid 44-character (32-bytes) base64</constraintErrorMessage>
            </properties>
            <children>
              <leafNode name="allowed-ips">
                <properties>
                  <help>IP addresses allowed to traverse the peer</help>
                <multi/>
                </properties>
              </leafNode>
              <!--  check format IP:port -->
              <leafNode name="endpoint">
                <properties>
                  <help>Remote endpoint</help>
                </properties>
              </leafNode>
              <leafNode name="persistent-keepalive">
                <properties>
                  <help>how often send keep alives in seconds</help>
                  <constraint>
                    <regex>^(1|[1-9][0-9]{0,5})$</regex>
                  </constraint>
                  <constraintErrorMessage>keepliave timer has to be between 1 and 99999 seconds</constraintErrorMessage>
                </properties>
              </leafNode>

            </children>
          </tagNode>
        </children>
      </tagNode>
    </children>
  </node>
</interfaceDefinition>