ok_computer-clamav 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cba4b6796c3b0cde03e5aac46f7f757abf4987be91b459e8f47ed217b22698b7
4
+ data.tar.gz: 7d001359aa532a4f6b6f3096d4831a7ec6822d33042d3912b6b46d0728876eaf
5
+ SHA512:
6
+ metadata.gz: 7fd45eafaacd5e7423f8018d5e2d67c59593711ac559f17b2eda6d1f034512d866ccbcee3af5b0d8b905441b53da80d2c1d92131ca751070768df41dfe0b83b6
7
+ data.tar.gz: 40abf4e0a663318785bef47895e54ceb41d370c533d89019bacff941e83e7ca13ad7ea7acc084856221d3513edeb92a667df015ac7e563a64b9dd8056bff5c19
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in ok_computer-clamav.gemspec
6
+ gemspec
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ok_computer-clamav (0.1.0)
5
+ okcomputer (>= 1.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ okcomputer (1.17.3)
12
+ rake (10.5.0)
13
+ rspec (3.8.0)
14
+ rspec-core (~> 3.8.0)
15
+ rspec-expectations (~> 3.8.0)
16
+ rspec-mocks (~> 3.8.0)
17
+ rspec-core (3.8.0)
18
+ rspec-support (~> 3.8.0)
19
+ rspec-expectations (3.8.2)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-mocks (3.8.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-support (3.8.0)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ bundler (~> 1.16)
32
+ ok_computer-clamav!
33
+ rake (~> 10.0)
34
+ rspec (~> 3.0)
35
+
36
+ BUNDLED WITH
37
+ 1.16.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Joost Baaij
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # OkComputer::Clamav
2
+
3
+ Monitor `clamd` from the luxury of your existing [OkComputer](https://github.com/sportngin/okcomputer/) setup!
4
+
5
+ This check will make noise when the daemon does not respond to messages. It
6
+ makes a socket connection, sends a PING and waits for a PONG. If any of that
7
+ does not occur, you'll know it.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'ok_computer-clamav'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ ## Usage
22
+
23
+ In `config/initializers/ok_computer.rb`:
24
+
25
+ ``` ruby
26
+ OkComputer::Registry.register "clamd", OkComputer::Clamav::ClamdCheck.new
27
+ ```
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/spacebabies/ok_computer-clamav.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ok_computer/clamav"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ require "ok_computer/clamav/version"
2
+
3
+ module OkComputer
4
+ module Clamav
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+ module OkComputer
2
+ module Clamav
3
+ # This class performs a health check on a clamd instance using the
4
+ # {PING command}[https://linux.die.net/man/8/clamd].
5
+ #
6
+ class ClamdCheck < OkComputer::Check
7
+ attr_reader :socket_path
8
+
9
+ # `socket_path`: the Unix socket path clamd is using.
10
+ #
11
+ # default: /var/run/clamav/clamd.ctl (Debian/Ubuntu)
12
+ # homebrew on macOS uses /tmp/clamd.socket
13
+ def initialize(socket_path:'/var/run/clamav/clamd.ctl')
14
+ @socket_path = socket_path
15
+ end
16
+
17
+ def check
18
+ socket = UNIXSocket.new(socket_path)
19
+ socket.write "nPING\n"
20
+ clamd_status = socket.readline
21
+ socket.close
22
+
23
+ if clamd_status != "PONG\n"
24
+ mark_failure
25
+ mark_message "clamd responded to PING with #{clamd_status}"
26
+ else
27
+ mark_message 'clamd is running and responds to PING'
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ module OkComputer
2
+ module Clamav
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "ok_computer/clamav/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ok_computer-clamav"
8
+ spec.version = OkComputer::Clamav::VERSION
9
+ spec.license = 'MIT'
10
+ spec.authors = ["Joost Baaij"]
11
+ spec.email = ["joost@spacebabies.nl"]
12
+
13
+ spec.summary = 'Monitor ClamAV using OK Computer'
14
+ spec.description = <<-EOF
15
+ Monitor `clamd` from the luxury of your existing OkComputer setup!
16
+ This check will make noise when the daemon does not respond to messages. It
17
+ makes a socket connection, sends a PING and waits for a PONG. If any of that
18
+ does not occur, you'll know it.
19
+ EOF
20
+ spec.homepage = 'https://github.com/spacebabies/ok_computer-clamav'
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_runtime_dependency 'okcomputer', '>= 1.0.0'
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ok_computer-clamav
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joost Baaij
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-10-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: okcomputer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.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.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: |2
70
+ Monitor `clamd` from the luxury of your existing OkComputer setup!
71
+ This check will make noise when the daemon does not respond to messages. It
72
+ makes a socket connection, sends a PING and waits for a PONG. If any of that
73
+ does not occur, you'll know it.
74
+ email:
75
+ - joost@spacebabies.nl
76
+ executables: []
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - LICENSE
83
+ - README.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/setup
87
+ - lib/ok_computer/clamav.rb
88
+ - lib/ok_computer/clamav/clamd_check.rb
89
+ - lib/ok_computer/clamav/version.rb
90
+ - ok_computer-clamav.gemspec
91
+ homepage: https://github.com/spacebabies/ok_computer-clamav
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.7.7
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Monitor ClamAV using OK Computer
115
+ test_files: []