acmesh-official / acme.sh

A pure Unix shell script implementing ACME client protocol
https://acme.sh
GNU General Public License v3.0
38.43k stars 4.89k forks source link

Feature request - can we add portunity here #5099

Open Helmut1965 opened 4 months ago

Helmut1965 commented 4 months ago

There Team, please can we add portunity to the next release please. The working script:

`

!/usr/bin/env sh

Author: Daniel Harp

#

Required Variables:

export PORTUNITY_USER="ASDF1234ASDF1234"

export PORTUNITY_API_KEY="CFCFCFCFCFCFCF"

PORTUNITY_API="https://wr.ispsuite.portunity.de/api/"

######## Public functions #####################

Usage: dns_portunity_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"

dns_portunity_add() { fulldomain=$1 txtvalue=$2 _info "Adding Portunity DNS Record" _debug fulldomain "$fulldomain" _debug txtvalue "$txtvalue"

PORTUNITY_USER="${PORTUNITY_USER:-$(_readaccountconf_mutable PORTUNITY_USER)}" if [ -z "$PORTUNITY_USER" ]; then PORTUNITY_USER="" _err "You must specify PORTUNITY_USER" return 1 fi

PORTUNITY_API_KEY="${PORTUNITY_API_KEY:-$(_readaccountconf_mutable PORTUNITY_API_KEY)}" if [ -z "$PORTUNITY_API_KEY" ]; then PORTUNITY_API_KEY="" _err "You must specify PORTUNITY_API_KEY" return 1 fi

_saveaccountconf_mutable PORTUNITY_USER "$PORTUNITY_USER" _saveaccountconf_mutable PORTUNITY_API_KEY "$PORTUNITY_API_KEY" if ! _portunity_rest "add" "$fulldomain" "$txtvalue"; then _err "Portunity add record failed" return 1 fi

_info "Add successful" return 0 }

Usage: fulldomain txtvalue

Remove the txt record after validation.

dns_portunity_rm() { fulldomain=$1 txtvalue=$2 _info "Removing Portunity DNS Record" _debug fulldomain "$fulldomain" _debug txtvalue "$txtvalue"

if ! _portunity_rest "delete" "$fulldomain" "$txtvalue"; then _err "Portunity delete record failed" return 1 fi

_info "Delete successful" return 0 }

#################### Private functions below ################################## _portunity_rest() { action="$1" fulldomain="$2" txtvalue="$3"

user_trimmed=$(printf "%s" "$PORTUNITY_USER" | tr -d '"') key_trimmed=$(printf "%s" "$PORTUNITY_API_KEY" | tr -d '"') authorization=$(printf "%s" "$user_trimmed:$key_trimmed" | _base64)

data=$(printf 'data={"api":"product-dns","action": "%s","rrset": {"type": "TXT","name":"%s","ttl":30,"records":[{"content": "%s"}]}}' "$action" "$fulldomain" "$txtvalue")

_debug data "$data" response="$(_post "$data" "$PORTUNITY_API")"

ret_cd="$?" if [ "$ret_cd" != "0" ]; then _err "Post to portunity failed. Return code: $ret_cd" return 1 fi if ! _contains "$response" '"ok"'; then _err 'Response from Portunity did not include "ok". Check error message in response.' _err "$response" return 1 fi

_debug2 "Response from Portunity: $response" return 0 }

`

github-actions[bot] commented 4 months ago

Please upgrade to the latest code and try again first. Maybe it's already fixed. acme.sh --upgrade If it's still not working, please provide the log with --debug 2, otherwise, nobody can help you.

Neilpang commented 4 months ago

send pr please

Helmut1965 commented 4 months ago

Dear Neil, I'm not so expedience, please what is the meaning of "send pr pleas"? Should I send you the script?

scruel commented 4 months ago

Dear Neil, I'm not so expedience, please what is the meaning of "send pr pleas"? Should I send you the script?

Check: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request https://www.google.com/search?q=how+to+make+pull+request+github

Helmut1965 commented 4 months ago

@scruel, thanks for the reply. I don't know about the way to work with git-hub. I found the code from Daniel Harb and I changed one statement. So I'm able to use the vi. I'm looking for somebody who is able to bring the script (sorry for the bad formatting) to git and to the official package. I'm not able to do due to missing knowledge. Helmut