summaryrefslogtreecommitdiff
path: root/interface-definitions/wireguard.xml
blob: 7d1bb1b31f85e36a9a7a07955d8d2e61eb7b1a72 (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
88
89
90
91
92
93
94
95
<?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>peer alias</help>
              <constraint>
                <regex>^[0-9a-zA-Z]{1,100}</regex>
              </constraint>
              <constraintErrorMessage>input limited to 100 alphanumerical characters</constraintErrorMessage>
            </properties>
            <children>
              <leafNode name="pubkey">
                <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>
              </leafNode>
              <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]{1,5})$</regex>
                  </constraint>
                  <constraintErrorMessage>keepliave timer has to be between 1 and 99999 seconds</constraintErrorMessage>
                </properties>
              </leafNode>
            </children>
          </tagNode>
        </children>
      </tagNode>
    </children>
  </node>
</interfaceDefinition>