File tree Expand file tree Collapse file tree 6 files changed +20
-9
lines changed Expand file tree Collapse file tree 6 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ A: Probably a disk full, or permission error.
133
133
Via [clojars](http://clojars.org ) and
134
134
[Leiningen](http://github.com/technomancy/leiningen ).
135
135
136
- :dependencies [clj-ssh " 0.4.2 " ]
136
+ :dependencies [clj-ssh " 0.4.3 " ]
137
137
138
138
or your favourite maven repository aware tool.
139
139
Original file line number Diff line number Diff line change 1
1
# Release Notes
2
2
3
- Current release is 0.4.2
3
+ Current release is 0.4.3
4
+
5
+ ## 0.4.3
6
+
7
+ - Use passphrase when adding key to agent, and honour the key name
4
8
5
9
## 0.4.2
6
10
Original file line number Diff line number Diff line change 1
- (defproject clj-ssh " 0.4.2 "
1
+ (defproject clj-ssh " 0.4.3 "
2
2
:description " Library for using SSH from clojure."
3
3
:url " https://github.com/hugoduncan/clj-ssh"
4
4
:license {:name " Eclipse Public License"
Original file line number Diff line number Diff line change 155
155
(if (local-repo? id-repo)
156
156
(.addIdentity agent name private-key public-key passphrase)
157
157
(let [keypair (KeyPair/load agent private-key-path public-key-path)]
158
+ (when passphrase
159
+ (.decrypt keypair passphrase))
158
160
(.add id-repo (.forSSHAgent keypair)))))
159
161
160
162
(and public-key-path private-key-path)
164
166
agent
165
167
(file-path private-key-path) (file-path public-key-path) passphrase)
166
168
(let [keypair (KeyPair/load agent private-key-path public-key-path)]
169
+ (when passphrase
170
+ (.decrypt keypair passphrase))
171
+ (.setPublicKeyComment keypair name)
167
172
(.add id-repo (.forSSHAgent keypair)))))
168
173
169
174
private-key-path
170
175
(let [id-repo (id-repository )]
171
176
(if (local-repo? id-repo)
172
177
(.addIdentity agent (file-path private-key-path) passphrase)
173
178
(let [keypair (KeyPair/load agent private-key-path)]
179
+ (when passphrase
180
+ (.decrypt keypair passphrase))
181
+ (.setPublicKeyComment keypair name)
174
182
(.add id-repo (.forSSHAgent keypair)))))
175
183
176
184
:else
Original file line number Diff line number Diff line change 76
76
(with-ssh-agent (ssh-agent {:use-system-ssh-agent false })
77
77
(add-identity-with-keychain
78
78
:private-key-path (encrypted-private-key-path )
79
- :name " clj-ssh" )
79
+ :passphrase " clj-ssh" )
80
80
(let [session (session " localhost" )]
81
81
(is (instance? com.jcraft.jsch.Session session))
82
82
(is (not (connected? session)))
Original file line number Diff line number Diff line change 60
60
(let [agent (ssh-agent {})]
61
61
(let [n (count (.getIdentityNames agent))
62
62
test-key-comment " key for test clj-ssh"
63
- has-key (some #(= test -key-comment %) (.getIdentityNames agent))]
63
+ has-key (some #(= ( private -key-path ) %) (.getIdentityNames agent))]
64
64
(add-identity
65
65
agent
66
- {:name " name"
67
- :private-key-path (private-key-path )
66
+ {:private-key-path (private-key-path )
68
67
:public-key-path (public-key-path )})
69
68
(is (or has-key (= (inc n) (count (.getIdentityNames agent)))))
70
- (is (some #(= test -key-comment %) (.getIdentityNames agent)))))))
69
+ (is (some #(= ( private -key-path ) %) (.getIdentityNames agent)))))))
71
70
72
71
(deftest has-identity?-test
73
72
(let [key (private-key-path )
141
140
(add-identity-with-keychain
142
141
agent
143
142
{:private-key-path (encrypted-private-key-path )
144
- :name " clj-ssh" })
143
+ :passphrase " clj-ssh" })
145
144
(let [session (session
146
145
agent
147
146
" localhost"
You can’t perform that action at this time.
0 commit comments