Commit 27b0a20f authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Support OpenSSH ProxyJump on older releases

parent 4da3b55c
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -23,9 +23,9 @@ ssh_version() {
make_config() {
	ssh_version || return 1

	# SSH >=7.2 does not need a filtered config
	# SSH >=7.3 does not need a filtered config
	[ $SSH_MAJOR -gt 7 ] && return
	[ $SSH_MAJOR -eq 7 ] && [ $SSH_MINOR -ge 2 ] && return
	[ $SSH_MAJOR -eq 7 ] && [ $SSH_MINOR -ge 3 ] && return

	SSH_CONFIG=$HOME/.ssh/configs/$PLATFORM.$KERNEL.$SSH_MAJOR.$SSH_MINOR.config
	export SSH_CONFIG
@@ -53,6 +53,7 @@ make_config() {
			`rule_canonisation`
			`rule_percent_C`
			`rule_include`
			`rule_jump`

			1
		"
@@ -151,3 +152,11 @@ rule_include() {
	[ $SSH_MAJOR -eq 7 ] && [ $SSH_MINOR -ge 2 ] && return
	echo 'match($1, /^Include$/) { remove_line() }'
}

rule_jump() {
	# ProxyJump requires >=7.3
	# Convert ProxyJump to ProxyCommand
	[ $SSH_MAJOR -gt 7 ] && return
	[ $SSH_MAJOR -eq 7 ] && [ $SSH_MINOR -ge 3 ] && return
	echo 'match($1, /^ProxyJump/) { sub(/^ProxyJump/, "ProxyCommand ssh -W %r@%h:%p") }'
}