remove the ability to save GPG password, show in GUI use_gpg_agent optin. fixes #2791
This commit is contained in:
parent
97f4c470b5
commit
c15b616ddd
5 changed files with 58 additions and 147 deletions
|
@ -780,42 +780,19 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox4">
|
<widget class="GtkCheckButton" id="use_gpg_agent_checkbutton1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="spacing">6</property>
|
<property name="sensitive">False</property>
|
||||||
<child>
|
<property name="can_focus">True</property>
|
||||||
<widget class="GtkCheckButton" id="gpg_save_password_checkbutton1">
|
<property name="tooltip" translatable="yes">If checked, Gajim will get the password from a GPG agent like seahorse</property>
|
||||||
<property name="visible">True</property>
|
<property name="label" translatable="yes">Use GPG _Agent</property>
|
||||||
<property name="sensitive">False</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<property name="tooltip" translatable="yes">If checked, Gajim will store the password in ~/.gajim/config with 'read' permission only for you</property>
|
<signal name="toggled" handler="on_use_gpg_agent_checkbutton_toggled"/>
|
||||||
<property name="label" translatable="yes">Save _passphrase (insecure)</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
<signal name="toggled" handler="on_gpg_save_password_checkbutton_toggled"/>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkEntry" id="gpg_password_entry1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="visibility">False</property>
|
|
||||||
<property name="invisible_char">*</property>
|
|
||||||
<signal name="changed" handler="on_gpg_password_entry_changed"/>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="position">1</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1218,40 +1195,18 @@ You might consider to change possible firewall settings.</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox7">
|
<widget class="GtkCheckButton" id="use_gpg_agent_checkbutton2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="spacing">6</property>
|
<property name="can_focus">True</property>
|
||||||
<child>
|
<property name="tooltip" translatable="yes">If checked, Gajim will get the password from a GPG agent like seahorse</property>
|
||||||
<widget class="GtkCheckButton" id="gpg_save_password_checkbutton2">
|
<property name="label" translatable="yes">Use GPG _Agent</property>
|
||||||
<property name="visible">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<property name="tooltip" translatable="yes">If checked, Gajim will store the password in ~/.gajim/config with 'read' permission only for you</property>
|
<signal name="toggled" handler="on_use_gpg_agent_checkbutton_toggled"/>
|
||||||
<property name="label" translatable="yes">Save _passphrase (insecure)</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
<signal name="toggled" handler="on_gpg_save_password_checkbutton_toggled"/>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkEntry" id="gpg_password_entry2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="visibility">False</property>
|
|
||||||
<property name="invisible_char">*</property>
|
|
||||||
<signal name="changed" handler="on_gpg_password_entry_changed"/>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">2</property>
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -103,8 +103,7 @@ class AdvancedConfigurationWindow(object):
|
||||||
make the cellrenderertext not editable else it's editable'''
|
make the cellrenderertext not editable else it's editable'''
|
||||||
optname = model[iter][C_PREFNAME]
|
optname = model[iter][C_PREFNAME]
|
||||||
opttype = model[iter][C_TYPE]
|
opttype = model[iter][C_TYPE]
|
||||||
if opttype == self.types['boolean'] or optname in ('password',
|
if opttype == self.types['boolean'] or optname == 'password':
|
||||||
'gpgpassword'):
|
|
||||||
cell.set_property('editable', False)
|
cell.set_property('editable', False)
|
||||||
else:
|
else:
|
||||||
cell.set_property('editable', True)
|
cell.set_property('editable', True)
|
||||||
|
@ -239,7 +238,7 @@ class AdvancedConfigurationWindow(object):
|
||||||
type = val[OPT_TYPE][0]
|
type = val[OPT_TYPE][0]
|
||||||
type = self.types[type] # i18n
|
type = self.types[type] # i18n
|
||||||
value = val[OPT_VAL]
|
value = val[OPT_VAL]
|
||||||
if name in ('password', 'gpgpassword'):
|
if name == 'password':
|
||||||
#we talk about password
|
#we talk about password
|
||||||
value = _('Hidden') # override passwords with this string
|
value = _('Hidden') # override passwords with this string
|
||||||
if value in self.right_true_dict:
|
if value in self.right_true_dict:
|
||||||
|
|
|
@ -266,8 +266,6 @@ class Config:
|
||||||
'use_custom_host': [ opt_bool, False, '', True ],
|
'use_custom_host': [ opt_bool, False, '', True ],
|
||||||
'custom_port': [ opt_int, 5222, '', True ],
|
'custom_port': [ opt_int, 5222, '', True ],
|
||||||
'custom_host': [ opt_str, '', '', True ],
|
'custom_host': [ opt_str, '', '', True ],
|
||||||
'savegpgpass': [ opt_bool, False, '', True ],
|
|
||||||
'gpgpassword': [ opt_str, '' ],
|
|
||||||
'sync_with_global_status': [ opt_bool, False, ],
|
'sync_with_global_status': [ opt_bool, False, ],
|
||||||
'no_log_for': [ opt_str, '' ],
|
'no_log_for': [ opt_str, '' ],
|
||||||
'minimized_gc': [ opt_str, '' ],
|
'minimized_gc': [ opt_str, '' ],
|
||||||
|
|
|
@ -1509,7 +1509,7 @@ class AccountsWindow:
|
||||||
account = self.current_account
|
account = self.current_account
|
||||||
keyid = gajim.config.get_per('accounts', account, 'keyid')
|
keyid = gajim.config.get_per('accounts', account, 'keyid')
|
||||||
keyname = gajim.config.get_per('accounts', account, 'keyname')
|
keyname = gajim.config.get_per('accounts', account, 'keyname')
|
||||||
savegpgpass = gajim.config.get_per('accounts', account, 'savegpgpass')
|
use_gpg_agent = gajim.config.get('use_gpg_agent')
|
||||||
|
|
||||||
if account == gajim.ZEROCONF_ACC_NAME:
|
if account == gajim.ZEROCONF_ACC_NAME:
|
||||||
widget_name_add = '2'
|
widget_name_add = '2'
|
||||||
|
@ -1518,27 +1518,19 @@ class AccountsWindow:
|
||||||
|
|
||||||
gpg_key_label = self.xml.get_widget('gpg_key_label' + widget_name_add)
|
gpg_key_label = self.xml.get_widget('gpg_key_label' + widget_name_add)
|
||||||
gpg_name_label = self.xml.get_widget('gpg_name_label' + widget_name_add)
|
gpg_name_label = self.xml.get_widget('gpg_name_label' + widget_name_add)
|
||||||
gpg_save_password_checkbutton = \
|
use_gpg_agent_checkbutton = self.xml.get_widget(
|
||||||
self.xml.get_widget('gpg_save_password_checkbutton' + widget_name_add)
|
'use_gpg_agent_checkbutton' + widget_name_add)
|
||||||
gpg_password_entry = self.xml.get_widget('gpg_password_entry' + \
|
|
||||||
widget_name_add)
|
|
||||||
|
|
||||||
if not keyid or not gajim.config.get('usegpg'):
|
if not keyid or not gajim.config.get('usegpg'):
|
||||||
gpg_save_password_checkbutton.set_sensitive(False)
|
use_gpg_agent_checkbutton.set_sensitive(False)
|
||||||
gpg_password_entry.set_sensitive(False)
|
|
||||||
gpg_key_label.set_text(_('No key selected'))
|
gpg_key_label.set_text(_('No key selected'))
|
||||||
gpg_name_label.set_text('')
|
gpg_name_label.set_text('')
|
||||||
return
|
return
|
||||||
|
|
||||||
gpg_key_label.set_text(keyid)
|
gpg_key_label.set_text(keyid)
|
||||||
gpg_name_label.set_text(keyname)
|
gpg_name_label.set_text(keyname)
|
||||||
gpg_save_password_checkbutton.set_sensitive(True)
|
use_gpg_agent_checkbutton.set_sensitive(True)
|
||||||
gpg_save_password_checkbutton.set_active(savegpgpass)
|
use_gpg_agent_checkbutton.set_active(use_gpg_agent)
|
||||||
|
|
||||||
if savegpgpass:
|
|
||||||
gpg_password_entry.set_sensitive(True)
|
|
||||||
gpgpassword = gajim.config.get_per('accounts', account, 'gpgpassword')
|
|
||||||
gpg_password_entry.set_text(gpgpassword)
|
|
||||||
|
|
||||||
def init_normal_account(self):
|
def init_normal_account(self):
|
||||||
account = self.current_account
|
account = self.current_account
|
||||||
|
@ -2002,17 +1994,14 @@ class AccountsWindow:
|
||||||
wiget_name_ext = '2'
|
wiget_name_ext = '2'
|
||||||
else:
|
else:
|
||||||
wiget_name_ext = '1'
|
wiget_name_ext = '1'
|
||||||
checkbutton = self.xml.get_widget('gpg_save_password_checkbutton' + \
|
|
||||||
wiget_name_ext)
|
|
||||||
gpg_key_label = self.xml.get_widget('gpg_key_label' + wiget_name_ext)
|
gpg_key_label = self.xml.get_widget('gpg_key_label' + wiget_name_ext)
|
||||||
gpg_name_label = self.xml.get_widget('gpg_name_label' + wiget_name_ext)
|
gpg_name_label = self.xml.get_widget('gpg_name_label' + wiget_name_ext)
|
||||||
gpg_password_entry = self.xml.get_widget('gpg_password_entry' + \
|
use_gpg_agent_checkbutton = self.xml.get_widget(
|
||||||
wiget_name_ext)
|
'use_gpg_agent_checkbutton' + wiget_name_ext)
|
||||||
if keyID[0] == _('None'):
|
if keyID[0] == _('None'):
|
||||||
gpg_key_label.set_text(_('No key selected'))
|
gpg_key_label.set_text(_('No key selected'))
|
||||||
gpg_name_label.set_text('')
|
gpg_name_label.set_text('')
|
||||||
checkbutton.set_sensitive(False)
|
use_gpg_agent_checkbutton.set_sensitive(False)
|
||||||
gpg_password_entry.set_sensitive(False)
|
|
||||||
if self.option_changed('keyid', ''):
|
if self.option_changed('keyid', ''):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account, 'keyname', '')
|
gajim.config.set_per('accounts', self.current_account, 'keyname', '')
|
||||||
|
@ -2020,34 +2009,20 @@ class AccountsWindow:
|
||||||
else:
|
else:
|
||||||
gpg_key_label.set_text(keyID[0])
|
gpg_key_label.set_text(keyID[0])
|
||||||
gpg_name_label.set_text(keyID[1])
|
gpg_name_label.set_text(keyID[1])
|
||||||
checkbutton.set_sensitive(True)
|
use_gpg_agent_checkbutton.set_sensitive(True)
|
||||||
if self.option_changed('keyid', keyID[0]):
|
if self.option_changed('keyid', keyID[0]):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account, 'keyname',
|
gajim.config.set_per('accounts', self.current_account, 'keyname',
|
||||||
keyID[1])
|
keyID[1])
|
||||||
gajim.config.set_per('accounts', self.current_account, 'keyid',
|
gajim.config.set_per('accounts', self.current_account, 'keyid',
|
||||||
keyID[0])
|
keyID[0])
|
||||||
gajim.config.set_per('accounts', self.current_account, 'savegpgpass',
|
|
||||||
False)
|
|
||||||
gajim.config.set_per('accounts', self.current_account, 'gpgpassword', '')
|
|
||||||
checkbutton.set_active(False)
|
|
||||||
gpg_password_entry.set_text('')
|
|
||||||
|
|
||||||
def on_gpg_save_password_checkbutton_toggled(self, widget):
|
def on_use_gpg_agent_checkbutton_toggled(self, widget):
|
||||||
if self.current_account == gajim.ZEROCONF_ACC_NAME:
|
if self.current_account == gajim.ZEROCONF_ACC_NAME:
|
||||||
wiget_name_ext = '2'
|
wiget_name_ext = '2'
|
||||||
else:
|
else:
|
||||||
wiget_name_ext = '1'
|
wiget_name_ext = '1'
|
||||||
self.xml.get_widget('gpg_password_entry' + wiget_name_ext).set_sensitive(
|
self.on_checkbutton_toggled(widget, 'use_gpg_agent')
|
||||||
widget.get_active())
|
|
||||||
self.on_checkbutton_toggled(widget, 'savegpgpass',
|
|
||||||
account = self.current_account)
|
|
||||||
|
|
||||||
def on_gpg_password_entry_changed(self, widget):
|
|
||||||
if self.ignore_events:
|
|
||||||
return
|
|
||||||
gajim.config.set_per('accounts', self.current_account, 'gpgpassword',
|
|
||||||
widget.get_text().decode('utf-8'))
|
|
||||||
|
|
||||||
def on_edit_details_button1_clicked(self, widget):
|
def on_edit_details_button1_clicked(self, widget):
|
||||||
if not gajim.interface.instances.has_key(self.current_account):
|
if not gajim.interface.instances.has_key(self.current_account):
|
||||||
|
@ -3317,8 +3292,6 @@ class AccountCreationWizardWindow:
|
||||||
config['custom_host'] = ''
|
config['custom_host'] = ''
|
||||||
config['keyname'] = ''
|
config['keyname'] = ''
|
||||||
config['keyid'] = ''
|
config['keyid'] = ''
|
||||||
config['savegpgpass'] = False
|
|
||||||
config['gpgpassword'] = ''
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def save_account(self, login, server, savepass, password):
|
def save_account(self, login, server, savepass, password):
|
||||||
|
|
|
@ -3442,11 +3442,6 @@ class RosterWindow:
|
||||||
keyid = None
|
keyid = None
|
||||||
use_gpg_agent = gajim.config.get('use_gpg_agent')
|
use_gpg_agent = gajim.config.get('use_gpg_agent')
|
||||||
# we don't need to bother with the passphrase if we use the agent
|
# we don't need to bother with the passphrase if we use the agent
|
||||||
if use_gpg_agent:
|
|
||||||
save_gpg_pass = False
|
|
||||||
else:
|
|
||||||
save_gpg_pass = gajim.config.get_per('accounts', account,
|
|
||||||
'savegpgpass')
|
|
||||||
keyid = gajim.config.get_per('accounts', account, 'keyid')
|
keyid = gajim.config.get_per('accounts', account, 'keyid')
|
||||||
if keyid and not gajim.config.get('usegpg'):
|
if keyid and not gajim.config.get('usegpg'):
|
||||||
dialog = dialogs.WarningDialog(_('GPG is not usable'), _('You will be connected to %s without OpenPGP.') % account)
|
dialog = dialogs.WarningDialog(_('GPG is not usable'), _('You will be connected to %s without OpenPGP.') % account)
|
||||||
|
@ -3456,42 +3451,33 @@ class RosterWindow:
|
||||||
if use_gpg_agent:
|
if use_gpg_agent:
|
||||||
self.gpg_passphrase[keyid] = None
|
self.gpg_passphrase[keyid] = None
|
||||||
else:
|
else:
|
||||||
if save_gpg_pass:
|
if self.gpg_passphrase.has_key(keyid):
|
||||||
passphrase = gajim.config.get_per('accounts', account,
|
passphrase = self.gpg_passphrase[keyid]
|
||||||
'gpgpassword')
|
save = False
|
||||||
else:
|
else:
|
||||||
if self.gpg_passphrase.has_key(keyid):
|
password_ok = False
|
||||||
passphrase = self.gpg_passphrase[keyid]
|
count = 0
|
||||||
save = False
|
title = _('Passphrase Required')
|
||||||
else:
|
second = _('Enter GPG key passphrase for account %s.') % \
|
||||||
password_ok = False
|
account
|
||||||
count = 0
|
while not password_ok and count < 3:
|
||||||
title = _('Passphrase Required')
|
count += 1
|
||||||
second = _('Enter GPG key passphrase for account %s.') % \
|
w = dialogs.PassphraseDialog(title, second,
|
||||||
account
|
_('Save passphrase'))
|
||||||
while not password_ok and count < 3:
|
passphrase, save = w.run()
|
||||||
count += 1
|
if passphrase == -1:
|
||||||
w = dialogs.PassphraseDialog(title, second,
|
passphrase = None
|
||||||
_('Save passphrase'))
|
password_ok = True
|
||||||
passphrase, save = w.run()
|
else:
|
||||||
if passphrase == -1:
|
password_ok = gajim.connections[account].\
|
||||||
passphrase = None
|
test_gpg_passphrase(passphrase)
|
||||||
password_ok = True
|
title = _('Wrong Passphrase')
|
||||||
else:
|
second = _('Please retype your GPG passphrase or '
|
||||||
password_ok = gajim.connections[account].\
|
'press Cancel.')
|
||||||
test_gpg_passphrase(passphrase)
|
if passphrase != None:
|
||||||
title = _('Wrong Passphrase')
|
self.gpg_passphrase[keyid] = passphrase
|
||||||
second = _('Please retype your GPG passphrase or '
|
gobject.timeout_add(30000, self.forget_gpg_passphrase,
|
||||||
'press Cancel.')
|
keyid)
|
||||||
if passphrase != None:
|
|
||||||
self.gpg_passphrase[keyid] = passphrase
|
|
||||||
gobject.timeout_add(30000, self.forget_gpg_passphrase,
|
|
||||||
keyid)
|
|
||||||
if save:
|
|
||||||
gajim.config.set_per('accounts', account, 'savegpgpass',
|
|
||||||
True)
|
|
||||||
gajim.config.set_per('accounts', account, 'gpgpassword',
|
|
||||||
passphrase)
|
|
||||||
gajim.connections[account].gpg_passphrase(passphrase)
|
gajim.connections[account].gpg_passphrase(passphrase)
|
||||||
|
|
||||||
if gajim.account_is_connected(account):
|
if gajim.account_is_connected(account):
|
||||||
|
|
Loading…
Add table
Reference in a new issue