Skip to content

Commit 0e4f175

Browse files
committed
SSH proxy: allow using a bare hostname without root@
Otherwise we can't connect to the proxy as the local user and we can't use ~/.ssh/config to set User directives. Defaulting to root@ is hard to deprecate without introducing new config. A clean break is probably clearest.
1 parent 81f3508 commit 0e4f175

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/kamal/configuration/docs/ssh.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ ssh:
2929

3030
# Proxy host
3131
#
32-
# Specified in the form <host> or <user>@<host>:
33-
proxy: root@proxy-host
32+
# Specified in the form <host> or <user>@<host>
33+
proxy: proxy-host
3434

3535
# Proxy command
3636
#

lib/kamal/configuration/ssh.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def port
1919
end
2020

2121
def proxy
22-
if (proxy = ssh_config["proxy"])
23-
Net::SSH::Proxy::Jump.new(proxy.include?("@") ? proxy : "root@#{proxy}")
24-
elsif (proxy_command = ssh_config["proxy_command"])
22+
if proxy = ssh_config["proxy"]
23+
Net::SSH::Proxy::Jump.new(proxy)
24+
elsif proxy_command = ssh_config["proxy_command"]
2525
Net::SSH::Proxy::Command.new(proxy_command)
2626
end
2727
end

test/configuration/ssh_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ConfigurationSshTest < ActiveSupport::TestCase
3030

3131
test "ssh options with proxy host" do
3232
config = Kamal::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "proxy" => "1.2.3.4" }) })
33-
assert_equal "root@1.2.3.4", config.ssh.options[:proxy].jump_proxies
33+
assert_equal "1.2.3.4", config.ssh.options[:proxy].jump_proxies
3434
end
3535

3636
test "ssh options with proxy host and user" do

0 commit comments

Comments
 (0)