Let's say you're having a bad day and while trying to upgrade your AWX instance you instead unrecoverably brick it, and then you realize that you made a point of storing a very important SSH key in AWX and nowhere else. Why? REASONS.
- The secret key from your AWX config file.
- A dump of your postgres database in plaintext.
- If you're lucky yours is still functional and you can just query it.
- Gumption.
- Find the data you want to rescue, in
example_dump
this is out of themain_credential
table. - Check the definition of the table to find the primary key. In this case it is the
id
column, which is the first one. - Plug in the relevant values to
decrypt.py
.
It's not super clear it the field_name
is always going to be the key in the dict or a column name, or under what circumstances the pk
is omitted, but this is what worked for me.
First of all: a thanks to wrossman for publishing this, saved my bacon today.
If anyone finds this in the future I've put an updated version of this script that fixes the typos that prevents the script from working here:
https://gist.github.com/oalmlov-lst/2bd058a450a896e0462f3db832748039