Skip to content

Instantly share code, notes, and snippets.

@ahmpro
Last active September 12, 2021 12:31

Revisions

  1. ahmpro revised this gist Sep 24, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ya.ddns.sh
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@
    # Get __TOKEN__: https://pddimp.yandex.ru/api2/admin/get_token
    # Get __RECORD_ID__:
    # curl -H 'PddToken: __TOKEN__' 'https://pddimp.yandex.ru/api2/admin/dns/list?domain=domain.com'
    # and find domain that you need in result, may use http://pro.jsonlint.com/ for pretty json :)

    # for more detail about Yandex API see https://tech.yandex.ru/pdd/doc/concepts/api-dns-docpage/

  2. ahmpro revised this gist Sep 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ya.ddns.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    # Author: ahmpro and community
    # gist url:
    # gist url: https://gist.github.com/ahmpro/f1fceddf1ac62d60980d

    # Yandex dDNS(handmade Dynamic DNS) for OpenWrt
    # Tested on OpenWrt Chaos Calmer r46612, LuCI (git-15.216.69575-bb7ea3e)
  3. ahmpro created this gist Sep 24, 2015.
    26 changes: 26 additions & 0 deletions ya.ddns.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/bin/bash

    # Author: ahmpro and community
    # gist url:

    # Yandex dDNS(handmade Dynamic DNS) for OpenWrt
    # Tested on OpenWrt Chaos Calmer r46612, LuCI (git-15.216.69575-bb7ea3e)
    # You should install curl (don't forget update packages list)

    # Get __TOKEN__: https://pddimp.yandex.ru/api2/admin/get_token
    # Get __RECORD_ID__:
    # curl -H 'PddToken: __TOKEN__' 'https://pddimp.yandex.ru/api2/admin/dns/list?domain=domain.com'

    # for more detail about Yandex API see https://tech.yandex.ru/pdd/doc/concepts/api-dns-docpage/

    __TOKEN__=1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
    __DOMAIN__=example.com
    __SUBDOMAIN__=home
    __RECORD_ID__=123456
    __TTL__=14400
    __IP__=$__IP # inner var from openwrt
    # as you know this script parsed inside send_update() of /usr/lib/ddns/dynamic_dns_functions.sh
    # if you don't know that see http://wiki.openwrt.org/doc/uci/ddns

    write_log 7 "curl -H 'PddToken: \$__TOKEN__' -d 'domain=$__DOMAIN__&subdomain=$__SUBDOMAIN__&record_id=$__RECORD_ID__&ttl=$__TTL__&content=$__IP__' 'https://pddimp.yandex.ru/api2/admin/dns/edit' -vk"
    write_log 7 `curl -H "PddToken: $__TOKEN__" -d "domain=$__DOMAIN__&subdomain=$__SUBDOMAIN__&record_id=$__RECORD_ID__&ttl=$__TTL__&content=$__IP__" "https://pddimp.yandex.ru/api2/admin/dns/edit" -vk`