sparoid 1.0.2 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +20 -0
- data/lib/sparoid.rb +1 -1
- data/lib/sparoid/cli.rb +23 -14
- data/lib/sparoid/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a97b0d586778f3f851e5c42039bffaf461bb2e8927d9fea86cd69c8cfa0e1e9
|
4
|
+
data.tar.gz: b66ff9a2c806838408c546d38c3698c7bc5334d3b11aba00d1e4de8f9e848f05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f2643b8599ab7c78e30b3e6927ad79e405becebfa8cfe617a0d7245e82ec4d0b11c9fcbf9cff2365403b59d2472260b4ab8b290e897991d8f3e6b1b19736e1e
|
7
|
+
data.tar.gz: '048ecd5b85d177c044626fb11cf304fbbc14b906d366566e34c7afa535ec419ba4b8a9369108ab67fc121496908e4a3ac0f42a2821db723bb7771a46ab26ab7e'
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## [1.0.7] - 2021-04-27
|
2
|
+
|
3
|
+
- Get key and hmac key from ENV variables
|
4
|
+
|
5
|
+
## [1.0.6] - 2021-04-13
|
6
|
+
|
7
|
+
- Use static IP for opendns resolver, saves one DNS lookup
|
8
|
+
|
9
|
+
## [1.0.5] - 2021-04-12
|
10
|
+
|
11
|
+
- Prefix all logging with `Sparoid: `
|
12
|
+
|
13
|
+
## [1.0.4] - 2021-03-25
|
14
|
+
|
15
|
+
- Only warn if config is missing when connecting with CLI
|
16
|
+
|
17
|
+
## [1.0.3] - 2021-03-17
|
18
|
+
|
19
|
+
- Nicer error handling in CLI, remove --fdpass option
|
20
|
+
|
1
21
|
## [1.0.2] - 2021-03-15
|
2
22
|
|
3
23
|
- `sparoid send` renamed to `sparoid auth`
|
data/lib/sparoid.rb
CHANGED
@@ -71,7 +71,7 @@ module Sparoid
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def public_ip
|
74
|
-
Resolv::DNS.open(nameserver: ["
|
74
|
+
Resolv::DNS.open(nameserver: ["208.67.222.222", "208.67.220.220"]) do |dns|
|
75
75
|
dns.getresource("myip.opendns.com", Resolv::DNS::Resource::IN::A).address
|
76
76
|
end
|
77
77
|
end
|
data/lib/sparoid/cli.rb
CHANGED
@@ -7,24 +7,26 @@ module Sparoid
|
|
7
7
|
# CLI
|
8
8
|
class CLI < Thor
|
9
9
|
desc "auth HOST [PORT]", "Send a authorization packet"
|
10
|
-
method_option :config, desc: "Path to a config file, INI format, with key and hmac-key"
|
11
|
-
method_option :fdpass,
|
12
|
-
type: :numeric,
|
13
|
-
desc: "After sending, open a TCP connection and pass the FD back to the calling process. \
|
14
|
-
For use with OpenSSH ProxyCommand and ProxyUseFdpass"
|
10
|
+
method_option :config, desc: "Path to a config file, INI format, with key and hmac-key", default: "~/.sparoid.ini"
|
15
11
|
def auth(host, port = 8484)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Sparoid
|
21
|
-
Sparoid.fdpass(host, options[:fdpass]) if options[:fdpass]
|
12
|
+
send_auth(host, port, options[:config])
|
13
|
+
rescue Errno::ENOENT
|
14
|
+
abort "Sparoid: Config not found"
|
15
|
+
rescue StandardError => e
|
16
|
+
abort "Sparoid: #{e.message}"
|
22
17
|
end
|
23
18
|
|
24
|
-
desc "connect", "Send a SPA, TCP connect, and then pass the FD back to the parent"
|
19
|
+
desc "connect HOST PORT [SPA-PORT]", "Send a SPA, TCP connect, and then pass the FD back to the parent"
|
20
|
+
method_option :config, desc: "Path to a config file, INI format, with key and hmac-key", default: "~/.sparoid.ini"
|
25
21
|
def connect(host, port, spa_port = 8484)
|
26
|
-
|
22
|
+
begin
|
23
|
+
send_auth(host, spa_port, options[:config])
|
24
|
+
rescue Errno::ENOENT
|
25
|
+
warn "Sparoid: Config not found"
|
26
|
+
end
|
27
27
|
Sparoid.fdpass(host, port)
|
28
|
+
rescue StandardError => e
|
29
|
+
abort "Sparoid: #{e.message}"
|
28
30
|
end
|
29
31
|
|
30
32
|
desc "keygen", "Generate an encryption key and a HMAC key"
|
@@ -38,8 +40,15 @@ module Sparoid
|
|
38
40
|
|
39
41
|
private
|
40
42
|
|
43
|
+
def send_auth(host, port, config)
|
44
|
+
key = ENV["SPAROID_KEY"]
|
45
|
+
hmac_key = ENV["SPAROID_HMAC_KEY"]
|
46
|
+
key, hmac_key = get_keys(parse_ini(config)) if config
|
47
|
+
Sparoid.auth(key, hmac_key, host, port.to_i)
|
48
|
+
end
|
49
|
+
|
41
50
|
def parse_ini(path)
|
42
|
-
File.readlines(path).map! { |
|
51
|
+
File.readlines(File.expand_path(path)).map! { |line| line.split("=", 2).map!(&:strip) }.to_h
|
43
52
|
end
|
44
53
|
|
45
54
|
def get_keys(config)
|
data/lib/sparoid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Hörberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.2.3
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: Single Packet Authorisation client
|