clamby 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +9 -4
- data/lib/clamby.rb +14 -2
- data/lib/clamby/version.rb +1 -1
- data/spec/clamby_spec.rb +22 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b01112eed29677aba4c41681568068a07d1fd44f
|
4
|
+
data.tar.gz: ea48a1a4470c40bcdc5e5d19ccda1c3013f711a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1d122187e6860f951be981e45fddc4cc7ba816228f4b0665954595f90a93653b205f24099e6a0df5aae99c79234337f1f89126cb770d607576ece7890c5d0d
|
7
|
+
data.tar.gz: 330b3bea8825e486404436c55e0b18ba4848673aa5e19e6f6b0fc75a62ce05d056db0d28ab3fc8d52ec2c99cb69dc6ae393a7dccf07949234b4b32ee55b90a95
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -64,25 +64,30 @@ It's good to note that Clamby will not by default delete files which had a virus
|
|
64
64
|
```
|
65
65
|
|
66
66
|
|
67
|
-
#Configuration
|
67
|
+
# Configuration
|
68
68
|
|
69
69
|
Configuration is rather limited right now. You can exclude the check if `clamscan` exists which will save a bunch of time for scanning your files. However, for development purposes, your machine may not have `clamscan` installed and you may wonder why it's not working properly. This is just to give you a reminder to install `clamscan` on your development machine and production machine. You can add the following to a config file, `clamby_setup.rb` to your initializers directory.
|
70
70
|
|
71
71
|
There has been added additional functionality where you can override exceptions. If you set the exceptions below to false, then there will not be a hard exception generated. Instead, it will post to your log that an error had occured. By default each one of these configuration options are set to true. You may want to set these to false in your production environment.
|
72
72
|
|
73
|
+
Setting the `fdpass` configuration option to `true` will pass the `--fdpass` option to clamscan. This might be useful if you are encountering permissions problems between clamscan and files being created by your application. From the clamscan man page:
|
74
|
+
|
75
|
+
`--fdpass : Pass the file descriptor permissions to clamd. This is useful if clamd is running as a different user as it is faster than streaming the file to clamd. Only available if connected to clamd via local(unix) socket.`
|
76
|
+
|
73
77
|
```ruby
|
74
78
|
Clamby.configure({
|
75
79
|
:check => false,
|
76
80
|
:daemonize => false,
|
77
81
|
:error_clamscan_missing => false,
|
78
82
|
:error_file_missing => false,
|
79
|
-
:error_file_virus => false
|
83
|
+
:error_file_virus => false,
|
84
|
+
:fdpass => false
|
80
85
|
})
|
81
86
|
```
|
82
87
|
|
83
88
|
I highly recommend using the `daemonize` set to true. This will allow for clamscan to remain in memory and will not have to load for each virus scan. It will save several seconds per request.
|
84
89
|
|
85
|
-
#Dependencies
|
90
|
+
# Dependencies
|
86
91
|
|
87
92
|
***Ubuntu***
|
88
93
|
|
@@ -108,7 +113,7 @@ This opens the root crontab file in a text editor. Add the following line
|
|
108
113
|
|
109
114
|
`57 08 * * * sudo freshclam`
|
110
115
|
|
111
|
-
#LICENSE
|
116
|
+
# LICENSE
|
112
117
|
|
113
118
|
Copyright (c) 2016 kobaltz
|
114
119
|
|
data/lib/clamby.rb
CHANGED
@@ -7,7 +7,8 @@ module Clamby
|
|
7
7
|
:daemonize => false,
|
8
8
|
:error_clamscan_missing => true,
|
9
9
|
:error_file_missing => true,
|
10
|
-
:error_file_virus => false
|
10
|
+
:error_file_virus => false,
|
11
|
+
:fdpass => false
|
11
12
|
}
|
12
13
|
|
13
14
|
@valid_config_keys = @config.keys
|
@@ -22,10 +23,21 @@ module Clamby
|
|
22
23
|
! value
|
23
24
|
end
|
24
25
|
|
26
|
+
# Assemble the system command to be called, including optional flags
|
27
|
+
# @param [String] path path to the file being scanned
|
28
|
+
# @return [String] command to be executed
|
29
|
+
def self.system_command(path)
|
30
|
+
command = clamd_executable_name
|
31
|
+
command += ' --fdpass' if @config[:fdpass]
|
32
|
+
command += " #{path}"
|
33
|
+
command += ' --no-summary'
|
34
|
+
command
|
35
|
+
end
|
36
|
+
|
25
37
|
def self.virus?(path)
|
26
38
|
return nil unless scanner_exists?
|
27
39
|
return nil unless file_exists?(path)
|
28
|
-
scanner = system(
|
40
|
+
scanner = system(system_command(path))
|
29
41
|
|
30
42
|
return false if scanner
|
31
43
|
return true unless @config[:error_file_virus]
|
data/lib/clamby/version.rb
CHANGED
data/spec/clamby_spec.rb
CHANGED
@@ -46,4 +46,26 @@ describe Clamby do
|
|
46
46
|
expect(Clamby.virus?('eicar.com')).to be true
|
47
47
|
File.delete('eicar.com')
|
48
48
|
end
|
49
|
+
|
50
|
+
# From the clamscan man page:
|
51
|
+
# Pass the file descriptor permissions to clamd. This is useful if clamd is
|
52
|
+
# running as a different user as it is faster than streaming the file to
|
53
|
+
# clamd. Only available if connected to clamd via local(unix) socket.
|
54
|
+
context 'fdpass option' do
|
55
|
+
it 'is false by default' do
|
56
|
+
expect(Clamby.config[:fdpass]).to eq false
|
57
|
+
end
|
58
|
+
it 'accepts an fdpass option in the config' do
|
59
|
+
Clamby.configure(fdpass: true)
|
60
|
+
expect(Clamby.config[:fdpass]).to eq true
|
61
|
+
end
|
62
|
+
it 'does not include fdpass in the command by default' do
|
63
|
+
Clamby.configure(fdpass: false)
|
64
|
+
expect(Clamby.system_command(good_path)).to eq "clamscan #{good_path} --no-summary"
|
65
|
+
end
|
66
|
+
it 'passes the fdpass option when invoking clamscan if it is set' do
|
67
|
+
Clamby.configure(fdpass: true)
|
68
|
+
expect(Clamby.system_command(good_path)).to eq "clamscan --fdpass #{good_path} --no-summary"
|
69
|
+
end
|
70
|
+
end
|
49
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clamby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kobaltz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.6.
|
100
|
+
rubygems_version: 2.6.12
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: Scan file uploads with ClamAV
|