#!/usr/bin/env sh ######################################################################## # Geoscaling hook script for acme.sh # # Environment variables: # # - $GEOSCALING_Username (your Geoscaling username - this is usually NOT an amail address) # - $GEOSCALING_Password (your Geoscaling password) #-- dns_geoscaling_add() - Add TXT record -------------------------------------- # Usage: dns_geoscaling_add _acme-challenge.subdomain.domain.com "XyZ123..." dns_geoscaling_add() { full_domain=$1 txt_value=$2 _info "Using DNS-01 Geoscaling DNS2 hook" GEOSCALING_Username="${GEOSCALING_Username:-$(_readaccountconf_mutable GEOSCALING_Username)}" GEOSCALING_Password="${GEOSCALING_Password:-$(_readaccountconf_mutable GEOSCALING_Password)}" if [ -z "$GEOSCALING_Username" ] || [ -z "$GEOSCALING_Password" ]; then GEOSCALING_Username= GEOSCALING_Password= _err "No auth details provided. Please set user credentials using the \$GEOSCALING_Username and \$GEOSCALING_Password environment variables." return 1 fi _saveaccountconf_mutable GEOSCALING_Username "${GEOSCALING_Username}" _saveaccountconf_mutable GEOSCALING_Password "${GEOSCALING_Password}" # Fills in the $zone_id and $zone_name find_zone "${full_domain}" || return 1 _debug "Zone id '${zone_id}' will be used." # We're logged in here # we should add ${full_domain} minus the trailing ${zone_name} prefix=$(echo "${full_domain}" | sed "s|\\.${zone_name}\$||") body="id=${zone_id}&name=${prefix}&type=TXT&content=${txt_value}&ttl=300&prio=0" do_post "$body" "https://www.geoscaling.com/dns2/ajax/add_record.php" exit_code="$?" if [ "${exit_code}" -eq 0 ]; then _info "TXT record added successfully." else _err "Couldn't add the TXT record." fi do_logout return "${exit_code}" } #-- dns_geoscaling_rm() - Remove TXT record ------------------------------------ # Usage: dns_geoscaling_rm _acme-challenge.subdomain.domain.com "XyZ123..." dns_geoscaling_rm() { full_domain=$1 txt_value=$2 _info "Cleaning up after DNS-01 Geoscaling DNS2 hook" # fills in the $zone_id find_zone "${full_domain}" || return 1 _debug "Zone id '${zone_id}' will be used." # Here we're logged in # Find the record id to clean # get the domain response=$(do_get "https://www.geoscaling.com/dns2/index.php?module=domain&id=${zone_id}") _debug2 "response" "$response" table="$(echo "${response}" | tr -d '\n' | sed 's|.*