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

Aliyun API without SDK dependency #253

Merged
merged 3 commits into from
Apr 17, 2023
Merged

Aliyun API without SDK dependency #253

merged 3 commits into from
Apr 17, 2023

Conversation

qdm12
Copy link
Owner

@qdm12 qdm12 commented Oct 15, 2021

  • Remove region parameter
  • Support AAAA records
  • Files split around

@qdm12 qdm12 force-pushed the aliyun-nosdk branch 3 times, most recently from 8a14828 to 1195118 Compare October 15, 2021 14:20
@cnjack
Copy link
Contributor

cnjack commented Oct 15, 2021

Hi @qdm12 I change my ip but I haven’t found the record value been changed, I will check the code tomorrow(GTM+8)

@qdm12
Copy link
Owner Author

qdm12 commented Oct 15, 2021

Thanks @cnjack feel free to also shares your logs tomorrow, to see if it fails anywhere. It should still operate the same as in list records then update the record.

@qdm12
Copy link
Owner Author

qdm12 commented Oct 24, 2021

Hey @cnjack have you had time to try it again? Thanks!!

@cnjack
Copy link
Contributor

cnjack commented Oct 25, 2021

sorry, I am out for a few days and came back yesterday, I will check it.

@cnjack
Copy link
Contributor

cnjack commented Oct 25, 2021

got error:

Received unexpected error: cannot get record ID: bad HTTP status: 400: {"RequestId":"D36EF4E4-D219-57F2-AC63-C54DF677E538","Message":"Specified signature is not matched with our calculation. server string to sign is:GET&%2F&AccessKeyId%3DABMH9WKCKEC71B7i%26Action%3DDescribeDomainRecords%26DomainName%3Dnightc.com%26Format%3DJSON%26RRKeyWord%3Dmi%26SignatureMethod%3DHMAC-SHA1%26SignatureNonce%3D7674778254249249097%26SignatureVersion%3D1.0%26Timestamp%3D2021-10-25T02%253A27%253A12Z%26Type%3DA%26Version%3D2015-01-09","Recommend":"https://error-center.aliyun.com/status/search?Keyword=SignatureDoesNotMatch&source=PopGw","HostId":"dns.aliyuncs.com","Code":"SignatureDoesNotMatch"}

@cnjack
Copy link
Contributor

cnjack commented Oct 25, 2021

image

@cnjack
Copy link
Contributor

cnjack commented Oct 25, 2021

image
hi @qdm12 pls follow this code. it works in my test case

@qdm12
Copy link
Owner Author

qdm12 commented Oct 26, 2021

Awesome @cnjack !! 💯 Thanks!

I pushed it on this branch, feel free to try the image :aliyun-nosdk again when you have the time to ensure it works. No pressure though 😉

@cnjack
Copy link
Contributor

cnjack commented Oct 26, 2021

hi @qdm12 , you haven't pushed the docker image, https://github.com/qdm12/ddns-updater/runs/4003765333?check_suite_focus=true

@cnjack
Copy link
Contributor

cnjack commented Oct 26, 2021

I got the same error(SignatureDoesNotMatch )

@qdm12
Copy link
Owner Author

qdm12 commented Oct 26, 2021

Oops sorry I forgot the CI was not automatically building images on branches. I pushed it manually, can you try pulling and run it again (docker pull qmcgaw/ddns-updater:aliyun-nosdk)? Thanks! Take your time.

@cnjack
Copy link
Contributor

cnjack commented Oct 26, 2021

I think it is work in my machine, but maybe need check the IP is equal to the record's value before update recode

ERROR cannot update record: bad HTTP status: 400: {"RequestId":"6D7D34A7-4B34-54C8-8DFF-EAC3D4027C05","HostId":"alidns.aliyuncs.com","Code":"DomainRecordDuplicate","Message":"The DNS record already exists.","Recommend":"https://error-center.aliyun.com/status/search?Keyword=DomainRecordDuplicate&source=PopGw"}

@cnjack
Copy link
Contributor

cnjack commented Oct 26, 2021

my fault, I set a record in my router's host file, so app get a LAN IP(not equal to WALN IP) and hit the update logic. ignore the above comment

@cnjack
Copy link
Contributor

cnjack commented Oct 26, 2021

I think you can merge this PR

@qdm12
Copy link
Owner Author

qdm12 commented Oct 26, 2021

Are you sure? The DNS record already exists. error should not show, the DNS record should be updated if it already exist, right?

EDIT: Also thanks for being so quick ⚡

@cnjack
Copy link
Contributor

cnjack commented Oct 26, 2021

you will hit the DomainRecordDuplicate when update the record ip same with the ip stored in DNS provider

@cnjack
Copy link
Contributor

cnjack commented Oct 26, 2021

the key point is that I set a static ip in my router's host file, the app get a LAN ip(ip in host file)

@qdm12
Copy link
Owner Author

qdm12 commented Oct 27, 2021

Ok that make sense. By the way, I received some Aliyun credentials from you by email, do you want me to try anything? I'll merge this soon, thanks again for your testing and also figuring out how to fix the signature thing (saved me some headaches!)

@cnjack
Copy link
Contributor

cnjack commented Oct 27, 2021

yes, I sent the credential by email, you mentioned that you want setup the record if the record not existed, it will be more easier if you have a real credential.

- Remove `region` parameter
- Support AAAA records
- Files split around
@cnjack
Copy link
Contributor

cnjack commented Apr 13, 2023

Great job!

@qdm12
Copy link
Owner Author

qdm12 commented Apr 14, 2023

Hello @cnjack sorry for reviving this old PR, I'm trying to create a record for test.napi.dev if it doesn't exist with AddDomainRecord but it doesn't seem to work giving me an error The specified domain name does not exist. Refresh the page and try again.. Is there any way through their API to create the domain? Or maybe it's due to the test domain? 🤔

Debug logs:

2023-04-14T14:50:55Z DEBUG GET https://alidns.aliyuncs.com?AccessKeyId=ABMH9W<redacted>&Action=AddDomainRecord&DomainName=test.napi.dev&Format=JSON&RR=%40&Signature=CY%2Fk<redacted>o%3D&SignatureMethod=HMAC-SHA1&SignatureNonce=6408606991561420191&SignatureVersion=1.0&Timestamp=2023-04-14T14%3A50%3A55Z&Type=A&Value=146.0.<redacted>&Version=2015-01-09 | headers: 
2023-04-14T14:50:57Z DEBUG 400 Bad Request | headers: X-Acs-Request-Id: 6000EF52-23F8-5FD5-9FBF-D0C3D926FEA0; X-Acs-Trace-Id: 9c81036d78932f9d603a4cb52b0197d6; Date: Fri, 14 Apr 2023 14:50:54 GMT; Content-Type: application/json;charset=utf-8; Content-Length: 302; Connection: keep-alive; Access-Control-Allow-Origin: * | body: {"RequestId":"6000EF52-23F8-5FD5-9FBF-D0C3D926FEA0","HostId":"alidns.aliyuncs.com","Code":"InvalidDomainName.NoExist","Message":"The specified domain name does not exist. Refresh the page and try again.","Recommend":"https://next.api.aliyun.com/troubleshoot?q=InvalidDomainName.NoExist&product=Alidns"}

@qdm12 qdm12 merged commit 522cc7c into master Apr 17, 2023
4 checks passed
@qdm12 qdm12 deleted the aliyun-nosdk branch April 17, 2023 11:26
@qdm12
Copy link
Owner Author

qdm12 commented Apr 17, 2023

Merged it, it now creates the record if it doesn't exist, although it won't create the domain. I think the domain should exist anyway if the user wants to update records on it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants