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

Report bugs to HuaweiCloud DNS API #3265

Open
eastonman opened this issue Nov 24, 2020 · 9 comments
Open

Report bugs to HuaweiCloud DNS API #3265

eastonman opened this issue Nov 24, 2020 · 9 comments
Assignees
Labels
3rd party api report bugs to dns api, deploy hooks and notification hooks

Comments

@eastonman
Copy link
Contributor

Please report here if you encounter any bugs related to HuaweiCloud DNS API

@Neilpang Neilpang added the 3rd party api report bugs to dns api, deploy hooks and notification hooks label Nov 25, 2020
@tutugreen
Copy link
Contributor

Hi,发现一些小问题。

_get_zoneid

_get_zoneid() {
_token=$1
_domain_string=$2
export _H1="X-Auth-Token: ${_token}"
i=1
while true; do
h=$(printf "%s" "${_domain_string}" | cut -d . -f $i-100)
if [ -z "$h" ]; then
#not valid
return 1
fi
_debug "$h"
response=$(_get "${dns_api}/v2/zones?name=${h}")
if _contains "${response}" "id"; then
_debug "Get Zone ID Success."
_zoneid=$(echo "${response}" | _egrep_o "\"id\": *\"[^\"]*\"" | cut -d : -f 2 | tr -d \" | tr -d " ")
printf "%s" "${_zoneid}"
return 0
fi
i=$(_math "$i" + 1)
done
return 1
}

由于接口是模糊搜索的,当账户存在 同域子域名更长但末尾相同的域名 等情况时,会Get到多个ID

例如账户存在公网解析域名:
a.com
b.a.com
ca.com

如果为 d.a.com 创建DNS验证时,会用a.com,response筛出3个Zone的ID,处理后换行分割,在 _add_record GET 时

response=$(_get "${dns_api}/v2/zones/${zoneid}/recordsets?name=${_domain}")

会异常

@tutugreen
Copy link
Contributor

_get_recordset_id()

if _contains "${response}" "id"; then

返回的response的"self"包含被检索的name。

{
"links": {
"self": "https://dns.myhuaweicloud.com/v2/zones/xxxxxxxxxx/recordsets?name=id.aaa.com"
},
"recordsets": [],
"metadata": {
"total_count": 0
}
}

如果只是判断 “id” 字符串是否存在,会导致包含 "id" 的域名,例如 aaaaid.com、或者 id.aaa.com,recordset一直判为存在,无限重复尝试删除。

@eastonman
Copy link
Contributor Author

eastonman commented Jan 13, 2022

@tutugreen 感谢您!
acme.sh这边提交PR需要跑action的测试 https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Test
#3887 的PR如果不方便配置action,也可以由我帮您提交PR

@tutugreen
Copy link
Contributor

tutugreen commented Jan 13, 2022

@eastonman Wow,谢谢指导!我这边试试调整下。

2022-01-05 Edited:试了N波,终于把 Check 跑通了,有讲究的,学到很多,重新提了PR。

@hayye
Copy link

hayye commented Sep 24, 2024

报错了,提示
dns_api(dns_huaweicloud): Error getting token.

@sub-rats
Copy link

报错了,提示 dns_api(dns_huaweicloud): Error getting token.

修改 dnsapi 中 dns_huaweicloud.sh

修改 dns_api="https://dns.ap-southeast-1.myhuaweicloud.com"

将 ap-southeast-1 改为国内任意一个节点,如 :cn-north-4

@hayye
Copy link

hayye commented Sep 25, 2024

报错了,提示 dns_api(dns_huaweicloud): Error getting token.

修改 dnsapi 中 dns_huaweicloud.sh

修改 dns_api="https://dns.ap-southeast-1.myhuaweicloud.com"

将 ap-southeast-1 改为国内任意一个节点,如 :cn-north-4

我好像知道问题了,我这个是华为账号不是华为云账号,看华为官方文档,华为账号是不能通过密码获取token的,,只有华为云账号才可以,,或者就是升级到企业用户在创建子账户去获取,,华为这逻辑是真恶心啊

@yanshibin
Copy link

报错了,提示 dns_api(dns_huaweicloud): Error getting token.

修改 dnsapi 中 dns_huaweicloud.sh
修改 dns_api="https://dns.ap-southeast-1.myhuaweicloud.com"
将 ap-southeast-1 改为国内任意一个节点,如 :cn-north-4

我好像知道问题了,我这个是华为账号不是华为云账号,看华为官方文档,华为账号是不能通过密码获取token的,,只有华为云账号才可以,,或者就是升级到企业用户在创建子账户去获取,,华为这逻辑是真恶心啊

创建了子账号 给了admin 权限都获取不了啊

@wangjianls
Copy link

成功获取。有几个注意的点

  1. 账号必须是子账号,创建子账号时需要关闭登录保护
  2. 修改/root/.acme.sh/dnsapi/dns_huaweicloud.sh 中的 dns_api,以及get token ,body中的为同一个值,我写的 cn-north-4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party api report bugs to dns api, deploy hooks and notification hooks
Projects
None yet
Development

No branches or pull requests

7 participants