Browse Source

Add warning if trying to change template VM

donoban 3 years ago
parent
commit
1edc4effd8
1 changed files with 11 additions and 0 deletions
  1. 11 0
      qubesmanager/settings.py

+ 11 - 0
qubesmanager/settings.py

@@ -432,6 +432,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
             self.netVM.setCurrentIndex(-1)
 
         self.netVM.currentIndexChanged.connect(self.check_warn_dispvmnetvm)
+        self.netVM.currentIndexChanged.connect(self.check_warn_templatenetvm)
 
         try:
             self.include_in_backups.setChecked(self.vm.include_in_backups)
@@ -625,6 +626,16 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
                 self.init_mem.value() * 10 < self.max_mem_size.value():
             self.warn_too_much_mem_label.setVisible(True)
 
+    def check_warn_templatenetvm(self):
+        if self.vm.klass == 'TemplateVM':
+            QtWidgets.QMessageBox.warning(
+                self,
+                self.tr("Warning!"),
+                self.tr("Connecting a TemplateVM directly to a network is higly "
+                        "discouraged! <br> <small>You are breaking a basic part"
+                        " of Qubes security and there is probably no real need "
+                        "to do so. Continue at your own risk.</small>"))
+
     def check_warn_dispvmnetvm(self):
         if not hasattr(self.vm, 'default_dispvm'):
             self.warn_netvm_dispvm.setVisible(False)