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

Pass credentials in environment variables #31

@fts-tmassey

Description

@fts-tmassey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions