puppet-lint-security-plugins 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +90 -0
  4. data/lib/puppet-lint-security-plugins.rb +2 -0
  5. data/lib/puppet-lint/plugins/check_class_or_define_parameter_in_exec.rb +36 -0
  6. data/lib/puppet-lint/plugins/check_security_apache_bad_cipher.rb +28 -0
  7. data/lib/puppet-lint/plugins/check_security_apache_no_ssl_vhost.rb +27 -0
  8. data/lib/puppet-lint/plugins/check_security_apt_no_key.rb +26 -0
  9. data/lib/puppet-lint/plugins/check_security_eval_in_erb.rb +21 -0
  10. data/lib/puppet-lint/plugins/check_security_file_with_setgid_permission.rb +25 -0
  11. data/lib/puppet-lint/plugins/check_security_file_with_setuid_permission.rb +25 -0
  12. data/lib/puppet-lint/plugins/check_security_file_with_world_permissions.rb +25 -0
  13. data/lib/puppet-lint/plugins/check_security_firewall_any_any_allow.rb +26 -0
  14. data/lib/puppet-lint/plugins/check_security_firewall_any_any_deny.rb +27 -0
  15. data/lib/puppet-lint/plugins/check_security_firewall_dns_used.rb +30 -0
  16. data/lib/puppet-lint/plugins/check_security_firewall_puppetmaster_any_deny.rb +33 -0
  17. data/lib/puppet-lint/plugins/check_security_package_pinned_version.rb +25 -0
  18. data/lib/puppet-lint/plugins/check_security_password_in_code.rb +31 -0
  19. data/lib/puppet-lint/plugins/check_security_password_variable_in_exec.rb +22 -0
  20. data/lib/puppet-lint/plugins/check_security_regex_unspecific.rb +23 -0
  21. data/lib/puppet-lint/plugins/check_security_service_mysql_disabled.rb +22 -0
  22. data/lib/puppet-lint/plugins/check_security_service_puppetmaster_disabled.rb +24 -0
  23. data/lib/puppet-lint/plugins/check_security_ssh_root_allowed.rb +26 -0
  24. data/lib/puppet-lint/plugins/check_security_sudo_with_world_nopasswd.rb +23 -0
  25. data/lib/puppet-lint/plugins/check_security_tidy_all_files.rb +20 -0
  26. data/lib/puppet-lint/plugins/check_security_tidy_matches_greedy.rb +27 -0
  27. data/lib/puppet-lint/plugins/check_security_tidy_recurse.rb +21 -0
  28. data/lib/puppet-lint/plugins/check_security_user_with_id_0_created.rb +28 -0
  29. data/lib/puppet-lint/security.rb +280 -0
  30. data/spec/puppet-lint/plugins/check_class_or_define_parameter_in_exec_spec.rb +85 -0
  31. data/spec/puppet-lint/plugins/check_security_apache_bad_cipher_spec.rb +49 -0
  32. data/spec/puppet-lint/plugins/check_security_apache_no_ssl_vhost_spec.rb +40 -0
  33. data/spec/puppet-lint/plugins/check_security_apt_absent_no_key_spec.rb +45 -0
  34. data/spec/puppet-lint/plugins/check_security_apt_no_key_spec.rb +38 -0
  35. data/spec/puppet-lint/plugins/check_security_dir_guid_permissions_spec.rb +49 -0
  36. data/spec/puppet-lint/plugins/check_security_dir_world_permissions_spec.rb +39 -0
  37. data/spec/puppet-lint/plugins/check_security_eval_in_erb_spec.rb +35 -0
  38. data/spec/puppet-lint/plugins/check_security_file_suid_permissions_spec.rb +48 -0
  39. data/spec/puppet-lint/plugins/check_security_file_with_setgid_permission_spec.rb +59 -0
  40. data/spec/puppet-lint/plugins/check_security_file_with_setuid_permission_spec.rb +59 -0
  41. data/spec/puppet-lint/plugins/check_security_file_with_world_permissions_spec.rb +62 -0
  42. data/spec/puppet-lint/plugins/check_security_file_world_and_guid_permissions_spec.rb +43 -0
  43. data/spec/puppet-lint/plugins/check_security_firewall_any_any_allow_spec.rb +36 -0
  44. data/spec/puppet-lint/plugins/check_security_firewall_any_any_deny_spec.rb +124 -0
  45. data/spec/puppet-lint/plugins/check_security_firewall_dns_used_spec.rb +77 -0
  46. data/spec/puppet-lint/plugins/check_security_firewall_puppetmaster_any_deny_spec.rb +60 -0
  47. data/spec/puppet-lint/plugins/check_security_package_pinned_version_spec.rb +43 -0
  48. data/spec/puppet-lint/plugins/check_security_password_in_code_spec.rb +55 -0
  49. data/spec/puppet-lint/plugins/check_security_password_variable_in_exec_spec.rb +45 -0
  50. data/spec/puppet-lint/plugins/check_security_regex_unspecific_spec.rb +40 -0
  51. data/spec/puppet-lint/plugins/check_security_service_mysql_disabled_spec.rb +54 -0
  52. data/spec/puppet-lint/plugins/check_security_service_puppetmaster_disabled_spec.rb +40 -0
  53. data/spec/puppet-lint/plugins/check_security_ssh_root_allowed_spec.rb +60 -0
  54. data/spec/puppet-lint/plugins/check_security_ssh_server_root_allowed_spec.rb +60 -0
  55. data/spec/puppet-lint/plugins/check_security_sudo_with_world_nopasswd_spec.rb +40 -0
  56. data/spec/puppet-lint/plugins/check_security_tidy_all_files_spec.rb +36 -0
  57. data/spec/puppet-lint/plugins/check_security_tidy_matches_greedy_spec.rb +37 -0
  58. data/spec/puppet-lint/plugins/check_security_tidy_recurse_spec.rb +37 -0
  59. data/spec/puppet-lint/plugins/check_security_user_with_id_0_created_spec.rb +47 -0
  60. data/spec/spec_helper.rb +5 -0
  61. metadata +232 -0
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'security_tidy_all_files' do
4
+ let(:msg) { 'Purging all files, be warned!' }
5
+
6
+ context 'with fix disabled' do
7
+ context 'code having unspecific tidy' do
8
+ let(:code) { "
9
+ tidy { '/usr/local':
10
+ }
11
+ " }
12
+
13
+ it 'should detect a single problem' do
14
+ expect(problems).to have(1).problem
15
+ end
16
+
17
+ it 'should create a warning' do
18
+ expect(problems).to contain_warning(msg).on_line(2).in_column(21)
19
+ end
20
+ end
21
+
22
+ context 'code having specific tidy' do
23
+ let(:code) { "
24
+ tidy { '/tmp':
25
+ age => '1w',
26
+ matches => [ '[0-9]pub*.tmp', '*.temp', 'tmpfile?' ]
27
+ }
28
+ " }
29
+
30
+ it 'should not detect any problems' do
31
+ expect(problems).to have(0).problems
32
+ end
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'security_tidy_matches_greedy' do
4
+ let(:msg) { 'This will delete all files, be warned!' }
5
+
6
+ context 'with fix disabled' do
7
+ context 'code having greedy tidy' do
8
+ let(:code) { "
9
+ tidy { '/usr/local':
10
+ matches => [ '[0-9]pub*.tmp', '*', '*.temp', 'tmpfile?' ]
11
+ }
12
+ " }
13
+
14
+ it 'should detect a single problem' do
15
+ expect(problems).to have(1).problem
16
+ end
17
+
18
+ it 'should create a warning' do
19
+ expect(problems).to contain_warning(msg).on_line(3).in_column(33)
20
+ end
21
+ end
22
+
23
+ context 'code having no greedy tidy' do
24
+ let(:code) { "
25
+ tidy { '/tmp':
26
+ age => '1w',
27
+ matches => [ '[0-9]pub*.tmp', '*.temp', 'tmpfile?' ]
28
+ }
29
+ " }
30
+
31
+ it 'should not detect any problems' do
32
+ expect(problems).to have(0).problems
33
+ end
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'security_tidy_recurse' do
4
+ let(:msg) { 'Purging files recurse, be warned!' }
5
+
6
+ context 'with fix disabled' do
7
+ context 'code having recurse purging tidy' do
8
+ let(:code) { "
9
+ tidy { '/usr/local':
10
+ recurse => true,
11
+ }
12
+ " }
13
+
14
+ it 'should detect a single problem' do
15
+ expect(problems).to have(1).problem
16
+ end
17
+
18
+ it 'should create a warning' do
19
+ expect(problems).to contain_warning(msg).on_line(3).in_column(14)
20
+ end
21
+ end
22
+
23
+ context 'code having no recurse purging tidy' do
24
+ let(:code) { "
25
+ tidy { '/tmp':
26
+ age => '1w',
27
+ matches => [ '[0-9]pub*.tmp', '*.temp', 'tmpfile?' ]
28
+ }
29
+ " }
30
+
31
+ it 'should not detect any problems' do
32
+ expect(problems).to have(0).problems
33
+ end
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'security_user_with_id_0_created' do
4
+ let(:msg) { 'Another User with ID 0 would be created (security!)' }
5
+
6
+ context 'with fix disabled' do
7
+ context 'code having user with id 0 created' do
8
+ let(:code) { "
9
+
10
+ user {'myroot':
11
+ ensure => present,
12
+ managehome => true,
13
+ allowdupe => true,
14
+ shell => '/bin/bash',
15
+ password => '$6$vvj6dlOH$ORJ0dok0GJIbuTMAexlSsxOHMBmtz1qCioS3xB4f3ap5azQdZjqRLzHpJhCNjAVsW3E3GtZwcnHJu/baLjhr3.',
16
+ uid => 0,
17
+ }
18
+
19
+ " }
20
+
21
+ it 'should detect a single problem' do
22
+ expect(problems).to have(1).problem
23
+ end
24
+
25
+ it 'should create a error' do
26
+ expect(problems).to contain_error(msg).on_line(3).in_column(16)
27
+ end
28
+ end
29
+
30
+ context 'code having no user with id 0 created' do
31
+ let(:code) { "
32
+ user {'myroot':
33
+ ensure => present,
34
+ managehome => true,
35
+ shell => '/bin/bash',
36
+ password => '$6$vvj6dlOH$ORJ0dok0GJIbuTMAexlSsxOHMBmtz1qCioS3xB4f3ap5azQdZjqRLzHpJhCNjAVsW3E3GtZwcnHJu/baLjhr3.',
37
+ }
38
+
39
+ " }
40
+
41
+ it 'should not detect any problems' do
42
+ expect(problems).to have(0).problems
43
+ end
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,5 @@
1
+ require 'bundler/setup'
2
+ require 'puppet-lint'
3
+ require 'puppet-lint-security-plugins'
4
+
5
+ PuppetLint::Plugins.load_spec_helper
metadata ADDED
@@ -0,0 +1,232 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: puppet-lint-security-plugins
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
5
+ platform: ruby
6
+ authors:
7
+ - Florian Freund
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: puppet-lint
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-its
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-collection_matchers
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mail
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: " Checks puppet manifests for security related problems.\n"
112
+ email: mail@floek.net
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - README.md
118
+ - LICENSE
119
+ - lib/puppet-lint/plugins/check_class_or_define_parameter_in_exec.rb
120
+ - lib/puppet-lint/plugins/check_security_apache_bad_cipher.rb
121
+ - lib/puppet-lint/plugins/check_security_apache_no_ssl_vhost.rb
122
+ - lib/puppet-lint/plugins/check_security_apt_no_key.rb
123
+ - lib/puppet-lint/plugins/check_security_eval_in_erb.rb
124
+ - lib/puppet-lint/plugins/check_security_file_with_setgid_permission.rb
125
+ - lib/puppet-lint/plugins/check_security_file_with_setuid_permission.rb
126
+ - lib/puppet-lint/plugins/check_security_file_with_world_permissions.rb
127
+ - lib/puppet-lint/plugins/check_security_firewall_any_any_allow.rb
128
+ - lib/puppet-lint/plugins/check_security_firewall_any_any_deny.rb
129
+ - lib/puppet-lint/plugins/check_security_firewall_dns_used.rb
130
+ - lib/puppet-lint/plugins/check_security_firewall_puppetmaster_any_deny.rb
131
+ - lib/puppet-lint/plugins/check_security_package_pinned_version.rb
132
+ - lib/puppet-lint/plugins/check_security_password_in_code.rb
133
+ - lib/puppet-lint/plugins/check_security_password_variable_in_exec.rb
134
+ - lib/puppet-lint/plugins/check_security_regex_unspecific.rb
135
+ - lib/puppet-lint/plugins/check_security_service_mysql_disabled.rb
136
+ - lib/puppet-lint/plugins/check_security_service_puppetmaster_disabled.rb
137
+ - lib/puppet-lint/plugins/check_security_ssh_root_allowed.rb
138
+ - lib/puppet-lint/plugins/check_security_sudo_with_world_nopasswd.rb
139
+ - lib/puppet-lint/plugins/check_security_tidy_all_files.rb
140
+ - lib/puppet-lint/plugins/check_security_tidy_matches_greedy.rb
141
+ - lib/puppet-lint/plugins/check_security_tidy_recurse.rb
142
+ - lib/puppet-lint/plugins/check_security_user_with_id_0_created.rb
143
+ - lib/puppet-lint/security.rb
144
+ - lib/puppet-lint-security-plugins.rb
145
+ - spec/puppet-lint/plugins/check_class_or_define_parameter_in_exec_spec.rb
146
+ - spec/puppet-lint/plugins/check_security_apache_bad_cipher_spec.rb
147
+ - spec/puppet-lint/plugins/check_security_apache_no_ssl_vhost_spec.rb
148
+ - spec/puppet-lint/plugins/check_security_apt_absent_no_key_spec.rb
149
+ - spec/puppet-lint/plugins/check_security_apt_no_key_spec.rb
150
+ - spec/puppet-lint/plugins/check_security_dir_guid_permissions_spec.rb
151
+ - spec/puppet-lint/plugins/check_security_dir_world_permissions_spec.rb
152
+ - spec/puppet-lint/plugins/check_security_eval_in_erb_spec.rb
153
+ - spec/puppet-lint/plugins/check_security_file_suid_permissions_spec.rb
154
+ - spec/puppet-lint/plugins/check_security_file_with_setgid_permission_spec.rb
155
+ - spec/puppet-lint/plugins/check_security_file_with_setuid_permission_spec.rb
156
+ - spec/puppet-lint/plugins/check_security_file_with_world_permissions_spec.rb
157
+ - spec/puppet-lint/plugins/check_security_file_world_and_guid_permissions_spec.rb
158
+ - spec/puppet-lint/plugins/check_security_firewall_any_any_allow_spec.rb
159
+ - spec/puppet-lint/plugins/check_security_firewall_any_any_deny_spec.rb
160
+ - spec/puppet-lint/plugins/check_security_firewall_dns_used_spec.rb
161
+ - spec/puppet-lint/plugins/check_security_firewall_puppetmaster_any_deny_spec.rb
162
+ - spec/puppet-lint/plugins/check_security_package_pinned_version_spec.rb
163
+ - spec/puppet-lint/plugins/check_security_password_in_code_spec.rb
164
+ - spec/puppet-lint/plugins/check_security_password_variable_in_exec_spec.rb
165
+ - spec/puppet-lint/plugins/check_security_regex_unspecific_spec.rb
166
+ - spec/puppet-lint/plugins/check_security_service_mysql_disabled_spec.rb
167
+ - spec/puppet-lint/plugins/check_security_service_puppetmaster_disabled_spec.rb
168
+ - spec/puppet-lint/plugins/check_security_ssh_root_allowed_spec.rb
169
+ - spec/puppet-lint/plugins/check_security_ssh_server_root_allowed_spec.rb
170
+ - spec/puppet-lint/plugins/check_security_sudo_with_world_nopasswd_spec.rb
171
+ - spec/puppet-lint/plugins/check_security_tidy_all_files_spec.rb
172
+ - spec/puppet-lint/plugins/check_security_tidy_matches_greedy_spec.rb
173
+ - spec/puppet-lint/plugins/check_security_tidy_recurse_spec.rb
174
+ - spec/puppet-lint/plugins/check_security_user_with_id_0_created_spec.rb
175
+ - spec/spec_helper.rb
176
+ homepage: https://github.com/floek/puppet-lint-security-plugins
177
+ licenses:
178
+ - MIT
179
+ metadata: {}
180
+ post_install_message:
181
+ rdoc_options: []
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ requirements: []
195
+ rubyforge_project:
196
+ rubygems_version: 2.0.14
197
+ signing_key:
198
+ specification_version: 4
199
+ summary: A puppet-lint plugin to check security issues.
200
+ test_files:
201
+ - spec/puppet-lint/plugins/check_class_or_define_parameter_in_exec_spec.rb
202
+ - spec/puppet-lint/plugins/check_security_apache_bad_cipher_spec.rb
203
+ - spec/puppet-lint/plugins/check_security_apache_no_ssl_vhost_spec.rb
204
+ - spec/puppet-lint/plugins/check_security_apt_absent_no_key_spec.rb
205
+ - spec/puppet-lint/plugins/check_security_apt_no_key_spec.rb
206
+ - spec/puppet-lint/plugins/check_security_dir_guid_permissions_spec.rb
207
+ - spec/puppet-lint/plugins/check_security_dir_world_permissions_spec.rb
208
+ - spec/puppet-lint/plugins/check_security_eval_in_erb_spec.rb
209
+ - spec/puppet-lint/plugins/check_security_file_suid_permissions_spec.rb
210
+ - spec/puppet-lint/plugins/check_security_file_with_setgid_permission_spec.rb
211
+ - spec/puppet-lint/plugins/check_security_file_with_setuid_permission_spec.rb
212
+ - spec/puppet-lint/plugins/check_security_file_with_world_permissions_spec.rb
213
+ - spec/puppet-lint/plugins/check_security_file_world_and_guid_permissions_spec.rb
214
+ - spec/puppet-lint/plugins/check_security_firewall_any_any_allow_spec.rb
215
+ - spec/puppet-lint/plugins/check_security_firewall_any_any_deny_spec.rb
216
+ - spec/puppet-lint/plugins/check_security_firewall_dns_used_spec.rb
217
+ - spec/puppet-lint/plugins/check_security_firewall_puppetmaster_any_deny_spec.rb
218
+ - spec/puppet-lint/plugins/check_security_package_pinned_version_spec.rb
219
+ - spec/puppet-lint/plugins/check_security_password_in_code_spec.rb
220
+ - spec/puppet-lint/plugins/check_security_password_variable_in_exec_spec.rb
221
+ - spec/puppet-lint/plugins/check_security_regex_unspecific_spec.rb
222
+ - spec/puppet-lint/plugins/check_security_service_mysql_disabled_spec.rb
223
+ - spec/puppet-lint/plugins/check_security_service_puppetmaster_disabled_spec.rb
224
+ - spec/puppet-lint/plugins/check_security_ssh_root_allowed_spec.rb
225
+ - spec/puppet-lint/plugins/check_security_ssh_server_root_allowed_spec.rb
226
+ - spec/puppet-lint/plugins/check_security_sudo_with_world_nopasswd_spec.rb
227
+ - spec/puppet-lint/plugins/check_security_tidy_all_files_spec.rb
228
+ - spec/puppet-lint/plugins/check_security_tidy_matches_greedy_spec.rb
229
+ - spec/puppet-lint/plugins/check_security_tidy_recurse_spec.rb
230
+ - spec/puppet-lint/plugins/check_security_user_with_id_0_created_spec.rb
231
+ - spec/spec_helper.rb
232
+ has_rdoc: