};
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;
},
"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" ]
}
}
}