pipe2me-client 0.2.14 → 0.2.15
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 +4 -4
- data/lib/pipe2me/cli.rb +13 -8
- data/lib/pipe2me/ext/http.rb +21 -1
- data/lib/pipe2me/tunnel/openssl.rb +6 -1
- data/lib/pipe2me/tunnel.rb +1 -0
- data/lib/pipe2me/version.rb +1 -1
- data/rakelib/gem.rake +6 -2
- data/test/ssl-test.sh +3 -3
- 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: a9d71c8d4790ffb256420754f6da2f3883d640b4
|
4
|
+
data.tar.gz: d9cf6ae6b8c13975fa9e70cff666bcd0af35fd3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcab1a08ad5d8900dd697f2ddd0a421c3e76b814cbb1c2b9789e7f97d6d87852d20ef0a6d3f3bd9c3f6cdd22ab7834a51403dbe1ffd375e22c8a1ea340eae966
|
7
|
+
data.tar.gz: ec2c3cecba6b539aef79e71710cc5d7e235740aa738b738788b50d90cca8ea6ddbdfa884a12484aef7b73970ca15f0b89cbdca72d1a17862bd1803afad91bd3c
|
data/lib/pipe2me/cli.rb
CHANGED
@@ -2,10 +2,11 @@ require "thor"
|
|
2
2
|
require_relative "which"
|
3
3
|
|
4
4
|
class Pipe2me::CLI < Thor
|
5
|
-
class_option :dir,
|
6
|
-
class_option :verbose,
|
7
|
-
class_option :quiet,
|
8
|
-
class_option :silent,
|
5
|
+
class_option :dir, :type => :string
|
6
|
+
class_option :verbose, :aliases => "-v", :type => :boolean
|
7
|
+
class_option :quiet, :aliases => "-q", :type => :boolean
|
8
|
+
class_option :silent, :type => :boolean
|
9
|
+
class_option :insecure, :aliases => "-k", :type => :boolean
|
9
10
|
|
10
11
|
private
|
11
12
|
|
@@ -23,6 +24,10 @@ class Pipe2me::CLI < Thor
|
|
23
24
|
Dir.chdir options[:dir]
|
24
25
|
UI.info "Changed into", options[:dir]
|
25
26
|
end
|
27
|
+
|
28
|
+
if options[:insecure]
|
29
|
+
Pipe2me::HTTP.enable_insecure_mode
|
30
|
+
end
|
26
31
|
end
|
27
32
|
|
28
33
|
public
|
@@ -37,10 +42,10 @@ class Pipe2me::CLI < Thor
|
|
37
42
|
end
|
38
43
|
|
39
44
|
desc "setup", "fetch a new tunnel setup"
|
40
|
-
option :server,
|
41
|
-
option :token,
|
42
|
-
option :protocols,
|
43
|
-
option :ports,
|
45
|
+
option :server, :aliases => "-s", :default => "http://test.pipe2.me"
|
46
|
+
option :token, :required => true # "tunnel token"
|
47
|
+
option :protocols, :default => "https" # "protocol names, e.g. 'http,https,imap'"
|
48
|
+
option :ports, :type => :string # "local ports, one per protocol"
|
44
49
|
def setup
|
45
50
|
handle_global_options
|
46
51
|
|
data/lib/pipe2me/ext/http.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "net/http"
|
2
|
+
require "net/https"
|
2
3
|
require "ostruct"
|
3
4
|
require "forwardable"
|
4
5
|
|
@@ -7,6 +8,15 @@ require "forwardable"
|
|
7
8
|
module Pipe2me::HTTP
|
8
9
|
extend self
|
9
10
|
|
11
|
+
def self.enable_insecure_mode
|
12
|
+
UI.error "Enabling insecure_mode"
|
13
|
+
@insecure_mode = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.insecure_mode?
|
17
|
+
!! @insecure_mode
|
18
|
+
end
|
19
|
+
|
10
20
|
# Error to be raised when maximum number of redirections is reached.
|
11
21
|
class RedirectionLimit < RuntimeError; end
|
12
22
|
|
@@ -159,8 +169,13 @@ module Pipe2me::HTTP
|
|
159
169
|
do_raw_request verb, uri, headers, body, config.max_redirections, uri, Net::HTTP::Get
|
160
170
|
end
|
161
171
|
|
172
|
+
rescue ::OpenSSL::SSL::SSLError
|
173
|
+
UI.error "#{uri}: SSL connection failed"
|
174
|
+
UI.error "#{uri}: Note: you may use the -k/--insecure flag to disable certificate validation"
|
175
|
+
raise $!
|
162
176
|
rescue
|
163
|
-
|
177
|
+
UI.error "#{uri} #{$!.class} #{$!}"
|
178
|
+
raise $!
|
164
179
|
end
|
165
180
|
|
166
181
|
def do_raw_request(verb, uri, headers, body, max_redirections, original_url, redirection_verb = Net::HTTP::Get)
|
@@ -175,6 +190,11 @@ module Pipe2me::HTTP
|
|
175
190
|
http = Net::HTTP.new(uri.host, uri.port || default_port)
|
176
191
|
if uri.scheme == "https"
|
177
192
|
http.use_ssl = true
|
193
|
+
|
194
|
+
if insecure_mode?
|
195
|
+
UI.warn "Disabling certificate validation."
|
196
|
+
http.verify_mode = ::OpenSSL::SSL::VERIFY_NONE
|
197
|
+
end
|
178
198
|
end
|
179
199
|
|
180
200
|
# create request and get response
|
@@ -3,6 +3,7 @@ module Pipe2me::Tunnel::OpenSSL
|
|
3
3
|
|
4
4
|
SSL_KEY = Pipe2me::Tunnel::SSL_KEY
|
5
5
|
SSL_CERT = Pipe2me::Tunnel::SSL_CERT
|
6
|
+
SSL_CACERT = Pipe2me::Tunnel::SSL_CACERT
|
6
7
|
|
7
8
|
def openssl_conf
|
8
9
|
File.join(File.dirname(__FILE__), "openssl.conf")
|
@@ -19,11 +20,15 @@ module Pipe2me::Tunnel::OpenSSL
|
|
19
20
|
"-days", "7300"
|
20
21
|
end
|
21
22
|
|
22
|
-
# send cert signing request to server and receive certificate
|
23
|
+
# send cert signing request to server and receive certificate and root certificate.
|
23
24
|
def ssl_certsign
|
24
25
|
cert = HTTP.post!("#{url}/cert.pem", File.read("#{SSL_KEY}.csr"), {'Content-Type' =>'text/plain'})
|
25
26
|
UI.debug "received certificate:\n#{cert}"
|
26
27
|
|
27
28
|
File.write SSL_CERT, cert
|
29
|
+
|
30
|
+
cacert = HTTP.get! "#{Pipe2me::Config.server}/cacert"
|
31
|
+
UI.error "Got #{cacert.length} byte from #{Pipe2me::Config.server}/cacert"
|
32
|
+
File.write SSL_CACERT, cacert
|
28
33
|
end
|
29
34
|
end
|
data/lib/pipe2me/tunnel.rb
CHANGED
data/lib/pipe2me/version.rb
CHANGED
data/rakelib/gem.rake
CHANGED
@@ -8,9 +8,13 @@ task :release => :changelog
|
|
8
8
|
task :changelog do
|
9
9
|
require "simple/ui"
|
10
10
|
FileUtils.cp "CHANGELOG.md", "CHANGELOG.old.md"
|
11
|
-
last_version = `git tag -l 'v[0-9]*' | sort -n | tail -n 1`
|
12
|
-
last_version.chomp!
|
13
11
|
|
12
|
+
version_tags = `git tag -l 'v[0-9]*'`.split("\n")
|
13
|
+
version_tags = version_tags.sort_by do |tag|
|
14
|
+
tag.split(/\D+/).reject(&:empty?).map(&:to_i)
|
15
|
+
end
|
16
|
+
last_version = version_tags.last
|
17
|
+
|
14
18
|
current_version = `bin/pipe2me version`.chomp
|
15
19
|
UI.success "Changes from #{last_version} .. #{current_version}:"
|
16
20
|
|
data/test/ssl-test.sh
CHANGED
@@ -11,16 +11,16 @@ it_sets_up_ssl_certs() {
|
|
11
11
|
# setup the pipe2me client. This must create a private key and a server
|
12
12
|
# certificate, amongst other things. The certificate must contain the
|
13
13
|
# correct name.
|
14
|
-
|
15
14
|
|
16
15
|
fqdn=$($pipe2me setup --server $pipe2me_server --token $pipe2me_token)
|
17
16
|
|
18
17
|
# test for private key
|
19
|
-
test -f pipe2me.openssl.priv
|
20
18
|
cat pipe2me.openssl.priv | grep -E "BEGIN.*PRIVATE KEY"
|
21
19
|
|
20
|
+
# test for CAcert
|
21
|
+
cat pipe2me.cacert | grep "BEGIN CERTIFICATE"
|
22
|
+
|
22
23
|
# test for certificate
|
23
|
-
test -f pipe2me.openssl.cert
|
24
24
|
cat pipe2me.openssl.cert | grep "BEGIN CERTIFICATE"
|
25
25
|
|
26
26
|
# verify name in certificate
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipe2me-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radiospiel
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: pipe2me command line client V0.2.
|
69
|
+
description: pipe2me command line client V0.2.15; (c) The kinko team, 2013, 2014.
|
70
70
|
email: contact@kinko.me
|
71
71
|
executables:
|
72
72
|
- pipe2me
|
@@ -133,5 +133,5 @@ rubyforge_project:
|
|
133
133
|
rubygems_version: 2.2.2
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
|
-
summary: pipe2me command line client V0.2.
|
136
|
+
summary: pipe2me command line client V0.2.15; (c) The kinko team, 2013, 2014.
|
137
137
|
test_files: []
|