sparoid 1.0.4 → 1.0.9
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/.gitignore +1 -0
- data/CHANGELOG.md +21 -0
- data/README.md +1 -1
- data/exe/sparoid +6 -2
- data/lib/sparoid.rb +6 -1
- data/lib/sparoid/cli.rb +9 -4
- 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: 3e5d9f60a2c48147b21a1bd2970f9b495b8f28d6627b3783e27870fd7572e87e
|
|
4
|
+
data.tar.gz: 5448587233f343935ea5bd5ccc0484f24f852b90d129a0192627847b32c14032
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba3a127fc5d7ec9cd6c5e859a467e65428a4597eb5069f32c06e69504aca2aeecdb7fcab691c781d07fd7c1c00df0dd04555780f51f5da7678626fa41bf87f33
|
|
7
|
+
data.tar.gz: b7f356bb8018f0a653263103adbd22da116b4f0ea6bd03a646ecd43c3b61f79429b38e7597e20b9d0ea7401074f6043ad3fa9c122dda0a9af3ba0c285952201c
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [1.0.9] - 2021-05-23
|
|
2
|
+
|
|
3
|
+
- Exit gracefully on abort (ctrl-c) instead of dumping huge stacktrace
|
|
4
|
+
- Sleep 20ms aftering sending UDP package to allow for remote host to open its firewall
|
|
5
|
+
|
|
6
|
+
## [1.0.8] - 2021-04-27
|
|
7
|
+
|
|
8
|
+
- Get ENV variables if config file is missing
|
|
9
|
+
|
|
10
|
+
## [1.0.7] - 2021-04-27
|
|
11
|
+
|
|
12
|
+
- Get key and hmac key from ENV variables
|
|
13
|
+
|
|
14
|
+
## [1.0.6] - 2021-04-13
|
|
15
|
+
|
|
16
|
+
- Use static IP for opendns resolver, saves one DNS lookup
|
|
17
|
+
|
|
18
|
+
## [1.0.5] - 2021-04-12
|
|
19
|
+
|
|
20
|
+
- Prefix all logging with `Sparoid: `
|
|
21
|
+
|
|
1
22
|
## [1.0.4] - 2021-03-25
|
|
2
23
|
|
|
3
24
|
- Only warn if config is missing when connecting with CLI
|
data/README.md
CHANGED
data/exe/sparoid
CHANGED
data/lib/sparoid.rb
CHANGED
|
@@ -14,6 +14,11 @@ module Sparoid
|
|
|
14
14
|
msg = message(public_ip)
|
|
15
15
|
data = prefix_hmac(hmac_key, encrypt(key, msg))
|
|
16
16
|
sendmsg(host, port, data)
|
|
17
|
+
|
|
18
|
+
# wait some time for the server to actually open the port
|
|
19
|
+
# if we don't wait the next SYN package will be dropped
|
|
20
|
+
# and it have to be redelivered, adding 1 second delay
|
|
21
|
+
sleep 0.02
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
# Generate new aes and hmac keys, print to stdout
|
|
@@ -71,7 +76,7 @@ module Sparoid
|
|
|
71
76
|
end
|
|
72
77
|
|
|
73
78
|
def public_ip
|
|
74
|
-
Resolv::DNS.open(nameserver: ["
|
|
79
|
+
Resolv::DNS.open(nameserver: ["208.67.222.222", "208.67.220.220"]) do |dns|
|
|
75
80
|
dns.getresource("myip.opendns.com", Resolv::DNS::Resource::IN::A).address
|
|
76
81
|
end
|
|
77
82
|
end
|
data/lib/sparoid/cli.rb
CHANGED
|
@@ -11,9 +11,9 @@ module Sparoid
|
|
|
11
11
|
def auth(host, port = 8484)
|
|
12
12
|
send_auth(host, port, options[:config])
|
|
13
13
|
rescue Errno::ENOENT
|
|
14
|
-
abort "Config not found"
|
|
14
|
+
abort "Sparoid: Config not found"
|
|
15
15
|
rescue StandardError => e
|
|
16
|
-
abort e.message
|
|
16
|
+
abort "Sparoid: #{e.message}"
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
desc "connect HOST PORT [SPA-PORT]", "Send a SPA, TCP connect, and then pass the FD back to the parent"
|
|
@@ -22,11 +22,11 @@ module Sparoid
|
|
|
22
22
|
begin
|
|
23
23
|
send_auth(host, spa_port, options[:config])
|
|
24
24
|
rescue Errno::ENOENT
|
|
25
|
-
warn "Config not found"
|
|
25
|
+
warn "Sparoid: Config not found"
|
|
26
26
|
end
|
|
27
27
|
Sparoid.fdpass(host, port)
|
|
28
28
|
rescue StandardError => e
|
|
29
|
-
abort e.message
|
|
29
|
+
abort "Sparoid: #{e.message}"
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
desc "keygen", "Generate an encryption key and a HMAC key"
|
|
@@ -47,6 +47,11 @@ module Sparoid
|
|
|
47
47
|
|
|
48
48
|
def parse_ini(path)
|
|
49
49
|
File.readlines(File.expand_path(path)).map! { |line| line.split("=", 2).map!(&:strip) }.to_h
|
|
50
|
+
rescue Errno::ENOENT
|
|
51
|
+
{
|
|
52
|
+
"key" => ENV["SPAROID_KEY"],
|
|
53
|
+
"hmac-key" => ENV["SPAROID_HMAC_KEY"]
|
|
54
|
+
}
|
|
50
55
|
end
|
|
51
56
|
|
|
52
57
|
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.9
|
|
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-05-23 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.15
|
|
73
73
|
signing_key:
|
|
74
74
|
specification_version: 4
|
|
75
75
|
summary: Single Packet Authorisation client
|