rubygems-checkcert 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +6 -0
- data/README.txt +60 -0
- data/Rakefile +14 -0
- data/lib/rubygems/commands/checkcert_command.rb +74 -0
- data/lib/rubygems_plugin.rb +3 -0
- metadata +112 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
= rubygems_checkcert
|
2
|
+
|
3
|
+
* http://rubyforge.org/projects/seattlerb
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Gem command to display the certificate of a gem, if any.
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* Quickly display the signing certificate for a gem.
|
12
|
+
* Unfortunately, this currently only works with local gems.
|
13
|
+
|
14
|
+
== SYNOPSIS:
|
15
|
+
|
16
|
+
% gem checkcert ZenTest
|
17
|
+
|
18
|
+
Certificate:
|
19
|
+
Data:
|
20
|
+
Version: 3 (0x2)
|
21
|
+
Serial Number: 0 (0x0)
|
22
|
+
Signature Algorithm: sha1WithRSAEncryption
|
23
|
+
Issuer: CN=ryand-ruby, DC=zenspider, DC=com
|
24
|
+
...
|
25
|
+
|
26
|
+
% gem checkcert autotest
|
27
|
+
ERROR: Gem 'autotest' is not signed
|
28
|
+
|
29
|
+
== REQUIREMENTS:
|
30
|
+
|
31
|
+
* openssl
|
32
|
+
|
33
|
+
== INSTALL:
|
34
|
+
|
35
|
+
* sudo gem install rubygems-checkcert
|
36
|
+
|
37
|
+
== LICENSE:
|
38
|
+
|
39
|
+
(The MIT License)
|
40
|
+
|
41
|
+
Copyright (c) Ryan Davis, seattle.rb
|
42
|
+
|
43
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
44
|
+
a copy of this software and associated documentation files (the
|
45
|
+
'Software'), to deal in the Software without restriction, including
|
46
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
47
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
48
|
+
permit persons to whom the Software is furnished to do so, subject to
|
49
|
+
the following conditions:
|
50
|
+
|
51
|
+
The above copyright notice and this permission notice shall be
|
52
|
+
included in all copies or substantial portions of the Software.
|
53
|
+
|
54
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
55
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
56
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
57
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
58
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
59
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
60
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "rubygems/command"
|
4
|
+
require "rubygems/version_option"
|
5
|
+
require "rubygems/local_remote_options"
|
6
|
+
require "rubygems/format"
|
7
|
+
|
8
|
+
##
|
9
|
+
# Gem command to display the certificate of a gem, if any.
|
10
|
+
|
11
|
+
class Gem::Commands::CheckcertCommand < Gem::Command
|
12
|
+
VERSION = '1.0.0'
|
13
|
+
|
14
|
+
include Gem::VersionOption
|
15
|
+
include Gem::LocalRemoteOptions
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
super("checkcert", "Display the certificate of a gem's signature, if any.",
|
19
|
+
:domain => :local, :version => Gem::Requirement.default)
|
20
|
+
|
21
|
+
add_version_option
|
22
|
+
add_local_remote_options
|
23
|
+
end
|
24
|
+
|
25
|
+
def arguments # :nodoc:
|
26
|
+
'GEMNAME name of an installed gem to check'
|
27
|
+
end
|
28
|
+
|
29
|
+
def defaults_str # :nodoc:
|
30
|
+
"--local --version='>= 0'"
|
31
|
+
end
|
32
|
+
|
33
|
+
def usage # :nodoc:
|
34
|
+
"#{program_name} GEMNAME [options]"
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_certificate
|
38
|
+
gem, specs = get_one_gem_name, []
|
39
|
+
|
40
|
+
dep = Gem::Dependency.new gem, options[:version]
|
41
|
+
|
42
|
+
if local? then
|
43
|
+
if File.exist? gem then
|
44
|
+
specs << Gem::Format.from_file_by_path(gem).spec # rescue nil
|
45
|
+
end
|
46
|
+
|
47
|
+
specs.push(*Gem.source_index.search(dep)) if specs.empty?
|
48
|
+
end
|
49
|
+
|
50
|
+
if remote? then
|
51
|
+
abort "rubygems sucks and doesn't include the cert info..."
|
52
|
+
end
|
53
|
+
|
54
|
+
if specs.empty? then
|
55
|
+
alert_error "Unknown gem '#{gem}'"
|
56
|
+
terminate_interaction 1
|
57
|
+
end
|
58
|
+
|
59
|
+
spec = specs.last
|
60
|
+
cert = spec.cert_chain.join
|
61
|
+
|
62
|
+
unless cert.empty? then
|
63
|
+
IO.popen("openssl x509 -noout -text", "w+") do |io|
|
64
|
+
io.puts cert
|
65
|
+
puts io.read
|
66
|
+
end
|
67
|
+
else
|
68
|
+
alert_error "Gem '#{gem}' is not signed"
|
69
|
+
terminate_interaction 1
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
alias :execute :check_certificate
|
74
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubygems-checkcert
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Ryan Davis
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-01 00:00:00 -08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rubyforge
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 0
|
30
|
+
- 4
|
31
|
+
version: 2.0.4
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: minitest
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 6
|
44
|
+
- 0
|
45
|
+
version: 1.6.0
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: hoe
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 2
|
57
|
+
- 6
|
58
|
+
- 0
|
59
|
+
version: 2.6.0
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
62
|
+
description: Gem command to display the certificate of a gem, if any.
|
63
|
+
email:
|
64
|
+
- ryand-ruby@zenspider.com
|
65
|
+
executables: []
|
66
|
+
|
67
|
+
extensions: []
|
68
|
+
|
69
|
+
extra_rdoc_files:
|
70
|
+
- History.txt
|
71
|
+
- Manifest.txt
|
72
|
+
- README.txt
|
73
|
+
files:
|
74
|
+
- History.txt
|
75
|
+
- Manifest.txt
|
76
|
+
- README.txt
|
77
|
+
- Rakefile
|
78
|
+
- lib/rubygems/commands/checkcert_command.rb
|
79
|
+
- lib/rubygems_plugin.rb
|
80
|
+
has_rdoc: true
|
81
|
+
homepage: http://rubyforge.org/projects/seattlerb
|
82
|
+
licenses: []
|
83
|
+
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options:
|
86
|
+
- --main
|
87
|
+
- README.txt
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
requirements: []
|
105
|
+
|
106
|
+
rubyforge_project: seattlerb
|
107
|
+
rubygems_version: 1.3.6
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: Gem command to display the certificate of a gem, if any.
|
111
|
+
test_files: []
|
112
|
+
|