Skip to content

Instantly share code, notes, and snippets.

@stefanpejcic
Created October 3, 2024 17:16
Show Gist options
  • Save stefanpejcic/8ebe3dcb79d18b429786b699985c558e to your computer and use it in GitHub Desktop.
Save stefanpejcic/8ebe3dcb79d18b429786b699985c558e to your computer and use it in GitHub Desktop.
get JetBackup5 encryption key for a server runninf WHM/cPanel
#!/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