2 #dyndns via ssh login + djbdns/dbndns
5 # $ ssh dyndns@example.org home.example.org
8 # $ useradd -g nogroup -m -N -s /usr/local/bin/ssh-dyndns dyndns
9 # .. add ssh key to user
10 #do not show login messages:
11 # $ su - dyndns -s /bin/bash
12 # $ touch ~/.hushlogin
13 # alternatively, comment out the motd lines in /etc/pam.d/sshd
16 if [ -z "$SSH_CONNECTION" ]; then
17 echo "no ssh connection"
21 remoteip=${SSH_CLIENT%% *}
22 if [ -z "$remoteip" ]; then
23 echo "ssh client IP not found"
28 echo Missing argument: domain name
34 if [ -x ~/.config/ssh-dyndns.sh ]; then
35 . ~/.config/ssh-dyndns.sh
37 if [ -x /etc/ssh-dyndns.sh ]; then
41 if [ -z "$data_dir" ]; then
42 echo '$data_dir not set'
45 if [ ! -d "$data_dir" ]; then
46 echo "$data_dir does not exist"
49 if [ ! -f "$data_dir/Makefile" ]; then
50 echo "$data_dir misses Makefile"
54 #FIXME: check allowed domains, allowed suffixes
56 file_pattern="${file_pattern:-data-dyndns-%DOMAIN%}"
57 timeout=${timeout:-300}
59 datafile=${data_dir}`echo $file_pattern | sed "s/%DOMAIN%/$domain/"`
62 if [ `echo "$remoteip"| sed "s/://"` != "$remoteip" ]; then
63 echo "IPv6 not supported yet"
64 # we need ipv6 address expansion
68 #=cweiske.de:5.35.241.22
69 djbdnsline="=${domain}:${remoteip}:${timeout}"
70 echo $djbdnsline > $datafile