powerdns_db_cli 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5e6f3d87c00985c078ee4cc74bc8b65ed5c81a94
4
+ data.tar.gz: c304fb1275845242be180ec3daad77cfd30eb6de
5
+ SHA512:
6
+ metadata.gz: ea8c9a5dcec8fba3c60202970d2ac957018893c9f319117504f3c660b8d9b8a44cdfbe9889423ee11b871e9f44956b5ee315b79d87f6483402f2dcf536a98acc
7
+ data.tar.gz: c7b495741d6d3f9dfb8b23cff779f46ef38975cac1fae6f56e3a55f01dbd76049615d43a5b1606ca0f30562d53437db2c51d13a44fe649f06da235cb9cf6a09e
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2014 henning mueller
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,20 @@
1
+ powerdns_db_cli
2
+ ===============
3
+
4
+ Minimal command-line interface for PowerDNS database administration based on [Active Record](https://github.com/rails/rails/tree/master/activerecord) and [thor](https://github.com/erikhuda/thor). Some of the code was shamelessly copied from [PowerDNS on Rails](https://github.com/kennethkalmer/powerdns-on-rails).
5
+
6
+ Installation
7
+ ------------
8
+
9
+ From source:
10
+
11
+ rake install
12
+
13
+ Or from rubygems.org:
14
+
15
+ gem install powerdns_db_cli
16
+
17
+ Usage
18
+ -----
19
+
20
+ For now, only the [Active Record Query Interface](http://guides.rubyonrails.org/active_record_querying.html) works which is invoked by `pdns -i`.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/pdns ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path('../../lib', __FILE__)
4
+ $:.unshift(lib) unless $:.include?(lib)
5
+
6
+ require 'powerdns_db_cli'
7
+
8
+ PowerDNS::DB::CLI.start
@@ -0,0 +1,20 @@
1
+ module PowerDNS
2
+ module DB
3
+ class CLI < Thor
4
+ package_name 'pdns'
5
+
6
+ map '-i' => :irb
7
+
8
+ desc 'irb', 'Start interactive shell.'
9
+ def irb
10
+ PowerDNS::DB::Shell.start(PowerDNS::DB)
11
+ end
12
+
13
+ def initialize(*)
14
+ @config = Config.instance
15
+ ActiveRecord::Base.establish_connection(@config)
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,29 @@
1
+ require 'singleton'
2
+ require 'yaml'
3
+
4
+ module PowerDNS
5
+ module DB
6
+ class Config < Hash
7
+ include Singleton
8
+
9
+ PATH = File.expand_path('~/.config/PowerDNS/db_cli.yaml')
10
+
11
+ DEFAULT = {
12
+ adapter: 'postgresql',
13
+ host: 'localhost',
14
+ port: 5432,
15
+ database: 'pdns',
16
+ username: 'postgres',
17
+ password: ''
18
+ }
19
+
20
+ def initialize
21
+ if File.exists?(PATH)
22
+ self.merge!(YAML.load_file(PATH))
23
+ else
24
+ self.merge!(DEFAULT)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,6 @@
1
+ module PowerDNS
2
+ module DB
3
+ class Cryptokey < ActiveRecord::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,36 @@
1
+ module PowerDNS
2
+ module DB
3
+ class Domain < ActiveRecord::Base
4
+ IP_ADDR_REGEX = /\A(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\z/
5
+ TYPES = %w[NATIVE MASTER SLAVE]
6
+
7
+ has_many :records, dependent: :destroy
8
+
9
+ self.inheritance_column = :sti
10
+
11
+ validates :name,
12
+ presence: true,
13
+ uniqueness: true
14
+
15
+ validates :type,
16
+ inclusion: {
17
+ in: TYPES,
18
+ message: "has to be one of #{TYPES.join(', ')}"
19
+ }
20
+
21
+ validates :master,
22
+ if: :slave?,
23
+ presence: true,
24
+ format: {
25
+ with: IP_ADDR_REGEX,
26
+ message: 'has to be IP address'
27
+ }
28
+
29
+ default_scope { order :name }
30
+
31
+ def slave?
32
+ self.type == 'SLAVE'
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,6 @@
1
+ module PowerDNS
2
+ module DB
3
+ class Domainmetadatum < ActiveRecord::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,40 @@
1
+ module PowerDNS
2
+ module DB
3
+ class Record < ActiveRecord::Base
4
+ belongs_to :domain
5
+
6
+ self.inheritance_column = :sti
7
+
8
+ validates :domain_id,
9
+ presence: true
10
+
11
+ validates :name,
12
+ presence: true
13
+
14
+ validates :ttl,
15
+ numericality: {
16
+ only_integer: true,
17
+ greater_than_or_equal_to: 0
18
+ }
19
+
20
+ before_validation :append_domain_name!, if: :domain_id?
21
+ before_save :update_change_date
22
+
23
+ private
24
+
25
+ def append_domain_name!
26
+ if self.name.blank?
27
+ self.name = self.domain.name
28
+ else
29
+ unless self.name.include?(self.domain.name)
30
+ self.name << ".#{self.domain.name}"
31
+ end
32
+ end
33
+ end
34
+
35
+ def update_change_date
36
+ self.change_date = Time.now.to_i
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,22 @@
1
+ module PowerDNS
2
+ module DB
3
+ class Shell
4
+ def initialize(context)
5
+ ARGV.clear
6
+
7
+ require 'irb'
8
+
9
+ IRB.setup nil
10
+ IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
11
+
12
+ require 'irb/ext/multi-irb'
13
+
14
+ IRB.irb nil, context
15
+ end
16
+
17
+ def self.start(context)
18
+ new(context)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,6 @@
1
+ module PowerDNS
2
+ module DB
3
+ class Supermaster < ActiveRecord::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module PowerDNS
2
+ module DB
3
+ class Tsigkey < ActiveRecord::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,19 @@
1
+ module PowerDNS
2
+ module DB
3
+ end
4
+ end
5
+
6
+ require 'active_record'
7
+ require 'thor'
8
+
9
+ require 'powerdns_db_cli/cryptokey'
10
+ require 'powerdns_db_cli/domainmetadatum'
11
+ require 'powerdns_db_cli/domain'
12
+ require 'powerdns_db_cli/record'
13
+ require 'powerdns_db_cli/supermaster'
14
+ require 'powerdns_db_cli/tsigkey'
15
+
16
+ require 'powerdns_db_cli/config'
17
+ require 'powerdns_db_cli/shell'
18
+
19
+ require 'powerdns_db_cli/cli'
data/powerdns.pgsql ADDED
@@ -0,0 +1,565 @@
1
+ --
2
+ -- PostgreSQL database dump
3
+ --
4
+
5
+ SET statement_timeout = 0;
6
+ SET client_encoding = 'UTF8';
7
+ SET standard_conforming_strings = on;
8
+ SET check_function_bodies = false;
9
+ SET client_min_messages = warning;
10
+
11
+ --
12
+ -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
13
+ --
14
+
15
+ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
16
+
17
+
18
+ --
19
+ -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
20
+ --
21
+
22
+ COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
23
+
24
+
25
+ SET search_path = public, pg_catalog;
26
+
27
+ SET default_tablespace = '';
28
+
29
+ SET default_with_oids = false;
30
+
31
+ --
32
+ -- Name: cryptokeys; Type: TABLE; Schema: public; Owner: pdns; Tablespace:
33
+ --
34
+
35
+ CREATE TABLE cryptokeys (
36
+ id integer NOT NULL,
37
+ domain_id integer,
38
+ flags integer NOT NULL,
39
+ active boolean,
40
+ content text
41
+ );
42
+
43
+
44
+ /* ALTER TABLE public.cryptokeys OWNER TO pdns; */
45
+
46
+ --
47
+ -- Name: cryptokeys_id_seq; Type: SEQUENCE; Schema: public; Owner: pdns
48
+ --
49
+
50
+ CREATE SEQUENCE cryptokeys_id_seq
51
+ START WITH 1
52
+ INCREMENT BY 1
53
+ NO MINVALUE
54
+ NO MAXVALUE
55
+ CACHE 1;
56
+
57
+
58
+ /* ALTER TABLE public.cryptokeys_id_seq OWNER TO pdns; */
59
+
60
+ --
61
+ -- Name: cryptokeys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: pdns
62
+ --
63
+
64
+ ALTER SEQUENCE cryptokeys_id_seq OWNED BY cryptokeys.id;
65
+
66
+
67
+ --
68
+ -- Name: domainmetadata; Type: TABLE; Schema: public; Owner: pdns; Tablespace:
69
+ --
70
+
71
+ CREATE TABLE domainmetadata (
72
+ id integer NOT NULL,
73
+ domain_id integer,
74
+ kind character varying(16),
75
+ content text
76
+ );
77
+
78
+
79
+ /* ALTER TABLE public.domainmetadata OWNER TO pdns; */
80
+
81
+ --
82
+ -- Name: domainmetadata_id_seq; Type: SEQUENCE; Schema: public; Owner: pdns
83
+ --
84
+
85
+ CREATE SEQUENCE domainmetadata_id_seq
86
+ START WITH 1
87
+ INCREMENT BY 1
88
+ NO MINVALUE
89
+ NO MAXVALUE
90
+ CACHE 1;
91
+
92
+
93
+ /* ALTER TABLE public.domainmetadata_id_seq OWNER TO pdns; */
94
+
95
+ --
96
+ -- Name: domainmetadata_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: pdns
97
+ --
98
+
99
+ ALTER SEQUENCE domainmetadata_id_seq OWNED BY domainmetadata.id;
100
+
101
+
102
+ --
103
+ -- Name: domains; Type: TABLE; Schema: public; Owner: pdns; Tablespace:
104
+ --
105
+
106
+ CREATE TABLE domains (
107
+ id integer NOT NULL,
108
+ name character varying(255) NOT NULL,
109
+ master character varying(20) DEFAULT NULL::character varying,
110
+ last_check integer,
111
+ type character varying(6) NOT NULL,
112
+ notified_serial integer,
113
+ account character varying(40) DEFAULT NULL::character varying
114
+ );
115
+
116
+
117
+ /* ALTER TABLE public.domains OWNER TO pdns; */
118
+
119
+ --
120
+ -- Name: domains_id_seq; Type: SEQUENCE; Schema: public; Owner: pdns
121
+ --
122
+
123
+ CREATE SEQUENCE domains_id_seq
124
+ START WITH 1
125
+ INCREMENT BY 1
126
+ NO MINVALUE
127
+ NO MAXVALUE
128
+ CACHE 1;
129
+
130
+
131
+ /* ALTER TABLE public.domains_id_seq OWNER TO pdns; */
132
+
133
+ --
134
+ -- Name: domains_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: pdns
135
+ --
136
+
137
+ ALTER SEQUENCE domains_id_seq OWNED BY domains.id;
138
+
139
+
140
+ --
141
+ -- Name: records; Type: TABLE; Schema: public; Owner: pdns; Tablespace:
142
+ --
143
+
144
+ CREATE TABLE records (
145
+ id integer NOT NULL,
146
+ domain_id integer,
147
+ name character varying(255) DEFAULT NULL::character varying,
148
+ type character varying(10) DEFAULT NULL::character varying,
149
+ content character varying(65535) DEFAULT NULL::character varying,
150
+ ttl integer,
151
+ prio integer,
152
+ change_date integer,
153
+ ordername character varying(255),
154
+ auth boolean
155
+ );
156
+
157
+
158
+ /* ALTER TABLE public.records OWNER TO pdns; */
159
+
160
+ --
161
+ -- Name: records_id_seq; Type: SEQUENCE; Schema: public; Owner: pdns
162
+ --
163
+
164
+ CREATE SEQUENCE records_id_seq
165
+ START WITH 1
166
+ INCREMENT BY 1
167
+ NO MINVALUE
168
+ NO MAXVALUE
169
+ CACHE 1;
170
+
171
+
172
+ /* ALTER TABLE public.records_id_seq OWNER TO pdns; */
173
+
174
+ --
175
+ -- Name: records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: pdns
176
+ --
177
+
178
+ ALTER SEQUENCE records_id_seq OWNED BY records.id;
179
+
180
+
181
+ --
182
+ -- Name: supermasters; Type: TABLE; Schema: public; Owner: pdns; Tablespace:
183
+ --
184
+
185
+ CREATE TABLE supermasters (
186
+ ip character varying(64) NOT NULL,
187
+ nameserver character varying(255) NOT NULL,
188
+ account character varying(40) DEFAULT NULL::character varying
189
+ );
190
+
191
+
192
+ /* ALTER TABLE public.supermasters OWNER TO pdns; */
193
+
194
+ --
195
+ -- Name: tsigkeys; Type: TABLE; Schema: public; Owner: pdns; Tablespace:
196
+ --
197
+
198
+ CREATE TABLE tsigkeys (
199
+ id integer NOT NULL,
200
+ name character varying(255),
201
+ algorithm character varying(255),
202
+ secret character varying(255)
203
+ );
204
+
205
+
206
+ /* ALTER TABLE public.tsigkeys OWNER TO pdns; */
207
+
208
+ --
209
+ -- Name: tsigkeys_id_seq; Type: SEQUENCE; Schema: public; Owner: pdns
210
+ --
211
+
212
+ CREATE SEQUENCE tsigkeys_id_seq
213
+ START WITH 1
214
+ INCREMENT BY 1
215
+ NO MINVALUE
216
+ NO MAXVALUE
217
+ CACHE 1;
218
+
219
+
220
+ /* ALTER TABLE public.tsigkeys_id_seq OWNER TO pdns; */
221
+
222
+ --
223
+ -- Name: tsigkeys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: pdns
224
+ --
225
+
226
+ ALTER SEQUENCE tsigkeys_id_seq OWNED BY tsigkeys.id;
227
+
228
+
229
+ --
230
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: pdns
231
+ --
232
+
233
+ ALTER TABLE ONLY cryptokeys ALTER COLUMN id SET DEFAULT nextval('cryptokeys_id_seq'::regclass);
234
+
235
+
236
+ --
237
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: pdns
238
+ --
239
+
240
+ ALTER TABLE ONLY domainmetadata ALTER COLUMN id SET DEFAULT nextval('domainmetadata_id_seq'::regclass);
241
+
242
+
243
+ --
244
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: pdns
245
+ --
246
+
247
+ ALTER TABLE ONLY domains ALTER COLUMN id SET DEFAULT nextval('domains_id_seq'::regclass);
248
+
249
+
250
+ --
251
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: pdns
252
+ --
253
+
254
+ ALTER TABLE ONLY records ALTER COLUMN id SET DEFAULT nextval('records_id_seq'::regclass);
255
+
256
+
257
+ --
258
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: pdns
259
+ --
260
+
261
+ ALTER TABLE ONLY tsigkeys ALTER COLUMN id SET DEFAULT nextval('tsigkeys_id_seq'::regclass);
262
+
263
+
264
+ --
265
+ -- Data for Name: cryptokeys; Type: TABLE DATA; Schema: public; Owner: pdns
266
+ --
267
+
268
+ COPY cryptokeys (id, domain_id, flags, active, content) FROM stdin;
269
+ \.
270
+
271
+
272
+ --
273
+ -- Name: cryptokeys_id_seq; Type: SEQUENCE SET; Schema: public; Owner: pdns
274
+ --
275
+
276
+ SELECT pg_catalog.setval('cryptokeys_id_seq', 1, false);
277
+
278
+
279
+ --
280
+ -- Data for Name: domainmetadata; Type: TABLE DATA; Schema: public; Owner: pdns
281
+ --
282
+
283
+ COPY domainmetadata (id, domain_id, kind, content) FROM stdin;
284
+ \.
285
+
286
+
287
+ --
288
+ -- Name: domainmetadata_id_seq; Type: SEQUENCE SET; Schema: public; Owner: pdns
289
+ --
290
+
291
+ SELECT pg_catalog.setval('domainmetadata_id_seq', 1, false);
292
+
293
+
294
+ --
295
+ -- Data for Name: domains; Type: TABLE DATA; Schema: public; Owner: pdns
296
+ --
297
+
298
+ COPY domains (id, name, master, last_check, type, notified_serial, account) FROM stdin;
299
+ \.
300
+
301
+
302
+ --
303
+ -- Name: domains_id_seq; Type: SEQUENCE SET; Schema: public; Owner: pdns
304
+ --
305
+
306
+ SELECT pg_catalog.setval('domains_id_seq', 1, false);
307
+
308
+
309
+ --
310
+ -- Data for Name: records; Type: TABLE DATA; Schema: public; Owner: pdns
311
+ --
312
+
313
+ COPY records (id, domain_id, name, type, content, ttl, prio, change_date, ordername, auth) FROM stdin;
314
+ \.
315
+
316
+
317
+ --
318
+ -- Name: records_id_seq; Type: SEQUENCE SET; Schema: public; Owner: pdns
319
+ --
320
+
321
+ SELECT pg_catalog.setval('records_id_seq', 1, false);
322
+
323
+
324
+ --
325
+ -- Data for Name: supermasters; Type: TABLE DATA; Schema: public; Owner: pdns
326
+ --
327
+
328
+ COPY supermasters (ip, nameserver, account) FROM stdin;
329
+ \.
330
+
331
+
332
+ --
333
+ -- Data for Name: tsigkeys; Type: TABLE DATA; Schema: public; Owner: pdns
334
+ --
335
+
336
+ COPY tsigkeys (id, name, algorithm, secret) FROM stdin;
337
+ \.
338
+
339
+
340
+ --
341
+ -- Name: tsigkeys_id_seq; Type: SEQUENCE SET; Schema: public; Owner: pdns
342
+ --
343
+
344
+ SELECT pg_catalog.setval('tsigkeys_id_seq', 1, false);
345
+
346
+
347
+ --
348
+ -- Name: cryptokeys_pkey; Type: CONSTRAINT; Schema: public; Owner: pdns; Tablespace:
349
+ --
350
+
351
+ ALTER TABLE ONLY cryptokeys
352
+ ADD CONSTRAINT cryptokeys_pkey PRIMARY KEY (id);
353
+
354
+
355
+ --
356
+ -- Name: domainmetadata_pkey; Type: CONSTRAINT; Schema: public; Owner: pdns; Tablespace:
357
+ --
358
+
359
+ ALTER TABLE ONLY domainmetadata
360
+ ADD CONSTRAINT domainmetadata_pkey PRIMARY KEY (id);
361
+
362
+
363
+ --
364
+ -- Name: domains_pkey; Type: CONSTRAINT; Schema: public; Owner: pdns; Tablespace:
365
+ --
366
+
367
+ ALTER TABLE ONLY domains
368
+ ADD CONSTRAINT domains_pkey PRIMARY KEY (id);
369
+
370
+
371
+ --
372
+ -- Name: records_pkey; Type: CONSTRAINT; Schema: public; Owner: pdns; Tablespace:
373
+ --
374
+
375
+ ALTER TABLE ONLY records
376
+ ADD CONSTRAINT records_pkey PRIMARY KEY (id);
377
+
378
+
379
+ --
380
+ -- Name: tsigkeys_pkey; Type: CONSTRAINT; Schema: public; Owner: pdns; Tablespace:
381
+ --
382
+
383
+ ALTER TABLE ONLY tsigkeys
384
+ ADD CONSTRAINT tsigkeys_pkey PRIMARY KEY (id);
385
+
386
+
387
+ --
388
+ -- Name: domain_id; Type: INDEX; Schema: public; Owner: pdns; Tablespace:
389
+ --
390
+
391
+ CREATE INDEX domain_id ON records USING btree (domain_id);
392
+
393
+
394
+ --
395
+ -- Name: name_index; Type: INDEX; Schema: public; Owner: pdns; Tablespace:
396
+ --
397
+
398
+ CREATE UNIQUE INDEX name_index ON domains USING btree (name);
399
+
400
+
401
+ --
402
+ -- Name: namealgoindex; Type: INDEX; Schema: public; Owner: pdns; Tablespace:
403
+ --
404
+
405
+ CREATE UNIQUE INDEX namealgoindex ON tsigkeys USING btree (name, algorithm);
406
+
407
+
408
+ --
409
+ -- Name: nametype_index; Type: INDEX; Schema: public; Owner: pdns; Tablespace:
410
+ --
411
+
412
+ CREATE INDEX nametype_index ON records USING btree (name, type);
413
+
414
+
415
+ --
416
+ -- Name: orderindex; Type: INDEX; Schema: public; Owner: pdns; Tablespace:
417
+ --
418
+
419
+ CREATE INDEX orderindex ON records USING btree (ordername);
420
+
421
+
422
+ --
423
+ -- Name: rec_name_index; Type: INDEX; Schema: public; Owner: pdns; Tablespace:
424
+ --
425
+
426
+ CREATE INDEX rec_name_index ON records USING btree (name);
427
+
428
+
429
+ --
430
+ -- Name: cryptokeys_domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: pdns
431
+ --
432
+
433
+ ALTER TABLE ONLY cryptokeys
434
+ ADD CONSTRAINT cryptokeys_domain_id_fkey FOREIGN KEY (domain_id) REFERENCES domains(id) ON DELETE CASCADE;
435
+
436
+
437
+ --
438
+ -- Name: domain_exists; Type: FK CONSTRAINT; Schema: public; Owner: pdns
439
+ --
440
+
441
+ ALTER TABLE ONLY records
442
+ ADD CONSTRAINT domain_exists FOREIGN KEY (domain_id) REFERENCES domains(id) ON DELETE CASCADE;
443
+
444
+
445
+ --
446
+ -- Name: domainmetadata_domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: pdns
447
+ --
448
+
449
+ ALTER TABLE ONLY domainmetadata
450
+ ADD CONSTRAINT domainmetadata_domain_id_fkey FOREIGN KEY (domain_id) REFERENCES domains(id) ON DELETE CASCADE;
451
+
452
+
453
+ --
454
+ -- Name: public; Type: ACL; Schema: -; Owner: postgres
455
+ --
456
+
457
+ /* REVOKE ALL ON SCHEMA public FROM PUBLIC; */
458
+ /* REVOKE ALL ON SCHEMA public FROM postgres; */
459
+ /* GRANT ALL ON SCHEMA public TO postgres; */
460
+ /* GRANT ALL ON SCHEMA public TO PUBLIC; */
461
+
462
+
463
+ --
464
+ -- Name: cryptokeys; Type: ACL; Schema: public; Owner: pdns
465
+ --
466
+
467
+ /* REVOKE ALL ON TABLE cryptokeys FROM PUBLIC; */
468
+ /* REVOKE ALL ON TABLE cryptokeys FROM pdns; */
469
+ /* GRANT ALL ON TABLE cryptokeys TO pdns; */
470
+
471
+
472
+ --
473
+ -- Name: cryptokeys_id_seq; Type: ACL; Schema: public; Owner: pdns
474
+ --
475
+
476
+ /* REVOKE ALL ON SEQUENCE cryptokeys_id_seq FROM PUBLIC; */
477
+ /* REVOKE ALL ON SEQUENCE cryptokeys_id_seq FROM pdns; */
478
+ /* GRANT ALL ON SEQUENCE cryptokeys_id_seq TO pdns; */
479
+
480
+
481
+ --
482
+ -- Name: domainmetadata; Type: ACL; Schema: public; Owner: pdns
483
+ --
484
+
485
+ /* REVOKE ALL ON TABLE domainmetadata FROM PUBLIC; */
486
+ /* REVOKE ALL ON TABLE domainmetadata FROM pdns; */
487
+ /* GRANT ALL ON TABLE domainmetadata TO pdns; */
488
+
489
+
490
+ --
491
+ -- Name: domainmetadata_id_seq; Type: ACL; Schema: public; Owner: pdns
492
+ --
493
+
494
+ /* REVOKE ALL ON SEQUENCE domainmetadata_id_seq FROM PUBLIC; */
495
+ /* REVOKE ALL ON SEQUENCE domainmetadata_id_seq FROM pdns; */
496
+ /* GRANT ALL ON SEQUENCE domainmetadata_id_seq TO pdns; */
497
+
498
+
499
+ --
500
+ -- Name: domains; Type: ACL; Schema: public; Owner: pdns
501
+ --
502
+
503
+ /* REVOKE ALL ON TABLE domains FROM PUBLIC; */
504
+ /* REVOKE ALL ON TABLE domains FROM pdns; */
505
+ /* GRANT ALL ON TABLE domains TO pdns; */
506
+
507
+
508
+ --
509
+ -- Name: domains_id_seq; Type: ACL; Schema: public; Owner: pdns
510
+ --
511
+
512
+ /* REVOKE ALL ON SEQUENCE domains_id_seq FROM PUBLIC; */
513
+ /* REVOKE ALL ON SEQUENCE domains_id_seq FROM pdns; */
514
+ /* GRANT ALL ON SEQUENCE domains_id_seq TO pdns; */
515
+
516
+
517
+ --
518
+ -- Name: records; Type: ACL; Schema: public; Owner: pdns
519
+ --
520
+
521
+ /* REVOKE ALL ON TABLE records FROM PUBLIC; */
522
+ /* REVOKE ALL ON TABLE records FROM pdns; */
523
+ /* GRANT ALL ON TABLE records TO pdns; */
524
+
525
+
526
+ --
527
+ -- Name: records_id_seq; Type: ACL; Schema: public; Owner: pdns
528
+ --
529
+
530
+ /* REVOKE ALL ON SEQUENCE records_id_seq FROM PUBLIC; */
531
+ /* REVOKE ALL ON SEQUENCE records_id_seq FROM pdns; */
532
+ /* GRANT ALL ON SEQUENCE records_id_seq TO pdns; */
533
+
534
+
535
+ --
536
+ -- Name: supermasters; Type: ACL; Schema: public; Owner: pdns
537
+ --
538
+
539
+ /* REVOKE ALL ON TABLE supermasters FROM PUBLIC; */
540
+ /* REVOKE ALL ON TABLE supermasters FROM pdns; */
541
+ /* GRANT ALL ON TABLE supermasters TO pdns; */
542
+
543
+
544
+ --
545
+ -- Name: tsigkeys; Type: ACL; Schema: public; Owner: pdns
546
+ --
547
+
548
+ /* REVOKE ALL ON TABLE tsigkeys FROM PUBLIC; */
549
+ /* REVOKE ALL ON TABLE tsigkeys FROM pdns; */
550
+ /* GRANT ALL ON TABLE tsigkeys TO pdns; */
551
+
552
+
553
+ --
554
+ -- Name: tsigkeys_id_seq; Type: ACL; Schema: public; Owner: pdns
555
+ --
556
+
557
+ /* REVOKE ALL ON SEQUENCE tsigkeys_id_seq FROM PUBLIC; */
558
+ /* REVOKE ALL ON SEQUENCE tsigkeys_id_seq FROM pdns; */
559
+ /* GRANT ALL ON SEQUENCE tsigkeys_id_seq TO pdns; */
560
+
561
+
562
+ --
563
+ -- PostgreSQL database dump complete
564
+ --
565
+
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'powerdns_db_cli'
3
+ spec.version = '0.0.1'
4
+ spec.authors = ['henning mueller']
5
+ spec.email = ['mail@nning.io']
6
+
7
+ spec.summary = 'Minimal command-line interface for PowerDNS database administration.'
8
+ # spec.description = %q{TODO: Write a longer description. Optional.}
9
+ spec.homepage = ''
10
+ spec.license = 'MIT'
11
+
12
+ spec.files = `git ls-files -z`.split("\x0")
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ['lib']
16
+
17
+ spec.add_development_dependency 'bundler', '~> 1.7'
18
+ spec.add_development_dependency 'rake', '~> 10.0'
19
+
20
+ spec.add_runtime_dependency 'activerecord', '~> 4.1'
21
+ spec.add_runtime_dependency 'thor', '~> 0.19'
22
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: powerdns_db_cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - henning mueller
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activerecord
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.19'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.19'
69
+ description:
70
+ email:
71
+ - mail@nning.io
72
+ executables:
73
+ - pdns
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - bin/pdns
83
+ - lib/powerdns_db_cli.rb
84
+ - lib/powerdns_db_cli/cli.rb
85
+ - lib/powerdns_db_cli/config.rb
86
+ - lib/powerdns_db_cli/cryptokey.rb
87
+ - lib/powerdns_db_cli/domain.rb
88
+ - lib/powerdns_db_cli/domainmetadatum.rb
89
+ - lib/powerdns_db_cli/record.rb
90
+ - lib/powerdns_db_cli/shell.rb
91
+ - lib/powerdns_db_cli/supermaster.rb
92
+ - lib/powerdns_db_cli/tsigkey.rb
93
+ - powerdns.pgsql
94
+ - powerdns_db_cli.gemspec
95
+ homepage: ''
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.2.2
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Minimal command-line interface for PowerDNS database administration.
119
+ test_files: []