-
Notifications
You must be signed in to change notification settings - Fork 3.2k
plugins: add functionality to allow setting plugin pubkey from gui #9765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
a5c91fd
to
08927bb
Compare
electrum/plugin.py
Outdated
""" | ||
from winreg import ConnectRegistry, OpenKey, QueryValue, HKEY_LOCAL_MACHINE | ||
|
||
key_path = r'HKEY_LOCAL_MACHINE\SOFTWARE\Electrum\PluginsKey' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be deduped somehow with self.keyfile_windows
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i replaced the self.keyfile_windows var with a valid registry path and now use it for the prompt and the auto setup.
electrum/gui/qt/plugins_dialog.py
Outdated
auto_setup_btn = QPushButton(_('Try Auto-Setup')) | ||
def on_auto_setup_clicked(): | ||
if not self.plugins.try_auto_key_setup(key_hex): | ||
self.show_error(_("Auto-Setup not possible. Try the manual setup.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we should still show the manual setup instructions if this happens, but the popup gets closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(btw at the same time, we should probably improve the manual instructions, e.g. for Linux, write copy-pasteable and readable commands, such as:
$ sudo sh -c 'echo "015d0f863d213e7bd4549ec45d1155d43268b7dd5387728936e5a937346d53b3fe02f8495dabc5111401d7a5b897ccb11c34f3dc6b51afeff637d55efe61aa75edf3" > /etc/electrum/plugins_key'
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this, it now also shows a shell command in the prompt that can be used to setup the key.
08927bb
to
5eabbe3
Compare
Adds functionality that allows the user to store the plugin authorization pubkey without having to edit files/registry manually. On Linux systems it spawns the commands in a subprocess with pkexec which will trigger a OS prompt to execute the commands as root. The user sees the executed commands and can either authorize with the root password or decline. On windows it uses the windows `ShellExecuteExW` api to edit the registry, this also triggers a OS dialog to accept or decline (UAC dialog). There is also functionality to reset the key again, which works in the same way.
27105af
to
abc50a9
Compare
Now this also implements support for MacOS |
Adds functionality that allows the user to store the plugin authorization pubkey without having to edit files/registry manually. On Linux systems it spawns the commands in a subprocess with polkits pkexec which will trigger an OS prompt to execute the commands as root. The user sees the executed commands and can either authorize with the root password or decline.
On windows it uses the windows
ShellExecuteExW
api to execute reg.exe with elevated permissions to edit the registry, this also triggers an OS dialog the user can accept or decline (UAC dialog).There is also functionality to reset the key again, which works in the same way.
I tested this from source on both plattforms and as AppImage and Windows installer.
On macos it wraps the shell command in applescript and runs the applescript as subprocess which will also start a OS prompt the user has to accept.
The windows OS prompt:
The Linux (KDE) prompt: