sparoid 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97ffed008109eb32f070fc300c536cd29f000c6ff943b67bff64658c218f70ce
4
- data.tar.gz: 87fcc661eb04ee0a79b9d9cbd4ef12b5f80c8a4c1856569076f1eac57a37c41b
3
+ metadata.gz: 6069344b10804fda4024554fc6bfb9490c52ef0ef197dfcb598724cb760f587d
4
+ data.tar.gz: 35cc6eec43bb0b03fd2938166628618936c9659768b5454d880d96b942da04d1
5
5
  SHA512:
6
- metadata.gz: ded717258409725cbf49b97fd9c704dbbe550a024f4ce09b484640306079f67ccfd43f64d063326c787ed700cef4db09179b6facb98c7403304dad0a861216ea
7
- data.tar.gz: 180a6a9ae33549e198130f73e3e4bd5e9ce4e63727668e6ea2124e22ade18b4e7324efb15abf00053fc22b0728a05d17f49cff353a6f68cdf6b3bf9709b5fab4
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
- TODO: Write usage instructions here
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, default: "~/.sparoid.ini"
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
- abort "Config not found" unless File.exist? options[:config]
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(options[:config]))
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"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sparoid
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
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.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 00:00:00.000000000 Z
11
+ date: 2021-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor