Skip to content

Commit 4373d9d

Browse files
committedOct 3, 2024·
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 5036f88 commit 4373d9d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed
 

‎lib/kamal/configuration/docs/ssh.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ssh:
3232
# Proxy host
3333
#
3434
# Specified in the form <host> or <user>@<host>
35-
proxy: root@proxy-host
35+
proxy: proxy-host
3636

3737
# Proxy command
3838
#

‎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)