diff --git a/ui/opensnitch/dialogs/preferences.py b/ui/opensnitch/dialogs/preferences.py index 198fa538..31be44ad 100644 --- a/ui/opensnitch/dialogs/preferences.py +++ b/ui/opensnitch/dialogs/preferences.py @@ -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 = {} diff --git a/ui/opensnitch/res/preferences.ui b/ui/opensnitch/res/preferences.ui index 1babd9c0..94e03d29 100644 --- a/ui/opensnitch/res/preferences.ui +++ b/ui/opensnitch/res/preferences.ui @@ -647,19 +647,6 @@ Use ; to define multiple screens: 1;1.5 etc... - - - - By default the GUI is started when login - - - Autostart the GUI upon login - - - true - - - @@ -711,16 +698,6 @@ Use ; to define multiple screens: 1;1.5 etc... - - - - Auto screen scale factor - - - true - - - @@ -812,6 +789,29 @@ Use ; to define multiple screens: 1;1.5 etc... + + + + Auto screen scale factor + + + true + + + + + + + By default the GUI is started when login + + + Autostart the GUI upon login + + + true + + + @@ -820,7 +820,7 @@ Use ; to define multiple screens: 1;1.5 etc... 0 0 599 - 279 + 323 @@ -945,8 +945,8 @@ Use ; to define multiple screens: 1;1.5 etc... 0 0 - 321 - 112 + 599 + 323 @@ -1041,8 +1041,8 @@ Use ; to define multiple screens: 1;1.5 etc... 0 0 - 219 - 115 + 599 + 323 @@ -1300,22 +1300,6 @@ Temporary rules will still be valid, and you can use them when prompted to allow - - - - - 0 - 0 - - - - Version - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - @@ -1895,7 +1879,8 @@ Temporary rules will still be valid, and you can use them when prompted to allow Path - + + .. @@ -1914,14 +1899,61 @@ Temporary rules will still be valid, and you can use them when prompted to allow + + + 0 + 0 + 599 + 224 + + Internal - - + + + + + 0 + 0 + + + + Qt::ImhDigitsOnly + - Flush connections on start + 50 + + + Qt::AlignCenter + + + + + + + Max events + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Garbage collector percentage @@ -1944,14 +1976,26 @@ Temporary rules will still be valid, and you can use them when prompted to allow - - + + + + 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. + - Garbage collector percentage + Flush connections on start - + + + + Max stats + + + + 0 @@ -2023,49 +2067,45 @@ Temporary rules will still be valid, and you can use them when prompted to allow - - - - Qt::Vertical + + + + 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. - - - 20 - 40 - + + Firewall rules monitoring interval (seconds) - + - - + + 0 0 - - Qt::ImhDigitsOnly - - 50 + + + + 5 Qt::AlignCenter - - - - - - Max events + + 10s, 15s, 60s, etc - - + + - Max stats + Block outbound network traffic if the daemon unexpectedly dies @@ -2073,7 +2113,23 @@ Temporary rules will still be valid, and you can use them when prompted to allow - + + + + + 0 + 0 + + + + Version + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + +