Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Pass credentials in environment variables #31

Open
fts-tmassey opened this issue Dec 10, 2020 · 1 comment
Open

Pass credentials in environment variables #31

fts-tmassey opened this issue Dec 10, 2020 · 1 comment

Comments

@fts-tmassey
Copy link

Hello!

Passing credentials (username and password) on the command line is no bueno: it's trivial to see the command line of a task running on a system! Plus, if you start your task with e.g. systemd, you will need to hard-code your password into your unit files. Not for me.

So, I modified the code to add an -e (--env) parameter. That allows the SXM_USER and SXM_PASS variables to override the username and password passed on the command line. Combined with the EnvironmentFile parameter of a systemd unit file, this will allow you to store your credentials to be stored in a file (owned by, say, root with 400 ownership).

I wanted to change the underlying code as little as possible, so the username and password parameters are still required: I just use "user" and "pass". With the -e parameter, they will get overwritten by the environment variables (if the variables exist). If the author wanted to clean this up further (like not using the parameter in the first place and simply defining that the environment variables work all the time, and possibly allowing the username and password parameters to be optional if the environment variables exist), that would be trivial. In fact, I volunteer to do that if andrew0 wants me to (and will check in the results!!!). Otherwise, my changes are as minimal as possible and meet my needs. Hopefully they might meet yours, too.

A shout out to kryptek and his fork here: https://github.com/kryptek/SiriusXM He has a more comprehensive way of doing this with configuration files, plus more features. However, his script requires more modules, etc. and I don't personally need those features (mostly recording SXM streams) so I'm sticking with the basic script with my couple of patches.

@fts-tmassey
Copy link
Author

I forgot to put where the changes are: https://github.com/fts-tmassey/SiriusXM

Oh, and mea culpa for putting the changes in the master branch. The changes were so trivial I simply edited them in the GitHub web interface, and missed the "create a new branch" part when I committed! And you can't undo that from the GUI... :(

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

No branches or pull requests

1 participant