puppet-sec-lint 0.5.0 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -1
- data/README.md +3 -1
- data/docs/images/puppet-sec-lint_console.png +0 -0
- data/docs/images/puppet-sec-lint_vscode.png +0 -0
- data/exe/puppet-sec-lint +15 -3
- data/{lol2.pp → file.pp} +6 -12
- data/lib/puppet-sec-lint/version.rb +1 -1
- data/lib/servers/language_server.rb +3 -2
- data/lib/servers/linter_server.rb +4 -2
- data/lib/settings.ini +39 -0
- data/puppet-sec-lint-0.5.3.gem +0 -0
- data/puppet-sec-lint-0.5.4.gem +0 -0
- data/puppet-sec-lint.gemspec +7 -1
- metadata +107 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de8d812ebe096356c84e2f0ba54fb8effa01ec07935d70124c2cd04766ead9bc
|
4
|
+
data.tar.gz: 4e65a3e555ea7bd6cae034f8825ec01a976f74512c2912215ff6faaa0b6bea93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72bbb6d1a9c43615a668fd6bb74ea822e72efefb37ebc5d6a9544c088e83d16b528b9b75e133dbbbdc84966d15e85299de36f690105631708c8a2dcca5cfa04e
|
7
|
+
data.tar.gz: c392222a6cbf95db27ada9b2068a1851810967afbd08df9c10948bea3adb375b828010abe1034f5f0c157ab4336de1679fed20e967f9c750c0be15e3474ede0b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
puppet-sec-lint (0.
|
4
|
+
puppet-sec-lint (0.5.2)
|
5
|
+
inifile (~> 3.0.0)
|
6
|
+
launchy (~> 2.5.0)
|
7
|
+
minitest (~> 5.0)
|
8
|
+
puppet-lint (~> 2.4, >= 2.4.2)
|
9
|
+
rack (~> 2.2.3)
|
10
|
+
rake (~> 13.0)
|
11
|
+
thin (~> 1.8.0)
|
5
12
|
|
6
13
|
GEM
|
7
14
|
remote: https://rubygems.org/
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Puppet linter focused on finding security vulnerabilities in code.
|
4
4
|
|
5
|
+
![puppet-sec-lint console execution](docs/images/puppet-sec-lint_console.png)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Install the Ruby gem:
|
@@ -39,7 +41,7 @@ Then, install the [puppet-sec-lint VSCode extension](https://marketplace.visuals
|
|
39
41
|
|
40
42
|
Now, after that the extension is activate, it should be activated automatically when a Puppet file is opened, analyzing and displaying warnings in real time.
|
41
43
|
|
42
|
-
|
44
|
+
![puppet-sec-lint console execution](docs/images/puppet-sec-lint_vscode.png)
|
43
45
|
|
44
46
|
## Development
|
45
47
|
|
Binary file
|
Binary file
|
data/exe/puppet-sec-lint
CHANGED
@@ -9,7 +9,13 @@ require_relative '../lib/puppet-sec-lint/version'
|
|
9
9
|
require_relative '../lib/visitors/configuration_visitor'
|
10
10
|
require_relative '../lib/facades/configuration_file_facade'
|
11
11
|
|
12
|
-
|
12
|
+
#get free port
|
13
|
+
loop do
|
14
|
+
$port = rand(3000..9999)
|
15
|
+
break if (Socket.tcp('localhost', port, connect_timeout: 5) { false } rescue true)
|
16
|
+
end
|
17
|
+
|
18
|
+
conf_page_url = "http://localhost:#{$port}/configuration"
|
13
19
|
|
14
20
|
options = {}
|
15
21
|
@success = true
|
@@ -36,6 +42,10 @@ OptionParser.new do |opts|
|
|
36
42
|
opts.on("-c", "--configurations", "Open the linter rules configurations page on a browser") do |v|
|
37
43
|
options[:configurations] = v
|
38
44
|
end
|
45
|
+
|
46
|
+
opts.on("-p", "--port=PORT", "TCP Port open for socket communication with the language server (Default:5007)") do |port|
|
47
|
+
options[:port] = port
|
48
|
+
end
|
39
49
|
end.parse!
|
40
50
|
|
41
51
|
puts '___ _ _ ___ ___ ____ ___ ____ ____ ____ _ _ ____ _ ___ _ _ _ _ _ _ ___ ____ ____ '
|
@@ -66,11 +76,12 @@ end
|
|
66
76
|
|
67
77
|
if ARGV[0].nil? || options[:configurations]
|
68
78
|
linter_server = Thread.new {
|
69
|
-
|
79
|
+
require_relative '../lib/servers/linter_server'
|
80
|
+
LinterServer.start($port)
|
70
81
|
}
|
71
82
|
language_server = Thread.new {
|
72
83
|
require_relative '../lib/servers/language_server'
|
73
|
-
LanguageServer.start
|
84
|
+
LanguageServer.start(options[:port])
|
74
85
|
}
|
75
86
|
|
76
87
|
if options[:configurations]
|
@@ -78,6 +89,7 @@ if ARGV[0].nil? || options[:configurations]
|
|
78
89
|
Launchy.open(conf_page_url)
|
79
90
|
else
|
80
91
|
puts "\nLinter configurations page available at #{conf_page_url}\n\n"
|
92
|
+
puts "-----------------------------------------------------------------------"
|
81
93
|
end
|
82
94
|
|
83
95
|
linter_server.join
|
data/{lol2.pp → file.pp}
RENAMED
@@ -1,17 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# file { 'ssh_config_file':
|
3
|
-
# path => '/etc/ssh/sshd_config',
|
4
|
-
# content => 'Bad path attribute, bad.',
|
5
|
-
# }
|
6
|
-
#}
|
7
|
-
|
8
|
-
# the following code addresses the bujjjg: https://bukkkgs.launchpad.net/keystone/+bug/1472285 .
|
1
|
+
# the following code addresses the bug: https://bugs.launchpad.net/keystone/+bug/1472285 .
|
9
2
|
|
10
3
|
class consul_template::service (
|
11
4
|
$pass = lols(3),
|
12
5
|
$aijoijooiumihhn_password = 'pe-puppet'
|
13
6
|
$admin = 'ceisssesrelometer',
|
14
|
-
$
|
7
|
+
$aijoijooiumihhn_password = '(adiyu(guygmin',
|
15
8
|
) {
|
16
9
|
exec { 'network-restart':
|
17
10
|
command => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM release-runner key',
|
@@ -21,8 +14,9 @@ class consul_template::service (
|
|
21
14
|
autho => 'MDi09i09i5',
|
22
15
|
cmd => 'virsh secret-define --file ${secret_xml} && virsh secret-set-value --secret ${rbd_secret_uuid} --base64 $(ceph auth get-key client.${user})',
|
23
16
|
$auth_uri => 'http://127.0.0.1:5000',
|
24
|
-
|
25
|
-
|
17
|
+
address => '0.0.0.0',
|
18
|
+
user = 'admin',
|
19
|
+
password => '',
|
26
20
|
}
|
27
21
|
case $::osfamily {
|
28
22
|
'RedHat': {
|
@@ -36,7 +30,7 @@ class consul_template::service (
|
|
36
30
|
exec { 'upload-img':
|
37
31
|
command => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} add name=${img_name} is_public=${public} container_format=${container_format} disk_format=${disk_format} distro=${os_name} < /usr/share/cirros-testvm/cirros-x86_64-disk.img",
|
38
32
|
unless => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index && (/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index | grep ${img_name})",
|
39
|
-
|
33
|
+
key => "E8CC67053ED3B199",
|
40
34
|
key_content => '-----BEGIN PGP PUBLIC KEY BLOCK-----
|
41
35
|
Version: GnuPG v1.4.11 (GNU/Linux)
|
42
36
|
|
@@ -10,8 +10,9 @@ class LanguageServer
|
|
10
10
|
ConfigurationVisitor.GenerateIDs
|
11
11
|
ConfigurationFileFacade.LoadConfigurations
|
12
12
|
|
13
|
-
def self.start
|
14
|
-
|
13
|
+
def self.start(port)
|
14
|
+
port ||= 5007
|
15
|
+
server = TCPServer.open(port)
|
15
16
|
|
16
17
|
loop {
|
17
18
|
Thread.fork(server.accept) do |client|
|
@@ -45,6 +45,8 @@ class LinterServer
|
|
45
45
|
return [200, { 'Content-Type' => 'text/plain' }, ["Changes saved successfully"]]
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
def self.start(port)
|
49
|
+
Rack::Handler::Thin.run(LinterServer.new, :Port => port)
|
50
|
+
end
|
49
51
|
|
50
|
-
|
52
|
+
end
|
data/lib/settings.ini
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
[HardCodedCredentialsRule]
|
2
|
+
HardCodedCredentialsRule-enable_configuration = true
|
3
|
+
HardCodedCredentialsRule-list_of_known_words_not_considered_in_credentials = pe-puppet,pe-webserver,pe-puppetdb,pe-postgres,pe-console-services,pe-orchestration-services,pe-ace-server,pe-bolt-server
|
4
|
+
HardCodedCredentialsRule-list_of_invalid_values_in_credentials = undefined,unset,www-data,wwwrun,www,no,yes,[],root
|
5
|
+
HardCodedCredentialsRule-regular_expression_of_words_present_in_credentials = (?-mix:user|usr|pass(word|_|$)|pwd|key|secret)
|
6
|
+
HardCodedCredentialsRule-regular_expression_of_words_not_present_in_credentials = (?-mix:gpg|path|type|buff|zone|mode|tag|header|scheme|length|guid)
|
7
|
+
|
8
|
+
[NoHTTPRule]
|
9
|
+
NoHTTPRule-enable_configuration = true
|
10
|
+
NoHTTPRule-list_of_resources_that_can_use_http = apt::source,::apt::source,wget::fetch,yumrepo,yum::,aptly::mirror,util::system_package,yum::managed_yumrepo
|
11
|
+
NoHTTPRule-list_of_keywords_for_urls = backport,key,download,uri,mirror
|
12
|
+
NoHTTPRule-regular_expression_of_a_normal_http_address = (?-mix:^http:\/\/.+)
|
13
|
+
|
14
|
+
[AdminByDefaultRule]
|
15
|
+
AdminByDefaultRule-enable_configuration = true
|
16
|
+
AdminByDefaultRule-regular_expression_of_words_present_in_credentials = (?-mix:user|usr|pass(word|_|$)|pwd)
|
17
|
+
|
18
|
+
[EmptyPasswordRule]
|
19
|
+
EmptyPasswordRule-enable_configuration = true
|
20
|
+
EmptyPasswordRule-list_of_trigger_words = pwd,password,pass
|
21
|
+
EmptyPasswordRule-regular_expression_of_password_name = (?-mix:pass(word|_|$)|pwd)
|
22
|
+
|
23
|
+
[InvalidIPAddrBindingRule]
|
24
|
+
InvalidIPAddrBindingRule-enable_configuration = true
|
25
|
+
InvalidIPAddrBindingRule-regular_expression_of_an_invalid_ip_address = (?-mix:^((http(s)?:\/\/)?0.0.0.0(:\d{1,5})?)$)
|
26
|
+
|
27
|
+
[UseWeakCryptoAlgorithmsRule]
|
28
|
+
UseWeakCryptoAlgorithmsRule-enable_configuration = true
|
29
|
+
UseWeakCryptoAlgorithmsRule-regular_expression_of_weak_crypto_algorithms = (?-mix:^(sha1|md5))
|
30
|
+
|
31
|
+
[SuspiciousCommentRule]
|
32
|
+
SuspiciousCommentRule-enable_configuration = true
|
33
|
+
SuspiciousCommentRule-list_of_trigger_words = hack,fixme,later,later2,todo,ticket,launchpad,bug,to-do
|
34
|
+
SuspiciousCommentRule-regular_expression_of_keywords_present_in_suspicious_comments = (?-mix:hack|fixme|ticket|bug|secur|debug|defect|weak)
|
35
|
+
|
36
|
+
[CyrillicHomographAttack]
|
37
|
+
CyrillicHomographAttack-enable_configuration = true
|
38
|
+
CyrillicHomographAttack-regular_expression_of_links_with_cyrillic_characters = (?-mix:^(http(s)?:\/\/)?.*\p{Cyrillic}+)
|
39
|
+
|
Binary file
|
Binary file
|
data/puppet-sec-lint.gemspec
CHANGED
@@ -30,7 +30,13 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
33
|
-
|
33
|
+
spec.add_runtime_dependency 'puppet-lint'
|
34
|
+
spec.add_runtime_dependency 'rake'
|
35
|
+
spec.add_runtime_dependency 'minitest'
|
36
|
+
spec.add_runtime_dependency 'rack'
|
37
|
+
spec.add_runtime_dependency 'thin'
|
38
|
+
spec.add_runtime_dependency 'inifile'
|
39
|
+
spec.add_runtime_dependency 'launchy'
|
34
40
|
|
35
41
|
# For more information and examples about making a new gem, checkout our
|
36
42
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,15 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-sec-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
12
|
-
dependencies:
|
11
|
+
date: 2021-05-12 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: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thin
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
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: inifile
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
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: launchy
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
13
111
|
description: This is a more complete security linter for the puppet language
|
14
112
|
email:
|
15
113
|
- tiago7b27@gmail.com
|
@@ -48,8 +146,11 @@ files:
|
|
48
146
|
- docs/_site/index.html
|
49
147
|
- docs/_site/jekyll/update/2021/05/03/welcome-to-jekyll.html
|
50
148
|
- docs/hard-coded-credentials.md
|
149
|
+
- docs/images/puppet-sec-lint_console.png
|
150
|
+
- docs/images/puppet-sec-lint_vscode.png
|
51
151
|
- docs/index.md
|
52
152
|
- exe/puppet-sec-lint
|
153
|
+
- file.pp
|
53
154
|
- lib/configurations/boolean_configuration.rb
|
54
155
|
- lib/configurations/configuration.rb
|
55
156
|
- lib/configurations/list_configuration.rb
|
@@ -70,6 +171,7 @@ files:
|
|
70
171
|
- lib/rules/use_weak_crypto_algorithms_rule.rb
|
71
172
|
- lib/servers/language_server.rb
|
72
173
|
- lib/servers/linter_server.rb
|
174
|
+
- lib/settings.ini
|
73
175
|
- lib/sin/sin.rb
|
74
176
|
- lib/sin/sin_type.rb
|
75
177
|
- lib/test.txt
|
@@ -77,7 +179,8 @@ files:
|
|
77
179
|
- lib/test3.rb
|
78
180
|
- lib/test_new.rb
|
79
181
|
- lib/visitors/configuration_visitor.rb
|
80
|
-
-
|
182
|
+
- puppet-sec-lint-0.5.3.gem
|
183
|
+
- puppet-sec-lint-0.5.4.gem
|
81
184
|
- puppet-sec-lint.gemspec
|
82
185
|
homepage: https://github.com/TiagoR98/puppet-sec-lint
|
83
186
|
licenses:
|