awslabs / route53-dynamic-dns-with-lambda

A Dynamic DNS system built with API Gateway, Lambda & Route 53.
Apache License 2.0
486 stars 167 forks source link

IP not beeing updated via route53-ddns-client.sh #41

Closed schwedenmut closed 1 year ago

schwedenmut commented 3 years ago

Hi there,

while having this up and running since quite a time, I recently took over this setup in our corporation. For us it seemed, that the ddns-client.sh quitted with the following output (redacted)

route53-ddns-client.sh: Updating subdomain.domain.tld. to IP 111.111.111.111 route53-ddns-client.sh: Request failed:

It worked for quite a while, but I don't know when it stopped working exactly.

I checked config and codebase, no changes or adaptions notified.

Then I took a look into the CloudWatch logs for the lambda and found the following stacktrace:

Unicode-objects must be encoded before hashing: TypeError Traceback (most recent call last): File "/var/task/lambda_function.py", line 258, in lambda_handler return_dict = run_set_mode(set_hostname, validation_hash, source_ip, internal_ip) File "/var/task/lambda_function.py", line 168, in run_set_mode source_ip + set_hostname + shared_secret).hexdigest() TypeError: Unicode-objects must be encoded before hashing

I then went ahead and patched line 167/168 by changing it to calculated_hash = hashlib.sha256(( source_ip + set_hostname + shared_secret).encode()).hexdigest() resulting in working updates again.

We don't have any special characters in our hostname btw.

Anybody else, who encountered this issue? Thanks a lot 👍

masberta commented 1 year ago

Hello, code base has been rewritten, please open a new issue if you encounter similar problems with the new solution. Thanks!