Skip to content
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

Please enter password for encrypted keyring #23

Closed
notDavid opened this issue Sep 19, 2015 · 15 comments
Closed

Please enter password for encrypted keyring #23

notDavid opened this issue Sep 19, 2015 · 15 comments

Comments

@notDavid
Copy link

Hi,
how do i configure urlwatch to send e-mails (my smtp provider requires TLS) without having to interactively type a password? Currently i get a popup saying "Please enter password for encrypted keyring:" which means i can't run the command in crontab/automatically.

thanks.

@k2ack
Copy link

k2ack commented Sep 19, 2015

What platform are you using?

@notDavid
Copy link
Author

Debian Jessie 8.1, without desktop environment, only commandline

@notDavid
Copy link
Author

and fyi, after installing pip install keyring i had to provide the keyring password, and i wasn't allowed to set an empty password (which would have been fine since i don't use it for anything important...)

@k2ack
Copy link

k2ack commented Sep 19, 2015

Hmm - this sounds like interaction challenges with the debian secure keyring rather than something specific to the python implementation. The general idea is that you can run url watch with the appropriate command line parameter to set the password and it should be retrieved from the keyring in the future. If debian doesn't support a trust model that lets the url watch command request the password automatically then there might be a problem. This works well on Window and Mac - so I'm surprised. I will see if I can reproduce, but it will involve installing your OS and isn't likely to happen in a hurry. Apologies.

Perhaps a quick test driver that checks that keyring can work autonomously is a good idea. I will see if I can whip one up.

@muonzoo
Copy link

muonzoo commented Sep 19, 2015

Can you try to run this test code and gist the output you see and describe any non-terminal out-of-band prompts you may see?

https://gist.github.com/muonzoo/0fe4838faa2691e6f061

@muonzoo
Copy link

muonzoo commented Sep 19, 2015

(urlwatch-dev)test git:master ❯ python test_keyring.py                                                                                                                                       ✭
.
----------------------------------------------------------------------
Ran 1 test in 0.096s

OK
(urlwatch-dev)test git:master ❯ _

@notDavid
Copy link
Author

Sure, i didn't get any prompts, here's the output:

# python --version
Python 2.7.9
# python ./test_keyring.py
E
======================================================================
ERROR: setUpClass (__main__.TestKeyring)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_keyring.py", line 11, in setUpClass
    keyring.delete_password(url,user)
  File "/usr/local/lib/python2.7/dist-packages/keyring/core.py", line 50, in delete_password
    _keyring_backend.delete_password(service_name, username)
  File "/usr/local/lib/python2.7/dist-packages/keyring/backends/file.py", line 134, in delete_password
    raise PasswordDeleteError("Password not found")
PasswordDeleteError: Password not found

----------------------------------------------------------------------
Ran 0 tests in 0.013s

FAILED (errors=1)

@muonzoo
Copy link

muonzoo commented Sep 19, 2015

Apologies - I had an error in the test driver where it wouldn't work unless you had run a previous version. Please re-try (I've updated the test driver).

@notDavid
Copy link
Author

Yes now i get a password prompt (i entered the keyring password):

python ./test_keyring.py
Please enter password for encrypted keyring:
.
----------------------------------------------------------------------
Ran 1 test in 5.413s

OK

@muonzoo
Copy link

muonzoo commented Sep 19, 2015

It would appear that Debian's implementation of keyring uses the linux secret service. I don't know much about it, but you might want to investigate how to get non-encrypted access to items configured. If this doesn't work, we can consider alternatives.

Consider looking at http://standards.freedesktop.org/secret-service/ and secret-tool (2).
https://www.mankier.com/1/secret-tool -- I don't know if secret-tool is part of your distro's implementation - it is possible that your lack of window manager and session manager are causing complications.

You might be able to tell keyring to use an alternate backend that is more amenable to automation.

https://pypi.python.org/pypi/keyring#config-file-content

If this isn't something that you are comfortable with, let me know and I'll see if I can assist.

@muonzoo
Copy link

muonzoo commented Sep 19, 2015

At risk of drowning you this is also relevant: http://docs.halon.se/halonctl/modules/keyring.html -- this indicates that without KDE or Gnome you'll fall back on an encrypted store.

@notDavid
Copy link
Author

I see, good to know thanks for the info!
For now i have simply hard coded the password which solved my problem and is fine in my case - dirty solution i know... :)

@marbon87
Copy link

marbon87 commented Jul 9, 2016

I have the same problem since a few days? Previously it worked well, but now i get asked for the encryption password.
I am running urlwatch on a rpi2 with arch linux.
Is there any solution in planning?

@notDavid How did you hard coded the password?

@jlefler
Copy link

jlefler commented Jan 1, 2018

I know this issue is closed, but if anyone else has this problem on debian...

If you don't care about the password not being encrypted, you can still use Keyring on debian. You just need to tell Debian to use a plain-text backend so the password isn't required.

Create or edit the file: ~/.local/share/python_keyring/keyringrc.cfg so that it has the following contents:
[backend]
default-keyring=keyrings.alt.file.PlaintextKeyring

Credit to: Dmitry Shachnev at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882164

@timetheoretical
Copy link

Just to clarify; if you have already set the password in the encrypted keyring, it is necessary to run urlwatch --smtp-login after switching to the plain text keyring by following the steps described by @jlefler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants