gluon/package/gluon-mesh-vpn-fastd/check_site.lua
Vincent Wiemann eaa110fc5a gluon-mesh-vpn-fastd: add site.conf options for fastd peer upgrade
This commit introduces two additional fastd site.conf options:
`sysupgrade_remove_old_peers` removes peer and peer group entries
 existing from an old configuration except those which were
defined using the node2node VPN feature after a sysupgrade.

`sysupgrade_remove_n2n_peers` removes existing peer and peer group
entries which were defined using the node2node VPN feature
(which have 'n2n_vpn' in their name) after a sysupgrade.
2019-02-24 05:30:34 +01:00

25 lines
945 B
Lua

local fastd_methods = {'salsa2012+gmac', 'salsa2012+umac', 'null+salsa2012+gmac', 'null+salsa2012+umac', 'null'}
need_array_of({'mesh_vpn', 'fastd', 'methods'}, fastd_methods)
need_boolean(in_site({'mesh_vpn', 'fastd', 'configurable'}), false)
need_boolean('mesh_vpn.fastd.sysupgrade_remove_old_peers', false)
need_boolean('mesh_vpn.fastd.sysupgrade_remove_n2n_peers', false)
need_one_of(in_site({'mesh_vpn', 'fastd', 'syslog_level'}), {'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false)
local function check_peer(k)
need_alphanumeric_key(k)
need_string_match(in_domain(extend(k, {'key'})), '^%x+$')
need_string_array(in_domain(extend(k, {'remotes'})))
end
local function check_group(k)
need_alphanumeric_key(k)
need_number(extend(k, {'limit'}), false)
need_table(extend(k, {'peers'}), check_peer, false)
need_table(extend(k, {'groups'}), check_group, false)
end
need_table({'mesh_vpn', 'fastd', 'groups'}, check_group)