File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ load_pubkey() {
66 local private_key_user=$( jq -r ' .source.private_key_user // empty' <<< " $1" )
77 local forward_agent=$( jq -r ' .source.forward_agent // false' <<< " $1" )
88 local passphrase=" $( jq -r ' .source.private_key_passphrase // empty' <<< " $1" ) "
9+ local uri=$( jq -r ' .source.uri // ""' <<< " $1" )
910
1011 (jq -r ' .source.private_key // empty' <<< " $1" ) > $private_key_path
1112
@@ -22,16 +23,31 @@ load_pubkey() {
2223StrictHostKeyChecking no
2324LogLevel quiet
2425EOF
26+
27+ # Handle ssh:// URLs with custom ports
28+ if [[ " $uri " =~ ^ssh://([^@]+@)? ([^:/]+):([0-9]+) ]]; then
29+ local ssh_host=" ${BASH_REMATCH[2]} "
30+ local ssh_port=" ${BASH_REMATCH[3]} "
31+
32+ cat >> ~ /.ssh/config << EOF
33+
34+ Host $ssh_host
35+ Port $ssh_port
36+ EOF
37+ fi
38+
2539 if [ ! -z " $private_key_user " ]; then
2640 cat >> ~ /.ssh/config << EOF
2741User $private_key_user
2842EOF
2943 fi
44+
3045 if [ " $forward_agent " = " true" ]; then
3146 cat >> ~ /.ssh/config << EOF
3247ForwardAgent yes
3348EOF
3449 fi
50+
3551 chmod 0600 ~ /.ssh/config
3652 fi
3753}
You can’t perform that action at this time.
0 commit comments