Forked from JonathonReinhart/decrypt-pfsense-config.sh
Created
December 21, 2020 09:23
-
-
Save markwell-ch/9247e00e9ce91ebeca6984bf7bc611b1 to your computer and use it in GitHub Desktop.
Decrypt pfSense encrypted config backups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Adapted from https://forum.netgate.com/topic/139561 | |
set -o pipefail | |
if [[ $# -lt 1 ]]; then | |
echo "Usage: $(basename $0) <encrypted-config>" | |
exit 1 | |
fi | |
inpath="$1" | |
tmpout="$(mktemp)" | |
cat "$inpath" \ | |
| openssl enc -a -d -aes-256-cbc -md md5 \ | |
> $tmpout | |
exitstatus=$? | |
if [[ $exitstatus -eq 0 ]]; then | |
cat $tmpout | |
fi | |
rm $tmpout | |
exit $exitstatus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from
openssl enc
manual page: