1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-05-02 15:17:28 +02:00

see #2515 Expanded set of options the user can change to pre-set

parameters in the new policy rules they create. Now user can set
default values for action ("Deny" or "Accept"), direction, the
"stateless" flag and logging.
This commit is contained in:
Vadim Kurland 2011-07-21 13:20:59 -07:00
parent 2ce9852aeb
commit 6d26bfac90
5 changed files with 180 additions and 8 deletions

View File

@ -1,5 +1,10 @@
2011-07-21 vadim <vadim@netcitadel.com>
* RuleSetModel.cpp (initRule): see #2515 Expanded set of options
the user can change to pre-set parameters in the new policy rules
they create. Now user can set default values for action ("Deny" or
"Accept"), direction, the "stateless" flag and logging.
* FindObjectWidget.cpp (matchAttr): see #2516 "Enhance Find to
include searching for IP addresses in ranges". Function "find"
now finds ip addresses inside address ranges.

View File

@ -400,6 +400,15 @@ void FWBSettings::init(bool force_first_time_run)
if (!hasKey("Objects/PolicyRule/defaultLoggingState"))
setBool("Objects/PolicyRule/defaultLoggingState", true);
if (!hasKey("Objects/PolicyRule/defaultStateful"))
setBool("Objects/PolicyRule/defaultStateful", true);
if (!hasKey("Objects/PolicyRule/defaultAction"))
setInt("Objects/PolicyRule/defaultAction", 0);
if (!hasKey("Objects/PolicyRule/defaultDirection"))
setInt("Objects/PolicyRule/defaultDirection", 0);
if (!hasKey("Objects/Interface/autoconfigureInterfaces"))
setBool("Objects/Interface/autoconfigureInterfaces", true);

View File

@ -162,6 +162,15 @@ PrefsDialog::PrefsDialog(QWidget *parent) : QDialog(parent)
m_dialog->rulesLoggingOn->setChecked(
st->getBool("Objects/PolicyRule/defaultLoggingState") );
m_dialog->rulesDefaultStateful->setChecked(
st->getBool("Objects/PolicyRule/defaultStateful"));
m_dialog->rulesDefaultAction->setCurrentIndex(
st->getInt("Objects/PolicyRule/defaultAction"));
m_dialog->rulesDefaultDirection->setCurrentIndex(
st->getInt("Objects/PolicyRule/defaultDirection"));
m_dialog->autoconfigure_interfaces->setChecked(
st->getBool("Objects/Interface/autoconfigureInterfaces") );
@ -487,6 +496,17 @@ void PrefsDialog::accept()
st->setBool("Objects/PolicyRule/defaultLoggingState",
m_dialog->rulesLoggingOn->isChecked());
st->setBool("Objects/PolicyRule/defaultStateful",
m_dialog->rulesDefaultStateful->isChecked());
st->setInt("Objects/PolicyRule/defaultAction",
m_dialog->rulesDefaultAction->currentIndex());
st->setInt("Objects/PolicyRule/defaultDirection",
m_dialog->rulesDefaultDirection->currentIndex());
st->setBool("Objects/Interface/autoconfigureInterfaces",
m_dialog->autoconfigure_interfaces->isChecked());

View File

@ -1510,12 +1510,30 @@ void PolicyModel::initRule(Rule *new_rule, Rule *old_rule)
PolicyRule *newrule_as_policy_rule = PolicyRule::cast(new_rule);
if (newrule_as_policy_rule)
{
FWOptions *ruleopt = newrule_as_policy_rule->getOptionsObject();
newrule_as_policy_rule->setLogging(supports_logging &&
st->getBool("Objects/PolicyRule/defaultLoggingState"));
newrule_as_policy_rule->setAction(PolicyRule::Deny);
newrule_as_policy_rule->setDirection(PolicyRule::Both);
FWOptions *ruleopt = newrule_as_policy_rule->getOptionsObject();
switch (st->getInt("Objects/PolicyRule/defaultAction"))
{
case 1:
newrule_as_policy_rule->setAction(PolicyRule::Accept); break;
default:
newrule_as_policy_rule->setAction(PolicyRule::Deny); break;
}
switch (st->getInt("Objects/PolicyRule/defaultDirection"))
{
case 0:
newrule_as_policy_rule->setDirection(PolicyRule::Both); break;
case 1:
newrule_as_policy_rule->setDirection(PolicyRule::Inbound); break;
case 2:
newrule_as_policy_rule->setDirection(PolicyRule::Outbound); break;
}
ruleopt->setBool("stateless",
! st->getBool("Objects/PolicyRule/defaultStateful") ||
getStatelessFlagForAction(newrule_as_policy_rule));
}

View File

@ -383,7 +383,7 @@ own library of templates and use it in addition to the one we provide</string>
<item row="7" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget_2">
<property name="currentIndex">
<number>3</number>
<number>2</number>
</property>
<widget class="QWidget" name="DNSName">
<attribute name="title">
@ -545,7 +545,7 @@ own library of templates and use it in addition to the one we provide</string>
<string>Policy Rules</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_16">
<item row="0" column="0">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label_16">
<property name="minimumSize">
<size>
@ -568,19 +568,129 @@ own library of templates and use it in addition to the one we provide</string>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="rulesLoggingOn">
<widget class="QLabel" name="label_19">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Create new policy rules with logging turned on by default</string>
<string>This setting allows you to change whether new rules created in fwbuilder have action, logging and stateful inspection turned on or off by default.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="rulesLoggingOn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Create new policy rules with logging turned on</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="rulesDefaultStateful">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Create new policy rules with stateful inspection turned on</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_20">
<property name="text">
<string>Create new policy rules with action </string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="rulesDefaultAction">
<item>
<property name="text">
<string>Deny</string>
</property>
</item>
<item>
<property name="text">
<string>Accept</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_21">
<property name="text">
<string>Create new policy rules with direction</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="rulesDefaultDirection">
<item>
<property name="text">
<string>Both</string>
</property>
</item>
<item>
<property name="text">
<string>Inbound</string>
</property>
</item>
<item>
<property name="text">
<string>Outbound</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_10">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -1738,6 +1848,16 @@ are never stored permanently)</string>
<signal>clicked()</signal>
<receiver>prefsDialog_q</receiver>
<slot>findDataDir()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>redBtn</sender>