Skip to content

Commit

Permalink
Adds logging and SSHKit backend host configuration for
Browse files Browse the repository at this point in the history
ssh_options. Also updates gemspec requirements to support ed25519
elliptic keys in net/ssh

next cleanup: change hardcoded ssh_options in
lib/loom/host_spec.rb to come from the config. pass in from
inventory.rb

more info:
net-ssh/net-ssh#565
net-ssh/net-ssh#476
net-ssh/net-ssh#175
  • Loading branch information
erickj committed Oct 20, 2018
1 parent 92edaf0 commit addfa69
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/loom/dsl.rb
Expand Up @@ -31,6 +31,7 @@ def on_host(host_specs, &run_block)
sshkit_backend = self

begin
# TODO: document the reciever of this yield
yield sshkit_backend, host_spec
rescue SocketError => e
Loom.log.error "error connecting to host => #{host_spec.hostname}"
Expand All @@ -53,6 +54,7 @@ def on_host(host_specs, &run_block)
end
end

# TODO: Why did I make this "shadow" class?
class SSHKitDSLShadow
extend SSHKit::DSL
end
Expand Down
12 changes: 11 additions & 1 deletion lib/loom/host_spec.rb
Expand Up @@ -11,6 +11,8 @@ class HostSpec
attr_accessor :disabled
attr_reader :sshkit_host

# TODO: change this to take an sshkit_host and make parse public. Stop calling parse from the
# ctor.
def initialize(host_string)
@sshkit_host = parse host_string
end
Expand All @@ -26,7 +28,15 @@ def is_localhost?

private
def parse(host_string)
SSHKit::Host.new host_string
host = SSHKit::Host.new host_string
host.ssh_options = {
:auth_methods => ['publickey'],
:keys => ["~/.ssh/id_esd25519_2"],
:verbose => :debug,
}
Loom.log.debug1(self) { "parsing hoststring[#{host_string}] => #{host}" }
Loom.log.debug1(self) { "netssh options for host[#{host}] => #{host.netssh_options}" }
host
end
end
end
7 changes: 6 additions & 1 deletion loom.gemspec
Expand Up @@ -18,6 +18,7 @@ Gem::Specification.new do |s|
s.add_dependency 'sshkit', '~> 1.11'
s.add_dependency 'commander', '~> 4.4'

# *** Obsolete, see new issue below ***
# Need net-ssh beta and its explicit requirements until for ed25519
# elliptic curve key support
# https://github.com/net-ssh/net-ssh/issues/214
Expand All @@ -28,7 +29,11 @@ Gem::Specification.new do |s|
# s.add_dependency 'net-ssh', '>= 4.0.0.beta3'
s.add_dependency 'net-ssh', '>= 3'
s.add_dependency 'rbnacl-libsodium', '1.0.10'
s.add_dependency 'bcrypt_pbkdf', '1.0.0.alpha1'
s.add_dependency 'bcrypt_pbkdf', '<2.0'

# New net-ssh requiremetns for ed25519
# https://github.com/net-ssh/net-ssh/issues/565
s.add_dependency 'ed25519', '<2.0'

s.add_development_dependency 'bundler', '~> 1.13'
s.add_development_dependency 'rake', '~> 11.3'
Expand Down

0 comments on commit addfa69

Please sign in to comment.