Backing up Master Keys via iControl REST

Problem this snippet solves:

Having a backup copy of a chassis master key can be valuable during a recovery event. For organizations with large deployments, automating the process certainly helps.

How to use this snippet:

To back up the magic key via API, use the bash util command URI with the proper payload:

Sample URI:

https://192.168.1.100/mgmt/tm/util/bash

Payload:

{“command”:“run”,“utilCmdArgs”:“-c ‘f5mku -K’”}

Response:

{“kind”:“tm:util:bash:runstate”,“command”:“run”,“utilCmdArgs”:“-c ‘f5mku -K’”,“commandResult”:“ZFLI5n83NuetlE9A+bYqwg==\n”}

The master key is the commandResult field, minus the trailing \n.

Code :

curl -sku admin:admin -H "content-type: application/json" -X POST https://192.168.1.100/mgmt/tm/util/bash -d {"command":"run","utilCmdArgs":"-c 'f5mku -K'"}

Tested this on version:

13.0