diff --git a/ui/details.ui b/ui/details.ui
index 95aa6a4b1..4159f1dc0 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -5906,6 +5906,7 @@ if you know what you are doing.</small>
_Save this password in your keyring
True
True
+ Check to save password, uncheck to forget password.
False
True
0
diff --git a/virtManager/config.py b/virtManager/config.py
index 9d394caf0..865fa2f11 100644
--- a/virtManager/config.py
+++ b/virtManager/config.py
@@ -708,3 +708,16 @@ class vmmConfig(object):
return
vm.set_console_password(username, keyid)
+
+ def del_console_password(self, vm):
+ if not self.has_keyring():
+ return
+
+ username, keyid = vm.get_console_password()
+
+ if keyid == -1:
+ return
+
+ self.keyring.del_secret(keyid)
+
+ vm.del_console_password()
diff --git a/virtManager/console.py b/virtManager/console.py
index 449e8018a..1d3311511 100644
--- a/virtManager/console.py
+++ b/virtManager/console.py
@@ -749,6 +749,8 @@ class vmmConsolePages(vmmGObjectUI):
if self.widget("console-auth-remember").get_active():
self.config.set_console_password(self.vm, passwd.get_text(),
username.get_text())
+ else:
+ self.config.del_console_password(self.vm)
##########################
diff --git a/virtManager/domain.py b/virtManager/domain.py
index a978cb9e5..3185cf848 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -1706,6 +1706,10 @@ class vmmDomain(vmmLibvirtObject):
def set_console_password(self, username, keyid):
return self.config.set_pervm(self.get_uuid(), "/console-password",
(username, keyid))
+ def del_console_password(self):
+ return self.config.set_pervm(self.get_uuid(), "/console-password",
+ ("", -1))
+
def _on_config_sample_network_traffic_changed(self, ignore=None):
self._enable_net_poll = self.config.get_stats_enable_net_poll()
diff --git a/virtManager/keyring.py b/virtManager/keyring.py
index 0f758e0f1..d3a300a1c 100644
--- a/virtManager/keyring.py
+++ b/virtManager/keyring.py
@@ -88,6 +88,16 @@ class vmmKeyring(object):
return ret
+ def del_secret(self, _id):
+ try:
+ path = self._collection.get_object_path() + "/" + str(_id)
+ iface = Gio.DBusProxy.new_sync(self._dbus, 0, None,
+ "org.freedesktop.secrets", path,
+ "org.freedesktop.Secret.Item", None)
+ iface.Delete("(s)", "/")
+ except:
+ logging.exception("Failed to delete keyring secret")
+
def get_secret(self, _id):
ret = None
try: