Dudders is a utility for updating DNS records. It points a domain name
to a given IP address, using the RFC2136 DNS UPDATE protocol and a
SIG(0) signature. It is designed with embedded systems in mind.

The hotplug script will be called automatically whenever an interface
is brought up (at least by pppd).  However, it will only run dudders
when the UP'd interface appears to be the default route.

The script uses environment variables expected to be set by OpenWRT's
/package/ppp/files/etc/ppp/ip-up; it is also compatible with the
original variables as set by pppd(8).

The dudders section in the config file /etc/config/dudders has the
following fields:

  enabled - dudders hotplug script only runs dudders if "yes"
  tcp - use TCP/IP to send the update message
  keyname - fully qualified name of private key's owner, or empty
  mname - override master server with domain name, or empty
  zone - override zone with domain name, or empty
  keyfile - dnssec-keygen private key filename
  hostname - fully qualified domain name to update
  ttl - time to live in seconds of updated A record for hostname

This build of dudders is runtime linked against OpenSSL and libgcrypt.
The dependencies of the ipkg have been relaxed so that neither of
these packages will be required to install dudders (due to ipkg's
limitations in specifying alternative dependencies).  However, at
least one must be installed for dudders to actually work.


Signed-off-by: Dean Scarff <[email protected]>
---
 net/dudders/Makefile              |   63 +++++++++++++++++++++++++++++++++++++
 net/dudders/files/dudders.conf    |    7 ++++
 net/dudders/files/dudders.hotplug |   46 +++++++++++++++++++++++++++
 3 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100644 net/dudders/Makefile
 create mode 100644 net/dudders/files/dudders.conf
 create mode 100755 net/dudders/files/dudders.hotplug

diff --git a/net/dudders/Makefile b/net/dudders/Makefile
new file mode 100644
index 0000000..9cd2b41
--- /dev/null
+++ b/net/dudders/Makefile
@@ -0,0 +1,63 @@
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dudders
+PKG_VERSION:=1.04
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=...@sf/$(PKG_NAME)
+PKG_SHA1SUM:=ae3fc90804698468c8f8e285c2387eb629c25dbf
+PKG_CAT:=bzcat
+PKG_BUILD_DEPENDS:=+libopenssl +libgcrypt
+PKG_FIXUP:=libtool
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dudders
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=DNS
+  TITLE:=DNS Update SIG(0) client
+  MAINTAINER:=<[email protected]>
+  DEPENDS:=
+  URL:=http://dudders.sourceforge.net/
+endef
+
+define Package/dudders/description
+  Dudders is a utility for updating DNS records.  It points
+  a domain name to a given IP address, using the RFC2136 DNS
+  UPDATE protocol and a SIG(0) signature.  It is designed with
+  embedded systems in mind.
+
+  You must have either libopenssl or libgcrypt installed to
+  use this package.
+endef
+
+define Package/dudders/conffiles
+/etc/config/dudders
+endef
+
+EXTRA_CFLAGS:= -DNDEBUG -std=gnu99
+
+CONFIGURE_ARGS+= \
+                --with-libgcrypt-prefix="$(STAGING_DIR)/usr"
+
+define Package/dudders/install
+        $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dudders $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib/dudders
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/dudders/crypt_gcrypt.so \
+                      $(1)/usr/lib/dudders
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/dudders/crypt_openssl.so \
+                       $(1)/usr/lib/dudders
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/dudders.conf $(1)/etc/config/dudders
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/dudders.hotplug 
$(1)/etc/hotplug.d/iface/30-dudders
+endef
+
+$(eval $(call BuildPackage,dudders))
diff --git a/net/dudders/files/dudders.conf b/net/dudders/files/dudders.conf
new file mode 100644
index 0000000..fb4c24a
--- /dev/null
+++ b/net/dudders/files/dudders.conf
@@ -0,0 +1,7 @@
+config dudders
+        option enabled  'no'
+        option tcp      'yes'
+        option keyfile '/tmp/dudders.private'
+        option keyname  'owner.example.com'
+        option hostname 'test.example.com'
+       option ttl       86400
diff --git a/net/dudders/files/dudders.hotplug 
b/net/dudders/files/dudders.hotplug
new file mode 100755
index 0000000..14dcf0c
--- /dev/null
+++ b/net/dudders/files/dudders.hotplug
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+. /etc/functions.sh
+
+config_cb() {
+       local cfg="$CONFIG_SECTION"
+       local cfgtype
+       config_get cfgtype "$cfg" TYPE
+       dudders=/usr/bin/dudders
+
+       case "$cfgtype" in
+               dudders)
+                       config_get enabled  $cfg enabled
+                       [ "$enabled" = "yes" ] || return 0
+
+                       config_get tcp      $cfg tcp
+                       config_get keyname  $cfg keyname
+                       config_get mname    $cfg mname
+                       config_get zone     $cfg zone
+                       config_get keyfile  $cfg keyfile
+                       config_get hostname $cfg hostname
+                       config_get ttl      $cfg ttl
+
+                       [ -r "$keyfile" ] || return 1
+                       sleep 1
+                       interface=$(route -n 2>&- \
+                         |grep '^0.0.0.0' \
+                         |sed -e 's/.* \([^ ]\+\)$/\1/')
+                       [ -z "$interface" ] && return 0
+                       [ "$DEVICE" = "$interface" -o \
+                         "$IFNAME" = "$interface" -o \
+                         "$PPP_IFACE" = "$interface" ] || return 0
+                       ipaddr=${PPP_LOCAL:-${IPLOCAL:-$(ifconfig "$interface" \
+                           |grep -o 'addr:[^ ]\+' \
+                           |sed -e 's/addr://')}}
+                       OPTS=${keyname:+" -k '$keyname'"}
+                       [ "$tcp" = "yes" ] && OPTS=$OPTS" -T"
+                       OPTS=$OPTS${mname:+" -m '$mname'"}
+                       OPTS=$OPTS${zone:+" -z '$zone'"}
+                       eval $dudders -k $keyfile $OPTS $hostname $ttl $ipaddr
+               ;;
+       esac
+}
+case "${ACTION:-ifup}" in
+       ifup) config_load dudders ;;
+esac
-- 
1.7.2.1
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to