aszlig / hetzner

A high-level Python API for accessing the Hetzner robot.
https://pypi.python.org/pypi/hetzner
Other
129 stars 36 forks source link

Add a password_command config option #43

Open lucc opened 3 years ago

lucc commented 3 years ago

I am not happy with saving my Hetzner password to disk in plain text. So I was looking for a way to allow hetznerctl to query my password manager but did not see one (I could hack together a shell script that generates a temporary config file and calls hetznerctl, but that is ugly).

Would you be interested to support some kind of integration with password managers? I am interested in coding it.

Ideas

  1. Add a password_cmd config option that can be set instead of password and use it as a shell command that will output the password that will be used. I would implement this option as it is little work and fixes the issue for me. Down side: not very integrated UI, every user who wants to use it has to write a shell command into the config.
  2. Depend on a library like https://github.com/jaraco/keyring, I am not sure which one is the best library for this but this looks like a more integrated solution for end uses (I am not sure if that library supports pass so that might not be a solution for me)
aszlig commented 3 years ago

Well, I originally wrote the hetznerctl tool as a debugging tool, but it turns out people are actually using it, who could have known?! :see_no_evil:

Nevertheless, I guess I can't undo it anymore, so let's move forward: Yes, such a password_cmd could be useful, especially since I myself use something similar for other software, so the first point you're mentioning is more flexible.

However, I'd also do the same for the username setting, so maybe it makes sense to implement this in a generic way, eg. by allowing {any_setting}_cmd.

lucc commented 3 years ago

For me as a sysadmin the hetznerctl command could be the complement to the hcloud command. I was wondering before why Hetzner did only allow me to manage half of my servers via the cli. But luckily you are here :)

I will start a PR and we can discuss the implementation there.

lucc commented 3 years ago

Which python versions are you targeting? I did not find a specification in setup.py. I saw the try-block to import configparser and that looks like python2. What is the minimum version of py3 you want to support?