summaryrefslogtreecommitdiff
path: root/test/integration/test_hmac_etm.rb
diff options
context:
space:
mode:
authorMiklos Fazekas <mfazekas@szemafor.com>2020-04-25 13:19:04 +0200
committerMiklos Fazekas <mfazekas@szemafor.com>2020-04-25 13:30:37 +0200
commite40df165d5f34fe4eaebe3bdb3b4a14499efb737 (patch)
treedb01cbadbf3e0f1b0bc7670a3c4e171255235a55 /test/integration/test_hmac_etm.rb
parent9bed3c7f210ac5de54e6b787cce8498f10ce5c79 (diff)
downloadnet-ssh-e40df165d5f34fe4eaebe3bdb3b4a14499efb737.tar.gz
Add test to reproduce corrupted Mac issue
Diffstat (limited to 'test/integration/test_hmac_etm.rb')
-rw-r--r--test/integration/test_hmac_etm.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/integration/test_hmac_etm.rb b/test/integration/test_hmac_etm.rb
index cb73133..3254289 100644
--- a/test/integration/test_hmac_etm.rb
+++ b/test/integration/test_hmac_etm.rb
@@ -1,4 +1,5 @@
require_relative 'common'
+require_relative 'mitm_server'
require 'fileutils'
require 'tmpdir'
@@ -56,4 +57,27 @@ class TestHMacEtm < NetSSHTest
end
end
end
+
+ variants.each do |key, variant|
+ define_method "test_hmac_through_proxy_#{key}" do
+ mitm = MitmServer.new('localhost', 22)
+
+ mitm.local_read_size = 2 * 1024
+ mitm.target_read_size = 19
+
+ mitm.run
+
+ # host, port = 'localhost', 22
+ host = mitm.host
+ port = mitm.port
+
+ hmac_options = { hmac: variant }
+ ssh = Net::SSH.start(host, "net_ssh_1", hmac_options.merge(port: port, password: 'foopwd'))
+ (1...20).each do |i|
+ ret = ssh.exec!("echo \"#{'f' * i}\"")
+ assert_includes ret, 'f' * i
+ end
+ ssh.close
+ end
+ end
end \ No newline at end of file