mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:15:15 +00:00
UI: Options: Add "Filter Local Network" flag
This commit is contained in:
parent
18b8732995
commit
6299ef3434
@ -26,6 +26,7 @@ typedef struct fort_conf_flags
|
||||
UINT32 boot_filter : 1;
|
||||
UINT32 filter_enabled : 1;
|
||||
UINT32 filter_locals : 1;
|
||||
UINT32 filter_local_net : 1;
|
||||
|
||||
UINT32 block_traffic : 1;
|
||||
UINT32 block_inet_traffic : 1;
|
||||
@ -43,8 +44,6 @@ typedef struct fort_conf_flags
|
||||
UINT32 log_blocked_ip : 1;
|
||||
UINT32 log_alerted_blocked_ip : 1;
|
||||
|
||||
UINT32 reserved : 1; /* DUMMY */
|
||||
|
||||
UINT32 group_bits : 16;
|
||||
} FORT_CONF_FLAGS, *PFORT_CONF_FLAGS;
|
||||
|
||||
|
@ -286,11 +286,12 @@ inline static BOOL fort_callout_ale_check_filter_flags(PCFORT_CALLOUT_ARG ca,
|
||||
return TRUE; /* block all */
|
||||
}
|
||||
|
||||
if (!fort_conf_ip_is_inet(&conf_ref->conf,
|
||||
(fort_conf_zones_ip_included_func *) &fort_conf_zones_ip_included,
|
||||
&fort_device()->conf, cx->remote_ip, ca->isIPv6)) {
|
||||
if (!conf_flags.filter_local_net
|
||||
&& !fort_conf_ip_is_inet(&conf_ref->conf,
|
||||
(fort_conf_zones_ip_included_func *) &fort_conf_zones_ip_included,
|
||||
&fort_device()->conf, cx->remote_ip, ca->isIPv6)) {
|
||||
cx->blocked = FALSE;
|
||||
return TRUE; /* allow LocalNetwork */
|
||||
return TRUE; /* allow Local Network */
|
||||
}
|
||||
|
||||
if (conf_flags.block_inet_traffic) {
|
||||
|
@ -31,6 +31,11 @@ void FirewallConf::setFilterLocals(bool filterLocals)
|
||||
m_filterLocals = filterLocals;
|
||||
}
|
||||
|
||||
void FirewallConf::setFilterLocalNet(bool filterLocalNet)
|
||||
{
|
||||
m_filterLocalNet = filterLocalNet;
|
||||
}
|
||||
|
||||
void FirewallConf::setBlockTraffic(bool blockTraffic)
|
||||
{
|
||||
m_blockTraffic = blockTraffic;
|
||||
@ -353,6 +358,7 @@ void FirewallConf::copyFlags(const FirewallConf &o)
|
||||
m_bootFilter = o.bootFilter();
|
||||
m_filterEnabled = o.filterEnabled();
|
||||
m_filterLocals = o.filterLocals();
|
||||
m_filterLocalNet = o.filterLocalNet();
|
||||
m_blockTraffic = o.blockTraffic();
|
||||
m_blockInetTraffic = o.blockInetTraffic();
|
||||
m_allowAllNew = o.allowAllNew();
|
||||
@ -400,6 +406,7 @@ QVariant FirewallConf::flagsToVariant() const
|
||||
map["bootFilter"] = bootFilter();
|
||||
map["filterEnabled"] = filterEnabled();
|
||||
map["filterLocals"] = filterLocals();
|
||||
map["filterLocalNet"] = filterLocalNet();
|
||||
map["blockTraffic"] = blockTraffic();
|
||||
map["blockInetTraffic"] = blockInetTraffic();
|
||||
map["allowAllNew"] = allowAllNew();
|
||||
@ -432,6 +439,7 @@ void FirewallConf::flagsFromVariant(const QVariant &v)
|
||||
m_bootFilter = map["bootFilter"].toBool();
|
||||
m_filterEnabled = map["filterEnabled"].toBool();
|
||||
m_filterLocals = map["filterLocals"].toBool();
|
||||
m_filterLocalNet = map["filterLocalNet"].toBool();
|
||||
m_blockTraffic = map["blockTraffic"].toBool();
|
||||
m_blockInetTraffic = map["blockInetTraffic"].toBool();
|
||||
m_allowAllNew = map["allowAllNew"].toBool();
|
||||
|
@ -52,6 +52,9 @@ public:
|
||||
bool filterLocals() const { return m_filterLocals; }
|
||||
void setFilterLocals(bool filterLocals);
|
||||
|
||||
bool filterLocalNet() const { return m_filterLocalNet; }
|
||||
void setFilterLocalNet(bool filterLocalNet);
|
||||
|
||||
bool blockTraffic() const { return m_blockTraffic; }
|
||||
void setBlockTraffic(bool blockTraffic);
|
||||
|
||||
@ -185,6 +188,7 @@ private:
|
||||
uint m_bootFilter : 1 = false;
|
||||
uint m_filterEnabled : 1 = true;
|
||||
uint m_filterLocals : 1 = false;
|
||||
uint m_filterLocalNet : 1 = false;
|
||||
uint m_blockTraffic : 1 = false;
|
||||
uint m_blockInetTraffic : 1 = false;
|
||||
uint m_allowAllNew : 1 = false;
|
||||
|
@ -139,6 +139,7 @@ void OptionsPage::onRetranslateUi()
|
||||
m_gbTraffic->setTitle(tr("Traffic"));
|
||||
m_gbProtection->setTitle(tr("Self Protection"));
|
||||
m_gbProg->setTitle(tr("Programs"));
|
||||
m_gbLan->setTitle(tr("Local Area Network"));
|
||||
m_gbLogs->setTitle(tr("Logs"));
|
||||
|
||||
m_labelStartMode->setText(tr("Auto-run:"));
|
||||
@ -156,9 +157,6 @@ void OptionsPage::onRetranslateUi()
|
||||
retranslateComboFilterMode();
|
||||
|
||||
m_cbBootFilter->setText(tr("Block traffic when Fort Firewall is not running"));
|
||||
m_cbFilterLocals->setText(tr("Filter Local Addresses"));
|
||||
m_cbFilterLocals->setToolTip(
|
||||
tr("Filter Local Loopback (127.0.0.0/8) and Broadcast (255.255.255.255) Addresses"));
|
||||
m_cbNoServiceControl->setText(tr("Disable Service controls"));
|
||||
m_cbCheckPasswordOnUninstall->setText(tr("Check password on Uninstall"));
|
||||
|
||||
@ -174,6 +172,11 @@ void OptionsPage::onRetranslateUi()
|
||||
m_cbAppAlertAlwaysOnTop->setText(tr("Alert Window is Always on top"));
|
||||
m_cbPurgeOnMounted->setText(tr("Purge Obsolete only on mounted drives"));
|
||||
|
||||
m_cbFilterLocals->setText(tr("Filter Local Addresses") + " (127.0.0.0/8, 255.255.255.255)");
|
||||
m_cbFilterLocals->setToolTip(
|
||||
tr("Filter Local Loopback (127.0.0.0/8) and Broadcast (255.255.255.255) Addresses"));
|
||||
m_cbFilterLocalNet->setText(tr("Filter Local Network"));
|
||||
|
||||
m_cbLogDebug->setText(tr("Log debug messages"));
|
||||
m_cbLogConsole->setText(tr("Show log messages in console"));
|
||||
}
|
||||
@ -286,12 +289,16 @@ QLayout *OptionsPage::setupColumn2()
|
||||
// Programs Group Box
|
||||
setupProgBox();
|
||||
|
||||
// LAN Group Box
|
||||
setupLanBox();
|
||||
|
||||
// Logs Group Box
|
||||
setupLogsBox();
|
||||
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setSpacing(10);
|
||||
layout->addWidget(m_gbProg);
|
||||
layout->addWidget(m_gbLan);
|
||||
layout->addWidget(m_gbLogs);
|
||||
layout->addStretch();
|
||||
|
||||
@ -391,11 +398,6 @@ void OptionsPage::setupProtectionBox()
|
||||
ctrl()->setFlagsEdited();
|
||||
});
|
||||
|
||||
m_cbFilterLocals = ControlUtil::createCheckBox(conf()->filterLocals(), [&](bool checked) {
|
||||
conf()->setFilterLocals(checked);
|
||||
ctrl()->setFlagsEdited();
|
||||
});
|
||||
|
||||
m_cbNoServiceControl =
|
||||
ControlUtil::createCheckBox(ini()->noServiceControl(), [&](bool checked) {
|
||||
ini()->setNoServiceControl(checked);
|
||||
@ -416,7 +418,6 @@ void OptionsPage::setupProtectionBox()
|
||||
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->addWidget(m_cbBootFilter);
|
||||
layout->addWidget(m_cbFilterLocals);
|
||||
layout->addWidget(m_cbNoServiceControl);
|
||||
layout->addWidget(ControlUtil::createSeparator());
|
||||
layout->addWidget(m_cbCheckPasswordOnUninstall);
|
||||
@ -534,6 +535,25 @@ void OptionsPage::setupLogBlocked()
|
||||
m_cbLogBlocked->setFont(GuiUtil::fontBold());
|
||||
}
|
||||
|
||||
void OptionsPage::setupLanBox()
|
||||
{
|
||||
m_cbFilterLocals = ControlUtil::createCheckBox(conf()->filterLocals(), [&](bool checked) {
|
||||
conf()->setFilterLocals(checked);
|
||||
ctrl()->setFlagsEdited();
|
||||
});
|
||||
|
||||
m_cbFilterLocalNet = ControlUtil::createCheckBox(conf()->filterLocalNet(), [&](bool checked) {
|
||||
conf()->setFilterLocalNet(checked);
|
||||
ctrl()->setFlagsEdited();
|
||||
});
|
||||
|
||||
// Layout
|
||||
auto layout = ControlUtil::createVLayoutByWidgets({ m_cbFilterLocals, m_cbFilterLocalNet });
|
||||
|
||||
m_gbLan = new QGroupBox();
|
||||
m_gbLan->setLayout(layout);
|
||||
}
|
||||
|
||||
void OptionsPage::setupLogsBox()
|
||||
{
|
||||
m_cbLogDebug = ControlUtil::createCheckBox(ini()->logDebug(), [&](bool checked) {
|
||||
|
@ -48,6 +48,7 @@ private:
|
||||
void setupPasswordLock();
|
||||
void setupProgBox();
|
||||
void setupLogBlocked();
|
||||
void setupLanBox();
|
||||
void setupLogsBox();
|
||||
|
||||
private:
|
||||
@ -59,18 +60,19 @@ private:
|
||||
QGroupBox *m_gbTraffic = nullptr;
|
||||
QGroupBox *m_gbProtection = nullptr;
|
||||
QGroupBox *m_gbProg = nullptr;
|
||||
QGroupBox *m_gbLan = nullptr;
|
||||
QGroupBox *m_gbLogs = nullptr;
|
||||
|
||||
QLabel *m_labelStartMode = nullptr;
|
||||
QComboBox *m_comboAutoRun = nullptr;
|
||||
QCheckBox *m_cbService = nullptr;
|
||||
|
||||
QCheckBox *m_cbFilterEnabled = nullptr;
|
||||
QLabel *m_labelBlockTraffic = nullptr;
|
||||
QComboBox *m_comboBlockTraffic = nullptr;
|
||||
QLabel *m_labelFilterMode = nullptr;
|
||||
QComboBox *m_comboFilterMode = nullptr;
|
||||
QCheckBox *m_cbBootFilter = nullptr;
|
||||
QCheckBox *m_cbFilterLocals = nullptr;
|
||||
QCheckBox *m_cbNoServiceControl = nullptr;
|
||||
QCheckBox *m_cbCheckPasswordOnUninstall = nullptr;
|
||||
QCheckBox *m_cbPassword = nullptr;
|
||||
@ -83,6 +85,9 @@ private:
|
||||
QCheckBox *m_cbAppAlertAlwaysOnTop = nullptr;
|
||||
QCheckBox *m_cbPurgeOnMounted = nullptr;
|
||||
|
||||
QCheckBox *m_cbFilterLocals = nullptr;
|
||||
QCheckBox *m_cbFilterLocalNet = nullptr;
|
||||
|
||||
QCheckBox *m_cbLogDebug = nullptr;
|
||||
QCheckBox *m_cbLogConsole = nullptr;
|
||||
};
|
||||
|
@ -389,6 +389,7 @@ void FortSettings::readConfIni(FirewallConf &conf) const
|
||||
conf.setBootFilter(iniBool("bootFilter"));
|
||||
conf.setFilterEnabled(iniBool("filterEnabled", true));
|
||||
conf.setFilterLocals(iniBool("filterLocals"));
|
||||
conf.setFilterLocalNet(iniBool("filterLocalNet"));
|
||||
conf.setBlockTraffic(iniBool("blockTraffic"));
|
||||
conf.setBlockInetTraffic(iniBool("blockInetTraffic"));
|
||||
conf.setAllowAllNew(iniBool("allowAllNew", true));
|
||||
@ -431,6 +432,7 @@ void FortSettings::writeConfIni(const FirewallConf &conf)
|
||||
setIniValue("bootFilter", conf.bootFilter());
|
||||
setIniValue("filterEnabled", conf.filterEnabled());
|
||||
setIniValue("filterLocals", conf.filterLocals());
|
||||
setIniValue("filterLocalNet", conf.filterLocalNet());
|
||||
setIniValue("blockTraffic", conf.blockTraffic());
|
||||
setIniValue("blockInetTraffic", conf.blockInetTraffic());
|
||||
setIniValue("allowAllNew", conf.allowAllNew());
|
||||
|
@ -59,6 +59,8 @@ void writeConfFlags(const FirewallConf &conf, PFORT_CONF_FLAGS confFlags)
|
||||
confFlags->boot_filter = conf.bootFilter();
|
||||
confFlags->filter_enabled = conf.filterEnabled();
|
||||
confFlags->filter_locals = conf.filterLocals();
|
||||
confFlags->filter_local_net = conf.filterLocalNet();
|
||||
|
||||
confFlags->block_traffic = conf.blockTraffic();
|
||||
confFlags->block_inet_traffic = conf.blockInetTraffic();
|
||||
confFlags->allow_all_new = conf.allowAllNew();
|
||||
|
@ -16,6 +16,6 @@
|
||||
#define APP_UPDATES_URL "https://github.com/tnodir/fort/releases"
|
||||
#define APP_UPDATES_API_URL "https://api.github.com/repos/tnodir/fort/releases/latest"
|
||||
|
||||
#define DRIVER_VERSION 34
|
||||
#define DRIVER_VERSION 35
|
||||
|
||||
#endif // FORT_VERSION_H
|
||||
|
Loading…
Reference in New Issue
Block a user