Open faonecze opened 2 years ago
我也一样,显示如下
阿里云UpdateDomainRecord接口请求处理失败,返回代码:SignatureDoesNotMatch消息:Specified signature is not matched with our calculation. server string to sign is:GET&%2F&AccessKeyId%3DLTAI5tDqtFAQbdxPCD5QVF99%26Action%3DUpdateDomainRecord%26Format%3Djson%26RR%3Dddns%26RecordId%3D741592597507382272%26SignatureMethod%3DHMAC-SHA1%26SignatureNonce%3Daeac180f-67b8-45ee-b273-754563fd2ec3%26SignatureVersion%3D1.0%26TTL%3D600%26Timestamp%3D2022-02-13T07%253A37%253A01Z%26Type%3DAAAA%26Value%3D240e%253A361%253Ab286%253A600%253A215%253A18ff%253Afe01%253A8131%26Version%3D2015-01-09
查看阿里云API文档,错误信息才会返回Code,所以修改710行 fun_send_request 为
if [[ "$response" =~ 'Code' ]]; then fun_wirte_log "${message_warning_tag}阿里云$2接口请求处理失败,返回代码:${code}消息:${message}" else fun_wirte_log "${message_success_tag}阿里云$2接口请求处理成功,返回消息:${message}" fi
@liliangliang176 大佬求解,我也遇到这个问题了,你解决了木有,卡了大半天了0.0
ipv6用户在使用该脚本的时候,会出现SignatureDoesNotMatch
的错误。这会造成dns修改失败。
该脚本缺少了对ipv6
地址的预处理。即没有预先将ipv6
地址中的:
替换为%3A
,这回造成本地签名和阿里云服务器签名不一致的问题。
脚本对ipv6地址的签名(Value部分):
Value%3D2409%3Axxxx%3Axxxx%3A6970%3A215%3Axxxx%3Axxxx%3A8102
阿里云对ipv6地址的签名(Value部分):
Value%3D2409%253Axxxx%253Axxxx%253A6970%253A215%253Axxxx%253Axxxx%253A8102
通过对比,我们可以清楚的看出,脚本将":"编码为了"%3A",而阿里云将":"编码为了"%253A"。也就是说阿里云对":"进行了两次编码,而脚本只进行了一次。
在脚本940行之后,添加以下代码
fun_get_ip_encryption() {
local ip=$var_local_wan_ip
echo -n "$ip" | fun_ip_encode
}
fun_ip_encode() {
out=""
while read -n1 c
do
case ${c} in
[a-zA-Z0-9]) out="$out$c" ;;
:) out="$out""%3A" ;;
esac
done
echo -n ${out}
}
修改第777行中的Value=$var_local_wan_ip
为Value=$(fun_get_ip_encryption)
运行后都正常提示而且说,更新成功。 但是查看日志dns值并没有修改更新.