Skip to content

Commit 934f57e

Browse files
committed
fix(transport/ssh): don't require public key for ssh connections
1 parent 6d0a1cd commit 934f57e

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

shard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: placeos-driver
2-
version: 7.11.2
2+
version: 7.11.3
33

44
dependencies:
55
action-controller:

src/placeos-driver/transport/ssh.cr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ require "simple_retry"
22
require "socket"
33
require "ssh2"
44
require "tasker"
5+
require "openssl_ext"
56

67
require "../transport"
78

@@ -38,8 +39,6 @@ class PlaceOS::Driver
3839
property password : String?
3940
property passphrase : String?
4041
property private_key : String?
41-
42-
# We should be able to remove this by generating the public from the private
4342
property public_key : String?
4443
end
4544

@@ -104,7 +103,7 @@ class PlaceOS::Driver
104103
when "publickey"
105104
if prikey = settings.private_key
106105
begin
107-
pubkey = settings.public_key.not_nil!
106+
pubkey = settings.public_key || OpenSSL::PKey.read(prikey, settings.passphrase).public_key.to_pem
108107
session.login_with_data(settings.username, prikey, pubkey, settings.passphrase)
109108
rescue SSH2::SessionError
110109
logger.warn { "publickey auth failed, incorrect key" }

0 commit comments

Comments
 (0)