mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
ui,prefs: allow to configure more internal options
Allow to configure:
- Bypass queue.
- Firewall rules monitoring interval.
Related: 6622df9d38
This commit is contained in:
parent
db84b551cc
commit
dd7271429e
2 changed files with 164 additions and 78 deletions
|
@ -84,6 +84,7 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
self.lineUIScreenFactor.setValidator(doubleValidator)
|
||||
self.lineNodeMaxEvents.setValidator(intValidator)
|
||||
self.lineNodeMaxStats.setValidator(intValidator)
|
||||
self.lineNodeFwMonInterval.setValidator(intValidator)
|
||||
|
||||
self.acceptButton.clicked.connect(self._cb_accept_button_clicked)
|
||||
self.applyButton.clicked.connect(self._cb_apply_button_clicked)
|
||||
|
@ -215,9 +216,11 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
self.comboNodeAuthVerifyType.currentIndexChanged.connect(self._cb_node_needs_update)
|
||||
self.enableChecksums.clicked.connect(self._cb_node_needs_update)
|
||||
self.checkNodeFlushConns.clicked.connect(self._cb_node_needs_update)
|
||||
self.checkNodeBypassQueue.clicked.connect(self._cb_node_needs_update)
|
||||
self.spinNodeGC.valueChanged.connect(self._cb_node_needs_update)
|
||||
self.lineNodeMaxEvents.textChanged.connect(self._cb_node_needs_update)
|
||||
self.lineNodeMaxStats.textChanged.connect(self._cb_node_needs_update)
|
||||
self.lineNodeFwMonInterval.textChanged.connect(self._cb_node_needs_update)
|
||||
self.lineNodeRulesPath.textChanged.connect(self._cb_node_needs_update)
|
||||
|
||||
self.comboAuthType.currentIndexChanged.connect(self._cb_combo_auth_type_changed)
|
||||
|
@ -455,6 +458,19 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
self.checkNodeFlushConns.setChecked(internal.get('FlushConnsOnStart'))
|
||||
self.spinNodeGC.setValue(internal.get('GCPercent'))
|
||||
|
||||
fwOptions = node_config.get('FwOptions')
|
||||
if fwOptions == None:
|
||||
fwOptions = {}
|
||||
if fwOptions.get('MonitorInterval') == None:
|
||||
fwOptions['MonitorInterval'] = "15"
|
||||
if fwOptions.get('QueueBypass') == None:
|
||||
fwOptions['QueueBypass'] = True
|
||||
node_config['FwOptions'] = fwOptions
|
||||
|
||||
monInterval = fwOptions['MonitorInterval'].removesuffix("s")
|
||||
self.checkNodeBypassQueue.setChecked(fwOptions.get('QueueBypass'))
|
||||
self.lineNodeFwMonInterval.setText(monInterval)
|
||||
|
||||
stats = node_config.get('Stats')
|
||||
if stats == None:
|
||||
stats = {}
|
||||
|
@ -474,6 +490,8 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
self._set_status_error(QC.translate("preferences", "Error loading config: {0}".format(e)))
|
||||
|
||||
def _load_node_config(self, addr):
|
||||
"""load the config of a node before sending it back to the node"""
|
||||
print("_load_node_config()")
|
||||
try:
|
||||
if self.comboNodeAddress.currentText() == "":
|
||||
return None, QC.translate("preferences", "Server address can not be empty")
|
||||
|
@ -534,6 +552,18 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
internal['GCPercent'] = self.spinNodeGC.value()
|
||||
node_config['Internal'] = internal
|
||||
|
||||
fwOptions = node_config.get('FwOptions')
|
||||
if fwOptions == None:
|
||||
fwOptions = {}
|
||||
if fwOptions.get('MonitorInterval') == None:
|
||||
fwOptions['MonitorInterval'] = "15s"
|
||||
if fwOptions.get('QueueBypass') == None:
|
||||
fwOptions['QueueBypass'] = True
|
||||
node_config['FwOptions'] = fwOptions
|
||||
|
||||
fwOptions['QueueBypass'] = self.checkNodeBypassQueue.isChecked()
|
||||
fwOptions['MonitorInterval'] = self.lineNodeFwMonInterval.text() + "s"
|
||||
|
||||
stats = node_config.get('Stats')
|
||||
if stats == None:
|
||||
stats = {}
|
||||
|
|
|
@ -647,19 +647,6 @@ Use ; to define multiple screens: 1;1.5 etc...</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="checkAutostart">
|
||||
<property name="toolTip">
|
||||
<string>By default the GUI is started when login</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Autostart the GUI upon login</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="sizePolicy">
|
||||
|
@ -711,16 +698,6 @@ Use ; to define multiple screens: 1;1.5 etc...</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="checkUIAutoScreen">
|
||||
<property name="text">
|
||||
<string>Auto screen scale factor</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboUILang"/>
|
||||
</item>
|
||||
|
@ -812,6 +789,29 @@ Use ; to define multiple screens: 1;1.5 etc...</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkUIAutoScreen">
|
||||
<property name="text">
|
||||
<string>Auto screen scale factor</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkAutostart">
|
||||
<property name="toolTip">
|
||||
<string>By default the GUI is started when login</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Autostart the GUI upon login</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_6">
|
||||
|
@ -820,7 +820,7 @@ Use ; to define multiple screens: 1;1.5 etc...</string>
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>599</width>
|
||||
<height>279</height>
|
||||
<height>323</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
@ -945,8 +945,8 @@ Use ; to define multiple screens: 1;1.5 etc...</string>
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>321</width>
|
||||
<height>112</height>
|
||||
<width>599</width>
|
||||
<height>323</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
@ -1041,8 +1041,8 @@ Use ; to define multiple screens: 1;1.5 etc...</string>
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>219</width>
|
||||
<height>115</height>
|
||||
<width>599</width>
|
||||
<height>323</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
@ -1300,22 +1300,6 @@ Temporary rules will still be valid, and you can use them when prompted to allow
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Version</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboNodes">
|
||||
<property name="sizePolicy">
|
||||
|
@ -1895,7 +1879,8 @@ Temporary rules will still be valid, and you can use them when prompted to allow
|
|||
<string>Path</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-open"/>
|
||||
<iconset theme="document-open">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1914,14 +1899,61 @@ Temporary rules will still be valid, and you can use them when prompted to allow
|
|||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_11">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>599</width>
|
||||
<height>224</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Internal</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkNodeFlushConns">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineNodeMaxStats">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhDigitsOnly</set>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flush connections on start</string>
|
||||
<string>50</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="text">
|
||||
<string>Max events</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string>Garbage collector percentage</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1944,14 +1976,26 @@ Temporary rules will still be valid, and you can use them when prompted to allow
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkNodeFlushConns">
|
||||
<property name="toolTip">
|
||||
<string>When this option is on, all the existing sockets will be killed, in order to force them establish the connection again so we can intercept them.
|
||||
|
||||
Note that this option may be not acceptable on servers, for example because downloads/uploads are taking place.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Garbage collector percentage</string>
|
||||
<string>Flush connections on start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>Max stats</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
|
@ -2023,49 +2067,45 @@ Temporary rules will still be valid, and you can use them when prompted to allow
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="toolTip">
|
||||
<string>Check every n seconds that the interception rules are present in the system.
|
||||
If they're no present, all the rules will be deleted and added again.
|
||||
|
||||
Use 0 to disable this feature.</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<property name="text">
|
||||
<string>Firewall rules monitoring interval (seconds)</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineNodeMaxStats">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineNodeFwMonInterval">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhDigitsOnly</set>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>50</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="text">
|
||||
<string>Max events</string>
|
||||
<property name="placeholderText">
|
||||
<string>10s, 15s, 60s, etc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkNodeBypassQueue">
|
||||
<property name="text">
|
||||
<string>Max stats</string>
|
||||
<string>Block outbound network traffic if the daemon unexpectedly dies</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -2073,7 +2113,23 @@ Temporary rules will still be valid, and you can use them when prompted to allow
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Version</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
|
|
Loading…
Add table
Reference in a new issue