From 17d2c131b518dff2b6df63238dd7cdcc4e80ecbb Mon Sep 17 00:00:00 2001 From: Luke De Mouy Date: Mon, 11 Jan 2016 15:02:07 -0700 Subject: [PATCH] Add in the option to restore the default configuration --- src/library/sysadm-firewall.cpp | 9 +++++++++ src/library/sysadm-firewall.h | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/library/sysadm-firewall.cpp b/src/library/sysadm-firewall.cpp index f5de9c0..faa20ce 100644 --- a/src/library/sysadm-firewall.cpp +++ b/src/library/sysadm-firewall.cpp @@ -129,6 +129,15 @@ void Firewall::Restart() system("/etc/rc.d/ipfw restart"); } +void Firewall::RestoreDefaults() +{ + //move the files out of the way + system("mv /etc/ipfw.rules /etc/ipfw.rules.previous"); + system("mv /etc/ipfw.openports /etc/ipfw.openports.previous"); + //refresh/restart the rules files + system("sh /usr/local/share/pcbsd/scripts/reset-firewall"); +} + Firewall::Firewall() { readServicesFile(); diff --git a/src/library/sysadm-firewall.h b/src/library/sysadm-firewall.h index 62d1bcd..c6aa321 100644 --- a/src/library/sysadm-firewall.h +++ b/src/library/sysadm-firewall.h @@ -55,7 +55,6 @@ public: * @return a QVector of the open ports */ QVector OpenPorts(); - ///#endsection ///#section: firewall commands @@ -76,6 +75,11 @@ public: * @brief Restarts the firewall */ void Restart(); + + /** + * @brief Restores the Default Configuration + */ + void RestoreDefaults(); ///#endsection ///#section: ctors dtors