summaryrefslogtreecommitdiff
path: root/test/test_config.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_config.rb')
-rw-r--r--test/test_config.rb30
1 files changed, 28 insertions, 2 deletions
diff --git a/test/test_config.rb b/test/test_config.rb
index cb462de..761299d 100644
--- a/test/test_config.rb
+++ b/test/test_config.rb
@@ -112,7 +112,8 @@ class TestConfig < Test::Unit::TestCase
'hostbasedauthentication' => false,
'passwordauthentication' => false,
'pubkeyauthentication' => false,
- 'challengeresponseauthentication' => false
+ 'challengeresponseauthentication' => false,
+ 'kbdinteractiveauthentication' => false
}
net_ssh = Net::SSH::Config.translate(open_ssh)
@@ -125,7 +126,8 @@ class TestConfig < Test::Unit::TestCase
'hostbasedauthentication' => true,
'passwordauthentication' => true,
'pubkeyauthentication' => true,
- 'challengeresponseauthentication' => true
+ 'challengeresponseauthentication' => true,
+ 'kbdinteractiveauthentication' => true
}
net_ssh = Net::SSH::Config.translate(open_ssh)
@@ -133,6 +135,30 @@ class TestConfig < Test::Unit::TestCase
assert_equal %w(hostbased keyboard-interactive none password publickey), net_ssh[:auth_methods].sort
end
+ def test_translate_should_not_disable_keyboard_interactive_when_challange_or_keyboardinterective_is_on
+ open_ssh = {
+ 'kbdinteractiveauthentication' => false
+ }
+ net_ssh = Net::SSH::Config.translate(open_ssh)
+ assert_equal %w(keyboard-interactive none password publickey), net_ssh[:auth_methods].sort
+
+ open_ssh = {
+ 'challengeresponseauthentication' => false
+ }
+ net_ssh = Net::SSH::Config.translate(open_ssh)
+ assert_equal %w(keyboard-interactive none password publickey), net_ssh[:auth_methods].sort
+ end
+
+ def test_should_ddisable_keyboard_interactive_when_challeng_and_keyboardinteractive_is_off
+ open_ssh = {
+ 'challengeresponseauthentication' => false,
+ 'kbdinteractiveauthentication' => false
+ }
+
+ net_ssh = Net::SSH::Config.translate(open_ssh)
+ assert_equal %w(none password publickey), net_ssh[:auth_methods].sort
+ end
+
def test_for_should_turn_off_authentication_methods
config = Net::SSH::Config.for("test.host", [config(:empty), config(:auth_off), config(:auth_on)])
assert_equal %w(none), config[:auth_methods].sort