sensu-plugins-ruby 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/.bonsai.yml +26 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +47 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +18 -0
- data/Rakefile +4 -0
- data/bin/check-bundler-audit +128 -0
- data/bin/check-ruby-version +112 -0
- data/lib/sensu-plugins-ruby.rb +3 -0
- data/lib/sensu-plugins-ruby/version.rb +11 -0
- data/sensu-plugins-ruby.gemspec +32 -0
- metadata +93 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ec7224c32897f3dfb83b505d4a09f43f38b58466a98f9c7cdb23a15ff08cac6e
|
|
4
|
+
data.tar.gz: 4eab94904ad8480dc8ec9d697ca5ba9a11bb1b63459c710bb0afff4fd2e5487d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 53de6f426203ae0a80ab8fcb31a47d32054adb409bda280cf497d50e69d83f23b4a3a14acdb9d4124ef976ece01a967a8ac2cc89f1767767b1aa7226814a7717
|
|
7
|
+
data.tar.gz: 7ce5be6cbe45f37d34f8aa5ce0394d6e9733da9f05b94d471d307d7562835dd6d91082380b586f448c198d710c8902a35cc312d4111cd9990d5ab3d6ba710719
|
data/.bonsai.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
description: "#{repo}"
|
|
2
|
+
builds:
|
|
3
|
+
- platform: "debian"
|
|
4
|
+
arch: "amd64"
|
|
5
|
+
asset_filename: "#{repo}_#{version}_debian_linux_amd64.tar.gz"
|
|
6
|
+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
|
|
7
|
+
filter:
|
|
8
|
+
- "entity.system.os == 'linux'"
|
|
9
|
+
- "entity.system.arch == 'amd64'"
|
|
10
|
+
- "entity.system.platform == 'debian'"
|
|
11
|
+
- platform: "centos"
|
|
12
|
+
arch: "amd64"
|
|
13
|
+
asset_filename: "#{repo}_#{version}_centos_linux_amd64.tar.gz"
|
|
14
|
+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
|
|
15
|
+
filter:
|
|
16
|
+
- "entity.system.os == 'linux'"
|
|
17
|
+
- "entity.system.arch == 'amd64'"
|
|
18
|
+
- "entity.system.platform == 'rhel'"
|
|
19
|
+
- platform: "alpine"
|
|
20
|
+
arch: "amd64"
|
|
21
|
+
asset_filename: "#{repo}_#{version}_alpine_linux_amd64.tar.gz"
|
|
22
|
+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
|
|
23
|
+
filter:
|
|
24
|
+
- "entity.system.os == 'linux'"
|
|
25
|
+
- "entity.system.arch == 'amd64'"
|
|
26
|
+
- "entity.system.platform == 'alpine'"
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
sudo: required
|
|
2
|
+
language: ruby
|
|
3
|
+
|
|
4
|
+
rvm:
|
|
5
|
+
- 2.5.5
|
|
6
|
+
|
|
7
|
+
services:
|
|
8
|
+
- docker
|
|
9
|
+
|
|
10
|
+
cache:
|
|
11
|
+
- bundler
|
|
12
|
+
|
|
13
|
+
before_install:
|
|
14
|
+
- gem install bundler
|
|
15
|
+
|
|
16
|
+
install:
|
|
17
|
+
- bundle install
|
|
18
|
+
|
|
19
|
+
script:
|
|
20
|
+
- gem build sensu-plugins-ruby.gemspec
|
|
21
|
+
- gem install sensu-plugins-ruby-*.gem
|
|
22
|
+
|
|
23
|
+
before_deploy:
|
|
24
|
+
- bash -c "[ ! -d bonsai/ ] && git clone https://github.com/sensu/sensu-go-bonsai-asset.git bonsai || echo 'bonsai/ exists, skipping git clone'"
|
|
25
|
+
|
|
26
|
+
deploy:
|
|
27
|
+
- provider: rubygems
|
|
28
|
+
api_key:
|
|
29
|
+
secure: Vha7m1Li7Jg7Md81siv18OvnqBaZHGnhhCIfe1ASxf5fe22EbLzqevBgSg8NI2MbOXOjOXZpO1WnWaeQKVRToYdqfLPRVQ0IwhvJxlT+fiYigczhj9jxNejIE7vfuJ/wWkjPubmRBvQBlr1eVT5donoyeCGlEoUGYoHF2AJ5rm2Yy056DxEFLXkYskpJZh49JIaTkELkSk8IfGKmDql2YDJQdqkwLcsz4Zg2cS8I4WlwpsW8bQjvTeuCKKIjnh3ylt9BYLCrs7kUPhXOyTdJzy8JxTzA/J2aM0jN0/PRfXMhzOtQfjywdJlCuVA3WTLBCr6Ny+ciS7W9kE5cHAm9SaPCZKPWPlhZB0KF1y7RpEEY2r+io3AE4oqPNBRHIXjfahyDbd71SqlFC05ZdUThVjGo9rgOHJUyxDjQ44KwjRKiX1e6MVouGHTjDjgATF2dqd1QOGiSKuqw7NmIMxge8unwz+FGVmMxCNqcVAfbMsZ1F0Unyh3KnWo7lp/cr7CyyWTRaRjC4le7l5120e1Akcx0rsHE8vlcqBbHGANtM4qW+qihUtVO0CKN+sPSsIRbmcC9gshIxrsxWX9agnT49UYB5kCy3ajkELjRHCDFtEXKm8DYzxcBRPD68mEZgJxEU63ZSfF1BZfM0Km63tyoxEtwr4CusAG1zIMsJZzWhmQ=
|
|
30
|
+
gem: sensu-plugins-ruby
|
|
31
|
+
on:
|
|
32
|
+
tags: true
|
|
33
|
+
all_branches: true
|
|
34
|
+
rvm: 2.5.5
|
|
35
|
+
repo: SICSoftwareGmbH/sensu-plugins-ruby
|
|
36
|
+
|
|
37
|
+
- provider: script
|
|
38
|
+
script: bonsai/ruby-runtime/travis-build-ruby-plugin-assets.sh sensu-plugins-ruby
|
|
39
|
+
skip_cleanup: true
|
|
40
|
+
on:
|
|
41
|
+
tags: true
|
|
42
|
+
all_branches: true
|
|
43
|
+
rvm: 2.5.5
|
|
44
|
+
|
|
45
|
+
env:
|
|
46
|
+
global:
|
|
47
|
+
secure: "wCy0rkujPL05QmhgC4m2896hsUmVn2aoolF9nF3IYklHTYLRUAcTpWPbjKNse0KkVJGNu1TGpxoKqD5IYyWagYfarI/mHPlkV7/JIVMOGx01AWT+gPIfF2AbRdzaYwhQGmPb1I4lAg4ZGXTQdIitSPQaKXT4Bqi5XdlOwbAY1vqtUI8nylEmepSKi32a1kz0ArDkrEX1FUeK0B4m3lxFGf9K+ZybYxx2TOhvVtuBLQSZHfsgcczO7LgUClJVpiJoXaAHUOG5Iur4G5bDEGcMSWA+w32NqEmSg20k3ZsSYhMTre9G937YCGpjnWybLy44tqPLs6FW1SB2HooyvI5yDRWGjPhHLjRlbsU7GgIGrKUbAIbAcXMgQsVQSXEA/tQ4HMSjfNHj3oSqNQaq5PcQk8t0s7VITx4c14rZ88ueH9ulwyhOfodjEVnPZ7P50aUCBJgDDZYdK/agmW+OhQCBT/OPO7XXaelf3KO9WC7IelV5MjH7Wt9pkBLozVFOuGN5pKc7wb99yNdgX9tCmjE2ZXRZmddu8ydgn+Kvk5F6I92f3u0e6FQKQoJCj0fbItaM5S3Mlw8MIraXveWN750va3j9cHMTjlnEhlE3YOtGe/A4U+bCqP7iSDVbyhE1uTcPBkDrB/0mu3T8tkoAeuAO0daQJkzznvRIl5IXlDOvVzE="
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2019-07-26
|
|
10
|
+
### Added
|
|
11
|
+
- check if ruby version is current
|
|
12
|
+
- check for security advisories using bundler-audit
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 SIC! Software GmbH
|
|
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,18 @@
|
|
|
1
|
+
## sensu-plugins-ruby
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/SICSoftwareGmbH/sensu-plugins-ruby)
|
|
4
|
+
[](http://badge.fury.io/rb/sensu-plugins-ruby)
|
|
5
|
+
[](https://bonsai.sensu.io/assets/SICSoftwareGmbH/sensu-plugins-ruby)
|
|
6
|
+
|
|
7
|
+
## Sensu Asset
|
|
8
|
+
The Sensu assets packaged from this repository are built against the Sensu ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator or handler), make sure you include the corresponding Sensu ruby runtime asset in the list of assets needed by the resource. The current ruby-runtime assets can be found [here](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the [Bonsai Asset Index](bonsai.sensu.io).
|
|
9
|
+
|
|
10
|
+
## Functionality
|
|
11
|
+
|
|
12
|
+
## Files
|
|
13
|
+
* bin/check-bundler-audit
|
|
14
|
+
* bin/check-ruby-version
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# check-bundle-audit
|
|
5
|
+
#
|
|
6
|
+
# DESCRIPTION:
|
|
7
|
+
# Check bundle for vulnerabilities
|
|
8
|
+
#
|
|
9
|
+
# OUTPUT:
|
|
10
|
+
# Plain text
|
|
11
|
+
#
|
|
12
|
+
# PLATFORMS:
|
|
13
|
+
# Linux; bundler-audit gem must be installed
|
|
14
|
+
#
|
|
15
|
+
# DEPENDENCIES:
|
|
16
|
+
# gem: sensu-plugin
|
|
17
|
+
# gem: bundler-audit
|
|
18
|
+
#
|
|
19
|
+
# LICENSE:
|
|
20
|
+
# Florian Schwab <me@ydkn.io>
|
|
21
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
|
22
|
+
# for details.
|
|
23
|
+
#
|
|
24
|
+
|
|
25
|
+
require 'bundler/audit/database'
|
|
26
|
+
require 'bundler/audit/scanner'
|
|
27
|
+
require 'sensu-plugin/check/cli'
|
|
28
|
+
|
|
29
|
+
# Sensu plugin for checking bundle audit status
|
|
30
|
+
class BundlerAuditCheck < Sensu::Plugin::Check::CLI
|
|
31
|
+
CRITICALITY_UNKOWN = 0
|
|
32
|
+
CRITICALITY_LOW = 1
|
|
33
|
+
CRITICALITY_MEDIUM = 2
|
|
34
|
+
CRITICALITY_HIGH = 3
|
|
35
|
+
|
|
36
|
+
option :paths,
|
|
37
|
+
short: '-p RUBY_APP_PATHS',
|
|
38
|
+
long: '--paths RUBY_APP_PATHS',
|
|
39
|
+
description: 'Comma separated list of paths containing ruby applications',
|
|
40
|
+
required: true
|
|
41
|
+
|
|
42
|
+
option :criticality,
|
|
43
|
+
short: '-c CRIT_NUM',
|
|
44
|
+
long: '--criticality CRIT_NUM',
|
|
45
|
+
description: 'Ignore vulnerabilities with lower criticality than this',
|
|
46
|
+
default: '0'
|
|
47
|
+
|
|
48
|
+
option :ignore,
|
|
49
|
+
short: '-i CVE_NUBMERS',
|
|
50
|
+
long: '--ignore CVE_NUMBERS',
|
|
51
|
+
description: 'Comma separated list of CVE numbers to ignore',
|
|
52
|
+
default: ''
|
|
53
|
+
|
|
54
|
+
def run
|
|
55
|
+
update_audit_db
|
|
56
|
+
|
|
57
|
+
checks = config[:paths].split(',').map do |path|
|
|
58
|
+
check_audit(path.strip)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
message = checks.select { |c| %i[critical warning].include?(c[:status]) }
|
|
62
|
+
.map { |c| "#{c[:path]}: #{c[:message]}" }
|
|
63
|
+
.compact.join("\n")
|
|
64
|
+
|
|
65
|
+
if checks.any? { |c| c[:status] == :critical }
|
|
66
|
+
critical("Vulnerabilities found: #{message}")
|
|
67
|
+
elsif checks.any? { |c| c[:status] == :warning }
|
|
68
|
+
warning("Vulnerabilities found: #{message}")
|
|
69
|
+
else
|
|
70
|
+
ok('No vulnerabilities found')
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
private
|
|
75
|
+
|
|
76
|
+
def update_audit_db
|
|
77
|
+
ok = Bundler::Audit::Database.update!(quiet: true)
|
|
78
|
+
|
|
79
|
+
warning("Failed to update advisory db: #{stdout} #{stderr}") unless ok
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def criticality_to_int(criticality)
|
|
83
|
+
case criticality
|
|
84
|
+
when :high
|
|
85
|
+
CRITICALITY_HIGH
|
|
86
|
+
when :medium
|
|
87
|
+
CRITICALITY_MEDIUM
|
|
88
|
+
when :low
|
|
89
|
+
CRITICALITY_LOW
|
|
90
|
+
else
|
|
91
|
+
CRITICALITY_UNKOWN
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def check_audit(path)
|
|
96
|
+
ENV['BUNDLE_GEMFILE'] = File.join(path, 'Gemfile.lock')
|
|
97
|
+
|
|
98
|
+
vulnerabilities = []
|
|
99
|
+
|
|
100
|
+
scanner = Bundler::Audit::Scanner.new(path)
|
|
101
|
+
scanner.scan do |result|
|
|
102
|
+
case result
|
|
103
|
+
when Bundler::Audit::Scanner::InsecureSource
|
|
104
|
+
vulnerabilities << { message: "Insecure Source URI found: #{result.source}", criticality: CRITICALITY_HIGH }
|
|
105
|
+
when Bundler::Audit::Scanner::UnpatchedGem
|
|
106
|
+
vulnerabilities << { gem: result.gem, advisory: result.advisory, criticality: criticality_to_int(result.advisory.criticality) }
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if vulnerabilities.empty?
|
|
111
|
+
{ path: path, status: :ok, message: 'No vulnerabilities found' }
|
|
112
|
+
else
|
|
113
|
+
message = vulnerabilities.map do |v|
|
|
114
|
+
v[:message] || "#{v[:gem].name} #{v[:gem].version} (#{v[:advisory].cve || v[:advisory].osvdb})"
|
|
115
|
+
end.join(', ')
|
|
116
|
+
|
|
117
|
+
if vulnerabilities.any? { |v| v[:criticality] >= config[:criticality].to_i && !config[:ignore].split(',').map(&:strip).include?(v[:advisory]) }
|
|
118
|
+
{ path: path, status: :critical, message: message }
|
|
119
|
+
elsif vulnerabilities.any?
|
|
120
|
+
{ path: path, status: :ok, message: message }
|
|
121
|
+
else
|
|
122
|
+
{ path: path, status: :warning, message: 'Vulnerabilities found' }
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
rescue StandardError => e
|
|
126
|
+
{ path: path, status: :warning, message: "Failed to check for vulnerabilities: #{e.message}" }
|
|
127
|
+
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# check-ruby-version
|
|
5
|
+
#
|
|
6
|
+
# DESCRIPTION:
|
|
7
|
+
# Check if used ruby version in .ruby-version is current patch release
|
|
8
|
+
#
|
|
9
|
+
# OUTPUT:
|
|
10
|
+
# Plain text
|
|
11
|
+
#
|
|
12
|
+
# PLATFORMS:
|
|
13
|
+
# Linux
|
|
14
|
+
#
|
|
15
|
+
# DEPENDENCIES:
|
|
16
|
+
# gem: sensu-plugin
|
|
17
|
+
#
|
|
18
|
+
# LICENSE:
|
|
19
|
+
# Florian Schwab <me@ydkn.io>
|
|
20
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
|
21
|
+
# for details.
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
require 'net/http'
|
|
25
|
+
require 'uri'
|
|
26
|
+
require 'sensu-plugin/check/cli'
|
|
27
|
+
|
|
28
|
+
# Sensu plugin for checking bundle audit status
|
|
29
|
+
class RubyVersionCheck < Sensu::Plugin::Check::CLI
|
|
30
|
+
RVM_KNOWN_RUBIES_URL = 'https://raw.githubusercontent.com/rvm/rvm/stable/config/known'
|
|
31
|
+
MIN_RUBY_VERSION = [2, 4].freeze
|
|
32
|
+
|
|
33
|
+
option :paths,
|
|
34
|
+
short: '-p RUBY_APP_PATHS',
|
|
35
|
+
long: '--paths RUBY_APP_PATHS',
|
|
36
|
+
description: 'Comma separated list of paths containing ruby applications',
|
|
37
|
+
required: true
|
|
38
|
+
|
|
39
|
+
def run
|
|
40
|
+
known_rubies = fetch_known_rubies
|
|
41
|
+
latest_ruby = known_rubies.max
|
|
42
|
+
|
|
43
|
+
checks = config[:paths].split(',').map do |path|
|
|
44
|
+
check_path(path, known_rubies, latest_ruby)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
message = checks.select { |c| %i[critical warning].include?(c[:status]) }
|
|
48
|
+
.map { |c| "#{c[:path]}: #{c[:message]}" }
|
|
49
|
+
.compact.join("\n")
|
|
50
|
+
|
|
51
|
+
if checks.any? { |c| c[:status] == :critical }
|
|
52
|
+
critical(message)
|
|
53
|
+
elsif checks.any? { |c| c[:status] == :warning }
|
|
54
|
+
warning(message)
|
|
55
|
+
elsif checks.length == 1
|
|
56
|
+
ok(checks[0][:message])
|
|
57
|
+
else
|
|
58
|
+
ok('Ruby versions are current')
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def fetch_known_rubies
|
|
65
|
+
Net::HTTP.get(URI.parse(RVM_KNOWN_RUBIES_URL))
|
|
66
|
+
.split("\n")
|
|
67
|
+
.map { |l| l.match(/^\[ruby\-\](\d+)\.(\d+)\[\.(\d+)\]/) }
|
|
68
|
+
.compact
|
|
69
|
+
.map { |m| [m[1], m[2], m[3]].map(&:to_i) }
|
|
70
|
+
.select { |v| v[0] >= MIN_RUBY_VERSION[0] && v[1] >= MIN_RUBY_VERSION[1] }
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def parse_ruby_version(string)
|
|
74
|
+
match = string.strip.match(/^(ruby\-)?(\d+)\.(\d+)\.(\d+)/)
|
|
75
|
+
|
|
76
|
+
return unless match
|
|
77
|
+
|
|
78
|
+
[match[2], match[3], match[4]].map(&:to_i)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def check_path(path, known_rubies, latest_ruby)
|
|
82
|
+
used_ruby = parse_ruby_version(File.read(File.join(path, '.ruby-version')))
|
|
83
|
+
current_branch_patch_version = known_rubies.find { |v| v[0] == used_ruby[0] && v[1] == used_ruby[1] }
|
|
84
|
+
|
|
85
|
+
if current_branch_patch_version.nil?
|
|
86
|
+
{
|
|
87
|
+
path: path,
|
|
88
|
+
status: :critical,
|
|
89
|
+
message: format('The ruby version has reached its end of live: %s', used_ruby.join('.'))
|
|
90
|
+
}
|
|
91
|
+
elsif current_branch_patch_version[2] > used_ruby[2]
|
|
92
|
+
{
|
|
93
|
+
path: path,
|
|
94
|
+
status: :warning,
|
|
95
|
+
message: format('Outdated Ruby version of %s branch: %s', used_ruby[0..-2].join('.'), used_ruby.join('.'))
|
|
96
|
+
}
|
|
97
|
+
elsif latest_ruby[0] > used_ruby[0] || latest_ruby[1] > used_ruby[1]
|
|
98
|
+
{
|
|
99
|
+
path: path,
|
|
100
|
+
status: :ok,
|
|
101
|
+
message: format('Using latest version of %s branch: %s - latest version: %s',
|
|
102
|
+
used_ruby[0..-2].join('.'), used_ruby.join('.'), latest_ruby[0..-2].join('.'))
|
|
103
|
+
}
|
|
104
|
+
else
|
|
105
|
+
{
|
|
106
|
+
path: path,
|
|
107
|
+
status: :ok,
|
|
108
|
+
message: format('Using latest version of ruby %s', used_ruby.join('.'))
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'sensu-plugins-ruby/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = 'sensu-plugins-ruby'
|
|
9
|
+
spec.version = SensuPluginsRuby::Version::STRING
|
|
10
|
+
spec.authors = ['SIC! Software GmbH', 'Florian Schwab']
|
|
11
|
+
spec.email = ['info@sic.software', 'me@ydkn.io']
|
|
12
|
+
spec.summary = 'This plugin provides checks for the used ruby version and security advisories for used gems'
|
|
13
|
+
spec.description = 'Sensu plugins vairous for ruby related stuff'
|
|
14
|
+
spec.homepage = 'https://github.com/SICSoftwareGmbH/sensu-plugins-ruby'
|
|
15
|
+
spec.license = 'MIT'
|
|
16
|
+
|
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/SICSoftwareGmbH/sensu-plugins-ruby/blob/master/CHANGELOG.md'
|
|
20
|
+
|
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
25
|
+
end
|
|
26
|
+
spec.bindir = 'bin'
|
|
27
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
28
|
+
spec.require_paths = ['lib']
|
|
29
|
+
|
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
31
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
32
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sensu-plugins-ruby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- SIC! Software GmbH
|
|
8
|
+
- Florian Schwab
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2019-07-26 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: bundler
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - "~>"
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: '2.0'
|
|
21
|
+
type: :development
|
|
22
|
+
prerelease: false
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
25
|
+
- - "~>"
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: '2.0'
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: rake
|
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - "~>"
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '10.0'
|
|
35
|
+
type: :development
|
|
36
|
+
prerelease: false
|
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - "~>"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '10.0'
|
|
42
|
+
description: Sensu plugins vairous for ruby related stuff
|
|
43
|
+
email:
|
|
44
|
+
- info@sic.software
|
|
45
|
+
- me@ydkn.io
|
|
46
|
+
executables:
|
|
47
|
+
- check-bundler-audit
|
|
48
|
+
- check-ruby-version
|
|
49
|
+
extensions: []
|
|
50
|
+
extra_rdoc_files: []
|
|
51
|
+
files:
|
|
52
|
+
- ".bonsai.yml"
|
|
53
|
+
- ".gitignore"
|
|
54
|
+
- ".rubocop.yml"
|
|
55
|
+
- ".travis.yml"
|
|
56
|
+
- CHANGELOG.md
|
|
57
|
+
- Gemfile
|
|
58
|
+
- LICENSE
|
|
59
|
+
- README.md
|
|
60
|
+
- Rakefile
|
|
61
|
+
- bin/check-bundler-audit
|
|
62
|
+
- bin/check-ruby-version
|
|
63
|
+
- lib/sensu-plugins-ruby.rb
|
|
64
|
+
- lib/sensu-plugins-ruby/version.rb
|
|
65
|
+
- sensu-plugins-ruby.gemspec
|
|
66
|
+
homepage: https://github.com/SICSoftwareGmbH/sensu-plugins-ruby
|
|
67
|
+
licenses:
|
|
68
|
+
- MIT
|
|
69
|
+
metadata:
|
|
70
|
+
homepage_uri: https://github.com/SICSoftwareGmbH/sensu-plugins-ruby
|
|
71
|
+
source_code_uri: https://github.com/SICSoftwareGmbH/sensu-plugins-ruby
|
|
72
|
+
changelog_uri: https://github.com/SICSoftwareGmbH/sensu-plugins-ruby/blob/master/CHANGELOG.md
|
|
73
|
+
post_install_message:
|
|
74
|
+
rdoc_options: []
|
|
75
|
+
require_paths:
|
|
76
|
+
- lib
|
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - ">="
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '0'
|
|
87
|
+
requirements: []
|
|
88
|
+
rubygems_version: 3.0.4
|
|
89
|
+
signing_key:
|
|
90
|
+
specification_version: 4
|
|
91
|
+
summary: This plugin provides checks for the used ruby version and security advisories
|
|
92
|
+
for used gems
|
|
93
|
+
test_files: []
|