diff --git a/protocols/luci-proto-openvpn/htdocs/luci-static/resources/protocol/openvpn.js b/protocols/luci-proto-openvpn/htdocs/luci-static/resources/protocol/openvpn.js index 84f27a7b4c..da1b698dee 100644 --- a/protocols/luci-proto-openvpn/htdocs/luci-static/resources/protocol/openvpn.js +++ b/protocols/luci-proto-openvpn/htdocs/luci-static/resources/protocol/openvpn.js @@ -1863,12 +1863,13 @@ return network.registerProtocol('openvpn', { }; ovconf.write = function(sid, value) { const config_name = `/etc/openvpn/${sid}/${sid}_config.cfg`; - fs.exec_direct('/bin/mkdir', ['-p', `/etc/openvpn/${sid}/`]).then(result => { - fs.write(config_name, value).catch(() => {}); - uci.set(this.config, sid, 'config', config_name); + return fs.exec('/bin/mkdir', ['-p', `/etc/openvpn/${sid}/`]).then(() => { + return fs.write(config_name, value); + }).then(() => { + try { + uci.set(this.config, sid, 'config', config_name); + } catch (err) {} }); - - return }; ovconf.rmempty = true; }, diff --git a/protocols/luci-proto-openvpn/root/usr/share/rpcd/acl.d/luci-openvpn.json b/protocols/luci-proto-openvpn/root/usr/share/rpcd/acl.d/luci-proto-openvpn.json similarity index 57% rename from protocols/luci-proto-openvpn/root/usr/share/rpcd/acl.d/luci-openvpn.json rename to protocols/luci-proto-openvpn/root/usr/share/rpcd/acl.d/luci-proto-openvpn.json index e79dbca9e2..af4ea82b2f 100644 --- a/protocols/luci-proto-openvpn/root/usr/share/rpcd/acl.d/luci-openvpn.json +++ b/protocols/luci-proto-openvpn/root/usr/share/rpcd/acl.d/luci-proto-openvpn.json @@ -2,23 +2,27 @@ "luci-proto-openvpn": { "description": "Grant access to LuCI openvpn procedures", "read": { + "file": { + "/bin/mkdir -p /etc/openvpn/*": [ "exec" ], + "/etc/openvpn/*": [ "read" ] + }, "ubus": { "luci.openvpn": [ "*" ] }, - "uci": [ "openvpn", "openvpn_recipes" ] + "uci": [ "network" ] }, "write": { "file": { - "/etc/openvpn/*": [ "write" ] + "/etc/openvpn/*": [ "write", "remove" ] }, "ubus": { "luci.openvpn": [ "*" ] }, - "uci": [ "openvpn" ] + "uci": [ "network" ] } } }