Aliyun DDNS client
Project description
AliDDNS
阿里云 Python DDNS 客户端 (https://github.com/kalixi/AliDDNS)
PS: Fork from https://github.com/rfancn/aliyun-ddns-client.
中文 | English
限制
本版本的 DDNS client只支持自动更新 “A” 类型 IPv4 地址的 DomainRecord。
其他类型不支持,因为它们需要以下值格式,而不是IP地址:
NS,MX,CNAME类型 DomainRecord 需要域名格式值AAAA类型 DomainRecord 需要 IPv6 地址格式的值SRV类型 DomainRecord 需要名称.协议格式的值显式URL和隐式URL需要 URL 格式值
先决条件
下面是 AliDDNS 需要的一些第三方 python 库,你可以通过 pip 或 easy_install 安装:
- requests
- netifaces
例如:
pip install requests netifaces
安装
1. 使用 cron
-
下载所有文件到某个地方, 例如:
/opt/aliddns -
将
ddns.conf.example重命名为ddns.conf -
创建一个 cron 任务,定时执行
python ddns.py, 例如:*/5 * * * * cd /opt/aliddns && /usr/bin/python ddns.py
-
确保 cron 用户可以访问
ddns.conf
2. 使用 SystemD
-
下载所有文件到某个地方, 例如:
/root/tools/aliddns -
将
ddns.conf.example重命名为ddns.conf -
复制
ddns.timer和ddns.service到/usr/lib/systemd/system -
执行:
root@local# systemctl daemon-reload root@local# systemctl start ddns.timer root@local# systemctl status ddns.timer -l
配置
/etc/ddns.conf 中需要设置的选项:
- access_id
- access_key
- domain
- sub_domain
可选的选项:
- type
[DEFAULT]
# access id obtains from aliyun
access_id =
# access key obtains from aliyun
access_key =
# it is not used at this moment, you can just ignore it
interval = 600
[DomainRecord1]
# domain name, like google.com
domain =
# subdomain name, like www, blog, bbs, *, @, ...
sub_domain =
# resolve type, 'A', 'AAAA'..., currently it only supports 'A'
type = A
[feature_public_ip_from_nic]
enable = false
interface = eth0
开始使用
- 在阿里云控制台手动创建 DNS 解析条目,例如:
blog.guanxigo.com - 您可以在阿里云服务器上为该条目留下任何IP地址,如 192.168.0.1
- 确保所有必需的选项都正确输入到
ddns.conf - 启用您想要使用的功能
- 确保
ddns.conf对于设置cron作业的用户来说是可读的
注意: 只更新本地配置文件和阿里云服务器中定义的域记录。
常见问题
-
问: 为什么报错
The input parameter "Timestamp" that is mandatory for processing this request is not supplied.? 答: 请检查参数 TimeStamp 的值是多少, 如果与正确时间相差较大,需要使用ntpdate将系统时间同步到正确的时间。 -
问: 为什么报错
Failed to save the config value? 答: 您需要确保当前的 cron 用户有权限写/etc/ddns.conf文件。 -
问: 为什么报错
AttributeError: 'X509' object has no attribute '_x509'? 答:PyOpenSSL 版本需要 >= 0.14,你可以尝试通过以下方法解决这个问题:sudo yum uninstall python-requests sudo pip uninstall pyopenssl cryptography requests sudo pip install requests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aliddns2-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aliddns2-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8044b95b4c3d36086de079a437d80eff6bbab2069a26d0a012ad9d2b74f71b8f
|
|
| MD5 |
8af63706e0ed5a22b9701e84b070343c
|
|
| BLAKE2b-256 |
c406d763c7b7676e8420c40e3407825694151bd207d681d61f84038a5348aa22
|
File details
Details for the file aliddns2-0.1.1-py2-none-any.whl.
File metadata
- Download URL: aliddns2-0.1.1-py2-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d7c5c2d5dc7d6c3a4bf143d703059a2ed65b07e6779c59558b2472fd770cee4
|
|
| MD5 |
586e9e45f47ecd231be8df716115fc49
|
|
| BLAKE2b-256 |
bc1ef7edaf3197d7470f0c141c17a7fa777dbadc077dcc5d9668556a93cf481b
|