Skip to content
Snippets Groups Projects
Unverified Commit b68a07e9 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

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.
parent d8f6ed24
No related branches found
Tags v2.9+2023-05-12
No related merge requests found
...@@ -9,6 +9,11 @@ local uci = require('simple-uci').cursor() ...@@ -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 ...@@ -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(),
......
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment