ssh-locate 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -1
- data/Gemfile +3 -2
- data/README.md +11 -1
- data/features/agent-ids.feature +12 -0
- data/features/step_definitions/agent-ids.rb +13 -1
- data/lib/net/ssh/locate.rb +24 -5
- data/lib/net/ssh/locate/version.rb +1 -1
- metadata +28 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cc7830c637948887cfa9eede807ab7711c35a59c01639dacfe5a91f63ac0b741
|
4
|
+
data.tar.gz: 46d307a723df4ba12ad17e15281025e9267f702c18d082fbaab955de8206861c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bf11790093cf5c3b403970686e605c4955768fbca8a76bb1f181f99a2e634a672cff9f433372c228729a5157aa4c1eee3ccd3131d6a1618a4f0aae791460b435
|
7
|
+
data.tar.gz: 705054a24018b873d254c51ae650a167381133c5c0e68f4f4d52f2c66dc2eaf88a3ec9c3cb2b698532bd916e297886984b34258612490b1472d920544ca30675
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
@@ -8,7 +8,8 @@ group :dev do
|
|
8
8
|
gem "rb-inotify"
|
9
9
|
gem "libnotify"
|
10
10
|
gem "cucumber"
|
11
|
-
gem "aruba"
|
11
|
+
gem "aruba"
|
12
12
|
gem "guard-cucumber"
|
13
|
+
gem "rspec-expectations"
|
13
14
|
end
|
14
15
|
|
data/README.md
CHANGED
@@ -13,7 +13,9 @@ Features
|
|
13
13
|
SSH_AGENT_PID=12427; export SSH_AGENT_PID;
|
14
14
|
echo Agent pid 12427;
|
15
15
|
```
|
16
|
-
|
16
|
+
|
17
|
+
- supports the Fish shell
|
18
|
+
|
17
19
|
Installation
|
18
20
|
------------
|
19
21
|
|
@@ -31,6 +33,14 @@ In a later shell (or any process running for the user who owns the agent):
|
|
31
33
|
$ eval `ssh-locate`
|
32
34
|
Agent pid 13457
|
33
35
|
|
36
|
+
Fish startup
|
37
|
+
------------
|
38
|
+
|
39
|
+
You can launch and activate an agent at startup by adding this to your config.fish:
|
40
|
+
|
41
|
+
ssh-agent -a /tmp/arnaud
|
42
|
+
source (ssh-locate|psub -f)
|
43
|
+
|
34
44
|
Caveat
|
35
45
|
------
|
36
46
|
|
data/features/agent-ids.feature
CHANGED
@@ -5,6 +5,7 @@ Feature: Agent IDs
|
|
5
5
|
|
6
6
|
Scenario: Locate a running agent
|
7
7
|
Given an ssh agent has been launched without parameters
|
8
|
+
Given the user's shell is Bash
|
8
9
|
When I run `ssh-locate`
|
9
10
|
Then the output should contain "SSH_AUTH_SOCK="
|
10
11
|
And the output should contain "export SSH_AUTH_SOCK;"
|
@@ -20,6 +21,7 @@ Feature: Agent IDs
|
|
20
21
|
|
21
22
|
Scenario: Locate an agent that shows its socket
|
22
23
|
Given an ssh agent has been launched with a specific socket
|
24
|
+
Given the user's shell is Bash
|
23
25
|
When I run `ssh-locate`
|
24
26
|
Then the output should contain "SSH_AUTH_SOCK="
|
25
27
|
And the output should contain "export SSH_AUTH_SOCK;"
|
@@ -43,3 +45,13 @@ Feature: Agent IDs
|
|
43
45
|
And no ssh agent is running for me
|
44
46
|
When I run `ssh-locate`
|
45
47
|
Then the output should contain "no agent found"
|
48
|
+
|
49
|
+
Scenario: Support Fish
|
50
|
+
Given an ssh agent has been launched with a specific socket
|
51
|
+
Given the user's shell is Fish
|
52
|
+
When I run `ssh-locate`
|
53
|
+
Then the output should contain "set -x SSH_AUTH_SOCK"
|
54
|
+
And the output should contain "set -x SSH_AGENT_PID"
|
55
|
+
And the output should contain the correct agent PID
|
56
|
+
And the output should contain the correct agent socket
|
57
|
+
|
@@ -29,7 +29,7 @@ Given /^no ssh agent is running for me$/ do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
Then /^the output should be empty$/ do
|
32
|
-
|
32
|
+
expect(all_output).to be_empty
|
33
33
|
end
|
34
34
|
|
35
35
|
Then /^the output should contain the correct agent PID$/ do
|
@@ -39,3 +39,15 @@ end
|
|
39
39
|
Then /^the output should contain the correct agent socket$/ do
|
40
40
|
assert_partial_output( @agentSocket.to_s, all_output )
|
41
41
|
end
|
42
|
+
|
43
|
+
Given("the user's shell is Fish") do
|
44
|
+
pending "Should check the actual parent process. Not just the default shell setting."
|
45
|
+
# passwdEntry = `getent passwd #{ENV['USER']}`
|
46
|
+
# expect(passwdEntry).to match(/fish$/)
|
47
|
+
end
|
48
|
+
|
49
|
+
Given("the user's shell is Bash") do
|
50
|
+
pending "Should check the actual parent process. Not just the default shell setting."
|
51
|
+
# passwdEntry = `getent passwd #{ENV['USER']}`
|
52
|
+
# expect(passwdEntry).to match(/fish$/)
|
53
|
+
end
|
data/lib/net/ssh/locate.rb
CHANGED
@@ -15,12 +15,31 @@ module Net
|
|
15
15
|
|
16
16
|
def print_shell_commands
|
17
17
|
return unless @scanner.found?
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
if usingFish?
|
19
|
+
fishOutput
|
20
|
+
else
|
21
|
+
bashOutput
|
22
|
+
end
|
23
23
|
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def usingFish?
|
27
|
+
passwdEntry = `getent passwd #{ENV['USER']}`
|
28
|
+
passwdEntry =~ /fish$/
|
29
|
+
end
|
30
|
+
|
31
|
+
def bashOutput
|
32
|
+
print "SSH_AUTH_SOCK=#{@scanner.agentSocket};"
|
33
|
+
puts "export SSH_AUTH_SOCK;"
|
34
|
+
print "SSH_AGENT_PID=#{@scanner.agentPID};"
|
35
|
+
puts "export SSH_AGENT_PID;"
|
36
|
+
puts "echo Agent pid #{@scanner.agentPID};"
|
37
|
+
end
|
38
|
+
|
39
|
+
def fishOutput
|
40
|
+
puts "set -x SSH_AUTH_SOCK #{@scanner.agentSocket}"
|
41
|
+
puts "set -x SSH_AGENT_PID #{@scanner.agentPID}"
|
42
|
+
end
|
24
43
|
end
|
25
44
|
|
26
45
|
class Scanner
|
metadata
CHANGED
@@ -1,38 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssh-locate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Arnaud Meuret
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2019-07-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sys-proctable
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: thor
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
36
41
|
description: A CLI tool and its associated Ruby library that help you locate and reconnect
|
37
42
|
to a running SSH agent. Useful in automation scenarios where multiple processes
|
38
43
|
must repeatedly open SSH connections leveraging a one-time authentication pass
|
@@ -43,8 +48,8 @@ executables:
|
|
43
48
|
extensions: []
|
44
49
|
extra_rdoc_files: []
|
45
50
|
files:
|
46
|
-
- .gitignore
|
47
|
-
- .travis.yml
|
51
|
+
- ".gitignore"
|
52
|
+
- ".travis.yml"
|
48
53
|
- Gemfile
|
49
54
|
- Guardfile
|
50
55
|
- README.md
|
@@ -59,26 +64,28 @@ files:
|
|
59
64
|
- ssh-locate.gemspec
|
60
65
|
homepage: ''
|
61
66
|
licenses: []
|
67
|
+
metadata: {}
|
62
68
|
post_install_message:
|
63
69
|
rdoc_options: []
|
64
70
|
require_paths:
|
65
71
|
- lib
|
66
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
73
|
requirements:
|
69
|
-
- -
|
74
|
+
- - ">="
|
70
75
|
- !ruby/object:Gem::Version
|
71
76
|
version: '0'
|
72
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
78
|
requirements:
|
75
|
-
- -
|
79
|
+
- - ">="
|
76
80
|
- !ruby/object:Gem::Version
|
77
81
|
version: '0'
|
78
82
|
requirements: []
|
79
|
-
|
80
|
-
rubygems_version: 1.8.11
|
83
|
+
rubygems_version: 3.0.4
|
81
84
|
signing_key:
|
82
|
-
specification_version:
|
85
|
+
specification_version: 4
|
83
86
|
summary: A tool (+ a Ruby lib) to locate a running SSH agent
|
84
|
-
test_files:
|
87
|
+
test_files:
|
88
|
+
- features/agent-ids.feature
|
89
|
+
- features/step_definitions/agent-ids.rb
|
90
|
+
- features/support/env.rb
|
91
|
+
- features/support/hooks.rb
|