Project

General

Profile

DNS Server » History » Version 1

Joseph Foley, 2015-09-05 02:57

1 1 Joseph Foley
h1. DNS Server
2
3
The system is up and running.  It is not automated, and requires logging into the bridge to update DNS.  Not optimal, but easily fixed once we figure out how we want to structure things.
4
5
h2. Overview
6
7
* @bridge.dev.ru.is@ is the primary DNS server (for now)
8
* @gryla.dev.ru.is@ is a secondary DNS server, updated via zone transfer.
9
10
11
h2. Guides/Links
12
13
* http://www.howtoforge.com/creating-your-own-webserver-with-bind-and-apache-centos5
14
* Simple (Web) Management for BIND (SMBIND) http://sourceforge.net/projects/smbind/
15
* Bind9 Chroot Jail http://www.unixwiz.net/techtips/bind9-chroot.html
16
* Secure BIND conf template http://www.cymru.com/Documents/secure-bind-template.html
17
* Ibibilio AD and BIND http://ibiblio.org/gferg/ldp/BIND+AD-HOWTO/BIND+AD-HOWTO-2.html#ss2.3
18
19
h2. Instructions
20
21
* Install the packages on CentOS
22
<pre>yum install bind bind-chroot bind-libs bind-utils caching-nameserver -y</pre>
23
* chroot makes things a little complicated, but more secure
24
** Go into the chroot config and move the standardized zone files into the data jail
25
<pre>cd /var/named
26
mv named.* chroot/var/named/.
27
</pre>
28
** Copy the new zone file there too.  You will need to checkout the devnet repository from SVN.  Copy the dev.objid.net.zone file until the RU dns is fixed also.
29
** We will be delegating the dev.objid.net subdomain as soon as foley gets it working
30
<pre> cd devnet/Machines/Bridge
31
cp named.* /var/named/chroot/var/named/.
32
cp dev.ru.is.zone /var/named/chroot/var/named/.
33
</pre>
34
** Edit the /etc/named.conf and add this line
35
<pre>include "/etc/named.conf.local";</pre>
36
** Restart named and check for errors
37
38
h3. Reverse DNS lookup
39
40
* Install mkrdns
41
<pre> wget http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/mkrdns-3.3-1.el6.rf.noarch.rpm
42
rpm -ihv mkrdns-3.3-1.el6.rf.noarch.rpm</pre>
43
* Create a file that looks like this called @209.208.130.in-addr.arpa@
44
<pre>
45
209.208.130.in-addr.arpa. 3600	IN	SOA	NS1.DEV.RU.IS. ROOT.DEV.RU.IS. 2012041504 3600 600 86400 60
46
209.208.130.in-addr.arpa. 3600	IN	NS	NS1.DEV.RU.IS.
47
209.208.130.in-addr.arpa. 3600	IN	NS	NS2.DEV.RU.IS.
48
209.208.130.in-addr.arpa. 3600	IN	PTR	EIR.DEV.RU.IS.
49
33.209.208.130.in-addr.arpa. 3600 IN	PTR	BALDUR.DEV.RU.IS.
50
34.209.208.130.in-addr.arpa. 3600 IN	PTR	HOD.DEV.RU.IS.
51
35.209.208.130.in-addr.arpa. 3600 IN	PTR	EIR.DEV.RU.IS.
52
36.209.208.130.in-addr.arpa. 3600 IN	PTR	CENTIPEDE.DEV.RU.IS.
53
37.209.208.130.in-addr.arpa. 3600 IN	PTR	GRYLA.DEV.RU.IS.
54
38.209.208.130.in-addr.arpa. 3600 IN	PTR	ODIN.DEV.RU.IS.
55
39.209.208.130.in-addr.arpa. 3600 IN	PTR	STEKKJARSTAUR.DEV.RU.IS.
56
40.209.208.130.in-addr.arpa. 3600 IN	PTR	GILJAGAUR.DEV.RU.IS.
57
41.209.208.130.in-addr.arpa. 3600 IN	PTR	STUFUR.DEV.RU.IS.
58
42.209.208.130.in-addr.arpa. 3600 IN	PTR	POTTASLEIKIR.DEV.RU.IS.
59
43.209.208.130.in-addr.arpa. 3600 IN	PTR	ASKASLEIKIR.DEV.RU.IS.
60
44.209.208.130.in-addr.arpa. 3600 IN	PTR	KETKROKUR.DEV.RU.IS.
61
45.209.208.130.in-addr.arpa. 3600 IN	PTR	LOKI.DEV.RU.IS.
62
46.209.208.130.in-addr.arpa. 3600 IN	PTR	FRIGGA.DEV.RU.IS.
63
47.209.208.130.in-addr.arpa. 3600 IN	PTR	BROADCAST.DEV.RU.IS.
64
</pre>
65
* update the named.conf.local file to make the server be a master
66
* Login to the slave server and put a zone-transfer slave entry also.
67
68
h3. More chroot adjustments
69
70
# @/etc/named.conf@
71
<pre>options {
72
        listen-on port 53 {
73
                127.0.0.1;
74
                172.16.0.254;
75
                130.208.209.35;
76
        };
77
#       listen-on-v6 port 53 { ::1; };
78
        directory       "/var/named";
79
        dump-file       "/var/named/data/cache_dump.db";
80
        statistics-file "/var/named/data/named_stats.txt";
81
        memstatistics-file "/var/named/data/named_mem_stats.txt";
82
        allow-query {
83
 #               127.0.0.1;  #localhost only
84
 #               130.208.209.32/24;  #DEVNET only
85
                any;  # this is a public nameserver
86
        };
87
        recursion yes;
88
89
        dnssec-enable yes;
90
        dnssec-validation no;
91
#       dnssec-lookaside auto;
92
93
        /* Path to ISC DLV key */
94
        bindkeys-file "/etc/named.iscdlv.key";
95
        managed-keys-directory "/var/named/dynamic";
96
};
97
98
logging {
99
        
100
        channel info_log {
101
                file "/var/log/named.info.run" versions 3 size 5m;
102
                severity info;
103
                print-time yes;
104
                print-severity yes;
105
                print-category yes;
106
        };
107
        channel warning_log {
108
                file "/var/log/named.warn.run" versions 3 size 5m;
109
                severity warning;
110
                print-time yes;
111
                print-severity yes;
112
                print-category yes;
113
        };
114
        category default {
115
           info_log;
116
           warning_log;
117
        };
118
};
119
120
zone "." IN {
121
        type hint;
122
        file "named.ca";
123
};
124
125
include "/etc/named.rfc1912.zones";
126
include "/etc/named.conf.local";
127
 </pre>
128
# Now run the setup
129
<pre>#!/bin/bash
130
#
131
# named.perms
132
#
133
#   Set the ownership and permissions on the named directory
134
#
135
136
cd /var/named/chroot
137
138
139
# By default, root owns everything and only root can write, but dirs
140
# have to be executable too. Note that some platforms use a dot
141
# instead of a colon between user/group in the chown parameters}
142
143
chown -R root:named .
144
145
find . -type f -print | xargs chmod u=rw,og=r     # regular files
146
find . -type d -print | xargs chmod u=rwx,og=rx   # directories
147
148
# the named.conf and rndc.conf must protect their keys
149
chmod o= etc/*.conf
150
151
# the "secondaries" directory is where we park files from
152
# master nameservers, and named needs to be able to update
153
# these files and create new ones.
154
155
touch var/named/dynamic/.empty  # placeholder
156
find var/named/dynamic/ -type f -print | xargs chown named:named
157
find var/named/dynamic/ -type f -print | xargs chmod ug=r,o=
158
159
touch var/named/dynamic/managed-keys.bind
160
161
# the var/run business is for the PID file
162
chown root:root  var/
163
chmod u=rwx,og=x var/
164
165
find var/run/ -type f -print | xargs chown named:named
166
find var/run/ -type f -print | xargs chmod ug=rw,o=
167
find var/run/ -type d -print | xargs chown named:named
168
find var/run/ -type d -print | xargs chmod ug=rwx,o=
169
170
# named has to be able to create logfiles
171
touch var/log/named.info.run
172
touch var/log/named.warn.run
173
find var/log/ -type f -print | xargs chown named:named
174
find var/log/ -type f -print | xargs chmod ug=rw,o=
175
find var/named/dynamic/ -type f -print | xargs chmod ug=r,o=
176
177
touch var/named/dynamic/managed-keys.bind
178
179
# the var/run business is for the PID file
180
chown root:root  var/
181
chmod u=rwx,og=x var/
182
183
find var/run/ -type f -print | xargs chown named:named
184
find var/run/ -type f -print | xargs chmod ug=rw,o=
185
find var/run/ -type d -print | xargs chown named:named
186
find var/run/ -type d -print | xargs chmod ug=rwx,o=
187
188
# named has to be able to create logfiles
189
touch var/log/named.info.run
190
touch var/log/named.warn.run
191
find var/log/ -type f -print | xargs chown named:named
192
find var/log/ -type f -print | xargs chmod ug=rw,o=
193
find var/log/ -type d -print | xargs chown named:named
194
find var/log/ -type d -print | xargs chmod ug=rwx,o=
195
chown root:named     var/log/named.run
196
chmod ug=rw,o=r      var/log/named.run
197
chmod ug=rwx,o=rx    var/log/
198
</pre>
199
200
h2. Testing
201
202
h3. Linux
203
204
* Edit your @/etc/resolv.conf@
205
<pre>domain dev.ru.is
206
search dev.ru.is
207
nameserver 130.208.209.35
208
</pre>