gluon-mesh-vpn-fastd: merge secret generation setup into main upgrade script
There wasn't really a reason to have a separate script to set a single value. In addition, the old script was using the identifier 'c' instead of 'uci' for the UCI cursor. Following the convention of the other scripts is helpful so it is easy to grep for all uses of a certain config file/ option.
This commit is contained in:
parent
d8f6ed2406
commit
b68a07e930
@ -9,6 +9,11 @@ local uci = require('simple-uci').cursor()
|
|||||||
|
|
||||||
local syslog_level = uci:get('fastd', 'mesh_vpn', 'syslog_level') or 'verbose'
|
local syslog_level = uci:get('fastd', 'mesh_vpn', 'syslog_level') or 'verbose'
|
||||||
|
|
||||||
|
local secret = uci:get('fastd', 'mesh_vpn', 'secret')
|
||||||
|
if not secret or not secret:match(('%x'):rep(64)) then
|
||||||
|
secret = 'generate'
|
||||||
|
end
|
||||||
|
|
||||||
local methods
|
local methods
|
||||||
|
|
||||||
if site.mesh_vpn.fastd.configurable(false) then
|
if site.mesh_vpn.fastd.configurable(false) then
|
||||||
@ -38,6 +43,7 @@ end
|
|||||||
uci:section('fastd', 'fastd', 'mesh_vpn', {
|
uci:section('fastd', 'fastd', 'mesh_vpn', {
|
||||||
group = 'gluon-mesh-vpn',
|
group = 'gluon-mesh-vpn',
|
||||||
syslog_level = syslog_level,
|
syslog_level = syslog_level,
|
||||||
|
secret = secret,
|
||||||
interface = vpn_core.get_interface(),
|
interface = vpn_core.get_interface(),
|
||||||
mode = 'tap',
|
mode = 'tap',
|
||||||
mtu = site.mesh_vpn.mtu(),
|
mtu = site.mesh_vpn.mtu(),
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
#!/usr/bin/lua
|
|
||||||
|
|
||||||
local uci = require 'simple-uci'
|
|
||||||
|
|
||||||
local c = uci.cursor()
|
|
||||||
|
|
||||||
local secret = c:get("fastd", "mesh_vpn", "secret")
|
|
||||||
|
|
||||||
if not secret or not secret:match(("%x"):rep(64)) then
|
|
||||||
c:set("fastd", "mesh_vpn", "secret", "generate")
|
|
||||||
c:save("fastd")
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user