sparoid 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/lib/sparoid.rb +6 -0
- data/lib/sparoid/cli.rb +9 -3
- data/lib/sparoid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6069344b10804fda4024554fc6bfb9490c52ef0ef197dfcb598724cb760f587d
|
4
|
+
data.tar.gz: 35cc6eec43bb0b03fd2938166628618936c9659768b5454d880d96b942da04d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c361191ea89d2c980dc89a639c11cdf77575006526560f00ae4a200e79b9ba5a66b282d1f2b9b750af5135652316cbffc87476100af6799dc904e8aa8b5f2ffb
|
7
|
+
data.tar.gz: 3b6df9484af0ee540bedff510f9643642151da0558767d9a20de4dfb7d8217df5ff25623802ccba00c5855ba3e002c22743eac0bbfff9322480b86d2ce4e2c3d
|
data/README.md
CHANGED
@@ -20,7 +20,15 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
...
|
24
|
+
|
25
|
+
Can be used with OpenSSH's ProxyCommand/ProxyUseFdpass to send the packet before connecting, open the TCP connection and that pass that connection back to the SSH client.
|
26
|
+
|
27
|
+
```
|
28
|
+
Host *.example.com
|
29
|
+
ProxyCommand sparoid send %h --passfd %p
|
30
|
+
ProxyUseFdpass yes
|
31
|
+
```
|
24
32
|
|
25
33
|
## Development
|
26
34
|
|
data/lib/sparoid.rb
CHANGED
@@ -68,5 +68,11 @@ module Sparoid
|
|
68
68
|
puts "hmac-key = #{hmac_key}"
|
69
69
|
end
|
70
70
|
|
71
|
+
def self.fdpass(host, port)
|
72
|
+
ssh = Socket.tcp host, port
|
73
|
+
parent = Socket.for_fd(1)
|
74
|
+
parent.sendmsg "\0", 0, nil, Socket::AncillaryData.unix_rights(ssh)
|
75
|
+
end
|
76
|
+
|
71
77
|
class Error < StandardError; end
|
72
78
|
end
|
data/lib/sparoid/cli.rb
CHANGED
@@ -7,12 +7,18 @@ module Sparoid
|
|
7
7
|
# CLI
|
8
8
|
class CLI < Thor
|
9
9
|
desc "send HOST [PORT]", "Send a packet"
|
10
|
-
method_option :config,
|
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"
|
11
15
|
def send(host, port = 8484)
|
12
|
-
|
16
|
+
config = File.expand_path(options[:config] || "~/.sparoid.ini")
|
17
|
+
abort "Config '#{config}' not found" unless File.exist? config
|
13
18
|
|
14
|
-
key, hmac_key = get_keys(parse_ini(
|
19
|
+
key, hmac_key = get_keys(parse_ini(config))
|
15
20
|
Sparoid.send(key, hmac_key, host, port.to_i)
|
21
|
+
Sparoid.fdpass(host, options[:fdpass]) if options[:fdpass]
|
16
22
|
end
|
17
23
|
|
18
24
|
desc "keygen", "Generate an encryption key and a HMAC key"
|
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.1
|
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-03-
|
11
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|