Is there a good way to get DKIM value for a specific domain via API through curl in bash? Doesn't seems to have much documentation about this CMD_API_DNS_CONTROL: https://www.directadmin.com/features.php?id=626
Currently I use this method it works but I think this is too complex. I'm not sure if there is a simpler way than this:
The sample output (the value of dkim key for domain test.com):
Is there a hidden feature that we able to query this easily using pure CMD_API_ ?
Currently I use this method it works but I think this is too complex. I'm not sure if there is a simpler way than this:
Code:
#!/bin/bash
api_username="username"
api_password="12321"
da_port="2222"
hostname="test.hostname.com"
ssl="https"
command="CMD_API_DNS_CONTROL"
domain="test.com"
data="domain=${domain}"
method="POST"
input=$(curl --request "${method}" --user "${api_username}":"${api_password}" --data "${data}" "${ssl}://${hostname}:${da_port}/${command}")
decoded_status=$(printf '%b' "${input//%/\\x}") # Remove encoding character
echo "${decoded_status}" | grep 'x._domainkey' | awk '{ print $6" "$7" "$8}'
The sample output (the value of dkim key for domain test.com):
Code:
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEXrHHDF4Yelpw2eAMFkQg69ZYCD09EBoJVlc4Zcgb0TNC+B0qNiO6X3UtXOgFiqlgU"
Is there a hidden feature that we able to query this easily using pure CMD_API_ ?
Last edited: