mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
API CHANGE: last sysadm/firewall action
Final action for the sysadm/firewall class: "action" = "reset-defaults"
This will reset all the firewall settings back to defaults and restart the firewall.
NOTE: This will only work on TrueOS - plain FreeBSD does not have any concept of default firewall settings and this API call will return an error in that case.
REST Request (example):
-------------------------------
PUT /sysadm/firewall
{
"action" : "reset-defaults"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"args" : {
"action" : "reset-defaults"
},
"namespace" : "sysadm",
"name" : "firewall"
}
Response:
-------------------------------
{
"args": {
"result": "success"
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
This commit is contained in:
@@ -1190,6 +1190,9 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmFirewallRequest(const QJsonV
|
||||
ok = true;
|
||||
FMGR.Disable();
|
||||
|
||||
}else if(action=="reset-defaults"){
|
||||
ok = FMGR.RestoreDefaults();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -182,14 +182,16 @@ void Firewall::Disable()
|
||||
serviceManager.Disable( serviceManager.GetService("ipfw") );
|
||||
}
|
||||
|
||||
void Firewall::RestoreDefaults()
|
||||
bool Firewall::RestoreDefaults()
|
||||
{
|
||||
if(QFile::exists("/usr/local/share/trueos/scripts/reset-firewall")){
|
||||
//refresh/restart the rules files
|
||||
QStringList args;
|
||||
args << "/usr/local/share/trueos/scripts/reset-firewall";
|
||||
General::RunCommand("sh",args);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Firewall::readServicesFile()
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
/**
|
||||
* @brief Restores the Default Configuration
|
||||
*/
|
||||
void RestoreDefaults();
|
||||
bool RestoreDefaults();
|
||||
///#endsection
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user