Created
October 3, 2024 17:16
-
-
Save stefanpejcic/8ebe3dcb79d18b429786b699985c558e to your computer and use it in GitHub Desktop.
get JetBackup5 encryption key for a server runninf WHM/cPanel
This file contains hidden or 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 | |
# Print JB encryption key | |
token=$(whmapi1 api_token_create token_name=temp 2>/dev/null | grep -oP '(?<=token: ).*' 2>/dev/null) | |
hostname=$(hostname) | |
encryption_key=$(curl --insecure -H "Authorization: whm root:$token" "https://$hostname:2087/cgi/addons/jetbackup5/api.cgi?function=getMasterEncryptionKey" 2>/dev/null | grep -o '"encryption_key":"[^"]*' | awk -F '"' '{print $4}') | |
whmapi1 api_token_revoke token_name='temp' &>/dev/null | |
echo "$encryption_key" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment