#!/bin/sh for uuid in $(vault list -format=json "$1/issuers" | jq -r '.[]') ; do vault read -field=certificate "$1/issuer/$uuid" >cert.pem newname=$(openssl x509 -noout -in cert.pem -subject_hash) mv cert.pem "${newname}.pem" done