cjdns: add seccomp config flag
Signed-off-by: Lars Gierth <larsg@systemli.org>
This commit is contained in:
parent
83c9fdfe5b
commit
2bab58cdcb
1 changed files with 27 additions and 2 deletions
|
@ -10,7 +10,14 @@ common.uci = UCI
|
||||||
-- @return table with configuration defaults
|
-- @return table with configuration defaults
|
||||||
function UCI.defaults()
|
function UCI.defaults()
|
||||||
return {
|
return {
|
||||||
security = { { exemptAngel = 1, setuser = "nobody" } },
|
security = {
|
||||||
|
{ setuser = "nobody", keepNetAdmin = 1 },
|
||||||
|
{ chroot = "/var/run/" },
|
||||||
|
{ nofiles = 0 },
|
||||||
|
{ noforks = 1 },
|
||||||
|
{ seccomp = 0 },
|
||||||
|
{ setupComplete = 1 }
|
||||||
|
},
|
||||||
router = {
|
router = {
|
||||||
ipTunnel = { outgoingConnections = {}, allowedConnections = {} },
|
ipTunnel = { outgoingConnections = {}, allowedConnections = {} },
|
||||||
interface = { type = "TUNInterface" }
|
interface = { type = "TUNInterface" }
|
||||||
|
@ -45,6 +52,12 @@ function UCI.get()
|
||||||
obj.router.interface.tunDevice = config.tun_device
|
obj.router.interface.tunDevice = config.tun_device
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for i,section in pairs(obj.security) do
|
||||||
|
if type(section.seccomp) == "number" then
|
||||||
|
obj.security[i].seccomp = tonumber(config.seccomp)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
cursor:foreach("cjdns", "iptunnel_outgoing", function(outgoing)
|
cursor:foreach("cjdns", "iptunnel_outgoing", function(outgoing)
|
||||||
table.insert(obj.router.ipTunnel.outgoingConnections, outgoing.public_key)
|
table.insert(obj.router.ipTunnel.outgoingConnections, outgoing.public_key)
|
||||||
end)
|
end)
|
||||||
|
@ -127,7 +140,7 @@ function UCI.set(obj)
|
||||||
private_key = obj.privateKey,
|
private_key = obj.privateKey,
|
||||||
admin_password = obj.admin.password,
|
admin_password = obj.admin.password,
|
||||||
admin_address = admin_address,
|
admin_address = admin_address,
|
||||||
admin_port = admin_port,
|
admin_port = admin_port
|
||||||
})
|
})
|
||||||
|
|
||||||
if obj.router.interface.tunDevice then
|
if obj.router.interface.tunDevice then
|
||||||
|
@ -136,6 +149,18 @@ function UCI.set(obj)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if obj.security then
|
||||||
|
for i,section in pairs(obj.security) do
|
||||||
|
for key,value in pairs(section) do
|
||||||
|
if key == "seccomp" then
|
||||||
|
UCI.cursor_section(cursor, "cjdns", "cjdns", "cjdns", {
|
||||||
|
seccomp = tonumber(value)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if obj.router.ipTunnel.outgoingConnections then
|
if obj.router.ipTunnel.outgoingConnections then
|
||||||
for i,public_key in pairs(obj.router.ipTunnel.outgoingConnections) do
|
for i,public_key in pairs(obj.router.ipTunnel.outgoingConnections) do
|
||||||
UCI.cursor_section(cursor, "cjdns", "iptunnel_outgoing", nil, {
|
UCI.cursor_section(cursor, "cjdns", "iptunnel_outgoing", nil, {
|
||||||
|
|
Loading…
Reference in a new issue