rmarchant / gandi-ddns Goto Github PK
View Code? Open in Web Editor NEWPython Dynamic DNS script for Gandi LiveDNS
License: MIT License
Python Dynamic DNS script for Gandi LiveDNS
License: MIT License
Hello,
I've got an error with, I think, requests, throwing me OpenSSL error:
2020-11-25 17:50:34.646715 - section local
https://dns.api.gandi.net/api/v5/domains/easter.fr/records/beta/A
Traceback (most recent call last):
File "./gandi_ddns.py", line 131, in <module>
main()
File "./gandi_ddns.py", line 110, in main
external_ip = get_ip(ipify_api, retries)
File "./gandi_ddns.py", line 48, in get_ip
return get_ip_inner(ipify_api)
File "./gandi_ddns.py", line 25, in get_ip_inner
r = requests.get(ipify_api, timeout=3)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn
conn.connect()
File "/usr/lib/python2.7/dist-packages/urllib3/connection.py", line 344, in connect
ssl_context=context)
File "/usr/lib/python2.7/dist-packages/urllib3/util/ssl_.py", line 321, in ssl_wrap_socket
context.load_verify_locations(ca_certs, ca_cert_dir)
File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 428, in load_verify_locations
self._ctx.load_verify_locations(cafile, capath)
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 776, in load_verify_locations
_raise_current_error()
File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: [('PEM routines', 'get_header_and_data', 'short header'), ('x509 certificate routines', 'X509_load_cert_crl_file', 'PEM lib')]
I had to add verify=False in every requests.get call.
Do you know how can I solve this ?
Thank you.
Hi,
The script works fine, thanx.
What if I want to update 2 subdomains ? Do I have to copy the script and the config file in 2 directories? I tried a comma and a space separator but got error messages.
Thanx in advance
I'm looking for a way to update several DNS records that differ from the type at the same time.
I have two questions about this:
1.) Is it possible to update several A-Records (Domain & Subdomains) at the same time by storing several, separated entries at "a_name" in the config.txt? If that works, which separator should be used?
2.) In order to properly configure my mail server I also need to update a TXT-Record ("v=spf1 a mx ip4: -all") regularly and plan to extend the script for this task. Do I have to pay special attention or can I simply extend the script with a suitable method?
Thank you for your time and work!
Hi @rmarchant. First, thanks a lot for creating this script, it's really useful. I'm just finding an issue when using it via cron.
Once the config file is setup, I can execute the command with
python /home/user/Software/gandi-ddns/gandi_ddns.py
and everything works perfectly. I can see the IP is being updated in the Gandi admin panel.
Then I add it as a cron job, with this format:
*/15 * * * * python /home/user/Software/gandi-ddns/gandi_ddns.py
I can tell it's being run by looking into /var/log/syslog
and seeing lines like this one:
Sep 25 20:44:01 devicename CRON[5733]: (root) CMD (python /home/user/Software/gandi-ddns/gandi_ddns.py)
But the DNS records are not being updated in the Gandi admin panel anymore. Is there something else I should take into account when configuring crontab?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.