Skip to content

Commit 163537d

Browse files
authored
Merge pull request #19 from yokawasa/fix-pubkeyacceptedalgorithms-issue
Fix Bad configuration option: pubkeyacceptedalgorithms issue
2 parents 5139fc6 + 2b39b5a commit 163537d

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

CHANGELOG.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
All notable changes to the "kubectl-plugin-ssh-jump" extension will be documented in this file.
44

5-
## 0.7.1
5+
## 0.7.2
66

7-
- Fix `root@127.0.0.1: Permission denied (publickey)` issue ([#13](https://github.com/yokawasa/kubectl-plugin-ssh-jump/issues/13)) by adding options like `-o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa` which works for newer ssh client scenario
7+
- Fix `Bad configuration option: pubkeyacceptedalgorithms` issue ([#18](https://github.com/yokawasa/kubectl-plugin-ssh-jump/issues/18))
8+
- Add OpenSSH version check
9+
- Add RSA workaround options (`-o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa`) introduced in [ssh-jump-0.7.1](https://github.com/yokawasa/kubectl-plugin-ssh-jump/releases/tag/0.7.1) only if the local OpenSSH version >= `8.5`
810

11+
## 0.7.1
912

13+
- Fix `root@127.0.0.1: Permission denied (publickey)` issue ([#13](https://github.com/yokawasa/kubectl-plugin-ssh-jump/issues/13))
14+
- Add options like `-o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa` which works for newer ssh client (`OpenSSH 8.5+`) scenario
1015

1116
## 0.7.0
1217

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ Options:
142142
--skip-agent option is given
143143
--cleanup-jump Clearning up sshjump pod at the end
144144
Defaults to skip cleaning up sshjump pod
145+
-v, --verbose Run ssh in verbose mode (=ssh -vvv)
145146
-h, --help Show this message
146147
147148
Example:
@@ -200,6 +201,7 @@ Options:
200201
-P, --port <port> SSH port for target node SSH server
201202
Defaults to 22
202203
-a, --args <args> Args to exec in ssh session
204+
--pod-template <file> Path to custom sshjump pod definition
203205
--skip-agent Skip automatically starting SSH agent and adding
204206
SSH Identity key into the agent before SSH login
205207
(=> You need to manage SSH agent by yourself)
@@ -217,14 +219,10 @@ Example:
217219
Scenario2 - You have .pem file but you don't have public key on your side
218220
$ kubectl ssh-jump -u ec2-user -i ~/.ssh/mykey.pem hostname
219221
220-
Scenario3 - You want to use a custom sshjump pod definition
221-
$ kubectl ssh-jump -u ec2-user -i ~/.ssh/mykey.pem --pod-template ~/myjumppod.yaml hostname
222-
223222
List of destination node...
224223
Hostname Internal-IP
225224
aks-nodepool1-18558189-0 10.240.0.4
226225
...
227-
228226
```
229227
230228

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.7.1
1+
0.7.2

kubectl-ssh-jump

+22-6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Options:
4242
--skip-agent option is given
4343
--cleanup-jump Clearning up sshjump pod at the end
4444
Defaults to skip cleaning up sshjump pod
45+
-v, --verbose Run ssh in verbose mode (=ssh -vvv)
4546
-h, --help Show this message
4647
4748
Example:
@@ -81,6 +82,10 @@ get_node_list(){
8182
echo ""
8283
}
8384

85+
get_openssh_verion_number() {
86+
ssh -V 2>&1 | awk -F'[_,]' '{print $2+0}'
87+
}
88+
8489
cleanup_sshjump_pod(){
8590
echo "Clearning up SSH Jump host (Pod)..."
8691
kubectl delete pod sshjump
@@ -197,14 +202,21 @@ run_ssh_node(){
197202
cat ${pubkey_sshjump} | \
198203
kubectl exec -i sshjump -- /bin/bash -c "cat > /root/.ssh/authorized_keys"
199204

205+
# Add default ssh option
206+
sshargs="${sshargs} -o StrictHostKeyChecking=no"
207+
208+
# Add RSA workaround options if the local OpenSSH version >= 8.5
209+
sshversion=$(get_openssh_verion_number)
210+
if [ $(echo "${sshversion} >= 8.5" | bc) -eq 1 ]; then
211+
sshargs="${sshargs} -o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa"
212+
fi
213+
200214
if [ "${destnode}" = "sshjump" ]; then
201-
ssh ${sshuser}@127.0.0.1 -p 2222 -i ${identity_sshjump} \
202-
-o StrictHostKeyChecking=no -o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa $sshargs
215+
ssh ${sshuser}@127.0.0.1 -p 2222 -i ${identity_sshjump} $sshargs
203216
else
204217
# Using the SSH Server as a jumphost (via port-forward proxy), ssh into the desired Node
205218
ssh -i ${identity} -p ${port} ${sshuser}@${destnode} \
206-
-o "ProxyCommand ssh root@127.0.0.1 -p 2222 -i ${identity_sshjump} -o \"StrictHostKeyChecking=no\" \"nc %h %p\"" \
207-
-o StrictHostKeyChecking=no -o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa $sshargs
219+
-o "ProxyCommand ssh root@127.0.0.1 -p 2222 -i ${identity_sshjump} -o \"StrictHostKeyChecking=no\" \"nc %h %p\"" $sshargs
208220
fi
209221
# Stop port-forward
210222
kill -3 ${pid_port_forward} 2>/dev/null
@@ -214,14 +226,18 @@ plugin_main() {
214226
skip_agent=no
215227
cleanup_jump=no
216228
cleanup_agent=no
229+
sshargs=""
217230
while [ $# -gt 0 ] ; do
218231
nSkip=1
219232
case $1 in
220233
"-h" | "--help")
221234
help
222235
exit 0
223236
;;
224-
"--cleanup-jump")
237+
"-v" | "--verbose" )
238+
sshargs="${sshargs} -vvv"
239+
;;
240+
"--cleanup-jump")
225241
cleanup_jump=yes
226242
;;
227243
"--cleanup-agent")
@@ -247,7 +263,7 @@ plugin_main() {
247263
nSkip=2
248264
;;
249265
"-a" | "--args" )
250-
sshargs="$2"
266+
sshargs="${sshargs} $2"
251267
nSkip=2
252268
;;
253269
"--pod-template")

0 commit comments

Comments
 (0)