radd 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/radd/config.rb +10 -3
- data/lib/radd/nameserver.rb +18 -14
- data/lib/radd/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f979c2d87f1f25eb5c780da9d4d5ecb0543c299bee5d7e73a046825357759d1f
|
|
4
|
+
data.tar.gz: 8f92e1c1018b4a5ea9f86e138f3a439e4bd76eaadbfe4ab78a91ecc15d12b33f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b7e11faf5690621e6027d2356c7ee403488fabf29caa0d5007a2e8d6b8ed8319f3b3ce8373e2f0f97905516f0eea9c263f824da406b067ab188ce0c8936d9fdf
|
|
7
|
+
data.tar.gz: 64f91eb6deccbaf8932960b620f65b1f87807c19d7a6492e44a8fa836608cfefe226b25ffde0d3bdec69434742e38bd3e5086bd1f251f11e5c17e451aa2e449f
|
data/lib/radd/config.rb
CHANGED
|
@@ -22,8 +22,8 @@ module Radd
|
|
|
22
22
|
raise ConfigurationError, 'invalid TTL' if config['ttl'] && config['ttl'] < 1
|
|
23
23
|
@ttl = config['ttl'] || 300
|
|
24
24
|
raise ConfigurationError, 'master name missing' unless config['mname']
|
|
25
|
-
@mname = config['mname']
|
|
26
|
-
@rname = config['rname'] || "hostmaster
|
|
25
|
+
@mname = config['mname'].split('.').freeze
|
|
26
|
+
@rname = encode_email(config['rname'] || "hostmaster@#{domain}").freeze
|
|
27
27
|
db_path = Pathname.new(config['db'] || 'radd.sqlite3')
|
|
28
28
|
db_path = Radd.root + db_path unless db_path.absolute?
|
|
29
29
|
@db = db_path
|
|
@@ -39,6 +39,13 @@ module Radd
|
|
|
39
39
|
def valid_ip?(ip)
|
|
40
40
|
!!(ip && ip.match(Resolv::IPv4::Regex))
|
|
41
41
|
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def encode_email(email)
|
|
46
|
+
addr, domain = email.split('@')
|
|
47
|
+
[addr, *domain.split('.')]
|
|
48
|
+
end
|
|
42
49
|
end
|
|
43
|
-
|
|
50
|
+
|
|
44
51
|
end
|
data/lib/radd/nameserver.rb
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
module Radd
|
|
2
|
+
class Nameserver < Async::DNS::Server
|
|
3
|
+
|
|
4
|
+
def initialize
|
|
5
|
+
super(Async::DNS::Endpoint.for(Radd.dns_host, port: Radd.dns_port))
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def process(name, resource_class, transaction)
|
|
9
|
+
name = name.downcase
|
|
10
|
+
# NOTE: do not use case..when, as resource classes are not identical
|
|
11
|
+
if Resolv::DNS::Resource::IN::A == resource_class
|
|
12
|
+
ip = Radd.domain == name ? Radd.ip : Radd.query(name)
|
|
13
|
+
return transaction.respond!(ip, ttl: Radd.ttl) if ip
|
|
14
|
+
elsif resource_class <= Resolv::DNS::Resource::SOA && Radd.domain == name
|
|
15
|
+
# mname, rname, serial, refresh, retry_, expire, minimum
|
|
16
|
+
return transaction.respond!(Radd.mname, Radd.rname, Radd.serial, 10800, 1800, 604800, 1800)
|
|
17
|
+
end
|
|
18
|
+
transaction.fail!(:NXDomain)
|
|
14
19
|
end
|
|
15
|
-
transaction.fail!(:NXDomain)
|
|
16
20
|
end
|
|
17
21
|
end
|
data/lib/radd/version.rb
CHANGED