2 # dyndns via ssh login + tinydns (djbdns/dbndns)
5 # $ ssh dyndns@example.org home.example.org
7 # @author Christian Weiske <cweiske@cweiske.de>
9 if [ -z "$SSH_CONNECTION" ]; then
10 echo "no ssh connection"
14 remoteip=${SSH_CLIENT%% *}
15 if [ -z "$remoteip" ]; then
16 echo "ssh client IP not found"
21 echo Missing argument: domain name
27 if [ -f ~/.config/ssh-dyndns.sh ]; then
28 . ~/.config/ssh-dyndns.sh
30 if [ -f /etc/ssh-dyndns.sh ]; then
34 if [ -z "$data_dir" ]; then
35 echo '$data_dir not set'
38 if [ ! -d "$data_dir" ]; then
39 echo "$data_dir does not exist"
42 if [ ! -f "$data_dir/Makefile" ]; then
43 echo "$data_dir misses Makefile"
47 #FIXME: check allowed domains, allowed suffixes
49 file_pattern="${file_pattern:-data-dyndns-%DOMAIN%}"
50 timeout=${timeout:-300}
52 datafile=${data_dir}`echo $file_pattern | sed "s/%DOMAIN%/$domain/"`
55 if [ `echo "$remoteip"| sed "s/://"` != "$remoteip" ]; then
56 echo "IPv6 not supported yet"
57 # we need ipv6 address expansion
61 #=cweiske.de:5.35.241.22
62 djbdnsline="=${domain}:${remoteip}:${timeout}"
63 echo $djbdnsline > $datafile