bruncsak / ght-acme.sh

Get publicly trusted certificate via ACME protocol from LetsEncrypt or from BuyPass
GNU General Public License v2.0
41 stars 9 forks source link

Push token example collection #11

Closed rdoeffinger closed 1 year ago

rdoeffinger commented 1 year ago

It would be nice to have a place to collect push token implementations. Many (like mine) will be pretty bad, but with multiple users they have a chance of getting polished, and even if not it will be a starting point for anyone using the same provider. I have attached my solution for using the IONOS (1and1) DNS API, maybe it helps someone.

#!/bin/sh
COMMAND='{ "disabled": true, "content": "null" }'
if [ "$1" = "add" ] ; then
  COMMAND='{ "disabled": false, "content": "'$3'" }'
fi
# Note: this script is only able to update existing entries
# to reduce the risk of making a mess and to make it simpler
# so you must create all _acme-challenge DNS entries before using it
URL="https://api.hosting.ionos.com/dns/v1/zones/<insert you zone ID>/records/<insert your _acme-challenge entry ID>"
# add a condition on to make URL depend on $2 to support multiple domains

# header.txt should contain your API key
# Could also use the -H @header.txt syntax,
# then header.txt only consists of
# X-API-Key: publicprefix.encryptionkey
curl -X PUT "$URL" -K header.txt -H 'accept: application/json' -H 'Content-Type: application/json' -d "$COMMAND"

pushdns.txt

bruncsak commented 1 year ago

I think having push token example collection is a good idea. There is already a directory for that: /contrib . Just make a pull request for your script into that directory.

rdoeffinger commented 1 year ago

Thanks, created pull request #12 , I guess can close this one then? Or maybe want to add a section about push scripts in contrib in the README?

bruncsak commented 1 year ago

I merged you contribution, thanks! Please do not hesitate to modify the README file to include the section you think appropriate.

rdoeffinger commented 1 year ago

I made pull request #13 as my best quick attempt to add a bit of documentation. I'll close this one, I think there's nothing else to do on this topic.