002b0116e556e92a36c949b200bfbcef171bdd0d
[ssh-dyndns.git] / README.rst
1 **********
2 ssh-dyndns
3 **********
4 Update DNS records by simply SSH'ing into a server.
5
6 The idea is to create a separate "dyndns" user on the DNS server.
7 It gets the ``ssh-dyndns`` script as login shell, so that no other programs
8 may be executed.
9 SSH provides secure, password-less key-based authentication.
10
11 Upon login, the remote IP is used to create/update a tinydns file with the
12 DNS record for a hostname given by the SSH client.
13
14 tinydns is part of the dbjdns/dbndns package.
15
16
17 =====
18 Setup
19 =====
20
21 1. Clone ssh-dyndns into a sensible location, e.g. ``/usr/local/src/ssh-dyndns``::
22
23     $ cd /usr/local/src/ && git clone git://git.cweiske.de/ssh-dyndns.git
24
25 2. Create a user with ``ssh-dyndns`` as login shell::
26
27     $ useradd -g nogroup -m -N -s /usr/local/src/ssh-dyndns/ssh-dyndns dyndns
28
29 3. Setup password-less ssh keys for the dyndns user::
30
31     $ su - dyndns -s /bin/bash
32     $ mkdir ~/.ssh
33     $ cat /path/to/key.pub >> ~/.ssh/authorized_keys
34
35 4. Prevent showing login messages::
36
37     $ su - dyndns -s /bin/bash
38     $ touch ~/.hushlogin
39
40    Alternatively, you may commend out the "motd" lines in ``/etc/pam.d/sshd``
41 5. Configure ssh-dyndns as root::
42
43     $ cp /usr/local/src/ssh-dyndns/ssh-dyndns.sh.config-dist /etc/ssh-dyndns.sh
44     $ nano /etc/ssh-dyndns.sh
45
46 6. Allow ssh-dyndns to run "sudo make" without password::
47
48     $ visudo
49     dyndns  ALL= NOPASSWD: /usr/bin/make
50
51
52 Configuration
53 =============
54 The configuration file template ``ssh-dyndns.sh.config-dist`` may be copied
55 to either ``/etc/ssh-dyndns.sh`` or ``~/.config/ssh-dyndns.sh``.
56
57 The system-wide config file is loaded first, the user-specific one after that.
58
59 The configuration file may define the following variables:
60
61 ``data_dir``
62     Path to the tinydns zone files, e.g. ``/etc/tinydns/root/``
63 ``file_pattern``
64     File name template. ``%DOMAIN%`` will be replaced with the actual
65     domain name.
66
67     Default: ``data-dyndns-%DOMAIN%``
68 ``timeout``
69     DNS entry TTL (time to live) in seconds
70
71     Default: 300
72 ``domain_patterns``
73     Defines patterns for domains that may be dynamically changed.
74     If the domain name does not match the pattern, the script aborts.
75
76     You may use several patterns by separating them with a space.
77     Shell wildcards are supported (``*`` and ``?``).
78
79     Default: ``home.example.org *.home.example.org``
80
81
82 =====
83 Usage
84 =====
85 Simply ssh into the server and pass the hostname as parameter::
86
87     $ ssh dyndns@example.org home.example.org
88
89 This will start the ``ssh-dyndns`` script on the remote server, generate
90 the tinydns zone file and run ``make`` in the ``data_dir`` directory to
91 compile the ``data.cdb`` file.
92 tinydns will automatically pick up the change.
93
94
95 ====
96 Bugs
97 ====
98 - IPv6 is not supported yet
99
100
101 =======
102 License
103 =======
104 ssh-dyndns is licensed under the `AGPL v3`__ or later.
105
106 __ http://www.gnu.org/licenses/agpl.html
107
108
109 ======
110 Author
111 ======
112 Written by Christian Weiske, cweiske@cweiske.de