mirror of
https://github.com/openwrt/luci.git
synced 2026-04-15 10:51:51 +00:00
luci-proto-openvpn: fix permissions and write promise
structure the promise so uci.set functions properly. Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
@@ -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" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user