simp-cli 1.0.12 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +1 -4
- data/lib/simp/cli.rb +1 -1
- data/lib/simp/cli/commands/bootstrap.rb +2 -2
- data/lib/simp/cli/config/item/certificates.rb +1 -1
- data/lib/simp/cli/config/item/common_runlevel_default.rb +1 -1
- data/lib/simp/cli/config/item/network_conf.rb +1 -1
- data/lib/simp/cli/config/item/sssd_domains.rb +35 -0
- data/lib/simp/cli/config/item_list_factory.rb +6 -1
- data/spec/lib/simp/cli/config/item/sssd_domains_spec.rb +48 -0
- metadata +46 -62
- data/lib/simp/cli/commands/check.rb +0 -163
- data/lib/simp/simp.rb +0 -77
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YTUyY2E3M2JmNDYwNTMwMDU0MmVkZmUwMzk5NjBhZjQ3MjI1ZDYzNA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c00f1a66b228c83d906fc95be29996b521bb4bc2
|
4
|
+
data.tar.gz: 288f511795f8e390be8299c28bde9cf86650d8a9
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZTlhNTJkOTU4ZDFiMTQ3YjcwMDZlMTQyZjRlY2ZhZWE5YmJmMmE3ZTVhOWNi
|
11
|
-
ZTVmYmY4ZThmYjdkZjc4Yjc4M2ZlMDVkOWNkYWUzOGNjZTI0YWQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OWIxODU0MGNjYjVlMWY1Nzk3YjVlMjA1Y2UxZWRlZGM1OWQ0MzdmZGFjZWU0
|
14
|
-
ZTFkMzQ1ODIxYmI2NzBhNWY4M2VhN2UxMjAzZjAwNzlhMWYwOTA3ZjY4MDZk
|
15
|
-
YjQ5Njg3ZWQzOGI2NmQ4N2MzYjUxOTFjNzE5NjkxZjdiNTUxYTM=
|
6
|
+
metadata.gz: 3e3d45b70867323215dd05c5c2b43325c55976f63b7bf039876ed86356eb92eccadf7e66c79cc7b8a0d4cebe71090fad79b8998a483c6ac2635def9785064e71
|
7
|
+
data.tar.gz: 791d38e9d4bca5aa79e3426f39eee29e2aa48a1be50d98c61a74e67accdbf358e91b8c7dc89d31057656cb0dee56c9f3bfcb33ced90aea49e18937ccd0077030
|
data/README.md
CHANGED
@@ -30,11 +30,8 @@ Displays SIMP documentation in elinks.
|
|
30
30
|
Controls user passwords.
|
31
31
|
|
32
32
|
#### Recently deprecated
|
33
|
-
##### `check` _(removed)_
|
34
|
-
Validates various subsystems
|
35
|
-
|
36
33
|
##### `cleancerts` _(deprecated - use `puppet cert clean CERTNAME` instead)_
|
37
|
-
Revokes and
|
34
|
+
Revokes and removes Puppet certificates from a list of hosts.
|
38
35
|
|
39
36
|
##### `runpuppet`_(deprecated - use [mcollective](http://puppetlabs.com/mcollective) instead._
|
40
37
|
Runs puppet on a list of hosts.
|
data/lib/simp/cli.rb
CHANGED
@@ -143,7 +143,7 @@ class Simp::Cli::Commands::Bootstrap < Simp::Cli
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
FileUtils.ln_s('simp','production')
|
146
|
+
FileUtils.ln_s('simp','production') unless File.exist?('production')
|
147
147
|
end
|
148
148
|
|
149
149
|
linecounts = Array.new
|
@@ -234,7 +234,7 @@ class Simp::Cli::Commands::Bootstrap < Simp::Cli
|
|
234
234
|
# At this point, we should be connected to LDAP properly.
|
235
235
|
# Run puppet up to 3 additional times if we can't verify that we're actually connected!
|
236
236
|
j = 0
|
237
|
-
while (j < 3) && !system('getent group administrators') do
|
237
|
+
while (j < 3) && !system('getent group administrators >& /dev/null') do
|
238
238
|
track_output("#{pupcmd}")
|
239
239
|
j = j + 1
|
240
240
|
end
|
@@ -27,7 +27,7 @@ module Simp::Cli::Config
|
|
27
27
|
|
28
28
|
if !(
|
29
29
|
File.exist?("#{@dirs[:keydist]}/#{hostname}/#{hostname}.pub") &&
|
30
|
-
File.exist?("#{@dirs[:
|
30
|
+
File.exist?("#{@dirs[:keydist]}/#{hostname}/#{hostname}.pem")
|
31
31
|
)
|
32
32
|
say_green "INFO: No certificates were found for '#{hostname}, generating..." if !@silent
|
33
33
|
Simp::Cli::Config::Utils.generate_certificates([hostname], @dirs[:fake_ca])
|
@@ -40,7 +40,7 @@ module Simp::Cli::Config
|
|
40
40
|
cmd += %Q@ipaddr => '#{ipaddress}', @
|
41
41
|
cmd += %Q@netmask => '#{netmask}', @
|
42
42
|
cmd += %Q@gateway => '#{gateway}' } @
|
43
|
-
cmd += %Q@class{ '
|
43
|
+
cmd += %Q@class{ 'simplib::resolv': @
|
44
44
|
cmd += %Q@resolv_domain => '#{resolv_domain}', @
|
45
45
|
cmd += %Q@nameservers => #{ format_puppet_array( dns_servers ) }, @
|
46
46
|
cmd += %Q@search => #{ format_puppet_array( dns_search ) }, @
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
require 'puppet'
|
3
|
+
require File.expand_path( '../item', File.dirname(__FILE__) )
|
4
|
+
require File.expand_path( '../utils', File.dirname(__FILE__) )
|
5
|
+
|
6
|
+
module Simp; end
|
7
|
+
class Simp::Cli; end
|
8
|
+
module Simp::Cli::Config
|
9
|
+
class Item::SssdDomains < ListItem
|
10
|
+
def initialize
|
11
|
+
super
|
12
|
+
@key = 'sssd::domains'
|
13
|
+
@description = %Q{
|
14
|
+
A list of domains for SSSD to use.
|
15
|
+
`simp config` will automativcally populate this field with `FQDN` if
|
16
|
+
`use_fqdn` is true, otherwise it will comment out the field.
|
17
|
+
}.gsub(/^\s+/, '' )
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def validate_item( x )
|
22
|
+
x =~ /[-a-z]/i ? true : false
|
23
|
+
end
|
24
|
+
|
25
|
+
def query_ask
|
26
|
+
use_ldap = @config_items.fetch( 'use_ldap' ).value
|
27
|
+
if use_ldap
|
28
|
+
@value = ['LDAP']
|
29
|
+
else
|
30
|
+
@skip_yaml = true
|
31
|
+
@value = []
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -42,6 +42,10 @@ class Simp::Cli::Config::ItemListFactory
|
|
42
42
|
# - ItemE
|
43
43
|
# - ItemF
|
44
44
|
# - ItemG
|
45
|
+
#
|
46
|
+
# modifers:
|
47
|
+
# USERAPPLY = execute apply() even when running non-privileged
|
48
|
+
# SILENT = set the Item's .silent flag to true
|
45
49
|
---
|
46
50
|
# ==== network ====
|
47
51
|
- UseFips
|
@@ -65,7 +69,7 @@ class Simp::Cli::Config::ItemListFactory
|
|
65
69
|
- Gateway SILENT
|
66
70
|
- DNSServers SILENT
|
67
71
|
- DNSSearch SILENT
|
68
|
-
false: # don't configure network (but
|
72
|
+
false: # don't configure network (but ask for info)
|
69
73
|
- Hostname
|
70
74
|
- IPAddress
|
71
75
|
- Netmask
|
@@ -121,6 +125,7 @@ class Simp::Cli::Config::ItemListFactory
|
|
121
125
|
- LdapUri
|
122
126
|
false:
|
123
127
|
- RemoveLdapFromHiera
|
128
|
+
- SssdDomains
|
124
129
|
|
125
130
|
# ==== rsync ====
|
126
131
|
- RsyncBase
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'simp/cli/config/item/sssd_domains'
|
2
|
+
require 'simp/cli/config/item/use_ldap'
|
3
|
+
require 'rspec/its'
|
4
|
+
require_relative( 'spec_helper' )
|
5
|
+
|
6
|
+
describe Simp::Cli::Config::Item::SssdDomains do
|
7
|
+
before :each do
|
8
|
+
@ci = Simp::Cli::Config::Item::SssdDomains.new
|
9
|
+
@ci.silent = true
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#value" do
|
13
|
+
it "when `use_fqdn` is `true`" do
|
14
|
+
item = Simp::Cli::Config::Item::UseLdap.new
|
15
|
+
item.value = true
|
16
|
+
@ci.config_items[item.key] = item
|
17
|
+
@ci.query
|
18
|
+
expect( @ci.value ).to eq ['LDAP']
|
19
|
+
end
|
20
|
+
|
21
|
+
it "when `use_fqdn` is `false`" do
|
22
|
+
item = Simp::Cli::Config::Item::UseLdap.new
|
23
|
+
item.value = false
|
24
|
+
@ci.config_items[item.key] = item
|
25
|
+
@ci.query
|
26
|
+
expect( @ci.value ).to eq []
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#to_yaml_s" do
|
31
|
+
it "when `use_fqdn` is `true`" do
|
32
|
+
item = Simp::Cli::Config::Item::UseLdap.new
|
33
|
+
item.value = true
|
34
|
+
@ci.config_items[item.key] = item
|
35
|
+
@ci.query
|
36
|
+
expect( @ci.to_yaml_s ).to match( %r{^"?sssd::domains"?} )
|
37
|
+
end
|
38
|
+
|
39
|
+
it "when `use_fqdn` is `false`" do
|
40
|
+
item = Simp::Cli::Config::Item::UseLdap.new
|
41
|
+
item.value = false
|
42
|
+
@ci.config_items[item.key] = item
|
43
|
+
@ci.query
|
44
|
+
expect( @ci.to_yaml_s ).to match( %r{^#(#| )*"?sssd::domains"?} )
|
45
|
+
end
|
46
|
+
end
|
47
|
+
it_behaves_like "a child of Simp::Cli::Config::Item"
|
48
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simp-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Vaughan
|
@@ -13,200 +13,184 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2016-06-24 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: highline
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
|
-
- - ~>
|
22
|
+
- - "~>"
|
23
23
|
- !ruby/object:Gem::Version
|
24
24
|
version: '1.6'
|
25
|
-
- -
|
25
|
+
- - ">"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.6.1
|
28
28
|
type: :runtime
|
29
29
|
prerelease: false
|
30
30
|
version_requirements: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1.6'
|
35
|
-
- -
|
35
|
+
- - ">"
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: 1.6.1
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: puppet
|
40
|
-
requirement: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
42
|
-
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: '3'
|
45
|
-
type: :runtime
|
46
|
-
prerelease: false
|
47
|
-
version_requirements: !ruby/object:Gem::Requirement
|
48
|
-
requirements:
|
49
|
-
- - ~>
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version: '3'
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: facter
|
54
|
-
requirement: !ruby/object:Gem::Requirement
|
55
|
-
requirements:
|
56
|
-
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version: '2'
|
59
|
-
type: :runtime
|
60
|
-
prerelease: false
|
61
|
-
version_requirements: !ruby/object:Gem::Requirement
|
62
|
-
requirements:
|
63
|
-
- - ~>
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: '2'
|
66
38
|
- !ruby/object:Gem::Dependency
|
67
39
|
name: rake
|
68
40
|
requirement: !ruby/object:Gem::Requirement
|
69
41
|
requirements:
|
70
|
-
- - ~>
|
42
|
+
- - "~>"
|
71
43
|
- !ruby/object:Gem::Version
|
72
44
|
version: '10'
|
73
45
|
type: :development
|
74
46
|
prerelease: false
|
75
47
|
version_requirements: !ruby/object:Gem::Requirement
|
76
48
|
requirements:
|
77
|
-
- - ~>
|
49
|
+
- - "~>"
|
78
50
|
- !ruby/object:Gem::Version
|
79
51
|
version: '10'
|
80
52
|
- !ruby/object:Gem::Dependency
|
81
53
|
name: rspec
|
82
54
|
requirement: !ruby/object:Gem::Requirement
|
83
55
|
requirements:
|
84
|
-
- - ~>
|
56
|
+
- - "~>"
|
85
57
|
- !ruby/object:Gem::Version
|
86
58
|
version: '3'
|
87
59
|
type: :development
|
88
60
|
prerelease: false
|
89
61
|
version_requirements: !ruby/object:Gem::Requirement
|
90
62
|
requirements:
|
91
|
-
- - ~>
|
63
|
+
- - "~>"
|
92
64
|
- !ruby/object:Gem::Version
|
93
65
|
version: '3'
|
94
66
|
- !ruby/object:Gem::Dependency
|
95
67
|
name: rspec-its
|
96
68
|
requirement: !ruby/object:Gem::Requirement
|
97
69
|
requirements:
|
98
|
-
- - ~>
|
70
|
+
- - "~>"
|
99
71
|
- !ruby/object:Gem::Version
|
100
72
|
version: '1'
|
101
73
|
type: :development
|
102
74
|
prerelease: false
|
103
75
|
version_requirements: !ruby/object:Gem::Requirement
|
104
76
|
requirements:
|
105
|
-
- - ~>
|
77
|
+
- - "~>"
|
106
78
|
- !ruby/object:Gem::Version
|
107
79
|
version: '1'
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: listen
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - "~>"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 3.0.0
|
87
|
+
type: :development
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 3.0.0
|
108
94
|
- !ruby/object:Gem::Dependency
|
109
95
|
name: guard
|
110
96
|
requirement: !ruby/object:Gem::Requirement
|
111
97
|
requirements:
|
112
|
-
- - ~>
|
98
|
+
- - "~>"
|
113
99
|
- !ruby/object:Gem::Version
|
114
100
|
version: '2'
|
115
101
|
type: :development
|
116
102
|
prerelease: false
|
117
103
|
version_requirements: !ruby/object:Gem::Requirement
|
118
104
|
requirements:
|
119
|
-
- - ~>
|
105
|
+
- - "~>"
|
120
106
|
- !ruby/object:Gem::Version
|
121
107
|
version: '2'
|
122
108
|
- !ruby/object:Gem::Dependency
|
123
109
|
name: guard-shell
|
124
110
|
requirement: !ruby/object:Gem::Requirement
|
125
111
|
requirements:
|
126
|
-
- - ~>
|
112
|
+
- - "~>"
|
127
113
|
- !ruby/object:Gem::Version
|
128
114
|
version: '0'
|
129
115
|
type: :development
|
130
116
|
prerelease: false
|
131
117
|
version_requirements: !ruby/object:Gem::Requirement
|
132
118
|
requirements:
|
133
|
-
- - ~>
|
119
|
+
- - "~>"
|
134
120
|
- !ruby/object:Gem::Version
|
135
121
|
version: '0'
|
136
122
|
- !ruby/object:Gem::Dependency
|
137
123
|
name: guard-rspec
|
138
124
|
requirement: !ruby/object:Gem::Requirement
|
139
125
|
requirements:
|
140
|
-
- - ~>
|
126
|
+
- - "~>"
|
141
127
|
- !ruby/object:Gem::Version
|
142
128
|
version: '4'
|
143
129
|
type: :development
|
144
130
|
prerelease: false
|
145
131
|
version_requirements: !ruby/object:Gem::Requirement
|
146
132
|
requirements:
|
147
|
-
- - ~>
|
133
|
+
- - "~>"
|
148
134
|
- !ruby/object:Gem::Version
|
149
135
|
version: '4'
|
150
136
|
- !ruby/object:Gem::Dependency
|
151
137
|
name: pry
|
152
138
|
requirement: !ruby/object:Gem::Requirement
|
153
139
|
requirements:
|
154
|
-
- - ~>
|
140
|
+
- - "~>"
|
155
141
|
- !ruby/object:Gem::Version
|
156
142
|
version: '0'
|
157
143
|
type: :development
|
158
144
|
prerelease: false
|
159
145
|
version_requirements: !ruby/object:Gem::Requirement
|
160
146
|
requirements:
|
161
|
-
- - ~>
|
147
|
+
- - "~>"
|
162
148
|
- !ruby/object:Gem::Version
|
163
149
|
version: '0'
|
164
150
|
- !ruby/object:Gem::Dependency
|
165
151
|
name: pry-doc
|
166
152
|
requirement: !ruby/object:Gem::Requirement
|
167
153
|
requirements:
|
168
|
-
- - ~>
|
154
|
+
- - "~>"
|
169
155
|
- !ruby/object:Gem::Version
|
170
156
|
version: '0'
|
171
157
|
type: :development
|
172
158
|
prerelease: false
|
173
159
|
version_requirements: !ruby/object:Gem::Requirement
|
174
160
|
requirements:
|
175
|
-
- - ~>
|
161
|
+
- - "~>"
|
176
162
|
- !ruby/object:Gem::Version
|
177
163
|
version: '0'
|
178
164
|
- !ruby/object:Gem::Dependency
|
179
165
|
name: dotenv
|
180
166
|
requirement: !ruby/object:Gem::Requirement
|
181
167
|
requirements:
|
182
|
-
- - ~>
|
168
|
+
- - "~>"
|
183
169
|
- !ruby/object:Gem::Version
|
184
170
|
version: '1'
|
185
171
|
type: :development
|
186
172
|
prerelease: false
|
187
173
|
version_requirements: !ruby/object:Gem::Requirement
|
188
174
|
requirements:
|
189
|
-
- - ~>
|
175
|
+
- - "~>"
|
190
176
|
- !ruby/object:Gem::Version
|
191
177
|
version: '1'
|
192
178
|
- !ruby/object:Gem::Dependency
|
193
179
|
name: rubocop
|
194
180
|
requirement: !ruby/object:Gem::Requirement
|
195
181
|
requirements:
|
196
|
-
- - ~>
|
182
|
+
- - "~>"
|
197
183
|
- !ruby/object:Gem::Version
|
198
184
|
version: '0.29'
|
199
185
|
type: :development
|
200
186
|
prerelease: false
|
201
187
|
version_requirements: !ruby/object:Gem::Requirement
|
202
188
|
requirements:
|
203
|
-
- - ~>
|
189
|
+
- - "~>"
|
204
190
|
- !ruby/object:Gem::Version
|
205
191
|
version: '0.29'
|
206
|
-
description:
|
207
|
-
|
208
|
-
|
209
|
-
'
|
192
|
+
description: |2
|
193
|
+
simp-cli provides the 'simp' command to configure and manage SIMP.
|
210
194
|
email: simp@simp-project.org
|
211
195
|
executables:
|
212
196
|
- simp
|
@@ -219,7 +203,6 @@ files:
|
|
219
203
|
- bin/simp
|
220
204
|
- lib/simp/cli.rb
|
221
205
|
- lib/simp/cli/commands/bootstrap.rb
|
222
|
-
- lib/simp/cli/commands/check.rb
|
223
206
|
- lib/simp/cli/commands/cleancerts.rb
|
224
207
|
- lib/simp/cli/commands/config.rb
|
225
208
|
- lib/simp/cli/commands/doc.rb
|
@@ -276,6 +259,7 @@ files:
|
|
276
259
|
- lib/simp/cli/config/item/rsync_timeout.rb
|
277
260
|
- lib/simp/cli/config/item/set_grub_password.rb
|
278
261
|
- lib/simp/cli/config/item/simp_yum_servers.rb
|
262
|
+
- lib/simp/cli/config/item/sssd_domains.rb
|
279
263
|
- lib/simp/cli/config/item/use_auditd.rb
|
280
264
|
- lib/simp/cli/config/item/use_fips.rb
|
281
265
|
- lib/simp/cli/config/item/use_iptables.rb
|
@@ -286,7 +270,6 @@ files:
|
|
286
270
|
- lib/simp/cli/config/questionnaire.rb
|
287
271
|
- lib/simp/cli/config/utils.rb
|
288
272
|
- lib/simp/cli/lib/utils.rb
|
289
|
-
- lib/simp/simp.rb
|
290
273
|
- spec/lib/simp/cli/commands/config_spec.rb
|
291
274
|
- spec/lib/simp/cli/config/item/add_ldap_to_hiera_spec.rb
|
292
275
|
- spec/lib/simp/cli/config/item/answers_yaml_file_writer_spec.rb
|
@@ -350,6 +333,7 @@ files:
|
|
350
333
|
- spec/lib/simp/cli/config/item/set_grub_password_spec.rb
|
351
334
|
- spec/lib/simp/cli/config/item/simp_yum_servers_spec.rb
|
352
335
|
- spec/lib/simp/cli/config/item/spec_helper.rb
|
336
|
+
- spec/lib/simp/cli/config/item/sssd_domains_spec.rb
|
353
337
|
- spec/lib/simp/cli/config/item/use_auditd_spec.rb
|
354
338
|
- spec/lib/simp/cli/config/item/use_fips_spec.rb
|
355
339
|
- spec/lib/simp/cli/config/item/use_iptables_spec.rb
|
@@ -372,12 +356,12 @@ require_paths:
|
|
372
356
|
- lib
|
373
357
|
required_ruby_version: !ruby/object:Gem::Requirement
|
374
358
|
requirements:
|
375
|
-
- -
|
359
|
+
- - ">="
|
376
360
|
- !ruby/object:Gem::Version
|
377
361
|
version: '0'
|
378
362
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
379
363
|
requirements:
|
380
|
-
- -
|
364
|
+
- - ">="
|
381
365
|
- !ruby/object:Gem::Version
|
382
366
|
version: '0'
|
383
367
|
requirements:
|
@@ -1,163 +0,0 @@
|
|
1
|
-
module Simp::Cli::Commands; end
|
2
|
-
|
3
|
-
class Simp::Cli::Commands::Check < Simp::Cli
|
4
|
-
@opt_parser = OptionParser.new do |opts|
|
5
|
-
opts.banner = "*Options*"
|
6
|
-
|
7
|
-
opts.on("-A", "--all", "Run all checks, equivalent to -nkl") do
|
8
|
-
@check_network = true
|
9
|
-
@check_keys = true
|
10
|
-
@check_ldap = true
|
11
|
-
end
|
12
|
-
|
13
|
-
opts.on("-p", "--pre", "Run checks that should pass before first run, equivalent to -nk") do
|
14
|
-
@check_network = true
|
15
|
-
@check_keys = true
|
16
|
-
end
|
17
|
-
|
18
|
-
opts.on("-n", "--network", "Check network items") do
|
19
|
-
@check_network = true
|
20
|
-
end
|
21
|
-
|
22
|
-
opts.on("-k", "--keys", "Check that keys have been generated for the host") do
|
23
|
-
@check_keys = true
|
24
|
-
end
|
25
|
-
|
26
|
-
opts.on("-l", "--ldap", "Check validity of ldap passwords") do
|
27
|
-
@check_ldap = true
|
28
|
-
end
|
29
|
-
|
30
|
-
opts.on("-v", "--verbose", "Run verbosely") do
|
31
|
-
@verbose = true
|
32
|
-
end
|
33
|
-
|
34
|
-
opts.on("-r", "--report FILE", "Create a report in FILE. NOTE: if FILE exists, it will be overwritten!") do |file|
|
35
|
-
@report_file = file
|
36
|
-
end
|
37
|
-
|
38
|
-
opts.on("-h", "--help", "Print this message") do
|
39
|
-
puts opts
|
40
|
-
exit
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.run(args)
|
45
|
-
raise "simp check Requires Arguments" if args.empty?
|
46
|
-
|
47
|
-
super
|
48
|
-
|
49
|
-
@version = Simp.version
|
50
|
-
|
51
|
-
report = []
|
52
|
-
|
53
|
-
system('clear')
|
54
|
-
|
55
|
-
if @check_network
|
56
|
-
report.push "\n***Starting Network Check***\n"
|
57
|
-
|
58
|
-
hostname = `hostname`.gsub!(/\s+/, '')
|
59
|
-
|
60
|
-
begin
|
61
|
-
network_hostname = `grep HOSTNAME /etc/sysconfig/network`.strip.match(/HOSTNAME\s*=\s*([^ ]*)/)[1]
|
62
|
-
rescue
|
63
|
-
report.push "ERROR: No hostname in /etc/sysconfig/network"
|
64
|
-
end
|
65
|
-
|
66
|
-
if hostname == network_hostname
|
67
|
-
report.push "Hostname matches hostname in /etc/sysconfig/network"
|
68
|
-
else
|
69
|
-
report.push "ERROR: Hostname does not match hostname in /etc/sysconfig/network"
|
70
|
-
end
|
71
|
-
|
72
|
-
if `grep ^127.0.0.1 /etc/hosts`.split("\n").any? { |line| line =~ /localhost.localdomain[\s+\z]/ and line =~ /localhost[\s+\z]/ }
|
73
|
-
report.push "Found valid entry for 127.0.0.1 in /etc/hosts"
|
74
|
-
else
|
75
|
-
report.push "ERROR: Did not find valid entry for 127.0.0.1 in /etc/hosts"
|
76
|
-
end
|
77
|
-
|
78
|
-
if `grep ^::1 /etc/hosts`.split("\n").any? { |line| line =~ /localhost6\.localdomain6(\s+|$)/ and line =~ /localhost6(\s+|$)/ }
|
79
|
-
report.push "Found valid entry for ::1 in /etc/hosts"
|
80
|
-
else
|
81
|
-
report.push "ERROR: Did not find valid entry for ::1 in /etc/hosts"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
if @check_keys
|
86
|
-
report.push "\n***Starting Keys Check***\n"
|
87
|
-
|
88
|
-
key_count = 0
|
89
|
-
valid_key_count = 0
|
90
|
-
|
91
|
-
Dir.foreach("/etc/puppet/keydist") do |host|
|
92
|
-
if (host !~ /\A\.+\z/) and (host !~ /\Acacerts\z/) and File::directory?("/etc/puppet/keydist/#{host}")
|
93
|
-
Dir.foreach("/etc/puppet/keydist/#{host}") do |key|
|
94
|
-
if key =~ /\.pem\z/ or key =~ /\.pub\z/
|
95
|
-
key_count += 1
|
96
|
-
|
97
|
-
if `openssl verify -CApath /etc/puppet/keydist/cacerts /etc/puppet/keydist/#{host}/#{key}`.strip =~ /\s+OK\z/
|
98
|
-
valid_key_count += 1
|
99
|
-
report.push "Key /etc/puppet/keydist/#{host}/#{key} validated\n"
|
100
|
-
else
|
101
|
-
report.push "ERROR: Key /etc/puppet/keydist/#{host}/#{key} did not validate\n"
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
if key_count == 0
|
109
|
-
report.push "ERROR: No keys found (recursively) in /etc/puppet/keydist\n"
|
110
|
-
else
|
111
|
-
report.push "#{valid_key_count}/#{key_count} keys validated\n"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
if @check_ldap
|
116
|
-
report.push "\n***Starting Ldap Check***\n"
|
117
|
-
|
118
|
-
binddn = ""
|
119
|
-
bindpw = ""
|
120
|
-
host = ""
|
121
|
-
base = ""
|
122
|
-
|
123
|
-
ldap_conf = '/etc/ldap.conf'
|
124
|
-
ldap_conf = '/etc/pam_ldap.conf' unless File.file?(ldap_conf)
|
125
|
-
|
126
|
-
File.open(ldap_conf).each_line do |line|
|
127
|
-
if (line =~ /\Abinddn\s+/) != nil
|
128
|
-
binddn = line.gsub(/\Abinddn\s+/, "").chomp
|
129
|
-
elsif (line =~ /\Abindpw\s+/) != nil
|
130
|
-
bindpw = line.gsub(/\Abindpw\s+/, "").chomp
|
131
|
-
elsif (line =~ /\Auri\s+/) != nil
|
132
|
-
host = line.gsub(/\Auri\s+/, "").chomp
|
133
|
-
elsif (line =~ /\Anss_base_passwd\s+/) != nil
|
134
|
-
base = line.gsub(/\Anss_base_passwd\s+/, "").chomp.gsub(/\?.*/, "")
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
exit_code = `ldapsearch -Z -LLLL -D "#{binddn}" -x -w "#{bindpw}" -H "#{host}" -b "#{base}" -s one uid sshPublidKey`.to_i
|
139
|
-
|
140
|
-
if exit_code == 0
|
141
|
-
report.push "Ldap appears to be working\n"
|
142
|
-
else
|
143
|
-
report.push "ERROR: Ldap does not appear to be working; ldapsearch exited with code #{exit_code}\n"
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
report = report.select { |line| line =~ /\A(\*\*\*|WARNING|ERROR)/ } unless @verbose
|
148
|
-
|
149
|
-
report = report.join("\n")
|
150
|
-
|
151
|
-
unless @report_file.nil?
|
152
|
-
begin
|
153
|
-
f = File.open(File.expand_path(@report_file), 'w')
|
154
|
-
f.puts report
|
155
|
-
f.close
|
156
|
-
rescue
|
157
|
-
raise "An error occurred while writing the report:#{$!}"
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
puts report
|
162
|
-
end
|
163
|
-
end
|
data/lib/simp/simp.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
class Simp
|
3
|
-
current_dir = File.dirname(File.expand_path(__FILE__)) + '/simp'
|
4
|
-
|
5
|
-
require 'optparse'
|
6
|
-
require current_dir + '/lib/utils'
|
7
|
-
|
8
|
-
protected
|
9
|
-
def self.menu
|
10
|
-
puts "Usage: simp [command]"
|
11
|
-
puts
|
12
|
-
puts " Commands"
|
13
|
-
@commands.each do |command_name, command_class|
|
14
|
-
puts " - " + command_name
|
15
|
-
end
|
16
|
-
puts " - help [command]"
|
17
|
-
puts
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.help
|
21
|
-
puts @opt_parser.to_s
|
22
|
-
puts
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.run(args = [])
|
26
|
-
@opt_parser.parse!
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
def self.version
|
31
|
-
begin
|
32
|
-
%x{rpm -q simp}.split(/\n/).last.match(/([0-9]+\.[0-9]+\.?[0-9]*)/)[1]
|
33
|
-
rescue
|
34
|
-
#raise "Simp is not installed!"
|
35
|
-
'4.1'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# load the commands from commands/*.rb and grab the classes that are simp commands
|
40
|
-
Dir.glob(current_dir + '/commands/*.rb').sort_by(&:to_s).each do |command_file|
|
41
|
-
require command_file
|
42
|
-
end
|
43
|
-
|
44
|
-
@commands = Simp::Commands::constants.inject({}) do |commands, constant|
|
45
|
-
obj = Simp::Commands.const_get(constant)
|
46
|
-
if obj.respond_to?(:superclass) and obj.superclass == Simp
|
47
|
-
commands[constant.to_s.downcase] = obj
|
48
|
-
end
|
49
|
-
commands
|
50
|
-
end
|
51
|
-
@commands['version'] = self
|
52
|
-
|
53
|
-
if ARGV.length == 0 or (ARGV.length == 1 and ARGV[0] == 'help')
|
54
|
-
menu
|
55
|
-
elsif ARGV[0] == 'version'
|
56
|
-
puts version
|
57
|
-
elsif ARGV[0] == 'help'
|
58
|
-
if (command = @commands[ARGV[1]]).nil?
|
59
|
-
puts "\n\033[31m#{ARGV[1]} is not a recognized command\033[39m\n\n"
|
60
|
-
menu
|
61
|
-
elsif ARGV[1] == 'version'
|
62
|
-
puts "Display the current version of SIMP."
|
63
|
-
else
|
64
|
-
command.help
|
65
|
-
end
|
66
|
-
elsif (command = @commands[ARGV[0]]).nil?
|
67
|
-
puts "\n\033[31m#{ARGV[0]} is not a recognized command\033[39m\n\n"
|
68
|
-
menu
|
69
|
-
else
|
70
|
-
begin
|
71
|
-
command.run(ARGV.drop(1))
|
72
|
-
rescue => e
|
73
|
-
puts "\n\033[31m#{e.message}\033[39m\n\n"
|
74
|
-
e.backtrace.first(10).each{|l| puts l }
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|