Compare commits
1 Commits
v2.5.1
...
proxy-with
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46e3085052 |
@@ -29,8 +29,8 @@ ssh:
|
|||||||
|
|
||||||
# Proxy host
|
# Proxy host
|
||||||
#
|
#
|
||||||
# Specified in the form <host> or <user>@<host>:
|
# Specified in the form <host> or <user>@<host>
|
||||||
proxy: root@proxy-host
|
proxy: proxy-host
|
||||||
|
|
||||||
# Proxy command
|
# Proxy command
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ class Kamal::Configuration::Ssh
|
|||||||
end
|
end
|
||||||
|
|
||||||
def proxy
|
def proxy
|
||||||
if (proxy = ssh_config["proxy"])
|
if proxy = ssh_config["proxy"]
|
||||||
Net::SSH::Proxy::Jump.new(proxy.include?("@") ? proxy : "root@#{proxy}")
|
Net::SSH::Proxy::Jump.new(proxy)
|
||||||
elsif (proxy_command = ssh_config["proxy_command"])
|
elsif proxy_command = ssh_config["proxy_command"]
|
||||||
Net::SSH::Proxy::Command.new(proxy_command)
|
Net::SSH::Proxy::Command.new(proxy_command)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class CommandsAppTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
test "run over ssh with proxy" do
|
test "run over ssh with proxy" do
|
||||||
@config[:ssh] = { "proxy" => "2.2.2.2" }
|
@config[:ssh] = { "proxy" => "2.2.2.2" }
|
||||||
assert_equal "ssh -J root@2.2.2.2 -t root@1.1.1.1 -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1")
|
assert_equal "ssh -J 2.2.2.2 -t root@1.1.1.1 -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "run over ssh with proxy user" do
|
test "run over ssh with proxy user" do
|
||||||
@@ -304,7 +304,7 @@ class CommandsAppTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
test "run over ssh with custom user with proxy" do
|
test "run over ssh with custom user with proxy" do
|
||||||
@config[:ssh] = { "user" => "app", "proxy" => "2.2.2.2" }
|
@config[:ssh] = { "user" => "app", "proxy" => "2.2.2.2" }
|
||||||
assert_equal "ssh -J root@2.2.2.2 -t app@1.1.1.1 -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1")
|
assert_equal "ssh -J 2.2.2.2 -t app@1.1.1.1 -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "run over ssh with proxy_command" do
|
test "run over ssh with proxy_command" do
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class ConfigurationSshTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
test "ssh options with proxy host" do
|
test "ssh options with proxy host" do
|
||||||
config = Kamal::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "proxy" => "1.2.3.4" }) })
|
config = Kamal::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "proxy" => "1.2.3.4" }) })
|
||||||
assert_equal "root@1.2.3.4", config.ssh.options[:proxy].jump_proxies
|
assert_equal "1.2.3.4", config.ssh.options[:proxy].jump_proxies
|
||||||
end
|
end
|
||||||
|
|
||||||
test "ssh options with proxy host and user" do
|
test "ssh options with proxy host and user" do
|
||||||
|
|||||||
Reference in New Issue
Block a user