Browse Source

Have curl read Authrorizaton header from stdin rather than the command line.

Prevents GoDaddy secret and key from exposure via ps.

There is still an issue if environment variables can be read.
pull/289/head
Timothe Litt 9 years ago
parent
commit
820dec6d3f
1 changed files with 15 additions and 9 deletions
  1. +15
    -9
      dns_scripts/dns_godaddy

+ 15
- 9
dns_scripts/dns_godaddy View File

@ -178,8 +178,6 @@ fi
echo "`basename $0`: $op $domain $name \"$data\" $ttl" >&2
# Authorization header has secret and key
# N.B. These will appear in a 'ps' listing since curl only allows
# headers to be provided on the command line.
authhdr="Authorization: sso-key $GODADDY_KEY:$GODADDY_SECRET"
@ -199,9 +197,12 @@ Add request to: $url
$request"
--------
EOF
result="$(curl -i -s -X PUT -H "$authhdr" \
-H "Content-Type: application/json" \
-d "$request" "$url")"
result="$(curl -i -s -X PUT -d "$request" --config - "$url" <<EOF
header = "Content-Type: application/json"
header = "$authhdr"
EOF
)"
sts=$?
[ -n "$DEBUG" ] && cat >&2 <<EOF
@ -255,7 +256,10 @@ while [[ "$domain" =~ [^.]+\.[^.]+ ]]; do
url="$API/$domain/records/TXT"
[ -n "$DEBUG" ] && echo "Query for TXT records to: $url" >&2
current="$(curl -i -s -X GET -H "$authhdr" "$url")"
current="$(curl -i -s -X GET --config - "$url" <<EOF
header = "$authhdr"
EOF
)"
sts=$?
if [ $sts -ne 0 ]; then
echo "curl error $sts for query" >&2
@ -357,9 +361,11 @@ $request
--------
EOF
result="$(curl -i -s -X PUT -H "$authhdr" \
-H "Content-Type: application/json" \
-d "$request" "$url")"
result="$(curl -i -s -X PUT -d "$request" --config - "$url" <<EOF
header = "Content-Type: application/json"
header = "$authhdr"
EOF
)"
sts=$?
[ -n "$DEBUG" ] && cat >&2 <<EOF


Loading…
Cancel
Save