Giter VIP home page Giter VIP logo

aliddns's Introduction

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

  1. 下载所有文件到某个地方, 例如: /opt/aliddns

  2. ddns.conf.example 重命名为 ddns.conf

  3. 创建一个 cron 任务,定时执行 python ddns.py, 例如:

    */5 * * * * cd /opt/aliddns && /usr/bin/python ddns.py
  4. 确保 cron 用户可以访问 ddns.conf

2. 使用 SystemD

  1. 下载所有文件到某个地方, 例如: /root/tools/aliddns

  2. ddns.conf.example 重命名为 ddns.conf

  3. 复制 ddns.timerddns.service/usr/lib/systemd/system

  4. 执行:

    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

开始使用

  1. 在阿里云控制台手动创建 DNS 解析条目,例如: blog.guanxigo.com
  2. 您可以在阿里云服务器上为该条目留下任何IP地址,如 192.168.0.1
  3. 确保所有必需的选项都正确输入到 ddns.conf
  4. 启用您想要使用的功能
  5. 确保 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

aliddns's People

Contributors

rfancn avatar catroll avatar kenpachi123 avatar yuguorui avatar zcq100 avatar cutesakurahime avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.