dns_one 0.4.53 → 0.4.54
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/dns_one/util.rb +54 -52
- data/lib/dns_one/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 290ee7db3aa668de5459c969ba5e4bd18e9efd24
|
4
|
+
data.tar.gz: 1af40e76a819e916150e01442270fdd36ddc0e4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98cda024453bd125b31c9b0c825cf02c7058ad195f952a3a93320cddd29544f7e2865ccf4d1858c80172b625b4ddaf4b7188e393ccca107467e1b4e80646987c
|
7
|
+
data.tar.gz: 16b5471d9c8cb771cb56061a05a8dd3be4d1e4c8f0beb239b9e5400cfaa0f5b02a4dd6e34c2da9b270c6f0f94772a2828a6781f74ad199818f23d340f38eb253
|
data/lib/dns_one/util.rb
CHANGED
@@ -1,54 +1,56 @@
|
|
1
|
-
module DnsOne; class Util
|
2
|
-
|
1
|
+
module DnsOne; class Util
|
2
|
+
|
3
3
|
DOM_REGEX = /^[a-z0-9]+([\-\.][a-z0-9]+)*\.[a-z]{2,32}$/i
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
constant
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
5
|
+
class << self
|
6
|
+
def die msg
|
7
|
+
Log.f msg
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
|
11
|
+
def run cmd
|
12
|
+
puts "Running #{cmd}..."
|
13
|
+
system cmd
|
14
|
+
end
|
15
|
+
|
16
|
+
def has_systemd?
|
17
|
+
File.exist?(`which systemctl`.strip) &&
|
18
|
+
File.writable?('/lib/systemd/system')
|
19
|
+
end
|
20
|
+
|
21
|
+
def ensure_sytemd
|
22
|
+
unless has_systemd?
|
23
|
+
STDERR.puts "Systemd not available. Aborting."
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def match_root stat
|
29
|
+
stat.uid == 0 && stat.gid == 0
|
30
|
+
end
|
31
|
+
|
32
|
+
def last_mod constant
|
33
|
+
constant.to_s.split('::').last
|
34
|
+
end
|
35
|
+
|
36
|
+
def log_result ip_address, domain_name, res_class, rcode, resp_log, from_cache
|
37
|
+
fields = []
|
38
|
+
|
39
|
+
fields << domain_name
|
40
|
+
fields << Util.last_mod(res_class)
|
41
|
+
fields << rcode
|
42
|
+
fields << resp_log.map{ |rec|
|
43
|
+
Util.last_mod(rec.res_class) +
|
44
|
+
':' +
|
45
|
+
[rec.val].flatten.join(',')
|
46
|
+
}.join(';')
|
47
|
+
fields << ip_address
|
48
|
+
fields << (from_cache ? '1' : '0')
|
49
|
+
|
50
|
+
fields.map!{|v| v.blank? ? '-' : v}
|
51
|
+
|
52
|
+
Log.i "result: #{ fields.join ' ' }"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end; end
|
data/lib/dns_one/version.rb
CHANGED