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

Feature request: Support getting password via an external means #314

Closed
nogweii opened this issue Oct 9, 2012 · 7 comments
Closed

Feature request: Support getting password via an external means #314

nogweii opened this issue Oct 9, 2012 · 7 comments

Comments

@nogweii
Copy link

nogweii commented Oct 9, 2012

So I like to have an automatic log in with Pandora, but I don't want to store my password in clear text. The most portable way I can think of is supporting being able to run an external command & use it's output as the password. (stdout, not stderr though) You could, also, implement a gnome-keyring or kde-wallet client, but I'm not sure that'll work well for users in other DE's & those that use neither.

Thoughts?

@PromyLOPh
Copy link
Owner

As far as I can see gnome-keyring is deprecated and kde-wallet requires
dbus. But there are commandline tools for both of them.

I like the idea though. Are you aware of any program that has a similar
feature?

@nogweii
Copy link
Author

nogweii commented Oct 10, 2012

The immediate thought I have is offlineimap, though it's not at all what I expect. Since offlineimap is written in python, it supports loading a python file and using a function from that to return the password.

Mutt also supports this concept, though not specifically this. It's configuration file supports calling external commands via foo, with it being replaced by the output of foo.

msmtp supports passing in a one-liner as a command line parameter via it's --passwordeval parameter. Standard behaviour there, execute what you passed in, and if $? == 0, use the output as the password.

@PromyLOPh
Copy link
Owner

Have a look at the branch passcmd. Works for me with gpg --decrypt ~/passwordsafe/pandora.gpg.

@nogweii
Copy link
Author

nogweii commented Oct 16, 2012

It works well! It took me a bit to figure out how to pass parameters to the command -- I couldn't quote the entire value, instead I had to use the following;

password_command = '/bin/echo' 'mypassword'

Helpfully, /bin/sh will also substitute the appropriate value for ~, so I could also use the following:

password_command = ~/bin/pianobar-get-password

And have it execute as I expected it to. Seems like it works in every way I could imagine!

To note, though I don't expect that you need to really consider this, is if the command outputs information to stderr, it is sent directly to the terminal. Also, if there is no output captured by pianobar, e.g. when there is only errors printed to stderr and nothing to stdout, pianobar will continue trying to log into Pandora with an empty password.

Thanks for the quick turn-around on this!

@PromyLOPh
Copy link
Owner

password_command = '/bin/echo' 'mypassword'

The quotes shouldn’t be necessary.

To note, though I don't expect that you need to really consider this,
is if the command outputs information to stderr, it is sent directly
to the terminal.
Suppressing stderr doesn’t look right to me either :/

Also, if there is no output captured by pianobar, e.g. when there is
only errors printed to stderr and nothing to stdout, pianobar will
continue trying to log into Pandora with an empty password.
In theory the command exits with a status != 0 in that case. We could
check for an empty string though – I guess empty passwords are not
permitted anyway.

@nogweii
Copy link
Author

nogweii commented Oct 18, 2012

The quotes shouldn’t be necessary.

...I did get a no such command. Now, it works. Oh well. More than likely, I made typo or something.

Suppressing stderr doesn’t look right to me either :/

And I don't think you should, either. Just something to note.

In theory the command exits with a status != 0 in that case. We could check for an empty string though – I guess empty passwords are not permitted anyway.

You're right that empty passwords are not allowed in pandora, but we're starting to down a rabbit hole of second-guessing the output from the command. Usually a lot easier to just accept whatever the output may be, and use that. If it's an empty string, that should up to the user to fix themselves.

@PromyLOPh
Copy link
Owner

I added documentation and merged the feature into master. Thanks for the
suggestion :)

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

2 participants