Giter Club home page Giter Club logo

ue-ddns's Introduction

UE-DDNS

Universal Embedded DDNS Shell Script

UE-DDNS is an embedded POSIX shell DDNS script that is designed with a modular and minimalist approach to dependencies and guided design.

  • Supports both IPV4 and IPV6, and can obtain dynamic IP from URL or network interface
  • Compatible with most Unix platforms, including some embedded devices with only busybox, and relies on fewer commands as much as possible
  • Users only need to provide API Tokens, and the rest are multiple-choice questions, directly generating custom scripts
  • New domain names can be added directly in the wizard, one step at a time
  • Can set proxy, set traffic to go through a specified network interface, and automatically detect openwrt installation support
  • Strict IP comparison is performed to comply with API calling specifications and avoid submitting duplicate IP update requests
  • Supports multiple message push methods, making it easy to receive dynamic IP update notifications on a mobile phone

Currently supported DNS service providers:

How to use

You can download the script from the following two url:
https://ddns.03k.org
https://raw.githubusercontent.com/kkkgo/UE-DDNS/main/ue-ddns.sh
You can run the following command to start :

curl -skLo ue-ddns.sh ddns.03k.org  
sh ue-ddns.sh

If curl not found, you can run:

wget --no-check-certificate https://ddns.03k.org -O ue-ddns.sh
sh ue-ddns.sh

After the script runs, a wizard will prompt you to choose your DNS service provider and choose IPV4/IPV6:

=========================================
# Universal embedded DDNS Shell Script #
# https://github.com/kkkgo/UE-DDNS
# https://blog.03k.org/post/ue-ddns.html
=========================================
[1] cloudflare
[2] dnspod
[3] godaddy
Select your DNS provider[1]:1
cloudflare DDNS:
[1] IPV4 DDNS
[2] IPV6 DDNS
IPV4/IPV6 DDNS?[1]:1

Next, according to the DNS service provider you choose, you need to provide the corresponding API Tokens, and the wizard will give a url help to apply for API Tokens. If you have more than one domain name, you will see the main domain name selection list after entering the API Tokens, followed by the sub-domain name selection list. The display effect depends on the API of the DNS service provider.

[help] https://dash.cloudflare.com/profile/api-tokens
Your cloudflare API TOKEN:***************************
[1] 03k.org
[2] example.com
Select your domain name[1]:1
Domain: 03k.org
IPV4 sub domain list:
[0] Add a new subdomain name
[1] 03k.org A 1.2.3.4
[2] office.03k.org A 5.6.7.8
[3] myhome.03k.org A 6.7.8.9
[4] www.03k.org A 1.2.3.4
Select your IPV4 subdomain name[0]:

You can directly select your subdomain name on the list to generate the DDNS script, and you can choose to use the URL to get the dynamic IP:

How to get your new IP ?
[1]From IP-Check URL
[2]From Interface
Your choice [1]:1
DDNS script generation completed!
/root/myhome.03k.org@cloudflare_IPV4_URL.sh:
-rwxrwxrwx 1 root root 12K Mar  8 18:36 myhome.03k.org@cloudflare_IPV4_URL.sh

Or you can directly choose to specify the IP of a interface:

How to get your new IP ?
[1]From IP-Check URL
[2]From Interface
Your choice [1]:2
[1] eth0 111.20.3.1
[2] eth1 112.30.1.4
[3] Enter the network interface manually
Please select your interface [1]
DDNS script generation completed!
/root/myhome.03k.org@cloudflare_IPV4_eth0.sh:
-rwxrwxrwx 1 root root 12K Mar  8 18:40 myhome.03k.org@cloudflare_IPV4_eth0.sh

If you choose Cloudflare, the script will also ask you if you want to enable the CDN proxy for this domain:

Turn on Cloudflare CDN proxied for myhome.03k.org?
[1]Disable
[2]Enable

In the subdomain list menu, you can also select [0] to create your new subdomain:

Select your IPV4 subdomain name[0]:0
Create New: Enter sub domain [ Like ddns ]:myhomeddns
Turn on Cloudflare CDN proxied for myhomeddns.03k.org?
[1]Disable
[2]Enable
Your choice [1]:1
How to get your new IP ?
[1]From IP-Check URL
[2]From Interface
Your choice [1]:1
DDNS script generation completed!
/root/myhomeddns.03k.org@cloudflare_IPV4_URL.sh:
-rwxrwxrwx 1 root root 12K Mar  8 18:57 myhomeddns.03k.org@cloudflare_IPV4_URL.sh

Finally, you'll get a custom DDNS script in the current directory that you can try to sh [email protected] to test it.
After the script is generated, you can rm ue-ddns.sh.
Depending on what DNS service provider you choose and what options you customize, the script looks like this:

2023-03-08 23:20:58 CST
URL IP : 218.56.43.21
DNS IP : 116.78.34.11
API IP : 116.78.34.11
Trying to update: myhomeddns.mytestdomain2023.com -> 218.56.43.21
Update OK: "type":"A","content":"218.56.43.21","proxiable":true,"proxied":false

How to deploy the script

  • There is basically a crontab (scheduled task) on Linux systems, assuming that the script has been added with executable permissions:chmod +x ./ddns.sh, in /root/ddns.sh:
    Edit cron: crontab -e  
    */10 * * * * /root/ddns.sh &>/dev/null
    It means run every 10 minutes. The log will be blocked. Of course, if you need to log, you can redirect directly to the save path.
  • The hotplug interface can automatically execute the script when the network card IP changes. For example, openwrt, when you choose to get the IP from the network interface, the script will prompt you whether to directly generate the script in the hotplug directory:
How to get your new IP ?
[1]From IP-Check URL
[2]From Interface
Your choice [1]:2
[1] wan 116.22.1.118
[2] br-lan 10.10.10.1
[3] Enter the network interface manually
Please select your interface [1]
Detected hotplug support, generate script in /etc/hotplug.d/iface ?
[1] No.
[2] Move to /etc/hotplug.d/iface
Your choice [1]:2
DDNS script generation completed!
/etc/hotplug.d/iface/myhome.03k.org@cloudflare_IPV4_wan.sh:
-rwxr-xr-x    1 root     root       11.1K Mar  8 23:15 /etc/hotplug.d/iface/myhome.03k.org@cloudflare_IPV4_wan-lan.sh

Custom Options and Message Notifications

After the script is generated, you can also adjust some custom options within the generated script.(Region from # Customizable option area to # Customizable option end).
Custom options:

  • PROXY Set a proxy for the connection API, such as PROXY="http://192.168.1.100:7890"
  • OUT Set script network traffic to go to which network card, such as OUT="eth0" (Only curl is supported)
  • CHECKURL Set the URL used to detect the IP address. The script has built in some websites to get the IP address. When it fails, it will try to get it in turn.The CHECKURL you set will be tried first.
  • ValidateCA verifies the validity of the certificate and is disabled by default.You need to complete the CA certificate yourself for the local environment, for example, most Linux needs to install the ca-certificates package.

Message notification options:

  • ddns_ntfy_url ntfy is a simple HTTP-based pub-sub notification service.
    Website:https://ntfy.sh/
    Example:ddns_ntfy_url="http://ntfy.sh/yourtopic"
  • ddns_bark_url Bark is an iOS App which allows you to push customed notifications to your iPhone.
    Website:https://github.com/Finb/bark-server
    Example:ddns_bark_url="https://api.day.app/yourkey"
  • ddns_sct_url ServerChan, a push service that can be pushed to WeChat.
    Website: https://sct.ftqq.com/
    Example:ddns_sct_url="https://sctapi.ftqq.com/yourkey.send"
  • ddns_pushplus_url Pushplus, a push service that can be pushed to WeChat.
    Website:https://www.pushplus.plus/
    Example:ddns_pushplus_url="http://www.pushplus.plus/send?token=yourkey"
  • ddns_dingtalk_url dingtalk group robot push.Please add keyword: IP
    Website:https://open.dingtalk.com/document/robots/custom-robot-access/
    Example:ddns_dingtalk_url="https://oapi.dingtalk.com/robot/send?access_token=yourkey"
    The script only has a few built-in notification options "out of the box". If you want to use your own Webhook, you can search for push_result functions in the generated script.

About

License:GPLv3
Blog: https://blog.03k.org/post/ue-ddns.html

ue-ddns's People

Contributors

kkkgo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ue-ddns's Issues

针对当前从网卡获取地址的一个BUG

大佬你好,又是我。当前遇到的问题是这样的:
在路由器多次重启之后,网卡会获得多个IPV6公网地址,当前脚本默认是从第一个记录获取数据,并没有判断该地址是否处于'detached'状态。导致更新出错。以下是状况实例。
address
epair
update

输入CloudFlare的Global API Key后提示找不到域名

=========================================
Universal embedded DDNS Shell Script #
https://github.com/kkkgo/UE-DDNS
https://blog.03k.org/post/ue-ddns.html
=========================================
[1] cloudflare
[2] dnspod
[3] godaddy
Select your DNS provider[1]:
1
cloudflare DDNS:
[1] IPV4 DDNS
[2] IPV6 DDNS
IPV4/IPV6 DDNS?[1]:
1
[help] https://dash.cloudflare.com/profile/api-tokens
Your cloudflare API TOKEN:
xxxxxxxxxxxxxxxxxxxxxxx
No domain name found for your account!

从Interface取得ipv6地址出现了错误

Log:
...
How to get your new IP ?
[1]From IP-Check URL
[2]From Interface
Your choice [1]:
2
[1] eth0 2551:7299::3fc
[2] Enter the network interface manually
...

对应地址如下
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
...
inet6 fd52:2551:7299::3fc prefixlen 128 scopeid 0x0

取到了私有地址的一部分

钉钉推送失效问题

脚本自带的钉钉机器人推送脚本好像失效了,我添加了token地址进脚本,同时群内机器人设置了加关键字IP,脚本执行提示推送失败。

脚本验证解析记录时出现问题

你好大佬,现在脚本运行的时候提示“IP SAME IN DNS,SKIP UPDATE.”,但记录跟需要更新的记录明显不一致,猜测是记录对比那边出了问题qwq

图片

图片

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.