sshkit-ec2instanceconnect 0.1.0 → 0.2.0
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/README.md +2 -0
- data/lib/sshkit/ec2instanceconnect/backend.rb +11 -0
- data/lib/sshkit/ec2instanceconnect/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a74af1e0cbbe916dd6322012215e20ab8d786b3e00bbb87dfe445b3b07fb15f1
|
|
4
|
+
data.tar.gz: f53f6fe60fa792a6cc8b84a659e66805748dc85e6281836295b03eb631782c42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4001376f708e7465119572bb635f61154e2e1b6d604d6e81bb5a8bc19438af07b80aefbe271907a360066120a489c7501b688d9db4c14f915660755cd4b53b4
|
|
7
|
+
data.tar.gz: 4c123c65362619651bfaebae8a49fe583501a91cd0afb4962a2d527dcf13441dda67e150a699c173a530e563965a1ddeb3ac261cad5669795ba45345fee88e6c
|
data/README.md
CHANGED
|
@@ -67,6 +67,8 @@ config.tunnel_enabled = true
|
|
|
67
67
|
|
|
68
68
|
**Note**: Tunneling requires the AWS CLI (`aws ec2-instance-connect`) to be installed and configured.
|
|
69
69
|
|
|
70
|
+
Since the host's `hostname`/`port` are overwritten to point at the local tunnel, the original values remain available on `host.properties.fetch(:original_hostname)` / `host.properties.fetch(:original_port)` for logging or diagnostics.
|
|
71
|
+
|
|
70
72
|
## IAM Policy
|
|
71
73
|
|
|
72
74
|
Sending ephemeral SSH keys and opening tunnels require the correct IAM permissions.
|
|
@@ -84,10 +84,21 @@ module SSHKit
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def update_host_and_port(tunnel:)
|
|
87
|
+
set_host_property_once(:original_hostname, host.hostname)
|
|
88
|
+
set_host_property_once(:original_port, host.port)
|
|
89
|
+
|
|
87
90
|
host.hostname = tunnel.host
|
|
88
91
|
host.port = tunnel.port
|
|
89
92
|
end
|
|
90
93
|
|
|
94
|
+
# Sets a host property only if it hasn't been set before, so the original
|
|
95
|
+
# value is preserved. host.properties isn't a Hash, so use #keys instead of #key?.
|
|
96
|
+
def set_host_property_once(key, value)
|
|
97
|
+
return if host.properties.keys.include?(key) # rubocop:disable Performance/InefficientHashSearch
|
|
98
|
+
|
|
99
|
+
host.properties.set(key, value)
|
|
100
|
+
end
|
|
101
|
+
|
|
91
102
|
def refresh_ssh_key
|
|
92
103
|
logger.debug { "Refreshing SSH key for instance #{instance_id}" }
|
|
93
104
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sshkit-ec2instanceconnect
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kentaa
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-07-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: aws-sdk-ec2instanceconnect
|
|
@@ -143,14 +143,14 @@ dependencies:
|
|
|
143
143
|
requirements:
|
|
144
144
|
- - "~>"
|
|
145
145
|
- !ruby/object:Gem::Version
|
|
146
|
-
version: '0
|
|
146
|
+
version: '1.0'
|
|
147
147
|
type: :development
|
|
148
148
|
prerelease: false
|
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
|
150
150
|
requirements:
|
|
151
151
|
- - "~>"
|
|
152
152
|
- !ruby/object:Gem::Version
|
|
153
|
-
version: '0
|
|
153
|
+
version: '1.0'
|
|
154
154
|
- !ruby/object:Gem::Dependency
|
|
155
155
|
name: webmock
|
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|