corineus 0.1.0
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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +72 -0
- data/Rakefile +10 -0
- data/bin/corineus +7 -0
- data/corineus.gemspec +32 -0
- data/lib/corineus.rb +130 -0
- data/lib/corineus/version.rb +3 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e3d562febe94252df9ff5252e1b3e3f2ae572c0
|
4
|
+
data.tar.gz: 104ee3be729b408bb407ac04ae2b3b7e2d2c840f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3745fd763b803a0bc15df5c637b967341f6c9d4cb6d776c484967c64c933c841e784fa6018ca9725e2d04b10ed3461f5629ec7326db81e8a3fd647f0fc798f80
|
7
|
+
data.tar.gz: e569a9da19c4486604ac6b946a7d585c143ee0dba1c0207de8ba51c73bccad827ddefa73bae64ee06f217fc6a1e3e6972116df0c455b52762baf6aaed52d78d3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Corineus
|
2
|
+
|
3
|
+
Corineus is a wrapper for the `kinit` and `nsupdate` commands to allow
|
4
|
+
easy authenticated updates of DNS records on a Microsoft Windows DNS server from
|
5
|
+
Linux.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```bash
|
10
|
+
# Centos 7 dependencies for kinit and nsupdate commands. Not sure what packages
|
11
|
+
# these commands are in for Ubuntu and other distros:
|
12
|
+
sudo yum install krb5-workstation bind-utils
|
13
|
+
|
14
|
+
# Install the gem
|
15
|
+
gem install corineus
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
### Add
|
21
|
+
|
22
|
+
```
|
23
|
+
corineus add -d, --data=Data for the record -k, --kdc=Kerberos KDC -n, --name=Record to be added -p, --password=Authorized password -r, --realm=Kerberos realm -s, --server=DNS server -u, --user=Authorized username
|
24
|
+
|
25
|
+
Options:
|
26
|
+
-n, --name=Record to be added
|
27
|
+
-d, --data=Data for the record
|
28
|
+
-t, [--type=Type of record]
|
29
|
+
# Default: A
|
30
|
+
-l, [--ttl=Time To Live]
|
31
|
+
# Default: 86400
|
32
|
+
-s, --server=DNS server
|
33
|
+
-r, --realm=Kerberos realm
|
34
|
+
-k, --kdc=Kerberos KDC
|
35
|
+
-u, --user=Authorized username
|
36
|
+
-p, --password=Authorized password
|
37
|
+
-v, [--verbose=Verbose output], [--no-verbose]
|
38
|
+
|
39
|
+
Description:
|
40
|
+
`corineus add` will add a DNS record to a server, authenticating via Kerberos.
|
41
|
+
|
42
|
+
> $ corineus add --name=www.mydomain.com --data=server1.mydomain.com --type=CNAME --server=dns1.mydomain.com --realm=MYDOMAIN.COM --kdc dc1.mydomain.com --user=admin --password=mypass
|
43
|
+
```
|
44
|
+
|
45
|
+
### Remove
|
46
|
+
|
47
|
+
```
|
48
|
+
corineus remove -k, --kdc=Kerberos KDC -n, --name=Record to be removed -p, --password=Authorized password -r, --realm=Kerberos realm -s, --server=DNS server -u, --user=Authorized username
|
49
|
+
|
50
|
+
Options:
|
51
|
+
-n, --name=Record to be removed
|
52
|
+
-s, --server=DNS server
|
53
|
+
-r, --realm=Kerberos realm
|
54
|
+
-k, --kdc=Kerberos KDC
|
55
|
+
-u, --user=Authorized username
|
56
|
+
-p, --password=Authorized password
|
57
|
+
-v, [--verbose=Verbose output], [--no-verbose]
|
58
|
+
|
59
|
+
Description:
|
60
|
+
`corineus remove` will remove a DNS record from a server, authenticating via Kerberos.
|
61
|
+
|
62
|
+
> $ corineus remove --name=www.mydomain.com --server=dns1.mydomain.com --realm=MYDOMAIN.COM --kdc dc1.mydomain.com --user=admin --password=mypass
|
63
|
+
```
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/harbottle/corineus.
|
68
|
+
|
69
|
+
|
70
|
+
## License
|
71
|
+
|
72
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/corineus
ADDED
data/corineus.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'corineus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "corineus"
|
8
|
+
spec.version = Corineus::VERSION
|
9
|
+
spec.authors = ["Richard Grainger"]
|
10
|
+
spec.email = ["grainger@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "corineus - update DNS records on remote Windows " \
|
13
|
+
"servers from Linux"
|
14
|
+
spec.description = "Corineus is a wrapper for the kinit and nsupdate " \
|
15
|
+
"commands to allow easy authenticated updates of DNS records on a " \
|
16
|
+
"Microsoft Windows DNS server from Linux."
|
17
|
+
spec.homepage = "https://gitlab.com/harbottle/corineus"
|
18
|
+
spec.license = "MIT"
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
spec.bindir = "bin"
|
22
|
+
spec.executables << "corineus"
|
23
|
+
spec.require_paths << "lib"
|
24
|
+
|
25
|
+
spec.add_dependency("colorize", ">=0.8.1")
|
26
|
+
spec.add_dependency("POpen4", ">=0.1.4")
|
27
|
+
spec.add_dependency("thor", ">=0.19.1")
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
32
|
+
end
|
data/lib/corineus.rb
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
require "corineus/version"
|
2
|
+
require 'thor'
|
3
|
+
require 'tempfile'
|
4
|
+
require 'popen4'
|
5
|
+
require 'colorize'
|
6
|
+
|
7
|
+
class String
|
8
|
+
def unindent
|
9
|
+
gsub(/^#{scan(/^\s*/).min_by{|l|l.length}}/, "")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class CORINEUS < Thor
|
14
|
+
|
15
|
+
class_option :verbose, :banner => 'Verbose output', :type => :boolean, :default => false, :aliases => '-v'
|
16
|
+
|
17
|
+
desc "add", "Add a DNS record"
|
18
|
+
long_desc <<-LONGDESC
|
19
|
+
`corineus add` will add a DNS record to a server, authenticating via
|
20
|
+
Kerberos.
|
21
|
+
|
22
|
+
> $ corineus add --name=www.mydomain.com --data=server1.mydomain.com
|
23
|
+
--type=CNAME --server=dns1.mydomain.com --realm=MYDOMAIN.COM
|
24
|
+
--kdc dc1.mydomain.com --user=admin --password=mypass
|
25
|
+
LONGDESC
|
26
|
+
option :name, :banner => 'Record to be added', :required => true, :aliases => '-n'
|
27
|
+
option :data, :banner => 'Data for the record', :required => true, :aliases => '-d'
|
28
|
+
option :type, :banner => 'Type of record', :default => 'A', :aliases => '-t'
|
29
|
+
option :ttl, :banner => 'Time To Live', :default => '86400', :aliases => '-l'
|
30
|
+
option :server, :banner => 'DNS server', :required => true, :aliases => '-s'
|
31
|
+
option :realm, :banner => 'Kerberos realm', :required => true, :aliases => '-r'
|
32
|
+
option :kdc, :banner => 'Kerberos KDC', :required => true, :aliases => '-k'
|
33
|
+
option :user, :banner => 'Authorized username', :required => true, :aliases => '-u'
|
34
|
+
option :password, :banner => 'Authorized password ', :required => true, :aliases => '-p'
|
35
|
+
|
36
|
+
def add()
|
37
|
+
update 'add'
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "remove", "Remove a DNS record"
|
41
|
+
long_desc <<-LONGDESC
|
42
|
+
`corineus remove` will remove a DNS record from a server, authenticating via
|
43
|
+
Kerberos.
|
44
|
+
|
45
|
+
> $ corineus remove --name=www.mydomain.com --server=dns1.mydomain.com
|
46
|
+
--realm=MYDOMAIN.COM --kdc dc1.mydomain.com --user=admin --password=mypass
|
47
|
+
LONGDESC
|
48
|
+
option :name, :banner => 'Record to be removed', :required => true, :aliases => '-n'
|
49
|
+
option :server, :banner => 'DNS server', :required => true, :aliases => '-s'
|
50
|
+
option :realm, :banner => 'Kerberos realm', :required => true, :aliases => '-r'
|
51
|
+
option :kdc, :banner => 'Kerberos KDC', :required => true, :aliases => '-k'
|
52
|
+
option :user, :banner => 'Authorized username', :required => true, :aliases => '-u'
|
53
|
+
option :password, :banner => 'Authorized password ', :required => true, :aliases => '-p'
|
54
|
+
|
55
|
+
def remove()
|
56
|
+
update 'delete'
|
57
|
+
end
|
58
|
+
|
59
|
+
no_commands do
|
60
|
+
def update(action='add')
|
61
|
+
|
62
|
+
k_conf = <<-KRBCONF.unindent
|
63
|
+
[realms]
|
64
|
+
#{options[:realm]} = {
|
65
|
+
kdc = #{options[:kdc]}
|
66
|
+
default_domain = #{options[:realm]}
|
67
|
+
}
|
68
|
+
KRBCONF
|
69
|
+
|
70
|
+
ns_input = <<-NSINPUT.unindent
|
71
|
+
server #{options[:server]}
|
72
|
+
update #{action} #{options[:name]} #{options[:ttl]} #{options[:type]} #{options[:data]}
|
73
|
+
send
|
74
|
+
quit
|
75
|
+
NSINPUT
|
76
|
+
|
77
|
+
pad_length = 50
|
78
|
+
k_file = Tempfile.new('krb5')
|
79
|
+
k_file.write(k_conf)
|
80
|
+
k_file.rewind
|
81
|
+
|
82
|
+
commands = {
|
83
|
+
"Kerberos" => {
|
84
|
+
:desc => 'Get Kerberos ticket',
|
85
|
+
:command => "env KRB5_CONFIG=#{k_file.path} kinit #{options[:user]}@#{options[:realm]}",
|
86
|
+
:input => "#{options[:password]}",
|
87
|
+
:exit => 1,
|
88
|
+
:clue => 'Do you have the kinit command installed and in your PATH?'
|
89
|
+
},
|
90
|
+
"nsupdate" => {
|
91
|
+
:desc => "#{action.capitalize} DNS record",
|
92
|
+
:command => "env KRB5_CONFIG=#{k_file.path} nsupdate -g",
|
93
|
+
:input => ns_input,
|
94
|
+
:exit => 2,
|
95
|
+
:clue => 'Do you have the nsupdate command installed and in your PATH?'
|
96
|
+
}
|
97
|
+
}
|
98
|
+
commands.each do |task, details|
|
99
|
+
outputs = ''
|
100
|
+
errors = ''
|
101
|
+
print "#{details[:desc]}...".ljust(pad_length, padstr='.') if options[:verbose]
|
102
|
+
command_status = POpen4::popen4(details[:command]) do |stdout, stderr, stdin|
|
103
|
+
stdin.puts details[:input]
|
104
|
+
stdout.each do |line|
|
105
|
+
outputs << "#{line.strip}\n"
|
106
|
+
end
|
107
|
+
stderr.each do |line|
|
108
|
+
errors << "#{line.strip}\n"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
if command_status.exitstatus == 0
|
112
|
+
print "Success.\n".green if options[:verbose]
|
113
|
+
else
|
114
|
+
if options[:verbose]
|
115
|
+
print "Failure:\n".red
|
116
|
+
print "#{outputs.strip}\n".red
|
117
|
+
print "#{errors.strip}\n".red
|
118
|
+
print "#{details[:clue]}\n".light_blue
|
119
|
+
end
|
120
|
+
exit details[:exit]
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
k_file.close
|
125
|
+
k_file.unlink
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: corineus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Grainger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: POpen4
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '5.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.0'
|
97
|
+
description: Corineus is a wrapper for the kinit and nsupdate commands to allow easy
|
98
|
+
authenticated updates of DNS records on a Microsoft Windows DNS server from Linux.
|
99
|
+
email:
|
100
|
+
- grainger@gmail.com
|
101
|
+
executables:
|
102
|
+
- corineus
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- .gitignore
|
107
|
+
- .travis.yml
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/corineus
|
113
|
+
- corineus.gemspec
|
114
|
+
- lib/corineus.rb
|
115
|
+
- lib/corineus/version.rb
|
116
|
+
homepage: https://gitlab.com/harbottle/corineus
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 2.0.14
|
138
|
+
signing_key:
|
139
|
+
specification_version: 4
|
140
|
+
summary: corineus - update DNS records on remote Windows servers from Linux
|
141
|
+
test_files: []
|