mirror of
https://github.com/kenzok8/small-package
synced 2025-09-20 19:11:30 +08:00
update 2023-02-01 20:20:39
This commit is contained in:
71
ariang/Makefile
Normal file
71
ariang/Makefile
Normal file
@ -0,0 +1,71 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ariang
|
||||
PKG_VERSION:=1.3.2
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
|
||||
PKG_SOURCE_URL:=https://github.com/mayswind/AriaNg/releases/download/$(PKG_VERSION)
|
||||
PKG_HASH:=2186dacf57c9d1650e00084c0454f2227e910f3203d89c6190f547b40cac7243
|
||||
UNPACK_CMD=unzip -q -d $(1) $(DL_DIR)/$(PKG_SOURCE)
|
||||
|
||||
PKG_MAINTAINER:=Ansuel Smith <ansuelsmth@gmail.com>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ariang/default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Download Manager
|
||||
DEPENDS:=+aria2
|
||||
TITLE:=AriaNg webui
|
||||
URL:=https://ariang.mayswind.net
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/ariang/description
|
||||
AriaNg is a web frontend making aria2 easier to use. AriaNg is written in pure html & javascript, thus it does not need any compilers or runtime environment.
|
||||
endef
|
||||
|
||||
Package/ariang-nginx/description = $(Package/ariang/description)
|
||||
|
||||
define Package/ariang
|
||||
$(Package/ariang/default)
|
||||
DEPENDS += +uhttpd
|
||||
TITLE += for uhttpd webserver
|
||||
endef
|
||||
|
||||
define Package/ariang-nginx
|
||||
$(Package/ariang/default)
|
||||
DEPENDS += +nginx
|
||||
TITLE += for nginx webserver
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/ariang/install
|
||||
$(INSTALL_DIR) \
|
||||
$(1)/www/ariang
|
||||
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/{langs,css,js,fonts} \
|
||||
$(PKG_BUILD_DIR)/index.html \
|
||||
$(PKG_BUILD_DIR)/LICENSE \
|
||||
$(PKG_BUILD_DIR)/favicon.* \
|
||||
$(PKG_BUILD_DIR)/robots.txt \
|
||||
$(1)/www/ariang
|
||||
endef
|
||||
|
||||
define Package/ariang-nginx/install
|
||||
$(Package/ariang/install)
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/conf.d/
|
||||
$(INSTALL_BIN) ./files/ariang.locations $(1)/etc/nginx/conf.d/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/80_ariang-nginx-support $(1)/etc/uci-defaults/80_ariang-nginx-support
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ariang))
|
||||
$(eval $(call BuildPackage,ariang-nginx))
|
5
ariang/files/80_ariang-nginx-support
Normal file
5
ariang/files/80_ariang-nginx-support
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -x /etc/init.d/nginx ] && /etc/init.d/nginx running && /etc/init.d/nginx reload
|
||||
|
||||
exit 0
|
4
ariang/files/ariang.locations
Normal file
4
ariang/files/ariang.locations
Normal file
@ -0,0 +1,4 @@
|
||||
location /ariang {
|
||||
index index.html;
|
||||
alias /www/ariang/;
|
||||
}
|
47
cgroupfs-mount/Makefile
Normal file
47
cgroupfs-mount/Makefile
Normal file
@ -0,0 +1,47 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cgroupfs-mount
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/tianon/$(PKG_NAME)
|
||||
PKG_SOURCE_VERSION:=0549428171605eae3097a3e21bf7664845eac9e8
|
||||
PKG_SOURCE_DATE:=2020-06-26
|
||||
PKG_MIRROR_HASH:=ca217ffff5aa938149d2d8adfe15d800903d2fec180acb2400c36d62905988ea
|
||||
|
||||
PKG_MAINTAINER:=Gerard Ryan <G.M0N3Y.2503@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/cgroupfs-mount/config
|
||||
config CGROUPFS_MOUNT_KERNEL_CGROUPS
|
||||
bool "Enable kernel cgroups support"
|
||||
depends on PACKAGE_cgroupfs-mount
|
||||
default y if ( DOCKER_KERNEL_OPTIONS || LXC_KERNEL_OPTIONS )
|
||||
select KERNEL_CGROUPS
|
||||
endef
|
||||
|
||||
define Package/cgroupfs-mount
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=cgroup mount scripts
|
||||
DEPENDS:=+mount-utils
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/cgroupfs-mount/description
|
||||
Simple scripts to properly mount the cgroupfs hierarchy, especially structured for Debian packaging
|
||||
endef
|
||||
|
||||
Build/Compile=# Nothing to compile, just install the scripts
|
||||
|
||||
define Package/cgroupfs-mount/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cgroupfs-mount $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cgroupfs-umount $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/cgroupfs-mount.init $(1)/etc/init.d/cgroupfs-mount
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,cgroupfs-mount))
|
12
cgroupfs-mount/files/cgroupfs-mount.init
Executable file
12
cgroupfs-mount/files/cgroupfs-mount.init
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=01
|
||||
|
||||
boot() {
|
||||
# Procd mounts non-hierarchical cgroupfs so unmount first before cgroupfs-mount
|
||||
if mountpoint -q /sys/fs/cgroup; then
|
||||
umount /sys/fs/cgroup/
|
||||
fi
|
||||
|
||||
cgroupfs-mount
|
||||
}
|
86
coremark/Makefile
Normal file
86
coremark/Makefile
Normal file
@ -0,0 +1,86 @@
|
||||
#
|
||||
# Copyright (C) 2018 Lim Guo Wei
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=coremark
|
||||
PKG_SOURCE_DATE:=2022-01-03
|
||||
PKG_SOURCE_VERSION:=b24e397f7103061b3673261d292a0667bd3bc1b8
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/eembc/coremark/tar.gz/$(PKG_SOURCE_VERSION)?
|
||||
PKG_HASH:=1b8c36b202f39b4f8a872ed7d5db1dc4473ee27f7bc2885a9da20e72925c58c3
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Lim Guo Wei <limguowei@gmail.com> \
|
||||
Aleksander Jan Bajkowski <olek2@wp.pl>
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE.md
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/coremark
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=CoreMark Embedded Microprocessor Benchmark
|
||||
URL:=https://github.com/eembc/coremark
|
||||
endef
|
||||
|
||||
define Package/coremark/description
|
||||
Embedded Microprocessor Benchmark
|
||||
endef
|
||||
|
||||
define Package/coremark/config
|
||||
config COREMARK_OPTIMIZE_O3
|
||||
bool "Use all optimizations (-O3)"
|
||||
depends on PACKAGE_coremark
|
||||
default y
|
||||
help
|
||||
This enables additional optmizations using the -O3 compilation flag.
|
||||
|
||||
config COREMARK_ENABLE_MULTITHREADING
|
||||
bool "Enable multithreading support"
|
||||
depends on PACKAGE_coremark
|
||||
default n
|
||||
help
|
||||
This enables multithreading support
|
||||
|
||||
config COREMARK_NUMBER_OF_THREADS
|
||||
int "Number of threads"
|
||||
depends on COREMARK_ENABLE_MULTITHREADING
|
||||
default 2
|
||||
help
|
||||
Number of threads to run in parallel
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -flto
|
||||
|
||||
ifeq ($(CONFIG_COREMARK_OPTIMIZE_O3),y)
|
||||
TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_COREMARK_ENABLE_MULTITHREADING),y)
|
||||
EXTRA_CFLAGS := -DMULTITHREAD=$(CONFIG_COREMARK_NUMBER_OF_THREADS) -DUSE_PTHREAD
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(SED) 's|EXE = .exe|EXE =|' $(PKG_BUILD_DIR)/posix/core_portme.mak
|
||||
mkdir $(PKG_BUILD_DIR)/$(ARCH)
|
||||
$(CP) -r $(PKG_BUILD_DIR)/linux/* $(PKG_BUILD_DIR)/$(ARCH)
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) PORT_DIR=$(ARCH) $(MAKE_FLAGS) \
|
||||
PORT_CFLAGS="$(TARGET_CFLAGS)" XCFLAGS="$(EXTRA_CFLAGS)" compile
|
||||
endef
|
||||
|
||||
define Package/coremark/install
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/coremark $(1)/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,coremark))
|
623
ddns-scripts/Makefile
Normal file
623
ddns-scripts/Makefile
Normal file
@ -0,0 +1,623 @@
|
||||
#
|
||||
# Copyright (C) 2008-2018 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-scripts
|
||||
PKG_VERSION:=2.8.2
|
||||
PKG_RELEASE:=25
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ddns-scripts/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Dynamic DNS Client scripts (with IPv6 support)
|
||||
DEPENDS:=+ddns-scripts-services
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts/description
|
||||
Dynamic DNS Client scripts (with IPv6 support)
|
||||
A highly configurable set of scripts for doing dynamic dns updates.
|
||||
- IPv6 support
|
||||
- DNS server support
|
||||
- Glue Record support (require BIND host or KNOT host)
|
||||
- DNS requests via TCP
|
||||
- Proxy server support
|
||||
- log file support
|
||||
- support to run once
|
||||
Version: $(PKG_VERSION)-$(PKG_RELEASE)
|
||||
Info : https://openwrt.org/docs/guide-user/services/ddns/client
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts/conffiles
|
||||
/etc/config/ddns
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-services
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Common ddns providers
|
||||
PROVIDES:=ddns-scripts_service
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-services/description
|
||||
Dynamic DNS Client definitions for supported services
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-cloudflare
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for cloudflare.com API v4
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
PROVIDES:=ddns-scripts_cloudflare.com-v4
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-cloudflare/description
|
||||
Dynamic DNS Client scripts extension for cloudflare.com API v4 (require curl)
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-freedns
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for freedns.42.pl
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
PROVIDES:=ddns-scripts_freedns_42_pl
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-freedns/description
|
||||
Dynamic DNS Client scripts extension for "freedns.42.pl".
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-godaddy
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for godaddy.com API v1
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
PROVIDES:=ddns-scripts_godaddy.com-v1
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-godaddy/description
|
||||
Dynamic DNS Client scripts extension for "godaddy.com API v1".
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-digitalocean
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extention for digitalocean.com API v2
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
PROVIDES:=ddns-scripts_digitalocean.com-v2
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-digitalocean/description
|
||||
Dynamic DNS Client scripts extension for "digitalocean.com API v2".
|
||||
The script directly updates a DNS record using the DO API.
|
||||
It requires:
|
||||
"option dns_server" to be set to the server to be used by nsupdate.
|
||||
"option domain" the dns domain to update the record for (eg. A-record: home.<example.com>)
|
||||
"option username" the dns record name to update (eg. A-record: <home>.example.com)
|
||||
"option param_opt" the id of the dns record to update (check using chrome inspector in the DO dns tab)
|
||||
"option password" the api token generated in the DO panel
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-dnspod
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for dnspod.cn API
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-dnspod/description
|
||||
Dynamic DNS Client scripts extension for dnspod.cn API (require curl)
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-noip
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for no-ip.com
|
||||
DEPENDS:=ddns-scripts
|
||||
PROVIDES:=ddns-scripts_no-ip_com
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-noip/description
|
||||
Dynamic DNS Client scripts extension for "no-ip.com".
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-ns1
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=NS1 API
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-ns1/description
|
||||
Dynamic DNS Client scripts extension for "ns1.com".
|
||||
It requires:
|
||||
"option username" to be a valid zone for ns1.com
|
||||
"option password" to be a valid API key for ns1.com
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-nsupdate
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for using bind nsupdate.
|
||||
DEPENDS:=ddns-scripts +bind-client
|
||||
PROVIDES:=ddns-scripts_nsupdate
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-nsupdate/description
|
||||
Dynamic DNS Client scripts extension for direct updates using bind nsupdate
|
||||
The script directly updates a PowerDNS (or maybe bind server) via nsupdate
|
||||
from bind-client package.
|
||||
It requires:
|
||||
"option dns_server" to be set to the server to be used by nsupdate.
|
||||
"option username" should be set to the key name and
|
||||
"option password" to the base64 encoded shared secret.
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-route53
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for route53 API v1
|
||||
DEPENDS:=ddns-scripts +curl +openssl-util
|
||||
PROVIDES:=ddns-scripts_route53-v1
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-route53/description
|
||||
Dynamic DNS Client scripts extension for Amazon AWS "route53 API v1".
|
||||
Note: You must also install ca-certificate or ca-bundle.
|
||||
It requires:
|
||||
"option username" to be a valid AWS access key id
|
||||
"option password" to be the matching AWS secret key id
|
||||
"option domain" to contain the hosted zone ID
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-cnkuai
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=CnKuai API
|
||||
DEPENDS:=ddns-scripts +curl +giflib-utils
|
||||
PROVIDES:=ddns-scripts_cnkuai_cn
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-cnkuai/description
|
||||
Dynamic DNS Client scripts extension for "cnkuai.cn".
|
||||
It requires:
|
||||
"option username" to be a valid CnKuai control panel id
|
||||
"option password" to be the matching CnKuai control panel password
|
||||
"option domain" to contain the domain
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-gandi
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Gandi API
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-gandi/description
|
||||
Dynamic DNS Client scripts extension for "gandi.net".
|
||||
It requires:
|
||||
"option username" to be a valid subdomain for gandi.net
|
||||
"option password" to be a valid API key for gandi.net
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-pdns
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=PowerDNS API
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-pdns/description
|
||||
Dynamic DNS Client scripts extension for "PowerDNS" via API.
|
||||
It requires:
|
||||
"option param_opt(Optional Parameter)" to be a valid root URL for the PowerDNS webserver
|
||||
"option username" to be a valid subdomain for the PowerDNS domain
|
||||
"option password" to be a valid API key for the PowerDNS webserver
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-transip
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for TransIP API
|
||||
DEPENDS:=ddns-scripts +curl +openssl-util +!BUSYBOX_CONFIG_MKTEMP:coreutils-mktemp
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-transip/description
|
||||
Dynamic DNS Client scripts extension for "transip.nl".
|
||||
Note: You must also install ca-certificate or ca-bundle.
|
||||
It requires:
|
||||
"option username" to be a valid username for transip.nl
|
||||
"option password" to be a valid matching private key
|
||||
"option domain" to contain the base domain
|
||||
"option param_enc" to contain the name of the DNS record to update
|
||||
"option param_opt" to contain the TTL of the DNS record to update
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-one
|
||||
$(call Package/ddns-scripts/Default)
|
||||
TITLE:=Extension for one.com Control Panel
|
||||
DEPENDS:=ddns-scripts +curl
|
||||
endef
|
||||
|
||||
define Package/ddns-scrtips-one/description
|
||||
Dynamic DNS Client scripts extension for "one.com".
|
||||
It requires:
|
||||
"option username" to be a valid Email for one.com Control Panel
|
||||
"option password" to be the matching one.com Control Panel password
|
||||
"option domain" to contain the domain / subdomain
|
||||
endef
|
||||
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts/install
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_DATA) ./files/etc/hotplug.d/iface/ddns \
|
||||
$(1)/etc/hotplug.d/iface/95-ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/ddns \
|
||||
$(1)/etc/init.d/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/etc/config/ddns \
|
||||
$(1)/etc/config/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns
|
||||
echo "$(PKG_VERSION)-$(PKG_RELEASE)" > $(1)/usr/share/ddns/version
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_DATA) ./files/usr/lib/ddns/dynamic_dns_functions.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/dynamic_dns_lucihelper.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/dynamic_dns_updater.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) ./files/usr/bin/ddns.sh \
|
||||
$(1)/usr/bin/ddns
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns enabled
|
||||
/etc/init.d/ddns start
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts/prerm
|
||||
#!/bin/sh
|
||||
if [ -n "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
/etc/init.d/ddns disable
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-services/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/* \
|
||||
$(1)/usr/share/ddns/default
|
||||
|
||||
# Remove special services
|
||||
rm $(1)/usr/share/ddns/default/cloudflare.com-v4.json
|
||||
rm $(1)/usr/share/ddns/default/freedns.42.pl.json
|
||||
rm $(1)/usr/share/ddns/default/godaddy.com-v1.json
|
||||
rm $(1)/usr/share/ddns/default/digitalocean.com-v2.json
|
||||
rm $(1)/usr/share/ddns/default/dnspod.cn.json
|
||||
rm $(1)/usr/share/ddns/default/no-ip.com.json
|
||||
rm $(1)/usr/share/ddns/default/bind-nsupdate.json
|
||||
rm $(1)/usr/share/ddns/default/route53-v1.json
|
||||
rm $(1)/usr/share/ddns/default/cnkuai.cn.json
|
||||
rm $(1)/usr/share/ddns/default/gandi.net.json
|
||||
rm $(1)/usr/share/ddns/default/pdns.json
|
||||
rm $(1)/usr/share/ddns/default/transip.nl.json
|
||||
rm $(1)/usr/share/ddns/default/ns1.com.json
|
||||
rm $(1)/usr/share/ddns/default/one.com.json
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-cloudflare/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_cloudflare_com_v4.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/cloudflare.com-v4.json \
|
||||
$(1)/usr/share/ddns/default/
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-cloudflare/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-freedns/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_freedns_42_pl.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/freedns.42.pl.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-freedns/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-godaddy/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_godaddy_com_v1.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/godaddy.com-v1.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-godaddy/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-digitalocean/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_digitalocean_com_v2.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/digitalocean.com-v2.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-digitalocean/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-dnspod/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_dnspod_cn.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/dnspod.cn.json \
|
||||
$(1)/usr/share/ddns/default/
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-dnspod/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-noip/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_no-ip_com.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/no-ip.com.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-noip/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-ns1/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_ns1_com.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/ns1.com.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-ns1/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-nsupdate/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_nsupdate.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/bind-nsupdate.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-nsupdate/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-route53/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_route53_v1.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/route53-v1.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-route53/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-cnkuai/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_cnkuai_cn.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/cnkuai.cn.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-cnkuai/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-gandi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_gandi_net.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/gandi.net.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-gandi/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-pdns/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_pdns.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/pdns.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-pdns/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-transip/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_transip_nl.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/transip.nl.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-transip/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/ddns-scripts-one/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns/update_one_com.sh \
|
||||
$(1)/usr/lib/ddns
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/ddns/default
|
||||
$(INSTALL_DATA) ./files/usr/share/ddns/default/one.com.json \
|
||||
$(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts-one/prerm
|
||||
#!/bin/sh
|
||||
if [-z "${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/ddns stop
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,ddns-scripts))
|
||||
$(eval $(call BuildPackage,ddns-scripts-services))
|
||||
$(eval $(call BuildPackage,ddns-scripts-cloudflare))
|
||||
$(eval $(call BuildPackage,ddns-scripts-freedns))
|
||||
$(eval $(call BuildPackage,ddns-scripts-godaddy))
|
||||
$(eval $(call BuildPackage,ddns-scripts-digitalocean))
|
||||
$(eval $(call BuildPackage,ddns-scripts-dnspod))
|
||||
$(eval $(call BuildPackage,ddns-scripts-noip))
|
||||
$(eval $(call BuildPackage,ddns-scripts-nsupdate))
|
||||
$(eval $(call BuildPackage,ddns-scripts-route53))
|
||||
$(eval $(call BuildPackage,ddns-scripts-cnkuai))
|
||||
$(eval $(call BuildPackage,ddns-scripts-gandi))
|
||||
$(eval $(call BuildPackage,ddns-scripts-pdns))
|
||||
$(eval $(call BuildPackage,ddns-scripts-transip))
|
||||
$(eval $(call BuildPackage,ddns-scripts-ns1))
|
||||
$(eval $(call BuildPackage,ddns-scripts-one))
|
32
ddns-scripts/files/etc/config/ddns
Normal file
32
ddns-scripts/files/etc/config/ddns
Normal file
@ -0,0 +1,32 @@
|
||||
#
|
||||
# Please read https://openwrt.org/docs/guide-user/base-system/ddns
|
||||
#
|
||||
config ddns "global"
|
||||
option ddns_dateformat "%F %R"
|
||||
# option ddns_rundir "/var/run/ddns"
|
||||
# option ddns_logdir "/var/log/ddns"
|
||||
option ddns_loglines "250"
|
||||
option upd_privateip "0"
|
||||
|
||||
|
||||
config service "myddns_ipv4"
|
||||
option service_name "dyndns.org"
|
||||
option lookup_host "yourhost.example.com"
|
||||
option domain "yourhost.example.com"
|
||||
option username "your_username"
|
||||
option password "your_password"
|
||||
option interface "wan"
|
||||
option ip_source "network"
|
||||
option ip_network "wan"
|
||||
|
||||
config service "myddns_ipv6"
|
||||
option update_url "http://[USERNAME]:[PASSWORD]@your.provider.net/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||
option lookup_host "yourhost.example.com"
|
||||
option domain "yourhost.example.com"
|
||||
option username "your_username"
|
||||
option password "your_password"
|
||||
option use_ipv6 "1"
|
||||
option interface "wan6"
|
||||
option ip_source "network"
|
||||
option ip_network "wan6"
|
||||
|
11
ddns-scripts/files/etc/hotplug.d/iface/ddns
Normal file
11
ddns-scripts/files/etc/hotplug.d/iface/ddns
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# there are other ACTIONs like ifupdate we don't need
|
||||
case "$ACTION" in
|
||||
ifup) # OpenWrt is giving a network not phys. Interface
|
||||
/etc/init.d/ddns enabled && /usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- start
|
||||
;;
|
||||
ifdown)
|
||||
/usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- stop
|
||||
;;
|
||||
esac
|
27
ddns-scripts/files/etc/init.d/ddns
Normal file
27
ddns-scripts/files/etc/init.d/ddns
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=95
|
||||
STOP=10
|
||||
|
||||
boot() {
|
||||
return 0
|
||||
}
|
||||
|
||||
reload() {
|
||||
/usr/lib/ddns/dynamic_dns_updater.sh -- reload
|
||||
return 0
|
||||
}
|
||||
|
||||
restart() {
|
||||
/usr/lib/ddns/dynamic_dns_updater.sh -- stop
|
||||
sleep 1 # give time to shutdown
|
||||
/usr/lib/ddns/dynamic_dns_updater.sh -- start
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/lib/ddns/dynamic_dns_updater.sh -- start
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/lib/ddns/dynamic_dns_updater.sh -- stop
|
||||
return 0
|
||||
}
|
172
ddns-scripts/files/usr/bin/ddns.sh
Normal file
172
ddns-scripts/files/usr/bin/ddns.sh
Normal file
@ -0,0 +1,172 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2020 TDT AG <development@tdt.de>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
DDNS_PACKAGE_DIR="/usr/share/ddns"
|
||||
URL="https://raw.githubusercontent.com/openwrt/packages/master/net/ddns-scripts/files"
|
||||
|
||||
usage() {
|
||||
local code="$1"
|
||||
local msg="$2"
|
||||
|
||||
echo "$msg"
|
||||
echo ""
|
||||
echo "Usage: $(basename "$0") <command> <action> <service>"
|
||||
echo ""
|
||||
echo "Supported ddns <command>:"
|
||||
echo " service: Command for custom ddns service providers"
|
||||
echo ""
|
||||
echo "Supported ddns 'service' command <action>:"
|
||||
echo " update: Update local custom ddns service list"
|
||||
echo " list-available: List all available custom service providers"
|
||||
echo " list-installed: List all installed custom service providers"
|
||||
echo " install <service>: Install custom service provider"
|
||||
echo " remove <service>: Remove custom service provider"
|
||||
echo " purge: Remove local custom ddns services"
|
||||
|
||||
exit "$code"
|
||||
}
|
||||
|
||||
action_update() {
|
||||
local cacert
|
||||
|
||||
config_load ddns
|
||||
config_get url global 'url' "${URL}${DDNS_PACKAGE_DIR}"
|
||||
config_get cacert global 'cacert' "IGNORE"
|
||||
url="${url}/list"
|
||||
|
||||
mkdir -p "${DDNS_PACKAGE_DIR}"
|
||||
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
uclient-fetch \
|
||||
--no-check-certificate \
|
||||
"$url" \
|
||||
-O "${DDNS_PACKAGE_DIR}/list"
|
||||
elif [ -f "$cacert" ]; then
|
||||
uclient-fetch \
|
||||
--ca-certificate="${cacert}" \
|
||||
"$url" \
|
||||
-O "${DDNS_PACKAGE_DIR}/list"
|
||||
elif [ -n "$cacert" ]; then
|
||||
echo "Certification file not found ($cacert)"
|
||||
exit 5
|
||||
fi
|
||||
}
|
||||
|
||||
action_list_available() {
|
||||
if [ -f "${DDNS_PACKAGE_DIR}/list" ]; then
|
||||
cat "${DDNS_PACKAGE_DIR}/list"
|
||||
else
|
||||
echo "No custom service list file found. Please download first"
|
||||
exit 3
|
||||
fi
|
||||
}
|
||||
|
||||
action_list_installed() {
|
||||
if [ -d "${DDNS_PACKAGE_DIR}/custom" ]; then
|
||||
ls "${DDNS_PACKAGE_DIR}/custom"
|
||||
else
|
||||
echo "No custom services installed"
|
||||
exit 4
|
||||
fi
|
||||
}
|
||||
|
||||
action_install() {
|
||||
local service="$1"
|
||||
|
||||
local url cacert
|
||||
|
||||
config_load ddns
|
||||
config_get url global 'url' "${URL}${DDNS_PACKAGE_DIR}/default"
|
||||
config_get cacert global 'cacert' "IGNORE"
|
||||
url="${url}/${service}.json"
|
||||
|
||||
if [ -z "$service" ]; then
|
||||
usage "4" "No custom service specified"
|
||||
fi
|
||||
|
||||
mkdir -p "${DDNS_PACKAGE_DIR}/custom"
|
||||
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
uclient-fetch \
|
||||
--no-check-certificate \
|
||||
"${url}" \
|
||||
-O "${DDNS_PACKAGE_DIR}/custom/${service}.json"
|
||||
elif [ -f "$cacert" ]; then
|
||||
uclient-fetch \
|
||||
--ca-certifcate="${cacert}" \
|
||||
"${url}" \
|
||||
-O "${DDNS_PACKAGE_DIR}/custom/${service}.json"
|
||||
elif [ -n "$cacert" ]; then
|
||||
echo "Certification file not found ($cacert)"
|
||||
exit 5
|
||||
fi
|
||||
}
|
||||
|
||||
action_remove() {
|
||||
local service="$1"
|
||||
if [ -z "$service" ]; then
|
||||
usage "4" "No custom service specified"
|
||||
fi
|
||||
|
||||
rm "${DDNS_PACKAGE_DIR}/custom/${service}.json"
|
||||
}
|
||||
|
||||
action_purge() {
|
||||
rm -rf "${DDNS_PACKAGE_DIR}/custom"
|
||||
rm -rf "${DDNS_PACKAGE_DIR}/list"
|
||||
}
|
||||
|
||||
sub_service() {
|
||||
local action="$1"
|
||||
local service="$2"
|
||||
|
||||
case "$action" in
|
||||
update)
|
||||
action_update
|
||||
;;
|
||||
list-available)
|
||||
action_list_available
|
||||
;;
|
||||
list-installed)
|
||||
action_list_installed
|
||||
;;
|
||||
purge)
|
||||
action_purge
|
||||
;;
|
||||
install)
|
||||
action_install "$service"
|
||||
;;
|
||||
remove)
|
||||
action_remove "$service"
|
||||
;;
|
||||
*)
|
||||
usage "2" "Action not supported"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main() {
|
||||
local cmd="$1"
|
||||
local action="$2"
|
||||
local service="$3"
|
||||
|
||||
[ "$#" -eq 0 ] && usage "1"
|
||||
|
||||
case "${cmd}" in
|
||||
service)
|
||||
sub_service "${action}" "${service}"
|
||||
;;
|
||||
*)
|
||||
usage "1" "Command not supported"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
1403
ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
Normal file
1403
ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
Normal file
File diff suppressed because it is too large
Load Diff
172
ddns-scripts/files/usr/lib/ddns/dynamic_dns_lucihelper.sh
Normal file
172
ddns-scripts/files/usr/lib/ddns/dynamic_dns_lucihelper.sh
Normal file
@ -0,0 +1,172 @@
|
||||
#!/bin/sh
|
||||
# /usr/lib/ddns/dynamic_dns_lucihelper.sh
|
||||
#
|
||||
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
||||
#.2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||
# This script is used by luci-app-ddns
|
||||
#
|
||||
# variables in small chars are read from /etc/config/ddns as parameter given here
|
||||
# variables in big chars are defined inside these scripts as gloval vars
|
||||
# variables in big chars beginning with "__" are local defined inside functions only
|
||||
# set -vx #script debugger
|
||||
|
||||
. /usr/lib/ddns/dynamic_dns_functions.sh # global vars are also defined here
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
|
||||
Usage:
|
||||
$MYPROG [options] -- command
|
||||
|
||||
Commands:
|
||||
get_local_ip using given INTERFACE or NETWORK or SCRIPT or URL
|
||||
get_registered_ip for given FQDN
|
||||
verify_dns given DNS-SERVER
|
||||
verify_proxy given PROXY
|
||||
start start given SECTION
|
||||
reload force running ddns processes to reload changed configuration
|
||||
restart restart all ddns processes
|
||||
|
||||
Parameters:
|
||||
-6 => use_ipv6=1 (default 0)
|
||||
-d DNS-SERVER => dns_server=SERVER[:PORT]
|
||||
-f => force_ipversion=1 (default 0)
|
||||
-g => is_glue=1 (default 0)
|
||||
-i INTERFACE => ip_interface=INTERFACE; ip_source="interface"
|
||||
-l FQDN => lookup_host=FQDN
|
||||
-n NETWORK => ip_network=NETWORK; ip_source="network"
|
||||
-p PROXY => proxy=[USER:PASS@]PROXY:PORT
|
||||
-s SCRIPT => ip_script=SCRIPT; ip_source="script"
|
||||
-t => force_dnstcp=1 (default 0)
|
||||
-u URL => ip_url=URL; ip_source="web"
|
||||
-S SECTION SECTION to start
|
||||
|
||||
-h => show this help and exit
|
||||
-L => use_logfile=1 (default 0)
|
||||
-v LEVEL => VERBOSE=LEVEL (default 0)
|
||||
-V => show version and exit
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
usage_err() {
|
||||
printf %s\\n "$MYPROG: $@" >&2
|
||||
usage >&2
|
||||
exit 255
|
||||
}
|
||||
|
||||
# preset some variables, wrong or not set in ddns-functions.sh
|
||||
SECTION_ID="lucihelper"
|
||||
LOGFILE="$ddns_logdir/$SECTION_ID.log"
|
||||
DATFILE="$ddns_rundir/$SECTION_ID.$$.dat" # save stdout data of WGet and other extern programs called
|
||||
ERRFILE="$ddns_rundir/$SECTION_ID.$$.err" # save stderr output of WGet and other extern programs called
|
||||
DDNSPRG="/usr/lib/ddns/dynamic_dns_updater.sh"
|
||||
VERBOSE=0 # no console logging
|
||||
# global variables normally set by reading DDNS UCI configuration
|
||||
use_syslog=0 # no syslog
|
||||
use_logfile=0 # no logfile
|
||||
|
||||
use_ipv6=0 # Use IPv6 - default IPv4
|
||||
force_ipversion=0 # Force IP Version - default 0 - No
|
||||
force_dnstcp=0 # Force TCP on DNS - default 0 - No
|
||||
is_glue=0 # Is glue record - default 0 - No
|
||||
use_https=0 # not needed but must be set
|
||||
|
||||
while getopts ":6d:fghi:l:n:p:s:S:tu:Lv:V" OPT; do
|
||||
case "$OPT" in
|
||||
6) use_ipv6=1;;
|
||||
d) dns_server="$OPTARG";;
|
||||
f) force_ipversion=1;;
|
||||
g) is_glue=1;;
|
||||
i) ip_interface="$OPTARG"; ip_source="interface";;
|
||||
l) lookup_host="$OPTARG";;
|
||||
n) ip_network="$OPTARG"; ip_source="network";;
|
||||
p) proxy="$OPTARG";;
|
||||
s) ip_script="$OPTARG"; ip_source="script";;
|
||||
t) force_dnstcp=1;;
|
||||
u) ip_url="$OPTARG"; ip_source="web";;
|
||||
h) usage; exit 255;;
|
||||
L) use_logfile=1;;
|
||||
v) VERBOSE=$OPTARG;;
|
||||
S) SECTION=$OPTARG;;
|
||||
V) printf %s\\n "ddns-scripts $VERSION"; exit 255;;
|
||||
:) usage_err "option -$OPTARG missing argument";;
|
||||
\?) usage_err "invalid option -$OPTARG";;
|
||||
*) usage_err "unhandled option -$OPT $OPTARG";;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1 )) # OPTIND is 1 based
|
||||
|
||||
[ $# -eq 0 ] && usage_err "missing command"
|
||||
|
||||
__RET=0
|
||||
case "$1" in
|
||||
get_registered_ip)
|
||||
[ -z "$lookup_host" ] && usage_err "command 'get_registered_ip': 'lookup_host' not set"
|
||||
write_log 7 "-----> get_registered_ip IP"
|
||||
[ -z "$SECTION" ] || IPFILE="$ddns_rundir/$SECTION.ip"
|
||||
IP=""
|
||||
get_registered_ip IP
|
||||
__RET=$?
|
||||
[ $__RET -ne 0 ] && IP=""
|
||||
printf "%s" "$IP"
|
||||
;;
|
||||
verify_dns)
|
||||
[ -z "$dns_server" ] && usage_err "command 'verify_dns': 'dns_server' not set"
|
||||
write_log 7 "-----> verify_dns '$dns_server'"
|
||||
verify_dns "$dns_server"
|
||||
__RET=$?
|
||||
;;
|
||||
verify_proxy)
|
||||
[ -z "$proxy" ] && usage_err "command 'verify_proxy': 'proxy' not set"
|
||||
write_log 7 "-----> verify_proxy '$proxy'"
|
||||
verify_proxy "$proxy"
|
||||
__RET=$?
|
||||
;;
|
||||
get_local_ip)
|
||||
[ -z "$ip_source" ] && usage_err "command 'get_local_ip': 'ip_source' not set"
|
||||
[ -n "$proxy" -a "$ip_source" = "web" ] && {
|
||||
# proxy defined, used for ip_source=web
|
||||
export HTTP_PROXY="http://$proxy"
|
||||
export HTTPS_PROXY="http://$proxy"
|
||||
export http_proxy="http://$proxy"
|
||||
export https_proxy="http://$proxy"
|
||||
}
|
||||
# don't need IP only the return code
|
||||
IP=""
|
||||
if [ "$ip_source" = "web" -o "$ip_source" = "script" ]; then
|
||||
# we wait only 3 seconds for an
|
||||
# answer from "web" or "script"
|
||||
write_log 7 "-----> timeout 3 -- get_local_ip IP"
|
||||
timeout 3 -- get_local_ip IP
|
||||
else
|
||||
write_log 7 "-----> get_local_ip IP"
|
||||
get_local_ip IP
|
||||
fi
|
||||
__RET=$?
|
||||
;;
|
||||
start)
|
||||
[ -z "$SECTION" ] && usage_err "command 'start': 'SECTION' not set"
|
||||
if [ $VERBOSE -eq 0 ]; then # start in background
|
||||
$DDNSPRG -v 0 -S $SECTION -- start &
|
||||
else
|
||||
$DDNSPRG -v $VERBOSE -S $SECTION -- start
|
||||
fi
|
||||
;;
|
||||
reload)
|
||||
$DDNSPRG -- reload
|
||||
;;
|
||||
restart)
|
||||
$DDNSPRG -- stop
|
||||
sleep 1
|
||||
$DDNSPRG -- start
|
||||
;;
|
||||
*)
|
||||
__RET=255
|
||||
;;
|
||||
esac
|
||||
|
||||
# remove out and err file
|
||||
[ -f $DATFILE ] && rm -f $DATFILE
|
||||
[ -f $ERRFILE ] && rm -f $ERRFILE
|
||||
return $__RET
|
436
ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh
Normal file
436
ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh
Normal file
@ -0,0 +1,436 @@
|
||||
#!/bin/sh
|
||||
# /usr/lib/ddns/dynamic_dns_updater.sh
|
||||
#
|
||||
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
||||
# Original written by Eric Paul Bishop, January 2008
|
||||
# (Loosely) based on the script on the one posted by exobyte in the forums here:
|
||||
# http://forum.openwrt.org/viewtopic.php?id=14040
|
||||
# extended and partial rewritten
|
||||
#.2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||
#
|
||||
# variables in small chars are read from /etc/config/ddns
|
||||
# variables in big chars are defined inside these scripts as global vars
|
||||
# variables in big chars beginning with "__" are local defined inside functions only
|
||||
# set -vx #script debugger
|
||||
|
||||
. $(dirname $0)/dynamic_dns_functions.sh # global vars are also defined here
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
|
||||
Usage:
|
||||
$MYPROG [options] -- command
|
||||
|
||||
Commands:
|
||||
start Start SECTION or NETWORK or all
|
||||
stop Stop NETWORK or all
|
||||
|
||||
Parameters:
|
||||
-n NETWORK Start/Stop sections in background monitoring NETWORK, force VERBOSE=0
|
||||
-S SECTION SECTION to start
|
||||
use either -N NETWORK or -S SECTION
|
||||
|
||||
-h show this help and exit
|
||||
-V show version and exit
|
||||
-v LEVEL VERBOSE=LEVEL (default 1)
|
||||
'0' NO output to console
|
||||
'1' output to console
|
||||
'2' output to console AND logfile
|
||||
+ run once WITHOUT retry on error
|
||||
'3' output to console AND logfile
|
||||
+ run once WITHOUT retry on error
|
||||
+ NOT sending update to DDNS service
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
usage_err() {
|
||||
printf %s\\n "$MYPROG: $@" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts ":hv:n:S:V" OPT; do
|
||||
case "$OPT" in
|
||||
h) usage; exit 0;;
|
||||
v) VERBOSE=$OPTARG;;
|
||||
n) NETWORK=$OPTARG;;
|
||||
S) SECTION_ID=$OPTARG;;
|
||||
V) printf %s\\n "ddns-scripts $VERSION"; exit 0;;
|
||||
:) usage_err "option -$OPTARG missing argument";;
|
||||
\?) usage_err "invalid option -$OPTARG";;
|
||||
*) usage_err "unhandled option -$OPT $OPTARG";;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1 )) # OPTIND is 1 based
|
||||
|
||||
[ -n "$NETWORK" -a -n "$SECTION_ID" ] && usage_err "use either option '-N' or '-S' not both"
|
||||
[ $# -eq 0 ] && usage_err "missing command"
|
||||
[ $# -gt 1 ] && usage_err "to much commands"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -n "$NETWORK" ]; then
|
||||
start_daemon_for_all_ddns_sections "$NETWORK"
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$SECTION_ID" ]; then
|
||||
start_daemon_for_all_ddns_sections
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if [ -n "$INTERFACE" ]; then
|
||||
stop_daemon_for_all_ddns_sections "$NETWORK"
|
||||
exit 0
|
||||
else
|
||||
stop_daemon_for_all_ddns_sections
|
||||
exit 0
|
||||
fi
|
||||
exit 1
|
||||
;;
|
||||
reload)
|
||||
killall -1 dynamic_dns_updater.sh 2>/dev/null
|
||||
exit $?
|
||||
;;
|
||||
*) usage_err "unknown command - $1";;
|
||||
esac
|
||||
|
||||
# set file names
|
||||
PIDFILE="$ddns_rundir/$SECTION_ID.pid" # Process ID file
|
||||
UPDFILE="$ddns_rundir/$SECTION_ID.update" # last update successful send (system uptime)
|
||||
DATFILE="$ddns_rundir/$SECTION_ID.dat" # save stdout data of WGet and other extern programs called
|
||||
ERRFILE="$ddns_rundir/$SECTION_ID.err" # save stderr output of WGet and other extern programs called
|
||||
IPFILE="$ddns_rundir/$SECTION_ID.ip" #
|
||||
LOGFILE="$ddns_logdir/$SECTION_ID.log" # log file
|
||||
|
||||
# VERBOSE > 1 delete logfile if exist to create an empty one
|
||||
# only with this data of this run for easier diagnostic
|
||||
# new one created by write_log function
|
||||
[ $VERBOSE -gt 1 -a -f $LOGFILE ] && rm -f $LOGFILE
|
||||
|
||||
# TRAP handler
|
||||
trap "trap_handler 0 \$?" 0 # handle script exit with exit status
|
||||
trap "trap_handler 1" 1 # SIGHUP Hangup / reload config
|
||||
trap "trap_handler 2" 2 # SIGINT Terminal interrupt
|
||||
trap "trap_handler 3" 3 # SIGQUIT Terminal quit
|
||||
# trap "trap_handler 9" 9 # SIGKILL no chance to trap
|
||||
trap "trap_handler 15" 15 # SIGTERM Termination
|
||||
|
||||
################################################################################
|
||||
# Leave this comment here, to clearly document variable names that are expected/possible
|
||||
# Use load_all_config_options to load config options, which is a much more flexible solution.
|
||||
#
|
||||
# config_load "ddns"
|
||||
# config_get <variable> $SECTION_ID <option>
|
||||
#
|
||||
# defined options (also used as variable):
|
||||
#
|
||||
# enabled self-explanatory
|
||||
# interface network interface used by hotplug.d i.e. 'wan' or 'wan6'
|
||||
#
|
||||
# service_name Which DDNS service do you use or "custom"
|
||||
# update_url URL to use to update your "custom" DDNS service
|
||||
# update_script SCRIPT to use to update your "custom" DDNS service
|
||||
#
|
||||
# lookup_host FQDN of ONE of your at DDNS service defined host / required to validate if IP update happen/necessary
|
||||
# domain Nomally your DDNS hostname / replace [DOMAIN] in update_url
|
||||
# username Username of your DDNS service account / urlenceded and replace [USERNAME] in update_url
|
||||
# password Password of your DDNS service account / urlencoded and replace [PASSWORD] in update_url
|
||||
# param_enc Optional parameter for (later) usage / urlencoded and replace [PARAMENC] in update_url
|
||||
# param_opt Optional parameter for (later) usage / replace [PARAMOPT] in update_url
|
||||
#
|
||||
# use_https use HTTPS to update DDNS service
|
||||
# cacert file or directory where HTTPS can find certificates to verify server; 'IGNORE' ignore check of server certificate
|
||||
#
|
||||
# use_syslog log activity to syslog
|
||||
#
|
||||
# ip_source source to detect current local IP ('network' or 'web' or 'script' or 'interface')
|
||||
# ip_network local defined network to read IP from i.e. 'wan' or 'wan6'
|
||||
# ip_url URL to read local address from i.e. http://checkip.dyndns.com/ or http://checkipv6.dyndns.com/
|
||||
# ip_script full path and name of your script to detect local IP
|
||||
# ip_interface physical interface to use for detecting
|
||||
#
|
||||
# check_interval check for changes every !!! checks below 10 minutes make no sense because the Internet
|
||||
# check_unit 'days' 'hours' 'minutes' !!! needs about 5-10 minutes to sync an IP-change for an DNS entry
|
||||
#
|
||||
# force_interval force to send an update to your service if no change was detected
|
||||
# force_unit 'days' 'hours' 'minutes' !!! force_interval="0" runs this script once for use i.e. with cron
|
||||
#
|
||||
# retry_interval if error was detected retry in
|
||||
# retry_unit 'days' 'hours' 'minutes' 'seconds'
|
||||
# retry_count number of retries before scripts stops
|
||||
#
|
||||
# use_ipv6 detecting/sending IPv6 address
|
||||
# force_ipversion force usage of IPv4 or IPv6 for the whole detection and update communication
|
||||
# dns_server using a non default dns server to get Registered IP from Internet
|
||||
# force_dnstcp force communication with DNS server via TCP instead of default UDP
|
||||
# proxy using a proxy for communication !!! ALSO used to detect local IP via web => return proxy's IP !!!
|
||||
# use_logfile self-explanatory "/var/log/ddns/$SECTION_ID.log"
|
||||
# is_glue the record that should be updated is a glue record
|
||||
#
|
||||
# some functionality needs
|
||||
# - GNU Wget or cURL installed for sending updates to DDNS service
|
||||
# - BIND host installed to detect Registered IP
|
||||
#
|
||||
################################################################################
|
||||
|
||||
load_all_config_options "ddns" "$SECTION_ID"
|
||||
ERR_LAST=$? # save return code - equal 0 if SECTION_ID found
|
||||
|
||||
# set defaults if not defined
|
||||
[ -z "$enabled" ] && enabled=0
|
||||
[ -z "$retry_count" ] && retry_count=0 # endless retry
|
||||
[ -z "$use_syslog" ] && use_syslog=2 # syslog "Notice"
|
||||
[ -z "$use_https" ] && use_https=0 # not use https
|
||||
[ -z "$use_logfile" ] && use_logfile=1 # use logfile by default
|
||||
[ -z "$use_ipv6" ] && use_ipv6=0 # use IPv4 by default
|
||||
[ -z "$force_ipversion" ] && force_ipversion=0 # default let system decide
|
||||
[ -z "$force_dnstcp" ] && force_dnstcp=0 # default UDP
|
||||
[ -z "$ip_source" ] && ip_source="network"
|
||||
[ -z "$is_glue" ] && is_glue=0 # default the ddns record is not a glue record
|
||||
[ "$ip_source" = "network" -a -z "$ip_network" -a $use_ipv6 -eq 0 ] && ip_network="wan" # IPv4: default wan
|
||||
[ "$ip_source" = "network" -a -z "$ip_network" -a $use_ipv6 -eq 1 ] && ip_network="wan6" # IPv6: default wan6
|
||||
[ "$ip_source" = "web" -a -z "$ip_url" -a $use_ipv6 -eq 0 ] && ip_url="http://checkip.dyndns.com"
|
||||
[ "$ip_source" = "web" -a -z "$ip_url" -a $use_ipv6 -eq 1 ] && ip_url="http://checkipv6.dyndns.com"
|
||||
[ "$ip_source" = "interface" -a -z "$ip_interface" ] && ip_interface="eth1"
|
||||
|
||||
# url encode username (might be email or something like this)
|
||||
# and password (might have special chars for security reason)
|
||||
# and optional parameter "param_enc"
|
||||
[ -n "$username" ] && urlencode URL_USER "$username"
|
||||
[ -n "$password" ] && urlencode URL_PASS "$password"
|
||||
[ -n "$param_enc" ] && urlencode URL_PENC "$param_enc"
|
||||
|
||||
# SECTION_ID does not exists
|
||||
[ $ERR_LAST -ne 0 ] && {
|
||||
[ $VERBOSE -le 1 ] && VERBOSE=2 # force console out and logfile output
|
||||
[ -f $LOGFILE ] && rm -f $LOGFILE # clear logfile before first entry
|
||||
write_log 7 "************ ************** ************** **************"
|
||||
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
||||
write_log 7 "ddns version : $VERSION"
|
||||
write_log 7 "uci configuration:${N}$(uci -q show ddns | grep '=service' | sort)"
|
||||
write_log 14 "Service section '$SECTION_ID' not defined"
|
||||
}
|
||||
|
||||
write_log 7 "************ ************** ************** **************"
|
||||
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
||||
write_log 7 "ddns version : $VERSION"
|
||||
write_log 7 "uci configuration:${N}$(uci -q show ddns.$SECTION_ID | sort)"
|
||||
# write_log 7 "ddns version : $(opkg list-installed ddns-scripts | cut -d ' ' -f 3)"
|
||||
case $VERBOSE in
|
||||
0) write_log 7 "verbose mode : 0 - run normal, NO console output";;
|
||||
1) write_log 7 "verbose mode : 1 - run normal, console mode";;
|
||||
2) write_log 7 "verbose mode : 2 - run once, NO retry on error";;
|
||||
3) write_log 7 "verbose mode : 3 - run once, NO retry on error, NOT sending update";;
|
||||
*) write_log 14 "error detecting VERBOSE '$VERBOSE'";;
|
||||
esac
|
||||
|
||||
# check enabled state otherwise we don't need to continue
|
||||
[ $enabled -eq 0 ] && write_log 14 "Service section disabled!"
|
||||
|
||||
# determine what update url we're using if a service_name is supplied
|
||||
# otherwise update_url is set inside configuration (custom update url)
|
||||
# or update_script is set inside configuration (custom update script)
|
||||
[ -n "$service_name" ] && {
|
||||
# Check first if we have a custom service provider with this name
|
||||
get_service_data "$service_name" "/usr/share/ddns/custom" update_url update_script UPD_ANSWER
|
||||
if [ "$?" != "0" ]; then
|
||||
get_service_data "$service_name" "/usr/share/ddns/default" update_url update_script UPD_ANSWER
|
||||
fi
|
||||
}
|
||||
|
||||
[ -z "$update_url" -a -z "$update_script" ] && write_log 14 "No update_url found/defined or no update_script found/defined!"
|
||||
[ -n "$update_script" -a ! -f "$update_script" ] && write_log 14 "Custom update_script not found!"
|
||||
|
||||
# temporary needed to convert existing uci settings
|
||||
[ -z "$lookup_host" ] && {
|
||||
uci -q set ddns.$SECTION_ID.lookup_host="$domain"
|
||||
uci -q commit ddns
|
||||
lookup_host="$domain"
|
||||
}
|
||||
# later versions only check if configured correctly
|
||||
|
||||
# without lookup host and possibly other required options we can do nothing for you
|
||||
[ -z "$lookup_host" ] && write_log 14 "Service section not configured correctly! Missing 'lookup_host'"
|
||||
|
||||
# verify validity of variables
|
||||
[ -n "$lookup_host" ] && sanitize_variable lookup_host "$DNS_CHARSET" ""
|
||||
[ -n "$dns_server" ] && sanitize_variable dns_server "$DNS_CHARSET" ""
|
||||
[ -n "$domain" ] && sanitize_variable domain "$DNS_CHARSET_DOMAIN" ""
|
||||
|
||||
# Filter shell escape characters, if these are required in the URL, they
|
||||
# can still be passed url encoded
|
||||
[ -n "$param_opt" ] && sanitize_variable param_opt "" "$SHELL_ESCAPE"
|
||||
|
||||
[ -n "$update_url" ] && {
|
||||
# only check if update_url is given, update_scripts have to check themselves
|
||||
[ -z "$domain" ] && $(echo "$update_url" | grep "\[DOMAIN\]" >/dev/null 2>&1) && \
|
||||
write_log 14 "Service section not configured correctly! Missing 'domain'"
|
||||
[ -z "$username" ] && $(echo "$update_url" | grep "\[USERNAME\]" >/dev/null 2>&1) && \
|
||||
write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||
[ -z "$password" ] && $(echo "$update_url" | grep "\[PASSWORD\]" >/dev/null 2>&1) && \
|
||||
write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||
[ -z "$param_enc" ] && $(echo "$update_url" | grep "\[PARAMENC\]" >/dev/null 2>&1) && \
|
||||
write_log 14 "Service section not configured correctly! Missing 'param_enc'"
|
||||
[ -z "$param_opt" ] && $(echo "$update_url" | grep "\[PARAMOPT\]" >/dev/null 2>&1) && \
|
||||
write_log 14 "Service section not configured correctly! Missing 'param_opt'"
|
||||
}
|
||||
|
||||
# verify ip_source 'script' if script is configured and executable
|
||||
if [ "$ip_source" = "script" ]; then
|
||||
set -- $ip_script #handling script with parameters, we need a trick
|
||||
[ -z "$1" ] && write_log 14 "No script defined to detect local IP!"
|
||||
[ -x "$1" ] || write_log 14 "Script to detect local IP not executable!"
|
||||
fi
|
||||
|
||||
# compute update interval in seconds
|
||||
get_seconds CHECK_SECONDS ${check_interval:-10} ${check_unit:-"minutes"} # default 10 min
|
||||
get_seconds FORCE_SECONDS ${force_interval:-72} ${force_unit:-"hours"} # default 3 days
|
||||
get_seconds RETRY_SECONDS ${retry_interval:-60} ${retry_unit:-"seconds"} # default 60 sec
|
||||
[ $CHECK_SECONDS -lt 300 ] && CHECK_SECONDS=300 # minimum 5 minutes
|
||||
[ $FORCE_SECONDS -gt 0 -a $FORCE_SECONDS -lt $CHECK_SECONDS ] && FORCE_SECONDS=$CHECK_SECONDS # FORCE_SECONDS >= CHECK_SECONDS or 0
|
||||
write_log 7 "check interval: $CHECK_SECONDS seconds"
|
||||
write_log 7 "force interval: $FORCE_SECONDS seconds"
|
||||
write_log 7 "retry interval: $RETRY_SECONDS seconds"
|
||||
write_log 7 "retry counter : $retry_count times"
|
||||
|
||||
# kill old process if it exists & set new pid file
|
||||
stop_section_processes "$SECTION_ID"
|
||||
[ $? -gt 0 ] && write_log 7 "'SIGTERM' was send to old process" || write_log 7 "No old process"
|
||||
echo $$ > $PIDFILE
|
||||
|
||||
# determine when the last update was
|
||||
# the following lines should prevent multiple updates if hotplug fires multiple startups
|
||||
# as described in Ticket #7820, but did not function if never an update take place
|
||||
# i.e. after a reboot (/var is linked to /tmp)
|
||||
# using uptime as reference because date might not be updated via NTP client
|
||||
get_uptime CURR_TIME
|
||||
[ -e "$UPDFILE" ] && {
|
||||
LAST_TIME=$(cat $UPDFILE)
|
||||
# check also LAST > CURR because link of /var/run to /tmp might be removed
|
||||
# i.e. boxes with larger filesystems
|
||||
[ -z "$LAST_TIME" ] && LAST_TIME=0
|
||||
[ $LAST_TIME -gt $CURR_TIME ] && LAST_TIME=0
|
||||
}
|
||||
if [ $LAST_TIME -eq 0 ]; then
|
||||
write_log 7 "last update: never"
|
||||
else
|
||||
EPOCH_TIME=$(( $(date +%s) - $CURR_TIME + $LAST_TIME ))
|
||||
EPOCH_TIME="date -d @$EPOCH_TIME +'$ddns_dateformat'"
|
||||
write_log 7 "last update: $(eval $EPOCH_TIME)"
|
||||
fi
|
||||
|
||||
# verify DNS server
|
||||
[ -n "$dns_server" ] && verify_dns "$dns_server"
|
||||
|
||||
# verify Proxy server and set environment
|
||||
[ -n "$proxy" ] && {
|
||||
verify_proxy "$proxy" && {
|
||||
# everything ok set proxy
|
||||
export HTTP_PROXY="http://$proxy"
|
||||
export HTTPS_PROXY="http://$proxy"
|
||||
export http_proxy="http://$proxy"
|
||||
export https_proxy="http://$proxy"
|
||||
}
|
||||
}
|
||||
|
||||
# let's check if there is already an IP registered on the web
|
||||
get_registered_ip REGISTERED_IP "NO_RETRY"
|
||||
ERR_LAST=$?
|
||||
# No error or No IP set otherwise retry
|
||||
[ $ERR_LAST -eq 0 -o $ERR_LAST -eq 127 ] || get_registered_ip REGISTERED_IP
|
||||
# on IPv6 we use expanded version to be shure when comparing
|
||||
[ $use_ipv6 -eq 1 ] && expand_ipv6 "$REGISTERED_IP" REGISTERED_IP
|
||||
|
||||
# loop endlessly, checking ip every check_interval and forcing an updating once every force_interval
|
||||
write_log 6 "Starting main loop at $(eval $DATE_PROG)"
|
||||
while : ; do
|
||||
|
||||
get_local_ip LOCAL_IP # read local IP
|
||||
[ $use_ipv6 -eq 1 ] && expand_ipv6 "$LOCAL_IP" LOCAL_IP # on IPv6 we use expanded version
|
||||
|
||||
# prepare update
|
||||
# never updated or forced immediate then NEXT_TIME = 0
|
||||
[ $FORCE_SECONDS -eq 0 -o $LAST_TIME -eq 0 ] \
|
||||
&& NEXT_TIME=0 \
|
||||
|| NEXT_TIME=$(( $LAST_TIME + $FORCE_SECONDS ))
|
||||
|
||||
get_uptime CURR_TIME # get current uptime
|
||||
|
||||
# send update when current time > next time or local ip different from registered ip
|
||||
if [ $CURR_TIME -ge $NEXT_TIME -o "$LOCAL_IP" != "$REGISTERED_IP" ]; then
|
||||
if [ $VERBOSE -gt 2 ]; then
|
||||
write_log 7 "Verbose Mode: $VERBOSE - NO UPDATE send"
|
||||
elif [ "$LOCAL_IP" != "$REGISTERED_IP" ]; then
|
||||
write_log 7 "Update needed - L: '$LOCAL_IP' <> R: '$REGISTERED_IP'"
|
||||
else
|
||||
write_log 7 "Forced Update - L: '$LOCAL_IP' == R: '$REGISTERED_IP'"
|
||||
fi
|
||||
|
||||
ERR_LAST=0
|
||||
[ $VERBOSE -lt 3 ] && {
|
||||
# only send if VERBOSE < 3
|
||||
send_update "$LOCAL_IP"
|
||||
ERR_LAST=$? # save return value
|
||||
}
|
||||
|
||||
# error sending local IP to provider
|
||||
# we have no communication error (handled inside send_update/do_transfer)
|
||||
# but update was not recognized
|
||||
# do NOT retry after RETRY_SECONDS, do retry after CHECK_SECONDS
|
||||
# to early retrys will block most DDNS provider
|
||||
# providers answer is checked inside send_update() function
|
||||
if [ $ERR_LAST -eq 0 ]; then
|
||||
get_uptime LAST_TIME # we send update, so
|
||||
echo $LAST_TIME > $UPDFILE # save LASTTIME to file
|
||||
[ "$LOCAL_IP" != "$REGISTERED_IP" ] \
|
||||
&& write_log 6 "Update successful - IP '$LOCAL_IP' send" \
|
||||
|| write_log 6 "Forced update successful - IP: '$LOCAL_IP' send"
|
||||
elif [ $ERR_LAST -eq 127 ]; then
|
||||
write_log 3 "No update send to DDNS Provider"
|
||||
else
|
||||
write_log 3 "IP update not accepted by DDNS Provider"
|
||||
fi
|
||||
fi
|
||||
|
||||
# now we wait for check interval before testing if update was recognized
|
||||
# only sleep if VERBOSE <= 2 because otherwise nothing was send
|
||||
[ $VERBOSE -le 2 ] && {
|
||||
write_log 7 "Waiting $CHECK_SECONDS seconds (Check Interval)"
|
||||
sleep $CHECK_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP # enable trap-handler
|
||||
PID_SLEEP=0
|
||||
} || write_log 7 "Verbose Mode: $VERBOSE - NO Check Interval waiting"
|
||||
|
||||
REGISTERED_IP="" # clear variable
|
||||
get_registered_ip REGISTERED_IP # get registered/public IP
|
||||
[ $use_ipv6 -eq 1 ] && expand_ipv6 "$REGISTERED_IP" REGISTERED_IP # on IPv6 we use expanded version
|
||||
|
||||
# IP's are still different
|
||||
if [ "$LOCAL_IP" != "$REGISTERED_IP" ]; then
|
||||
if [ $VERBOSE -le 1 ]; then # VERBOSE <=1 then retry
|
||||
ERR_UPDATE=$(( $ERR_UPDATE + 1 ))
|
||||
[ $retry_count -gt 0 -a $ERR_UPDATE -gt $retry_count ] && \
|
||||
write_log 14 "Updating IP at DDNS provider failed after $retry_count retries"
|
||||
write_log 4 "Updating IP at DDNS provider failed - starting retry $ERR_UPDATE/$retry_count"
|
||||
continue # loop to beginning
|
||||
else
|
||||
write_log 4 "Updating IP at DDNS provider failed"
|
||||
write_log 7 "Verbose Mode: $VERBOSE - NO retry"; exit 1
|
||||
fi
|
||||
else
|
||||
# we checked successful the last update
|
||||
ERR_UPDATE=0 # reset error counter
|
||||
fi
|
||||
|
||||
# force_update=0 or VERBOSE > 1 - leave here
|
||||
[ $VERBOSE -gt 1 ] && write_log 7 "Verbose Mode: $VERBOSE - NO reloop"
|
||||
[ $FORCE_SECONDS -eq 0 ] && write_log 6 "Configured to run once"
|
||||
[ $VERBOSE -gt 1 -o $FORCE_SECONDS -eq 0 ] && exit 0
|
||||
|
||||
write_log 6 "Rerun IP check at $(eval $DATE_PROG)"
|
||||
done
|
||||
# we should never come here there must be a programming error
|
||||
write_log 12 "Error in 'dynamic_dns_updater.sh - program coding error"
|
202
ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh
Normal file
202
ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh
Normal file
@ -0,0 +1,202 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
||||
#
|
||||
# script for sending updates to cloudflare.com
|
||||
#.based on Ben Kulbertis cloudflare-update-record.sh found at http://gist.github.com/benkulbertis
|
||||
#.and on George Johnson's cf-ddns.sh found at https://github.com/gstuartj/cf-ddns.sh
|
||||
#.2016-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||
# CloudFlare API documentation at https://api.cloudflare.com/
|
||||
#
|
||||
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
||||
#
|
||||
# using following options from /etc/config/ddns
|
||||
# option username - your cloudflare e-mail
|
||||
# option password - cloudflare api key, you can get it from cloudflare.com/my-account/
|
||||
# option domain - "hostname@yourdomain.TLD" # syntax changed to remove split_FQDN() function and tld_names.dat.gz
|
||||
#
|
||||
# The proxy status would not be changed by this script. Please change it in Cloudflare dashboard manually.
|
||||
#
|
||||
# variable __IP already defined with the ip-address to use for update
|
||||
#
|
||||
|
||||
# check parameters
|
||||
[ -z "$CURL" ] && [ -z "$CURL_SSL" ] && write_log 14 "Cloudflare communication require cURL with SSL support. Please install"
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing key as 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing secret as 'password'"
|
||||
[ $use_https -eq 0 ] && use_https=1 # force HTTPS
|
||||
|
||||
# used variables
|
||||
local __HOST __DOMAIN __TYPE __URLBASE __PRGBASE __RUNPROG __DATA __IPV6 __ZONEID __RECID __PROXIED
|
||||
local __URLBASE="https://api.cloudflare.com/client/v4"
|
||||
local __TTL=120
|
||||
|
||||
# split __HOST __DOMAIN from $domain
|
||||
# given data:
|
||||
# @example.com for "domain record"
|
||||
# host.sub@example.com for a "host record"
|
||||
__HOST=$(printf %s "$domain" | cut -d@ -f1)
|
||||
__DOMAIN=$(printf %s "$domain" | cut -d@ -f2)
|
||||
|
||||
# Cloudflare v4 needs:
|
||||
# __DOMAIN = the base domain i.e. example.com
|
||||
# __HOST = the FQDN of record to modify
|
||||
# i.e. example.com for the "domain record" or host.sub.example.com for "host record"
|
||||
|
||||
# handling domain record then set __HOST = __DOMAIN
|
||||
[ -z "$__HOST" ] && __HOST=$__DOMAIN
|
||||
# handling host record then rebuild fqdn host@domain.tld => host.domain.tld
|
||||
[ "$__HOST" != "$__DOMAIN" ] && __HOST="${__HOST}.${__DOMAIN}"
|
||||
|
||||
# set record type
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# transfer function to use for godaddy
|
||||
# all needed variables are set global here
|
||||
# so we can use them directly
|
||||
cloudflare_transfer() {
|
||||
local __CNT=0
|
||||
local __ERR
|
||||
while : ; do
|
||||
write_log 7 "#> $__RUNPROG"
|
||||
eval "$__RUNPROG"
|
||||
__ERR=$? # save communication error
|
||||
[ $__ERR -eq 0 ] && break # no error break while
|
||||
|
||||
write_log 3 "cURL Error: '$__ERR'"
|
||||
write_log 7 "$(cat $ERRFILE)" # report error
|
||||
|
||||
[ $VERBOSE_MODE -gt 1 ] && {
|
||||
# VERBOSE_MODE > 1 then NO retry
|
||||
write_log 4 "Transfer failed - Verbose Mode: $VERBOSE_MODE - NO retry on error"
|
||||
break
|
||||
}
|
||||
|
||||
__CNT=$(( $__CNT + 1 )) # increment error counter
|
||||
# if error count > retry_count leave here
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
|
||||
write_log 14 "Transfer failed after $retry_count retries"
|
||||
|
||||
write_log 4 "Transfer failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP # enable trap-handler
|
||||
PID_SLEEP=0
|
||||
done
|
||||
|
||||
# check for error
|
||||
grep -q '"success":\s*true' $DATFILE || {
|
||||
write_log 4 "CloudFlare reported an error:"
|
||||
write_log 7 "$(cat $DATFILE)" # report error
|
||||
return 1 # HTTP-Fehler
|
||||
}
|
||||
}
|
||||
|
||||
# Build base command to use
|
||||
__PRGBASE="$CURL -RsS -o $DATFILE --stderr $ERRFILE"
|
||||
# force network/interface-device to use for communication
|
||||
if [ -n "$bind_network" ]; then
|
||||
local __DEVICE
|
||||
network_get_physdev __DEVICE $bind_network || \
|
||||
write_log 13 "Can not detect local device using 'network_get_physdev $bind_network' - Error: '$?'"
|
||||
write_log 7 "Force communication via device '$__DEVICE'"
|
||||
__PRGBASE="$__PRGBASE --interface $__DEVICE"
|
||||
fi
|
||||
# force ip version to use
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __PRGBASE="$__PRGBASE -4" || __PRGBASE="$__PRGBASE -6" # force IPv4/IPv6
|
||||
fi
|
||||
# set certificate parameters
|
||||
if [ "$cacert" = "IGNORE" ]; then # idea from Ticket #15327 to ignore server cert
|
||||
__PRGBASE="$__PRGBASE --insecure" # but not empty better to use "IGNORE"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__PRGBASE="$__PRGBASE --cacert $cacert"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__PRGBASE="$__PRGBASE --capath $cacert"
|
||||
elif [ -n "$cacert" ]; then # it's not a file and not a directory but given
|
||||
write_log 14 "No valid certificate(s) found at '$cacert' for HTTPS communication"
|
||||
fi
|
||||
# disable proxy if not set (there might be .wgetrc or .curlrc or wrong environment set)
|
||||
# or check if libcurl compiled with proxy support
|
||||
if [ -z "$proxy" ]; then
|
||||
__PRGBASE="$__PRGBASE --noproxy '*'"
|
||||
elif [ -z "$CURL_PROXY" ]; then
|
||||
# if libcurl has no proxy support and proxy should be used then force ERROR
|
||||
write_log 13 "cURL: libcurl compiled without Proxy support"
|
||||
fi
|
||||
# set headers
|
||||
if [ "$username" = "Bearer" ]; then
|
||||
write_log 7 "Found Username 'Bearer' using Password as Bearer Authorization Token"
|
||||
__PRGBASE="$__PRGBASE --header 'Authorization: Bearer $password' "
|
||||
else
|
||||
__PRGBASE="$__PRGBASE --header 'X-Auth-Email: $username' "
|
||||
__PRGBASE="$__PRGBASE --header 'X-Auth-Key: $password' "
|
||||
fi
|
||||
__PRGBASE="$__PRGBASE --header 'Content-Type: application/json' "
|
||||
|
||||
if [ -n "$zone_id" ]; then
|
||||
__ZONEID="$zone_id"
|
||||
else
|
||||
# read zone id for registered domain.TLD
|
||||
__RUNPROG="$__PRGBASE --request GET '$__URLBASE/zones?name=$__DOMAIN'"
|
||||
cloudflare_transfer || return 1
|
||||
# extract zone id
|
||||
__ZONEID=$(grep -o '"id":\s*"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
[ -z "$__ZONEID" ] && {
|
||||
write_log 4 "Could not detect 'zone id' for domain.tld: '$__DOMAIN'"
|
||||
return 127
|
||||
}
|
||||
fi
|
||||
|
||||
# read record id for A or AAAA record of host.domain.TLD
|
||||
__RUNPROG="$__PRGBASE --request GET '$__URLBASE/zones/$__ZONEID/dns_records?name=$__HOST&type=$__TYPE'"
|
||||
cloudflare_transfer || return 1
|
||||
# extract record id
|
||||
__RECID=$(grep -o '"id":\s*"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
[ -z "$__RECID" ] && {
|
||||
write_log 4 "Could not detect 'record id' for host.domain.tld: '$__HOST'"
|
||||
return 127
|
||||
}
|
||||
|
||||
# extract current stored IP
|
||||
__DATA=$(grep -o '"content":\s*"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
|
||||
# check data
|
||||
[ $use_ipv6 -eq 0 ] \
|
||||
&& __DATA=$(printf "%s" "$__DATA" | grep -m 1 -o "$IPV4_REGEX") \
|
||||
|| __DATA=$(printf "%s" "$__DATA" | grep -m 1 -o "$IPV6_REGEX")
|
||||
|
||||
# we got data so verify
|
||||
[ -n "$__DATA" ] && {
|
||||
# expand IPv6 for compare
|
||||
if [ $use_ipv6 -eq 1 ]; then
|
||||
expand_ipv6 $__IP __IPV6
|
||||
expand_ipv6 $__DATA __DATA
|
||||
[ "$__DATA" = "$__IPV6" ] && { # IPv6 no update needed
|
||||
write_log 7 "IPv6 at CloudFlare.com already up to date"
|
||||
return 0
|
||||
}
|
||||
else
|
||||
[ "$__DATA" = "$__IP" ] && { # IPv4 no update needed
|
||||
write_log 7 "IPv4 at CloudFlare.com already up to date"
|
||||
return 0
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
# update is needed
|
||||
# let's build data to send
|
||||
# set proxied parameter
|
||||
__PROXIED=$(grep -o '"proxied":\s*[^",]*' $DATFILE | grep -o '[^:]*$')
|
||||
|
||||
# use file to work around " needed for json
|
||||
cat > $DATFILE << EOF
|
||||
{"id":"$__ZONEID","type":"$__TYPE","name":"$__HOST","content":"$__IP","ttl":$__TTL,"proxied":$__PROXIED}
|
||||
EOF
|
||||
|
||||
# let's complete transfer command
|
||||
__RUNPROG="$__PRGBASE --request PUT --data @$DATFILE '$__URLBASE/zones/$__ZONEID/dns_records/$__RECID'"
|
||||
cloudflare_transfer || return 1
|
||||
|
||||
return 0
|
||||
|
86
ddns-scripts/files/usr/lib/ddns/update_cnkuai_cn.sh
Normal file
86
ddns-scripts/files/usr/lib/ddns/update_cnkuai_cn.sh
Normal file
@ -0,0 +1,86 @@
|
||||
# inside url we need domain, username and password
|
||||
[ -z "$domain" ] && write_log 14 "Service section not configured correctly! Missing 'domain'"
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||
|
||||
local urlCp='http://cp.cnkuai.cn/'
|
||||
local urlLogin='http://cp.cnkuai.cn/userlogin.asp'
|
||||
local urlCaptcha='http://cp.cnkuai.cn/inc/image.asp'
|
||||
local urlDnsA='http://cp.cnkuai.cn/dns_a.asp'
|
||||
local urlDnsAAAA='http://cp.cnkuai.cn/dns_ipv6.asp'
|
||||
local urlDnsSave='http://cp.cnkuai.cn/dns_save.asp'
|
||||
|
||||
getPixel(){
|
||||
local filename=$1
|
||||
local x=$(($2*3))
|
||||
local y=$(($3*3))
|
||||
local width=48
|
||||
|
||||
hexdump -s "$((x+width*y))" -n 3 -e '3/1 "%02X"' "$filename"
|
||||
}
|
||||
|
||||
captchaChar(){
|
||||
local filename=$1
|
||||
local xoffset=$2
|
||||
|
||||
if [ "$(getPixel "$filename" $((xoffset+2)) 5)" = '000000' ]; then
|
||||
echo '1'
|
||||
elif [ "$(getPixel "$filename" $((xoffset+5)) 7)" = '000000' ]; then
|
||||
echo '2'
|
||||
elif [ "$(getPixel "$filename" $((xoffset+4)) 3)" = '000000' ]; then
|
||||
echo '4'
|
||||
elif [ "$(getPixel "$filename" $((xoffset+6)) 4)" = '000000' ]; then
|
||||
echo '7'
|
||||
elif [ "$(getPixel "$filename" $((xoffset+5)) 8)" = '000000' ]; then
|
||||
echo '8'
|
||||
elif [ "$(getPixel "$filename" $((xoffset+6)) 8)" = '000000' ]; then
|
||||
echo '9'
|
||||
elif [ "$(getPixel "$filename" $((xoffset+5)) 6)" = '000000' ]; then
|
||||
echo '3'
|
||||
elif [ "$(getPixel "$filename" $((xoffset+0)) 4)" = '000000' ]; then
|
||||
echo '5'
|
||||
elif [ "$(getPixel "$filename" $((xoffset+1)) 5)" = '000000' ]; then
|
||||
echo '6'
|
||||
else
|
||||
echo '0'
|
||||
fi
|
||||
}
|
||||
|
||||
captcha(){
|
||||
local str
|
||||
str=$(captchaChar "$1" 9)
|
||||
str=$str$(captchaChar "$1" 18)
|
||||
str=$str$(captchaChar "$1" 26)
|
||||
str=$str$(captchaChar "$1" 35)
|
||||
echo "$str"
|
||||
}
|
||||
|
||||
#clean
|
||||
rm /tmp/cnkuai.*
|
||||
#login to cnkuai dns cp
|
||||
curl -c '/tmp/cnkuai.cookiejar' "$urlCaptcha" | gif2rgb > /tmp/cnkuai.rgb || return 1
|
||||
yzm=$(captcha "/tmp/cnkuai.rgb")
|
||||
curl -b '/tmp/cnkuai.cookiejar' -c '/tmp/cnkuai.cookiejar' -H "Content-Type: application/x-www-form-urlencoded" -H "Referer: $urlCp" -d "userid=$URL_USER&password=$URL_PASS&yzm=$yzm&B1=%C8%B7%C8%CF%B5%C7%C2%BD&lx=0&userlx=3" -X POST "$urlLogin" > /dev/null || return 1
|
||||
|
||||
if [ "$use_ipv6" -eq 0 ]; then
|
||||
curl -b '/tmp/cnkuai.cookiejar' -c '/tmp/cnkuai.cookiejar' "$urlDnsA" > /tmp/cnkuai.html || return 1
|
||||
else
|
||||
curl -b '/tmp/cnkuai.cookiejar' -c '/tmp/cnkuai.cookiejar' "$urlDnsAAAA" > /tmp/cnkuai.html || return 1
|
||||
fi
|
||||
local domainline
|
||||
domainline=$(awk "/<td>$domain<\/td>/{ print NR; exit }" /tmp/cnkuai.html)
|
||||
local domainid
|
||||
domainid=$(awk "NR==$((domainline+3))" /tmp/cnkuai.html | sed 's/^.*name=\x27domainid\x27 value="//g' | sed 's/".*$//g')
|
||||
local dnslistid
|
||||
dnslistid=$(awk "NR==$((domainline+3))" /tmp/cnkuai.html | sed 's/^.*name=\x27dnslistid\x27 value="//g' | sed 's/".*$//g')
|
||||
|
||||
local data
|
||||
|
||||
if [ "$use_ipv6" -eq 0 ]; then
|
||||
data="T2=$__IP&T3=120&act=dns_a_edit&domainid=$domainid&dnslistid=$dnslistid&B1=%D0%DE%B8%C4"
|
||||
else
|
||||
data="T2=$__IP&T3=120&act=dns_ipv6_edit&domainid=$domainid&dnslistid=$dnslistid&B1=%D0%DE%B8%C4"
|
||||
fi
|
||||
curl -b '/tmp/cnkuai.cookiejar' -c '/tmp/cnkuai.cookiejar' -H "Content-Type: application/x-www-form-urlencoded" -H "Referer: $urlDnsA" -d "$data" -X POST "$urlDnsSave" > /dev/null || return 1
|
||||
|
||||
return 0
|
@ -0,0 +1,40 @@
|
||||
# Script for sending user defined updates using the DigitalOcean API
|
||||
# 2015 Artem Yakimenko <code at temik dot me>
|
||||
# 2021 George Giannou <giannoug at gmail dot com>
|
||||
|
||||
# Options passed from /etc/config/ddns:
|
||||
# Domain - the domain name managed by DigitalOcean (e.g. example.com)
|
||||
# Username - the hostname of the domain (e.g. myrouter)
|
||||
# Password - DigitalOcean personal access token (API key)
|
||||
# Optional Parameter - the API domain record ID of the hostname (e.g. 21694203)
|
||||
|
||||
# Use the following command to find your API domain record ID (replace TOKEN and DOMAIN with your own):
|
||||
# curl -X GET -H 'Content-Type: application/json' \
|
||||
# -H "Authorization: Bearer TOKEN" \
|
||||
# "https://api.digitalocean.com/v2/domains/DOMAIN/records"
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
[ -z "$domain" ] && write_log 14 "Service section not configured correctly! Missing domain name as 'Domain'"
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing hostname as 'Username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing personal access token as 'Password'"
|
||||
[ -z "$param_opt" ] && write_log 14 "Service section not configured correctly! Missing API domain record ID as 'Optional Parameter'"
|
||||
|
||||
# Construct JSON payload
|
||||
json_init
|
||||
json_add_string name "$username"
|
||||
json_add_string data "$__IP"
|
||||
|
||||
__STATUS=$(curl -Ss -X PUT "https://api.digitalocean.com/v2/domains/${domain}/records/${param_opt}" \
|
||||
-H "Authorization: Bearer ${password}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$(json_dump)" \
|
||||
-w "%{http_code}\n" -o $DATFILE 2>$ERRFILE)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
write_log 14 "Curl failed: $(cat $ERRFILE)"
|
||||
return 1
|
||||
elif [ -z $__STATUS ] || [ $__STATUS != 200 ]; then
|
||||
write_log 14 "Curl failed: $__STATUS \ndigitalocean.com answered: $(cat $DATFILE)"
|
||||
return 1
|
||||
fi
|
137
ddns-scripts/files/usr/lib/ddns/update_dnspod_cn.sh
Executable file
137
ddns-scripts/files/usr/lib/ddns/update_dnspod_cn.sh
Executable file
@ -0,0 +1,137 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check inputs
|
||||
[ -z "$username" ] && write_log 14 "Configuration error! [User name] cannot be empty"
|
||||
[ -z "$password" ] && write_log 14 "Configuration error! [Password] cannot be empty"
|
||||
|
||||
# Check external tools
|
||||
[ -n "$CURL_SSL" ] || write_log 13 "Dnspod communication require cURL with SSL support. Please install"
|
||||
[ -n "$CURL_PROXY" ] || write_log 13 "cURL: libcurl compiled without Proxy support"
|
||||
|
||||
# Declare variables
|
||||
#local __URLBASE __HOST __DOMAIN __TYPE __CMDBASE __POST __POST1 __RECIP __RECID __TTL
|
||||
__URLBASE="https://dnsapi.cn"
|
||||
|
||||
# Get host and domain from $domain
|
||||
[ "${domain:0:2}" = "@." ] && domain="${domain/./}" # host
|
||||
[ "$domain" = "${domain/@/}" ] && domain="${domain/./@}" # host with no sperator
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" = "$__DOMAIN" ] && __HOST=@
|
||||
|
||||
# Set record type
|
||||
[ $use_ipv6 = 0 ] && __TYPE=A || __TYPE=AAAA
|
||||
|
||||
# Build base command
|
||||
build_command() {
|
||||
__CMDBASE="$CURL -Ss"
|
||||
# bind host/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local __DEVICE
|
||||
network_get_physdev __DEVICE $bind_network || write_log 13 "Can not detect local device using 'network_get_physdev $bind_network' - Error: '$?'"
|
||||
write_log 7 "Force communication via device '$__DEVICE'"
|
||||
__CMDBASE="$__CMDBASE --interface $__DEVICE"
|
||||
fi
|
||||
# Force IP version
|
||||
if [ $force_ipversion = 1 ]; then
|
||||
[ $use_ipv6 = 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# Set CA
|
||||
if [ $use_https = 1 ]; then
|
||||
if [ "$cacert" = IGNORE ]; then
|
||||
__CMDBASE="$__CMDBASE --insecure"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --cacert $cacert"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --capath $cacert"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "No valid certificate(s) found at '$cacert' for HTTPS communication"
|
||||
fi
|
||||
fi
|
||||
# Set if no proxy (might be an error with .wgetrc or env)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --noproxy '*'"
|
||||
__CMDBASE="$__CMDBASE -d"
|
||||
}
|
||||
|
||||
# Dnspod API
|
||||
dnspod_transfer() {
|
||||
__CNT=0
|
||||
case "$1" in
|
||||
0) __A="$__CMDBASE '$__POST' $__URLBASE/Record.List" ;;
|
||||
1) __A="$__CMDBASE '$__POST1' $__URLBASE/Record.Create" ;;
|
||||
2) __A="$__CMDBASE '$__POST1&record_id=$__RECID&ttl=$__TTL' $__URLBASE/Record.Modify" ;;
|
||||
esac
|
||||
|
||||
write_log 7 "#> $__A"
|
||||
while ! __TMP=$(eval $__A 2>&1); do
|
||||
write_log 3 "[$__TMP]"
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "Transfer failed - detailed mode: $VERBOSE - Do not try again after an error"
|
||||
return 1
|
||||
fi
|
||||
__CNT=$(($__CNT + 1))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && write_log 14 "Transfer failed after $retry_count retries"
|
||||
write_log 4 "Transfer failed - $__CNT Try again in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
__ERR=$(jsonfilter -s "$__TMP" -e "@.status.code")
|
||||
[ $__ERR = 1 ] && return 0
|
||||
[ $__ERR = 10 ] && [ $1 = 0 ] && return 0
|
||||
__TMP=$(jsonfilter -s "$__TMP" -e "@.status.message")
|
||||
local A="$(date +%H%M%S) ERROR : [$__TMP] - Terminate process"
|
||||
logger -p user.err -t ddns-scripts[$$] $SECTION_ID: ${A:15}
|
||||
printf "%s\n" " $A" >>$LOGFILE
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Add record
|
||||
add_domain() {
|
||||
dnspod_transfer 1
|
||||
printf "%s\n" " $(date +%H%M%S) : Record add successfully: [$([ "$__HOST" = @ ] || echo $__HOST.)$__DOMAIN],[IP:$__IP]" >>$LOGFILE
|
||||
return 0
|
||||
}
|
||||
|
||||
# Modify record
|
||||
update_domain() {
|
||||
dnspod_transfer 2
|
||||
printf "%s\n" " $(date +%H%M%S) : Record modified successfully: [$([ "$__HOST" = @ ] || echo $__HOST.)$__DOMAIN],[IP:$__IP],[TTL:$__TTL]" >>$LOGFILE
|
||||
return 0
|
||||
}
|
||||
|
||||
# Get DNS record
|
||||
describe_domain() {
|
||||
ret=0
|
||||
__POST="login_token=$username,$password&format=json&domain=$__DOMAIN&sub_domain=$__HOST"
|
||||
__POST1="$__POST&value=$__IP&record_type=$__TYPE&record_line_id=0"
|
||||
dnspod_transfer 0
|
||||
__TMP=$(jsonfilter -s "$__TMP" -e "@.records[@.type='$__TYPE' && @.line_id='0']")
|
||||
if [ -z "$__TMP" ]; then
|
||||
printf "%s\n" " $(date +%H%M%S) : Record not exist: [$([ "$__HOST" = @ ] || echo $__HOST.)$__DOMAIN]" >>$LOGFILE
|
||||
ret=1
|
||||
else
|
||||
__RECIP=$(jsonfilter -s "$__TMP" -e "@.value")
|
||||
if [ "$__RECIP" != "$__IP" ]; then
|
||||
__RECID=$(jsonfilter -s "$__TMP" -e "@.id")
|
||||
__TTL=$(jsonfilter -s "$__TMP" -e "@.ttl")
|
||||
printf "%s\n" " $(date +%H%M%S) : Record needs to be updated: [Record IP:$__RECIP] [Local IP:$__IP]" >>$LOGFILE
|
||||
ret=2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
if [ $ret = 1 ]; then
|
||||
sleep 3
|
||||
add_domain
|
||||
elif [ $ret = 2 ]; then
|
||||
sleep 3
|
||||
update_domain
|
||||
else
|
||||
printf "%s\n" " $(date +%H%M%S) : Record needs not update: [Record IP:$__RECIP] [Local IP:$__IP]" >>$LOGFILE
|
||||
fi
|
||||
|
||||
return 0
|
17
ddns-scripts/files/usr/lib/ddns/update_freedns_42_pl.sh
Normal file
17
ddns-scripts/files/usr/lib/ddns/update_freedns_42_pl.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
||||
#.2018 Michal Lipka <michal at sysadmin dot care>
|
||||
local __DUMMY
|
||||
local __URL="https://freedns.42.pl/xmlrpc.php"
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||
[ $ip_dynamic -eq 1 ] && __IP='\<dynamic\>'
|
||||
PROG="$(command -v curl) -sk"
|
||||
write_log 7 "sending update to freedns.42.pl with ip $__IP"
|
||||
XMLDATA="<?xml version='1.0'?><methodCall><methodName>xname.updateArecord</methodName><params><param><value><struct><member><name>name</name><value><string>[RECORDNAME]</string></value></member><member><name>zone</name><value><string>[ZONENAME]</string></value></member><member><name>oldaddress</name><value><string>*</string></value></member><member><name>updatereverse</name><value><string>0</string></value></member><member><name>user</name><value><string>[USERNAME]</string></value></member><member><name>ttl</name><value><string>600</string></value></member><member><name>newaddress</name><value><string>[IP]</string></value></member><member><name>password</name><value><string>[PASSWORD]</string></value></member></struct></value></param></params></methodCall>"
|
||||
XMLDATA=$(echo $XMLDATA | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
||||
-e "s#\[ZONENAME\]#$zone#g" -e "s#\[RECORDNAME\]#$record#g" -e "s#\[IP\]#$__IP#g")
|
||||
$PROG -d "$XMLDATA" -o $DATFILE $__URL || return 1
|
||||
write_log 7 "'freedns.42.pl' answered:${N}$(cat $DATFILE)"
|
||||
grep "<fault>" $DATFILE > /dev/null 2>&1 && return 1
|
||||
grep '<name>serial</name>' $DATFILE >/dev/null 2>&1
|
||||
return $?
|
39
ddns-scripts/files/usr/lib/ddns/update_gandi_net.sh
Normal file
39
ddns-scripts/files/usr/lib/ddns/update_gandi_net.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# Thanks goes to Alex Griffin who provided this script.
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
local __TTL=600
|
||||
local __RRTYPE
|
||||
local __ENDPOINT="https://api.gandi.net/v5/livedns"
|
||||
local __STATUS
|
||||
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing subdomain as 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing API Key as 'password'"
|
||||
|
||||
[ $use_ipv6 -ne 0 ] && __RRTYPE="AAAA" || __RRTYPE="A"
|
||||
|
||||
# Construct JSON payload
|
||||
json_init
|
||||
json_add_int rrset_ttl "$__TTL"
|
||||
json_add_array rrset_values
|
||||
json_add_string "" "$__IP"
|
||||
json_close_array
|
||||
|
||||
__STATUS=$(curl -s -X PUT "$__ENDPOINT/domains/$domain/records/$username/$__RRTYPE" \
|
||||
-H "Authorization: Apikey $password" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$(json_dump)" \
|
||||
-w "%{http_code}\n" -o $DATFILE 2>$ERRFILE)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
write_log 14 "Curl failed: $(cat $ERRFILE)"
|
||||
return 1
|
||||
elif [ -z $__STATUS ] || [ $__STATUS != 201 ]; then
|
||||
write_log 14 "LiveDNS failed: $__STATUS \ngandi.net answered: $(cat $DATFILE)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
write_log 7 "gandi.net answered: $(cat $DATFILE)"
|
||||
|
||||
return 0
|
172
ddns-scripts/files/usr/lib/ddns/update_godaddy_com_v1.sh
Normal file
172
ddns-scripts/files/usr/lib/ddns/update_godaddy_com_v1.sh
Normal file
@ -0,0 +1,172 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
||||
#
|
||||
# script for sending updates to godaddy.com
|
||||
#.based on GoDaddy.sh v1.0 by Nazar78 @ TeaNazaR.com
|
||||
#.2017-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||
# GoDaddy Documentation at https://developer.godaddy.com/doc
|
||||
#
|
||||
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
||||
#
|
||||
# using following options from /etc/config/ddns
|
||||
# option username - "key" as generated at https://developer.godaddy.com/keys/
|
||||
# option password - "secret" as generated at https://developer.godaddy.com/keys/
|
||||
# option domain - "yourdomain.TLD" to update or "hostname@yourdomain.TLD"
|
||||
#
|
||||
# variable __IP already defined with the ip-address to use for update
|
||||
#
|
||||
|
||||
# check parameters
|
||||
[ -z "$CURL" ] && [ -z "$CURL_SSL" ] && write_log 14 "GoDaddy communication require cURL with SSL support. Please install"
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing key as 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing secret as 'password'"
|
||||
[ $use_https -eq 0 ] && use_https=1 # force HTTPS
|
||||
|
||||
# used variables
|
||||
local __HOST __DOMAIN __TYPE __URL __PRGBASE __RUNPROG __DATA __IPV6
|
||||
|
||||
# split __HOST __DOMAIN from $domain
|
||||
# given data:
|
||||
# @example.com for "domain record"
|
||||
# host.sub@example.com for a "host record"
|
||||
__HOST=$(printf %s "$domain" | cut -d@ -f1)
|
||||
__DOMAIN=$(printf %s "$domain" | cut -d@ -f2)
|
||||
|
||||
# GoDaddy needs:
|
||||
# __DOMAIN = the base domain i.e. example.com
|
||||
# __HOST = host.sub if updating a host record or
|
||||
# __HOST = "@" urlencoded "%40" for a domain record
|
||||
[ -z "$__HOST" -o "$__HOST" = "$__DOMAIN" ] && __HOST="%40"
|
||||
|
||||
# set record type
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# now we know the url to use
|
||||
# __URL="https://api.ote-godaddy.com/v1/domains/$__DOMAIN/records/$__TYPE/$__HOST" # api test server
|
||||
__URL="https://api.godaddy.com/v1/domains/$__DOMAIN/records/$__TYPE/$__HOST" # production server
|
||||
|
||||
# transfer function to use for godaddy
|
||||
# all needed variables are set global here
|
||||
# so we can use them directly
|
||||
godaddy_transfer() {
|
||||
local __CNT=0
|
||||
local __STATUS __ERR __DEVICE
|
||||
while : ; do
|
||||
write_log 7 "#> $__RUNPROG"
|
||||
__STATUS=$(eval "$__RUNPROG")
|
||||
__ERR=$? # save communication error
|
||||
[ $__ERR -eq 0 ] && break # no error break while
|
||||
|
||||
write_log 4 "cURL error: '$__ERR'"
|
||||
write_log 7 "$(cat $ERRFILE)" # report error
|
||||
|
||||
[ $VERBOSE_MODE -gt 1 ] && {
|
||||
# VERBOSE_MODE > 1 then NO retry
|
||||
write_log 4 "Transfer failed - Verbose Mode: $VERBOSE_MODE - NO retry on error"
|
||||
break
|
||||
}
|
||||
|
||||
__CNT=$(( $__CNT + 1 )) # increment error counter
|
||||
# if error count > retry_count leave here
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
|
||||
write_log 14 "Transfer failed after $retry_count retries"
|
||||
|
||||
write_log 4 "Transfer failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP # enable trap-handler
|
||||
PID_SLEEP=0
|
||||
done
|
||||
|
||||
# handle HTTP error
|
||||
[ $__STATUS -ne 200 ] && {
|
||||
write_log 4 "GoDaddy reported an error:"
|
||||
write_log 7 "$(cat $DATFILE)"
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
# Build base command to use
|
||||
__PRGBASE="$CURL -RsS -w '%{http_code}' -o $DATFILE --stderr $ERRFILE"
|
||||
# force network/interface-device to use for communication
|
||||
if [ -n "$bind_network" ]; then
|
||||
local __DEVICE
|
||||
network_get_physdev __DEVICE $bind_network || \
|
||||
write_log 13 "Can not detect local device using 'network_get_physdev $bind_network' - Error: '$?'"
|
||||
write_log 7 "Force communication via device '$__DEVICE'"
|
||||
__PRGBASE="$__PRGBASE --interface $__DEVICE"
|
||||
fi
|
||||
# force ip version to use
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __PRGBASE="$__PRGBASE -4" || __PRGBASE="$__PRGBASE -6" # force IPv4/IPv6
|
||||
fi
|
||||
# set certificate parameters
|
||||
if [ "$cacert" = "IGNORE" ]; then # idea from Ticket #15327 to ignore server cert
|
||||
__PRGBASE="$__PRGBASE --insecure" # but not empty better to use "IGNORE"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__PRGBASE="$__PRGBASE --cacert $cacert"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__PRGBASE="$__PRGBASE --capath $cacert"
|
||||
elif [ -n "$cacert" ]; then # it's not a file and not a directory but given
|
||||
write_log 14 "No valid certificate(s) found at '$cacert' for HTTPS communication"
|
||||
fi
|
||||
# disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set)
|
||||
# or check if libcurl compiled with proxy support
|
||||
if [ -z "$proxy" ]; then
|
||||
__PRGBASE="$__PRGBASE --noproxy '*'"
|
||||
elif [ -z "$CURL_PROXY" ]; then
|
||||
# if libcurl has no proxy support and proxy should be used then force ERROR
|
||||
write_log 13 "cURL: libcurl compiled without Proxy support"
|
||||
fi
|
||||
# set headers
|
||||
__PRGBASE="$__PRGBASE --header 'Authorization: sso-key $username:$password' "
|
||||
__PRGBASE="$__PRGBASE --header 'Accept: application/json' "
|
||||
__PRGBASE="$__PRGBASE --header 'Content-Type: application/json; charset=utf-8' "
|
||||
|
||||
# read data from godaddy.com
|
||||
__RUNPROG="$__PRGBASE --request GET $__URL"
|
||||
godaddy_transfer || return 1
|
||||
|
||||
# HTTP 200 OK, now analyse data and check if update needed
|
||||
__DATA=$(sed -r 's/.+data":"(.+)","t.+/\1/g' $DATFILE)
|
||||
|
||||
# check data
|
||||
[ $use_ipv6 -eq 0 ] \
|
||||
&& __DATA=$(printf "%s" "$__DATA" | grep -m 1 -o "$IPV4_REGEX") \
|
||||
|| __DATA=$(printf "%s" "$__DATA" | grep -m 1 -o "$IPV6_REGEX")
|
||||
|
||||
# we got data so verify
|
||||
[ -n "$__DATA" ] && {
|
||||
# expand IPv6 for compare
|
||||
if [ $use_ipv6 -eq 1 ]; then
|
||||
expand_ipv6 $__IP __IPV6
|
||||
expand_ipv6 $__DATA __DATA
|
||||
[ "$__DATA" = "$__IPV6" ] && { # IPv6 no update needed
|
||||
write_log 7 "IPv6 at GoDaddy.com already up to date"
|
||||
return 0
|
||||
}
|
||||
else
|
||||
[ "$__DATA" = "$__IP" ] && { # IPv4 no update needed
|
||||
write_log 7 "IPv4 at GoDaddy.com already up to date"
|
||||
return 0
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
# update is needed
|
||||
# let's build data to send,
|
||||
# use file to work around double quotes '"' needed for json
|
||||
cat > $DATFILE << EOF
|
||||
[{"data":"$__IP"}]
|
||||
EOF
|
||||
|
||||
# let's complete transfer command
|
||||
__RUNPROG="$__PRGBASE --request PUT --data @$DATFILE $__URL"
|
||||
|
||||
godaddy_transfer || return 1
|
||||
|
||||
# HTTP 200 OK
|
||||
return 0
|
||||
|
54
ddns-scripts/files/usr/lib/ddns/update_no-ip_com.sh
Normal file
54
ddns-scripts/files/usr/lib/ddns/update_no-ip_com.sh
Normal file
@ -0,0 +1,54 @@
|
||||
#
|
||||
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
||||
#
|
||||
# script for sending updates to no-ip.com / noip.com
|
||||
#.2014-2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||
#
|
||||
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
||||
#
|
||||
# provider did not reactivate records, if no IP change was recognized
|
||||
# so we send a dummy (localhost) and a seconds later we send the correct IP addr
|
||||
#
|
||||
local __DUMMY
|
||||
local __UPDURL6="http://[USERNAME]:[PASSWORD]@dynupdate6.noip.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||
local __UPDURL="http://[USERNAME]:[PASSWORD]@dynupdate.noip.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||
# inside url we need username and password
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||
|
||||
# set IP version dependend dummy (localhost)
|
||||
[ $use_ipv6 -eq 0 ] && __DUMMY="127.0.0.1" || __DUMMY="::1"
|
||||
[ $use_ipv6 -eq 0 ] && __UPDURL=$__UPDURL || __UPDURL=$__UPDURL6
|
||||
|
||||
# lets do DUMMY transfer
|
||||
write_log 7 "sending dummy IP to 'no-ip.com'"
|
||||
__URL=$(echo $__UPDURL | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
||||
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__DUMMY#g")
|
||||
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
|
||||
|
||||
do_transfer "$__URL" || return 1
|
||||
|
||||
write_log 7 "'no-ip.com' answered:${N}$(cat $DATFILE)"
|
||||
# analyse provider answers
|
||||
# "good [IP_ADR]" = successful
|
||||
# "nochg [IP_ADR]" = no change but OK
|
||||
grep -E "good|nochg" $DATFILE >/dev/null 2>&1 || return 1
|
||||
|
||||
# lets wait a seconds
|
||||
sleep 1
|
||||
|
||||
# now send the correct data
|
||||
write_log 7 "sending real IP to 'no-ip.com'"
|
||||
__URL=$(echo $__UPDURL | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
||||
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
|
||||
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
|
||||
|
||||
do_transfer "$__URL" || return 1
|
||||
|
||||
write_log 7 "'no-ip.com' answered:${N}$(cat $DATFILE)"
|
||||
# analyse provider answers
|
||||
# "good [IP_ADR]" = successful
|
||||
# "nochg [IP_ADR]" = no change but OK
|
||||
grep -E "good|nochg" $DATFILE >/dev/null 2>&1
|
||||
return $? # "0" if "good" or "nochg" found
|
||||
|
77
ddns-scripts/files/usr/lib/ddns/update_ns1_com.sh
Normal file
77
ddns-scripts/files/usr/lib/ddns/update_ns1_com.sh
Normal file
@ -0,0 +1,77 @@
|
||||
#!/bin/sh
|
||||
# Derived from update_gandi_net.sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
local __ENDPOINT="https://api.nsone.net/v1"
|
||||
local __TTL=600
|
||||
local __RRTYPE
|
||||
local __URL
|
||||
local __STATUS
|
||||
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing zone as 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing API Key as 'password'"
|
||||
|
||||
[ $use_ipv6 -ne 0 ] && __RRTYPE="AAAA" || __RRTYPE="A"
|
||||
|
||||
# Construct JSON payload
|
||||
json_init
|
||||
# {"answers":[{"answer":["1.1.1.1"]}]}
|
||||
json_add_array answers
|
||||
json_add_object
|
||||
json_add_array answer
|
||||
json_add_string "" "$__IP"
|
||||
json_close_array
|
||||
json_close_object
|
||||
json_close_array
|
||||
|
||||
__URL="$__ENDPOINT/zones/$username/$domain/$__RRTYPE"
|
||||
|
||||
__STATUS=$(curl -s -X POST "$__URL" \
|
||||
-H "X-NSONE-Key: $password" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$(json_dump)" \
|
||||
-w "%{http_code}\n" -o $DATFILE 2>$ERRFILE)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
write_log 14 "Curl failed: $(cat $ERRFILE)"
|
||||
return 1
|
||||
elif [ -z $__STATUS ] || [ $__STATUS != 200 ]; then
|
||||
write_log 4 "Request failed: $__STATUS, NS1 answered: $(cat $DATFILE)"
|
||||
if [ $__STATUS = 404 ]; then
|
||||
write_log 4 "Status is 404, trying to create a DNS record"
|
||||
|
||||
json_init
|
||||
json_add_string "zone" "$username"
|
||||
json_add_string "domain" "$domain"
|
||||
json_add_string "type" "$__RRTYPE"
|
||||
json_add_string "ttl" "$__TTL"
|
||||
json_add_array answers
|
||||
json_add_object
|
||||
json_add_array answer
|
||||
json_add_string "" "$__IP"
|
||||
json_close_array
|
||||
json_close_object
|
||||
json_close_array
|
||||
|
||||
__STATUS=$(curl -s -X PUT "$__URL" \
|
||||
-H "X-NSONE-Key: $password" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$(json_dump)" \
|
||||
-w "%{http_code}\n" -o $DATFILE 2>$ERRFILE)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
write_log 14 "Curl failed: $(cat $ERRFILE)"
|
||||
return 1
|
||||
elif [ -z $__STATUS ] || [ $__STATUS != 200 ]; then
|
||||
write_log 14 "Request failed: $__STATUS, NS1 answered: $(cat $DATFILE)"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
write_log 7 "NS1 answered: $(cat $DATFILE)"
|
||||
|
||||
return 0
|
48
ddns-scripts/files/usr/lib/ddns/update_nsupdate.sh
Normal file
48
ddns-scripts/files/usr/lib/ddns/update_nsupdate.sh
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
||||
#
|
||||
# The script directly updates a PowerDNS (or maybe bind server) via nsupdate from bind-client package.
|
||||
#.based on github request #957 by Jan Riechers <de at r-jan dot de>
|
||||
#.2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||
#
|
||||
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
||||
#
|
||||
# using following options from /etc/config/ddns
|
||||
# option username - keyname
|
||||
# option password - shared secret (base64 encoded)
|
||||
# option domain - full qualified domain to update
|
||||
# option dns_server - DNS server to update
|
||||
#
|
||||
# variable __IP already defined with the ip-address to use for update
|
||||
#
|
||||
local __TTL=600 #.preset DNS TTL (in seconds)
|
||||
local __RRTYPE __PW __TCP
|
||||
local __PROG=$(command -v nsupdate) # BIND nsupdate ?
|
||||
[ -z "$__PROG" ] && __PROG=$(command -v knsupdate) # Knot nsupdate ?
|
||||
|
||||
[ -z "$__PROG" ] && write_log 14 "'nsupdate' or 'knsupdate' not installed !"
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||
[ -z "$dns_server" ] && write_log 14 "Service section not configured correctly! Missing 'dns_server'"
|
||||
|
||||
[ $use_ipv6 -ne 0 ] && __RRTYPE="AAAA" || __RRTYPE="A"
|
||||
[ $force_dnstcp -ne 0 ] && __TCP="-v" || __TCP=""
|
||||
|
||||
# create command file
|
||||
cat >$DATFILE <<-EOF
|
||||
server $dns_server
|
||||
key $username $password
|
||||
update del $domain $__RRTYPE
|
||||
update add $domain $__TTL $__RRTYPE $__IP
|
||||
show
|
||||
send
|
||||
answer
|
||||
quit
|
||||
EOF
|
||||
|
||||
$__PROG -d $__TCP $DATFILE >$ERRFILE 2>&1
|
||||
|
||||
# nsupdate always return success
|
||||
write_log 7 "(k)nsupdate reports:${N}$(cat $ERRFILE)"
|
||||
|
||||
return 0
|
142
ddns-scripts/files/usr/lib/ddns/update_one_com.sh
Normal file
142
ddns-scripts/files/usr/lib/ddns/update_one_com.sh
Normal file
@ -0,0 +1,142 @@
|
||||
#!/bin/sh
|
||||
|
||||
# ONE.COM DDNS SCRIPT
|
||||
# REQUIRES CURL
|
||||
# $ opkg install curl
|
||||
|
||||
# SCRIPT BY LUGICO
|
||||
# CONTACT: main@lugico.de
|
||||
|
||||
[ -z "$CURL" ] && [ -z "$CURL_SSL" ] && write_log 14 "one.com communication require cURL with SSL support. Please install"
|
||||
[ -z "$domain" ] && write_log 14 "Service section not configured correctly! Missing 'domain'"
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
write_log 0 "one.com ddns script started"
|
||||
|
||||
local __SUBDOMAIN __MAINDOMAIN __LOGINURL __RECORDID
|
||||
local __TTL=3600
|
||||
|
||||
COOKIEJAR=$(mktemp /tmp/one_com_cookiejar.XXXXXX) || exit 1
|
||||
|
||||
__SUBDOMAIN=$(echo $domain | sed -e 's/[^\.]*\.[^\.]*$//' -e 's/\.$//' )
|
||||
__MAINDOMAIN=$(echo $domain | sed -e "s/${__SUBDOMAIN}\.//" )
|
||||
|
||||
|
||||
# LOGGING IN
|
||||
# GET LOGIN POST URL FROM FORM
|
||||
__LOGINURL=$( $CURL \
|
||||
-RsSL \
|
||||
--stderr $ERRFILE \
|
||||
-c $COOKIEJAR \
|
||||
"https://www.one.com/admin/" \
|
||||
| grep 'Login-form login autofill' \
|
||||
| sed -e 's/.*action="//' -e 's/".*//' -e 's/\&/\&/g' \
|
||||
)
|
||||
|
||||
# POST LOGIN DATA
|
||||
$CURL \
|
||||
-RsSL \
|
||||
--stderr $ERRFILE \
|
||||
-c $COOKIEJAR \
|
||||
-b $COOKIEJAR \
|
||||
"${__LOGINURL}" \
|
||||
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||
-X POST \
|
||||
-d "username=${username}&password=${password}&credentialId=" \
|
||||
| grep "Invalid username or password." > $DATFILE
|
||||
|
||||
if [ "$?" == "0" ] ; then
|
||||
write_log 14 "Invalid credentials"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
# SETTING DOMAIN
|
||||
$CURL -RsSL \
|
||||
--stderr $ERRFILE \
|
||||
-c $COOKIEJAR \
|
||||
-b $COOKIEJAR \
|
||||
"https://www.one.com/admin/select-admin-domain.do?domain=${__MAINDOMAIN}" \
|
||||
| grep "<meta name=\"one.com:active-domain\" content=\"${__MAINDOMAIN}\"/>" > $DATFILE
|
||||
|
||||
if [ "$?" != "0" ] ; then
|
||||
write_log 14 "Failed to select domain '${__MAINDOMAIN}'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
# GETTING RECORD ID
|
||||
records=$( $CURL \
|
||||
-RsSL \
|
||||
--stderr $ERRFILE \
|
||||
-c $COOKIEJAR \
|
||||
-b $COOKIEJAR \
|
||||
"https://www.one.com/admin/api/domains/${__MAINDOMAIN}/dns/custom_records"
|
||||
)
|
||||
|
||||
json_load "$records"
|
||||
|
||||
if json_is_a "result" "object" && \
|
||||
json_select "result" && \
|
||||
json_is_a "data" "array"
|
||||
then
|
||||
json_select "data"
|
||||
i=1
|
||||
while json_is_a ${i} "object" ; do
|
||||
json_select "${i}"
|
||||
json_select "attributes"
|
||||
json_get_var "prefix" "prefix"
|
||||
json_close_object
|
||||
if [ "$prefix" == "$__SUBDOMAIN" ] ; then
|
||||
json_get_var "__RECORDID" "id"
|
||||
write_log 0 "Found record id : ${__RECORDID}"
|
||||
break
|
||||
fi
|
||||
json_close_object
|
||||
i=$(($i + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
if [ "${__RECORDID}" == "" ] ; then
|
||||
write_log 14 "domain record not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
# CREATING PATCH DATA
|
||||
json_init
|
||||
json_add_string "type" "dns_service_records"
|
||||
json_add_string "id" "${__RECORDID}"
|
||||
json_add_object "attributes"
|
||||
json_add_string "type" "A"
|
||||
json_add_string "prefix" "${__SUBDOMAIN}"
|
||||
json_add_string "content" "${__IP}"
|
||||
json_add_int "ttl" ${__TTL}
|
||||
patchdata=$(json_dump)
|
||||
|
||||
|
||||
# SENDING PATCH
|
||||
$CURL \
|
||||
-RsSL \
|
||||
--stderr $ERRFILE \
|
||||
-c $COOKIEJAR \
|
||||
-b $COOKIEJAR \
|
||||
-X PATCH \
|
||||
-d "$patchdata" \
|
||||
-H "Content-Type: application/json" \
|
||||
"https://www.one.com/admin/api/domains/${__MAINDOMAIN}/dns/custom_records/${__RECORDID}" \
|
||||
| grep "priority" > $DATFILE
|
||||
|
||||
if [ "$?" != "0" ] ; then
|
||||
write_log 14 "one.com gave an unexpected response"
|
||||
return 1
|
||||
fi
|
||||
|
||||
rm $COOKIEJAR
|
||||
write_log 0 "one.com ddns script finished without errors"
|
||||
|
||||
return 0
|
52
ddns-scripts/files/usr/lib/ddns/update_pdns.sh
Executable file
52
ddns-scripts/files/usr/lib/ddns/update_pdns.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# Derived from update_gandi_net.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
local __TTL=600
|
||||
local __RRTYPE
|
||||
local __STATUS
|
||||
|
||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing subdomain as 'username'"
|
||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing API Key as 'password'"
|
||||
[ -z "$param_opt" ] && write_log 14 "Service section not configured correctly! Missing PowerDNS URL as 'Optional Parameter'(param_opt)"
|
||||
|
||||
# Create endpoint from $param_opt
|
||||
# e.g. param_opt=http://127.0.0.1:8081
|
||||
local __ENDPOINT="$param_opt/api/v1/servers/localhost/zones"
|
||||
|
||||
[ $use_ipv6 -ne 0 ] && __RRTYPE="AAAA" || __RRTYPE="A"
|
||||
|
||||
# Build JSON payload
|
||||
json_init
|
||||
json_add_array rrsets
|
||||
json_add_object
|
||||
json_add_string name "$username.$domain"
|
||||
json_add_string type "$__RRTYPE"
|
||||
json_add_int ttl $__TTL
|
||||
json_add_string changetype "REPLACE"
|
||||
json_add_array records
|
||||
json_add_object
|
||||
json_add_string content "$__IP"
|
||||
json_add_boolean disabled 0
|
||||
json_close_object
|
||||
json_close_array
|
||||
json_close_object
|
||||
json_close_array
|
||||
|
||||
__STATUS=$(curl -Ss -X PATCH "$__ENDPOINT/$domain" \
|
||||
-H "X-Api-Key: $password" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$(json_dump)" \
|
||||
-w "%{http_code}\n" \
|
||||
-o $DATFILE 2>$ERRFILE)
|
||||
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
write_log 14 "Curl failed: $(cat $ERRFILE)"
|
||||
return 1
|
||||
elif [ -z $__STATUS ] || [ $__STATUS != 204 ]; then
|
||||
write_log 14 "PowerDNS request failed: $__STATUS \n$(cat $DATFILE)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
95
ddns-scripts/files/usr/lib/ddns/update_route53_v1.sh
Normal file
95
ddns-scripts/files/usr/lib/ddns/update_route53_v1.sh
Normal file
@ -0,0 +1,95 @@
|
||||
#!/bin/sh
|
||||
# Distributed under the terms of the GNU General Public License (GPL) version 2.0
|
||||
# based on Yuval Adam's route53.sh found at https://github.com/yuvadm/route53-ddns/blob/master/route53.sh
|
||||
# 2017 Max Berger <max at berger dot name>
|
||||
|
||||
[ -z "${CURL_SSL}" ] && write_log 14 "Amazon AWS Route53 communication require cURL with SSL support. Please install"
|
||||
[ -z "${username}" ] && write_log 14 "Service section not configured correctly! Missing key as 'username'"
|
||||
[ -z "${password}" ] && write_log 14 "Service section not configured correctly! Missing secret as 'password'"
|
||||
[ -z "${domain}" ] && write_log 14 "Service section not configured correctly! Missing zone id as 'domain'"
|
||||
|
||||
ENDPOINT="route53.amazonaws.com"
|
||||
RECORD_TTL=300
|
||||
RECORD_NAME="${lookup_host}."
|
||||
[ ${use_ipv6} -eq 0 ] && RECORD_TYPE="A"
|
||||
[ ${use_ipv6} -eq 1 ] && RECORD_TYPE="AAAA"
|
||||
RECORD_VALUE="${LOCAL_IP}"
|
||||
HOSTED_ZONE_ID="${domain}"
|
||||
API_PATH="/2013-04-01/hostedzone/${HOSTED_ZONE_ID}/rrset/"
|
||||
|
||||
AWS_ACCESS_KEY_ID="${username}"
|
||||
AWS_SECRET_ACCESS_KEY="${password}"
|
||||
AWS_REGION='us-east-1'
|
||||
AWS_SERVICE='route53'
|
||||
|
||||
hash() {
|
||||
msg="$1"
|
||||
echo -en "${msg}" | openssl dgst -sha256 | sed 's/^.* //'
|
||||
}
|
||||
|
||||
sign_plain() {
|
||||
# Sign message using a plaintext key
|
||||
key="$1"
|
||||
msg="$2"
|
||||
echo -en "${msg}" | openssl dgst -hex -sha256 -hmac "${key}" | sed 's/^.* //'
|
||||
}
|
||||
|
||||
sign() {
|
||||
# Sign message using a hex formatted key
|
||||
key="$1"
|
||||
msg="$2"
|
||||
echo -en "${msg}" | openssl dgst -hex -sha256 -mac HMAC -macopt "hexkey:${key}" | sed 's/^.* //'
|
||||
}
|
||||
|
||||
request_body="<?xml version=\"1.0\" encoding=\"UTF-8\"?> \
|
||||
<ChangeResourceRecordSetsRequest xmlns=\"https://route53.amazonaws.com/doc/2013-04-01/\"> \
|
||||
<ChangeBatch> \
|
||||
<Changes> \
|
||||
<Change> \
|
||||
<Action>UPSERT</Action> \
|
||||
<ResourceRecordSet> \
|
||||
<Name>${RECORD_NAME}</Name> \
|
||||
<Type>${RECORD_TYPE}</Type> \
|
||||
<TTL>${RECORD_TTL}</TTL> \
|
||||
<ResourceRecords> \
|
||||
<ResourceRecord> \
|
||||
<Value>${RECORD_VALUE}</Value> \
|
||||
</ResourceRecord> \
|
||||
</ResourceRecords> \
|
||||
</ResourceRecordSet> \
|
||||
</Change> \
|
||||
</Changes> \
|
||||
</ChangeBatch> \
|
||||
</ChangeResourceRecordSetsRequest>"
|
||||
|
||||
fulldate="$(date --utc +%Y%m%dT%H%M%SZ)"
|
||||
shortdate="$(date --utc +%Y%m%d)"
|
||||
signed_headers="host;x-amz-date"
|
||||
request_hash="$(hash "${request_body}")"
|
||||
canonical_request="POST\n${API_PATH}\n\nhost:route53.amazonaws.com\nx-amz-date:${fulldate}\n\n${signed_headers}\n${request_hash}"
|
||||
|
||||
date_key="$(sign_plain "AWS4${AWS_SECRET_ACCESS_KEY}" "${shortdate}")"
|
||||
region_key="$(sign "${date_key}" ${AWS_REGION})"
|
||||
service_key="$(sign "${region_key}" ${AWS_SERVICE})"
|
||||
signing_key="$(sign "${service_key}" aws4_request)"
|
||||
|
||||
credential="${shortdate}/${AWS_REGION}/${AWS_SERVICE}/aws4_request"
|
||||
sigmsg="AWS4-HMAC-SHA256\n${fulldate}\n${credential}\n$(hash "${canonical_request}")"
|
||||
|
||||
signature="$(sign "${signing_key}" "${sigmsg}")"
|
||||
|
||||
authorization="AWS4-HMAC-SHA256 Credential=${AWS_ACCESS_KEY_ID}/${credential}, SignedHeaders=${signed_headers}, Signature=${signature}"
|
||||
|
||||
ANSWER="$(flock /tmp/$(basename -s .sh "$0").lock curl \
|
||||
-X "POST" \
|
||||
-H "Host: route53.amazonaws.com" \
|
||||
-H "X-Amz-Date: ${fulldate}" \
|
||||
-H "Authorization: ${authorization}" \
|
||||
-H "Content-Type: text/xml" \
|
||||
-d "$request_body" \
|
||||
"https://${ENDPOINT}${API_PATH}")"
|
||||
write_log 7 "${ANSWER}"
|
||||
|
||||
echo "${ANSWER}" | grep -F "Error" >/dev/null && return 1
|
||||
echo "${ANSWER}" | grep -F "ChangeInfo" >/dev/null && return 0
|
||||
return 2
|
134
ddns-scripts/files/usr/lib/ddns/update_transip_nl.sh
Normal file
134
ddns-scripts/files/usr/lib/ddns/update_transip_nl.sh
Normal file
@ -0,0 +1,134 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 2021 Martijn Atema <martijn@atema.one>
|
||||
#
|
||||
# This script sends ddns updates using the TransIP API (see https://api.transip.nl/)
|
||||
# and is parsed by dynamic_dns_functions.sh inside send_update().
|
||||
#
|
||||
# The following options provided by ddns are used:
|
||||
# username - Username of account used for logging in to TransIP
|
||||
# password - Private key generated at https://www.transip.nl/cp/account/api/
|
||||
# (make sure to accept non-whitelisted IP addresses)
|
||||
# domain - Base domain name registered at TransIP
|
||||
# ('domain.tld' when updating 'hostname.domain.tld')
|
||||
# param_enc - Name of DNS record to update
|
||||
# ('hostname' when updating 'hostname.domain.tld')
|
||||
# param_opt - TTL of the DNS record to update (in seconds)
|
||||
#
|
||||
# Note: Make sure that there is exactly one record of type A (for IPv4) or
|
||||
# AAAA (for IPv6) with the specified name and TTL. That record will be
|
||||
# updated by this script.
|
||||
#
|
||||
# The script requires cURL with SSL and the openssl binary
|
||||
|
||||
|
||||
[ -z "${username}" ] && write_log 14 "Service config is missing 'username'"
|
||||
[ -z "${password}" ] && write_log 14 "Service config is missing 'password' (private key)"
|
||||
[ -z "${domain}" ] && write_log 14 "Service config is missing 'domain' (base domain name)"
|
||||
[ -z "${param_enc}" ] && write_log 14 "Service config is missing 'param_enc' (DNS record name)"
|
||||
[ -z "${param_opt}" ] && write_log 14 "Service config is missing 'param_opt' (DNS record TTL)"
|
||||
|
||||
[ -z "${CURL_SSL}" ] && write_log 14 "TransIP update requires cURL with SSL"
|
||||
[ -z "$(openssl version)" ] && write_log 14 "TransIP update requires openssl binary"
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
|
||||
# Re-format the private key and write to a temporary file
|
||||
|
||||
__tmp_keyfile="$(mktemp -t ddns-transip.XXXXXX)"
|
||||
|
||||
echo "${password}" | \
|
||||
sed -e "s/-----BEGIN PRIVATE KEY-----\s*/&\n/" \
|
||||
-e "s/-----END PRIVATE KEY-----/\n&/" \
|
||||
-e "s/\S\{64\}\s*/&\n/g" \
|
||||
> "${__tmp_keyfile}"
|
||||
|
||||
|
||||
# Create authentication request
|
||||
|
||||
json_init
|
||||
json_add_string "login" "${username}"
|
||||
json_add_string "label" "DDNS-script ($(openssl rand -hex 4))"
|
||||
json_add_string "nonce" $(openssl rand -hex 16)
|
||||
json_add_boolean "read_only" 0
|
||||
json_add_boolean "global_key" 1
|
||||
__auth_body="$(json_dump)"
|
||||
|
||||
|
||||
# Sign body using the private key and encode with base64
|
||||
|
||||
__auth_signature=$(echo -n "${__auth_body}" | \
|
||||
openssl dgst -sha512 -sign "${__tmp_keyfile}" | \
|
||||
openssl base64 | \
|
||||
tr -d " \t\n\r")
|
||||
|
||||
rm "${__tmp_keyfile}"
|
||||
|
||||
|
||||
# Send and parse request for a temporary authentication token
|
||||
|
||||
__auth_status=$(curl -s -X POST "https://api.transip.nl/v6/auth" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Signature: ${__auth_signature}" \
|
||||
-d "${__auth_body}" \
|
||||
-w "%{http_code}\n" \
|
||||
-o "${DATFILE}" 2>"${ERRFILE}")
|
||||
|
||||
|
||||
# Logging for error and debug
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
write_log 14 "Curl failed: $(cat "${ERRFILE}")"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z ${__auth_status} ] || [ ${__auth_status} -ne 201 ]; then
|
||||
write_log 14 "TransIP authentication (status ${__auth_status}) failed: $(cat ${DATFILE})"
|
||||
return 1
|
||||
fi
|
||||
|
||||
write_log 7 "TransIP authentication successful"
|
||||
|
||||
|
||||
## Extract token from the response
|
||||
|
||||
__auth_token=$(cat ${DATFILE} | sed 's/^.*"token" *: *"\([^"]*\)".*$/\1/')
|
||||
|
||||
|
||||
# Create request body for update
|
||||
|
||||
json_init
|
||||
json_add_object "dnsEntry"
|
||||
json_add_string "name" "${param_enc}"
|
||||
json_add_string "type" "$([ $use_ipv6 -ne 0 ] && echo -n AAAA || echo -n A)"
|
||||
json_add_int "expire" "${param_opt}"
|
||||
json_add_string "content" "${__IP}"
|
||||
json_close_object
|
||||
__update_body="$(json_dump)"
|
||||
|
||||
|
||||
# Send update request
|
||||
|
||||
__update_status=$(curl -s -X PATCH "https://api.transip.nl/v6/domains/${domain}/dns" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${__auth_token}" \
|
||||
-d "${__update_body}" \
|
||||
-w "%{http_code}\n" \
|
||||
-o "${DATFILE}" 2>"${ERRFILE}")
|
||||
|
||||
|
||||
# Logging for error and debug
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
write_log 14 "Curl failed: $(cat "${ERRFILE}")"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z ${__update_status} ] || [ ${__update_status} -ne 204 ]; then
|
||||
write_log 14 "TransIP DNS update (status ${__update_status}) failed: $(cat ${DATFILE})"
|
||||
return 1
|
||||
fi
|
||||
|
||||
write_log 7 "TransIP DNS update successful"
|
||||
return 0
|
6
ddns-scripts/files/usr/share/ddns/default/3322.org.json
Normal file
6
ddns-scripts/files/usr/share/ddns/default/3322.org.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "3322.org",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@members.3322.org/dyndns/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "able.or.kr",
|
||||
"ipv4": {
|
||||
"url": "http://able.or.kr/ddns/src/update.php?hostname=[DOMAIN]&myip=[IP]&ddnsuser=[USERNAME]&pwd=[PASSWORD]"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "afraid.org-basicauth",
|
||||
"ipv4": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@freedns.afraid.org/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@freedns.afraid.org/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "afraid.org-keyauth",
|
||||
"ipv4": {
|
||||
"url": "https://freedns.afraid.org/dynamic/update.php?[PASSWORD]&address=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "https://freedns.afraid.org/dynamic/update.php?[PASSWORD]&address=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "afraid.org-v2-basic",
|
||||
"ipv4": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@sync.afraid.org/u/?h=[DOMAIN]&ip=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@v6.sync.afraid.org/u/?h=[DOMAIN]&ip=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "afraid.org-v2-token",
|
||||
"ipv4": {
|
||||
"url": "https://sync.afraid.org/u/[PASSWORD]/?address=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "https://v6.sync.afraid.org/u/[PASSWORD]/?address=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "all-inkl.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dyndns.kasserver.com/?myip=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dyndns.kasserver.com/?myip=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "bind-nsupdate",
|
||||
"ipv4": {
|
||||
"url": "update_nsupdate.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_nsupdate.sh"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "changeip.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@nic.changeip.com/nic/update?u=[USERNAME]&p=[PASSWORD]&cmd=update&hostname=[DOMAIN]&ip=[IP]",
|
||||
"answer": "Successful"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "cloudflare.com-v4",
|
||||
"ipv4": {
|
||||
"url": "update_cloudflare_com_v4.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_cloudflare_com_v4.sh"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/cnkuai.cn.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/cnkuai.cn.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "cnkuai.cn",
|
||||
"ipv4": {
|
||||
"url": "update_cnkuai_cn.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_cnkuai_cn.sh"
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "core-networks.de",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dyndns.core-networks.de/?hostname=[DOMAIN]&myip=[IP]&keepipv6=1",
|
||||
"answer": "good"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dyndns.core-networks.de/?hostname=[DOMAIN]&myip=[IP]&keepipv4=1",
|
||||
"answer": "good"
|
||||
}
|
||||
}
|
7
ddns-scripts/files/usr/share/ddns/default/ddnss.de.json
Normal file
7
ddns-scripts/files/usr/share/ddns/default/ddnss.de.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "ddnss.de",
|
||||
"ipv4": {
|
||||
"url": "http://ip4.ddnss.de/upd.php?user=[USERNAME]&pwd=[PASSWORD]&host=[DOMAIN]&ip=[IP]",
|
||||
"answer": "Updated|No change"
|
||||
}
|
||||
}
|
6
ddns-scripts/files/usr/share/ddns/default/ddo.jp.json
Normal file
6
ddns-scripts/files/usr/share/ddns/default/ddo.jp.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "ddo.jp",
|
||||
"ipv4": {
|
||||
"url": "http://free.ddo.jp/dnsupdate.php?dn=[DOMAIN]&pw=[PASSWORD]&ip=[IP]"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/desec.io.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/desec.io.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "desec.io",
|
||||
"ipv4": {
|
||||
"url": "http://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&hostname=[DOMAIN]&myipv4=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&hostname=[DOMAIN]&myipv6=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/dhis.org.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/dhis.org.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "dhis.org",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@is.dhis.org/"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@is.dhis.org/"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "digitalocean.com-v2",
|
||||
"ipv4": {
|
||||
"url": "update_digitalocean_com_v2.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_digitalocean_com_v2.sh"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "dnsdynamic.org",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@www.dnsdynamic.org/api/?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "dnsever.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dyna.dnsever.com/update.php?host[[DOMAIN]]"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "dnsexit.com",
|
||||
"ipv4": {
|
||||
"url": "http://update.dnsexit.com/RemoteUpdate.sv?login=[USERNAME]&password=[PASSWORD]&host=[DOMAIN]&myip=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "dnshome.de",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@www.dnshome.de/dyndns.php?hostname=[DOMAIN]&ip=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@www.dnshome.de/dyndns.php?hostname=[DOMAIN]&ip6=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "dnsmadeeasy.com",
|
||||
"ipv4": {
|
||||
"url": "http://cp.dnsmadeeasy.com/servlet/updateip?username=[USERNAME]&password=[PASSWORD]&id=[DOMAIN]&ip=[IP]",
|
||||
"answer": "success|ip-same"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "dnsmax.com",
|
||||
"ipv4": {
|
||||
"url": "http://update.dnsmax.com/update/?username=[USERNAME]&password=[PASSWORD]&resellerid=1&clientname=openwrt&clientversion=8.09&protocolversion=2.0&updatehostname=[DOMAIN]&ip=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "dnsomatic.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@updates.dnsomatic.com/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "dnspark.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@control.dnspark.com/api/dynamic/update.php?hostname=[DOMAIN]&ip=[IP]",
|
||||
"answer": "ok|nochange"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/dnspod.cn.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/dnspod.cn.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "dnspod.cn",
|
||||
"ipv4": {
|
||||
"url": "update_dnspod_cn.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_dnspod_cn.sh"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/do.de.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/do.de.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "do.de",
|
||||
"ipv4": {
|
||||
"url": "http://ddns.do.de/?myip=[IP]&hostname=[DOMAIN]&username=[USERNAME]&password=[PASSWORD]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://ddns.do.de/?myip=[IP]&hostname=[DOMAIN]&username=[USERNAME]&password=[PASSWORD]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "domopoli.de",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@http://dyndns.domopoli.de/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
6
ddns-scripts/files/usr/share/ddns/default/dtdns.com.json
Normal file
6
ddns-scripts/files/usr/share/ddns/default/dtdns.com.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "dtdns.com",
|
||||
"ipv4": {
|
||||
"url": "http://www.dtdns.com/api/autodns.cfm?id=[DOMAIN]&pw=[PASSWORD]&ip=[IP]"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/duckdns.org.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/duckdns.org.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "duckdns.org",
|
||||
"ipv4": {
|
||||
"url": "http://www.duckdns.org/update?domains=[DOMAIN]&token=[PASSWORD]&ip=[IP]",
|
||||
"answer": "OK"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://www.duckdns.org/update?domains=[DOMAIN]&token=[PASSWORD]&ipv6=[IP]",
|
||||
"answer": "OK"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "duiadns.net",
|
||||
"ipv4": {
|
||||
"url": "http://ip.duiadns.net/dynamic.duia?host=[DOMAIN]&password=[PASSWORD]&ip4=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://ip.duiadns.net/dynamic.duia?host=[DOMAIN]&password=[PASSWORD]&ip6=[IP]"
|
||||
}
|
||||
}
|
7
ddns-scripts/files/usr/share/ddns/default/dy.fi.json
Normal file
7
ddns-scripts/files/usr/share/ddns/default/dy.fi.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "dy.fi",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@www.dy.fi/nic/update?hostname=[DOMAIN]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/dyn.com.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/dyn.com.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "dyn.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@members.dyndns.org/v3/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@members.dyndns.org/v3/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
7
ddns-scripts/files/usr/share/ddns/default/dyndns.it.json
Normal file
7
ddns-scripts/files/usr/share/ddns/default/dyndns.it.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "dyndns.it",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@update.dyndns.it/nic/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/dyndns.org.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/dyndns.org.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "dyndns.org",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@members.dyndns.org/v3/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@members.dyndns.org/v3/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "dyndnss.net",
|
||||
"ipv4": {
|
||||
"url": "http://www.dyndnss.net/?user=[USERNAME]&pass=[PASSWORD]&domain=[DOMAIN]&updater=other"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "dynsip.org",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dynsip.org/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/dynu.com.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/dynu.com.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "dynu.com",
|
||||
"ipv4": {
|
||||
"url": "http://api.dynu.com/nic/update?hostname=[DOMAIN]&myip=[IP]&username=[USERNAME]&password=[PASSWORD]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://api.dynu.com/nic/update?hostname=[DOMAIN]&myipv6=[IP]&username=[USERNAME]&password=[PASSWORD]"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/dynv6.com.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/dynv6.com.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "dynv6.com",
|
||||
"ipv4": {
|
||||
"url": "http://dynv6.com/api/update?hostname=[DOMAIN]&token=[PASSWORD]&ipv4=[IP]",
|
||||
"answer": "updated|unchanged"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://dynv6.com/api/update?hostname=[DOMAIN]&token=[PASSWORD]&ipv6=[IP]",
|
||||
"answer": "updated|unchanged"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "easydns.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@api.cp.easydns.com/dyn/generic.php?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "OK|NOERROR"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "editdns.net",
|
||||
"ipv4": {
|
||||
"url": "http://dyndns-free.editdns.net/api/dynLinux.php?p=[PASSWORD]&r=[DOMAIN]"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "freedns.42.pl",
|
||||
"ipv4": {
|
||||
"url": "update_freedns_42_pl.sh"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/gandi.net.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/gandi.net.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "gandi.net",
|
||||
"ipv4": {
|
||||
"url": "update_gandi_net.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_gandi_net.sh"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "godaddy.com-v1",
|
||||
"ipv4": {
|
||||
"url": "update_godaddy_com_v1.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_godaddy_com_v1.sh"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/goip.de.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/goip.de.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "goip.de",
|
||||
"ipv4": {
|
||||
"url": "http://www.goip.de/setip?username=[USERNAME]&password=[PASSWORD]&subdomain=[DOMAIN]&ip=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://www.goip.de/setip?username=[USERNAME]&password=[PASSWORD]&subdomain=[DOMAIN]&ip6=[IP]"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/google.com.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/google.com.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "google.com",
|
||||
"ipv4": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/he.net.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/he.net.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "he.net",
|
||||
"ipv4": {
|
||||
"url": "http://[DOMAIN]:[PASSWORD]@dyn.dns.he.net/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[DOMAIN]:[PASSWORD]@dyn.dns.he.net/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "infomaniak.com",
|
||||
"ipv4": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@infomaniak.com/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@infomaniak.com/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/inwx.de.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/inwx.de.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "inwx.de",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dyndns.inwx.com/nic/update?myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dyndns.inwx.com/nic/update?myipv6=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
7
ddns-scripts/files/usr/share/ddns/default/joker.com.json
Normal file
7
ddns-scripts/files/usr/share/ddns/default/joker.com.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "joker.com",
|
||||
"ipv4": {
|
||||
"url": "http://svc.joker.com/nic/update?username=[USERNAME]&password=[PASSWORD]&myip=[IP]&hostname=[DOMAIN]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/loopia.se.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/loopia.se.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "loopia.se",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dns.loopia.se/XDynDNSServer/XDynDNS.php?system=custom&hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dns.loopia.se/XDynDNSServer/XDynDNS.php?system=custom&hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "moniker.com",
|
||||
"ipv4": {
|
||||
"url": "https://dynamicdns.key-systems.net/update.php?hostname=[DOMAIN]&password=[PASSWORD]&ip=[IP]",
|
||||
"answer": "success"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/mydns.jp.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/mydns.jp.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "mydns.jp",
|
||||
"ipv4": {
|
||||
"url": "http://www.mydns.jp/directip.html?MID=[USERNAME]&PWD=[PASSWORD]&IPV4ADDR=[IP]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://www.mydns.jp/directip.html?MID=[USERNAME]&PWD=[PASSWORD]&IPV6ADDR=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "myip.co.ua",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@myip.co.ua/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good"
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "myonlineportal.net",
|
||||
"ipv4": {
|
||||
"url": "http://myonlineportal.net/updateddns?hostname=[DOMAIN]&ip=[IP]&username=[USERNAME]&password=[PASSWORD]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://myonlineportal.net/updateddns?hostname=[DOMAIN]&ip6=[IP]&username=[USERNAME]&password=[PASSWORD]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "mythic-beasts.com",
|
||||
"ipv4": {
|
||||
"url": "http://dnsapi4.mythic-beasts.com/?domain=[USERNAME]&password=[PASSWORD]&command=REPLACE%20[DOMAIN]%2060%20A%20DYNAMIC_IP&origin=."
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://dnsapi6.mythic-beasts.com/?domain=[USERNAME]&password=[PASSWORD]&command=REPLACE%20[DOMAIN]%2060%20AAAA%20DYNAMIC_IP&origin=."
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "namecheap.com",
|
||||
"ipv4": {
|
||||
"url": "http://dynamicdns.park-your-domain.com/update?host=[USERNAME]&domain=[DOMAIN]&password=[PASSWORD]&ip=[IP]"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "nettica.com",
|
||||
"ipv4": {
|
||||
"url": "http://www.nettica.com/Domain/Update.aspx?U=[USERNAME]&PC=[PASSWORD]&FQDN=[DOMAIN]&N=[IP]"
|
||||
}
|
||||
}
|
10
ddns-scripts/files/usr/share/ddns/default/no-ip.com.json
Normal file
10
ddns-scripts/files/usr/share/ddns/default/no-ip.com.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "no-ip.com",
|
||||
"ipv4": {
|
||||
"url": "update_no-ip_com.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_no-ip_com.sh"
|
||||
}
|
||||
}
|
||||
|
9
ddns-scripts/files/usr/share/ddns/default/no-ip.pl.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/no-ip.pl.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "no-ip.pl",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@update.no-ip.pl/?hostname=[DOMAIN]"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@update.no-ip.pl/?hostname=[DOMAIN]"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/now-dns.com.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/now-dns.com.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "now-dns.com",
|
||||
"ipv4": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@now-dns.com/update?hostname=[DOMAIN]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "https://[USERNAME]:[PASSWORD]@now-dns.com/update?hostname=[DOMAIN]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/ns1.com.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/ns1.com.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "ns1.com",
|
||||
"ipv4": {
|
||||
"url": "update_ns1_com.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_ns1_com.sh"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/nsupdate.info.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/nsupdate.info.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "nsupdate.info",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@ipv4.nsupdate.info/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@ipv6.nsupdate.info/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
6
ddns-scripts/files/usr/share/ddns/default/one.com.json
Normal file
6
ddns-scripts/files/usr/share/ddns/default/one.com.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "one.com",
|
||||
"ipv4": {
|
||||
"url": "update_one_com.sh"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name":"opendns.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@updates.opendns.com/nic/update?hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
6
ddns-scripts/files/usr/share/ddns/default/oray.com.json
Normal file
6
ddns-scripts/files/usr/share/ddns/default/oray.com.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "oray.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@ddns.oray.com/ph/update?hostname=[DOMAIN]&myip=[IP]"
|
||||
}
|
||||
}
|
7
ddns-scripts/files/usr/share/ddns/default/ovh.com.json
Normal file
7
ddns-scripts/files/usr/share/ddns/default/ovh.com.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "ovh.com",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@www.ovh.com/nic/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
9
ddns-scripts/files/usr/share/ddns/default/pdns.json
Normal file
9
ddns-scripts/files/usr/share/ddns/default/pdns.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "PowerDNS",
|
||||
"ipv4": {
|
||||
"url": "update_pdns.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_pdns.sh"
|
||||
}
|
||||
}
|
11
ddns-scripts/files/usr/share/ddns/default/regfish.de.json
Normal file
11
ddns-scripts/files/usr/share/ddns/default/regfish.de.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "regfish.de",
|
||||
"ipv4": {
|
||||
"url": "http://dyndns.regfish.de/?fqdn=[DOMAIN]&forcehost=1&authtype=secure&token=[PASSWORD]&ipv4=[IP]",
|
||||
"answer": "success|100|101"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "http://dyndns.regfish.de/?fqdn=[DOMAIN]&forcehost=1&authtype=secure&token=[PASSWORD]&ipv6=[IP]",
|
||||
"answer": "success|100|101"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "route53-v1",
|
||||
"ipv4": {
|
||||
"url": "update_route53_v1.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_route53_v1.sh"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "schokokeks.org",
|
||||
"ipv4": {
|
||||
"url": "http://[USERNAME]:[PASSWORD]@dyndns.schokokeks.org/nic/update?myip=[IP]",
|
||||
"answer": "good|nochg"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "selfhost.de",
|
||||
"ipv4": {
|
||||
"url": "http://carol.selfhost.de/update?username=[USERNAME]&password=[PASSWORD]&myip=[IP]&hostname=1",
|
||||
"answer": "good|nochg|200|204"
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user