Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request - can we add portunity here #5099

Open
Helmut1965 opened this issue Apr 19, 2024 · 5 comments
Open

Feature request - can we add portunity here #5099

Helmut1965 opened this issue Apr 19, 2024 · 5 comments

Comments

@Helmut1965
Copy link

Helmut1965 commented Apr 19, 2024

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
}

`

Copy link

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
Copy link
Member

send pr please

@Helmut1965
Copy link
Author

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

@scruel
Copy link
Contributor

scruel commented Apr 25, 2024

@Helmut1965
Copy link
Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants