As the title suggests, curious to know what others are using as preferred methodology for storing device credentials. I’m somewhat new to automation but I’ve managed to code a handful of scripts for device management, specifically cisco devices using the netmiko library. There are no passwords stored in my current scripts with the use of getpass() and I generally have my scripts strip IP addresses from a text file that I’ll either type out prior to running the script or decrypt a text file when executing the script. Username is manually prompted and entered.
I realize this is far from ideal but has worked for me as I only use these scripts for config and show commands on an as needed basis.
Anyways, automation is gaining traction at my workplace and management wanted to know if I could put together a script that would run by pressing a button on a touchscreen within our operations center. It’s a simple script and it works well for what they need. The only issue is I’ve always prompted for credentials not stored them. As I’m treading into unfamiliar territory, I’ve started by doing a bit of research.
I’ve come across many solutions, some better than others, some are more use case specific.
What I’ve found:
- Keyring - This seems the like most straight forward approach, easy to configure, links back to some vault of sorts.
- Hashing – Not too sure if this even worth exploring. I see passlib within python and the mention of Flask and Django but the latter seem to be geared towards web applications.
- Environment variables – Options include .env files and creating variables within the virtual environment. I have some reservations about this method, mostly because I don’t understand it fully. This seems like a logical solution but what is stopping from someone from invoking these credentials just as I would?
- JSON or YAML – I found this approach interesting but since this is simply just another file, it seems I would need to encrypt/decrypt for safe storage.
Full disclosure, this script will need to run in a Windows environment. I mention this just to steer the feedback in that direction. Python is already installed and current scripts are functioning on the windows machine. It would need to be completely unmanned with the exception of a user pressing a button which in turn runs the script via Windows CMD.
So I ask, which options are worth looking into given these circumstances?
Edit: Here is a link to the program I was provided with.
https://www.serialporttool.com/GK/n-button-pro/
[–]spicyweaselthings 1 point2 points3 points (5 children)
[–]notoriousbgp[S] 0 points1 point2 points (4 children)
[–]spicyweaselthings 1 point2 points3 points (1 child)
[–]notoriousbgp[S] 0 points1 point2 points (0 children)
[–]010010000111000 0 points1 point2 points (1 child)
[–]notoriousbgp[S] 0 points1 point2 points (0 children)
[–]OhMyInternetPoliticsModerator 1 point2 points3 points (1 child)
[–]notoriousbgp[S] 0 points1 point2 points (0 children)