dsh-remote 0.8.45 → 0.8.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.en.md +361 -361
- package/README.md +368 -368
- package/cordis.patch.yml +9 -9
- package/lib/binding.js +172 -172
- package/lib/client.js +3637 -3623
- package/lib/credential.js +177 -177
- package/lib/deploy-tasks.js +142 -142
- package/lib/errors.js +87 -87
- package/lib/file-reference.js +457 -457
- package/lib/forwards.js +258 -258
- package/lib/hostkey.js +108 -108
- package/lib/http-transport.js +196 -196
- package/lib/ignore.js +156 -156
- package/lib/index.js +3771 -3747
- package/lib/openssh.js +838 -838
- package/lib/paths.js +225 -225
- package/lib/pool.js +757 -754
- package/lib/registry.js +95 -95
- package/lib/remote-fs.js +148 -143
- package/lib/routes-fs.js +233 -233
- package/lib/search.js +230 -230
- package/lib/sftp-surface.js +76 -76
- package/lib/sshconfig.js +454 -454
- package/lib/sync.js +275 -275
- package/lib/tasks.js +95 -95
- package/lib/telemetry.js +213 -213
- package/lib/update.js +472 -472
- package/lib/web-attach.js +850 -846
- package/lib/web-deploy-skill.js +205 -205
- package/lib/web-deploy.js +694 -694
- package/node_modules/asn1/Jenkinsfile +65 -0
- package/node_modules/asn1/LICENSE +19 -0
- package/node_modules/asn1/README.md +50 -0
- package/node_modules/asn1/lib/ber/errors.js +13 -0
- package/node_modules/asn1/lib/ber/index.js +27 -0
- package/node_modules/asn1/lib/ber/reader.js +262 -0
- package/node_modules/asn1/lib/ber/types.js +36 -0
- package/node_modules/asn1/lib/ber/writer.js +317 -0
- package/node_modules/asn1/lib/index.js +20 -0
- package/node_modules/asn1/package.json +31 -0
- package/node_modules/bcrypt-pbkdf/CONTRIBUTING.md +13 -0
- package/node_modules/bcrypt-pbkdf/LICENSE +66 -0
- package/node_modules/bcrypt-pbkdf/README.md +45 -0
- package/node_modules/bcrypt-pbkdf/index.js +556 -0
- package/node_modules/bcrypt-pbkdf/package.json +15 -0
- package/node_modules/buildcheck/.eslintrc.js +5 -0
- package/node_modules/buildcheck/.github/workflows/ci.yml +88 -0
- package/node_modules/buildcheck/.github/workflows/lint.yml +27 -0
- package/node_modules/buildcheck/.npmignore +3 -0
- package/node_modules/buildcheck/LICENSE +19 -0
- package/node_modules/buildcheck/README.md +106 -0
- package/node_modules/buildcheck/deps/Find-VisualStudio.cs +250 -0
- package/node_modules/buildcheck/lib/findvs.js +361 -0
- package/node_modules/buildcheck/lib/index.js +738 -0
- package/node_modules/buildcheck/package.json +36 -0
- package/node_modules/buildcheck/test/test.js +8 -0
- package/node_modules/cpu-features/.eslintrc.js +5 -0
- package/node_modules/cpu-features/.github/workflows/ci.yml +74 -0
- package/node_modules/cpu-features/.github/workflows/lint.yml +27 -0
- package/node_modules/cpu-features/LICENSE +19 -0
- package/node_modules/cpu-features/README.md +59 -0
- package/node_modules/cpu-features/binding.gyp +16 -0
- package/node_modules/cpu-features/buildcheck.js +32 -0
- package/node_modules/cpu-features/deps/cpu_features/.clang-format +4 -0
- package/node_modules/cpu-features/deps/cpu_features/.dockerignore +31 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/Dockerfile +5 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/aarch64_linux_cmake.yml +30 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_freebsd_cmake.yml +22 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_bazel.yml +26 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_cmake.yml +31 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_macos_cmake.yml +43 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_windows_cmake.yml +25 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/arm_linux_cmake.yml +31 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/clang_format.yml +24 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/mips_linux_cmake.yml +30 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/power_linux_cmake.yml +29 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/riscv_linux_cmake.yml +28 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/s390x_linux_cmake.yml +27 -0
- package/node_modules/cpu-features/deps/cpu_features/.grenrc.yml +21 -0
- package/node_modules/cpu-features/deps/cpu_features/BUILD.bazel +329 -0
- package/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt +261 -0
- package/node_modules/cpu-features/deps/cpu_features/CONTRIBUTING.md +23 -0
- package/node_modules/cpu-features/deps/cpu_features/LICENSE +230 -0
- package/node_modules/cpu-features/deps/cpu_features/README.md +272 -0
- package/node_modules/cpu-features/deps/cpu_features/WORKSPACE +19 -0
- package/node_modules/cpu-features/deps/cpu_features/bazel/ci/README.md +5 -0
- package/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl +11 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesConfig.cmake.in +3 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesNdkCompatConfig.cmake.in +3 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/README.md +30 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile +252 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md +40 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.dot +64 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.svg +312 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/generate_image.sh +7 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/amd64/Dockerfile +48 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/toolchain/Dockerfile +34 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/CMakeLists.txt +22 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/main.cpp +11 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/vagrant/freebsd/Vagrantfile +107 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/googletest.CMakeLists.txt.in +15 -0
- package/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +105 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_cache_info.h +54 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_macros.h +384 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_aarch64.h +259 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h +121 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_mips.h +74 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_ppc.h +149 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_riscv.h +72 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_s390x.h +108 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_x86.h +288 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/bit_utils.h +40 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/cpuid_x86.h +37 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/filesystem.h +39 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/hwcaps.h +240 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/stack_line_reader.h +49 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/string_view.h +110 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/windows_utils.h +70 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/CMakeLists.txt +60 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/README.md +4 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.c +205 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.h +320 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/ndk-compat-test.c +12 -0
- package/node_modules/cpu-features/deps/cpu_features/patches/0001-Add-Apple-Silicon-Support.patch +456 -0
- package/node_modules/cpu-features/deps/cpu_features/scripts/generate_badges.d +165 -0
- package/node_modules/cpu-features/deps/cpu_features/scripts/make_release.sh +75 -0
- package/node_modules/cpu-features/deps/cpu_features/scripts/run_integration.sh +490 -0
- package/node_modules/cpu-features/deps/cpu_features/scripts/test_integration.sh +79 -0
- package/node_modules/cpu-features/deps/cpu_features/src/copy.inl +19 -0
- package/node_modules/cpu-features/deps/cpu_features/src/define_introspection.inl +86 -0
- package/node_modules/cpu-features/deps/cpu_features/src/define_introspection_and_hwcaps.inl +26 -0
- package/node_modules/cpu-features/deps/cpu_features/src/equals.inl +22 -0
- package/node_modules/cpu-features/deps/cpu_features/src/filesystem.c +62 -0
- package/node_modules/cpu-features/deps/cpu_features/src/hwcaps.c +169 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64__base_implementation.inl +88 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_linux_or_android.c +79 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.c +82 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_windows.c +138 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_arm_linux_or_android.c +212 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_mips_linux_or_android.c +93 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_ppc_linux.c +163 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_riscv_linux.c +111 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_s390x_linux.c +120 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86__base_implementation.inl +2055 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_freebsd.c +68 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_linux_or_android.c +58 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_macos.c +57 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_windows.c +58 -0
- package/node_modules/cpu-features/deps/cpu_features/src/stack_line_reader.c +132 -0
- package/node_modules/cpu-features/deps/cpu_features/src/string_view.c +192 -0
- package/node_modules/cpu-features/deps/cpu_features/src/utils/list_cpu_features.c +461 -0
- package/node_modules/cpu-features/deps/cpu_features/test/CMakeLists.txt +114 -0
- package/node_modules/cpu-features/deps/cpu_features/test/bit_utils_test.cc +53 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_aarch64_test.cc +396 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_arm_test.cc +384 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_mips_test.cc +176 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_ppc_test.cc +131 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_riscv_test.cc +180 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_s390x_test.cc +82 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_x86_test.cc +1729 -0
- package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.cc +103 -0
- package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.h +61 -0
- package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.cc +52 -0
- package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.h +31 -0
- package/node_modules/cpu-features/deps/cpu_features/test/stack_line_reader_test.cc +132 -0
- package/node_modules/cpu-features/deps/cpu_features/test/string_view_test.cc +202 -0
- package/node_modules/cpu-features/lib/index.js +5 -0
- package/node_modules/cpu-features/package.json +40 -0
- package/node_modules/cpu-features/src/binding.cc +151 -0
- package/node_modules/cpu-features/test/test.js +12 -0
- package/node_modules/nan/.github/workflows/ci.yml +46 -0
- package/node_modules/nan/.pre-commit-config.yaml +8 -0
- package/node_modules/nan/CHANGELOG.md +605 -0
- package/node_modules/nan/CMakeLists.txt +138 -0
- package/node_modules/nan/LICENSE.md +9 -0
- package/node_modules/nan/README.md +457 -0
- package/node_modules/nan/doc/asyncworker.md +146 -0
- package/node_modules/nan/doc/buffers.md +54 -0
- package/node_modules/nan/doc/callback.md +76 -0
- package/node_modules/nan/doc/converters.md +41 -0
- package/node_modules/nan/doc/errors.md +226 -0
- package/node_modules/nan/doc/json.md +62 -0
- package/node_modules/nan/doc/maybe_types.md +583 -0
- package/node_modules/nan/doc/methods.md +689 -0
- package/node_modules/nan/doc/new.md +147 -0
- package/node_modules/nan/doc/node_misc.md +123 -0
- package/node_modules/nan/doc/object_wrappers.md +263 -0
- package/node_modules/nan/doc/persistent.md +296 -0
- package/node_modules/nan/doc/scopes.md +73 -0
- package/node_modules/nan/doc/script.md +58 -0
- package/node_modules/nan/doc/string_bytes.md +81 -0
- package/node_modules/nan/doc/v8_internals.md +211 -0
- package/node_modules/nan/doc/v8_misc.md +85 -0
- package/node_modules/nan/include_dirs.js +1 -0
- package/node_modules/nan/nan.h +3202 -0
- package/node_modules/nan/nan_callbacks.h +141 -0
- package/node_modules/nan/nan_callbacks_12_inl.h +730 -0
- package/node_modules/nan/nan_callbacks_pre_12_inl.h +528 -0
- package/node_modules/nan/nan_converters.h +72 -0
- package/node_modules/nan/nan_converters_43_inl.h +68 -0
- package/node_modules/nan/nan_converters_pre_43_inl.h +42 -0
- package/node_modules/nan/nan_define_own_property_helper.h +29 -0
- package/node_modules/nan/nan_implementation_12_inl.h +446 -0
- package/node_modules/nan/nan_implementation_pre_12_inl.h +263 -0
- package/node_modules/nan/nan_json.h +166 -0
- package/node_modules/nan/nan_maybe_43_inl.h +360 -0
- package/node_modules/nan/nan_maybe_pre_43_inl.h +268 -0
- package/node_modules/nan/nan_new.h +340 -0
- package/node_modules/nan/nan_object_wrap.h +156 -0
- package/node_modules/nan/nan_persistent_12_inl.h +132 -0
- package/node_modules/nan/nan_persistent_pre_12_inl.h +242 -0
- package/node_modules/nan/nan_private.h +73 -0
- package/node_modules/nan/nan_scriptorigin.h +97 -0
- package/node_modules/nan/nan_string_bytes.h +305 -0
- package/node_modules/nan/nan_typedarray_contents.h +96 -0
- package/node_modules/nan/nan_weak.h +453 -0
- package/node_modules/nan/package.json +38 -0
- package/node_modules/nan/tools/1to2.js +412 -0
- package/node_modules/nan/tools/README.md +14 -0
- package/node_modules/nan/tools/package.json +19 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/ssh2/.eslintignore +4 -0
- package/node_modules/ssh2/.eslintrc.js +5 -0
- package/node_modules/ssh2/.github/workflows/ci.yml +110 -0
- package/node_modules/ssh2/.github/workflows/lint.yml +27 -0
- package/node_modules/ssh2/LICENSE +19 -0
- package/node_modules/ssh2/README.md +1529 -0
- package/node_modules/ssh2/SFTP.md +413 -0
- package/node_modules/ssh2/examples/server-chat.js +238 -0
- package/node_modules/ssh2/examples/sftp-server-download-only.js +134 -0
- package/node_modules/ssh2/install.js +27 -0
- package/node_modules/ssh2/lib/Channel.js +295 -0
- package/node_modules/ssh2/lib/agent.js +1123 -0
- package/node_modules/ssh2/lib/client.js +2176 -0
- package/node_modules/ssh2/lib/http-agents.js +84 -0
- package/node_modules/ssh2/lib/index.js +44 -0
- package/node_modules/ssh2/lib/keygen.js +582 -0
- package/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
- package/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
- package/node_modules/ssh2/lib/protocol/constants.js +356 -0
- package/node_modules/ssh2/lib/protocol/crypto/binding.gyp +23 -0
- package/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
- package/node_modules/ssh2/lib/protocol/crypto/src/binding.cc +2300 -0
- package/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
- package/node_modules/ssh2/lib/protocol/handlers.js +16 -0
- package/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
- package/node_modules/ssh2/lib/protocol/kex.js +1908 -0
- package/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
- package/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
- package/node_modules/ssh2/lib/protocol/utils.js +356 -0
- package/node_modules/ssh2/lib/protocol/zlib.js +255 -0
- package/node_modules/ssh2/lib/server.js +1380 -0
- package/node_modules/ssh2/lib/utils.js +336 -0
- package/node_modules/ssh2/package.json +49 -0
- package/node_modules/ssh2/test/common.js +316 -0
- package/node_modules/ssh2/test/fixtures/bad_rsa_private_key +26 -0
- package/node_modules/ssh2/test/fixtures/https_cert.pem +33 -0
- package/node_modules/ssh2/test/fixtures/https_key.pem +52 -0
- package/node_modules/ssh2/test/fixtures/id_dsa +12 -0
- package/node_modules/ssh2/test/fixtures/id_ecdsa +5 -0
- package/node_modules/ssh2/test/fixtures/id_rsa +15 -0
- package/node_modules/ssh2/test/fixtures/id_rsa.ppk +26 -0
- package/node_modules/ssh2/test/fixtures/id_rsa_enc +30 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa +21 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc +22 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm +23 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa +9 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc +28 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm +29 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa +12 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc +15 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa +5 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc +30 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 +54 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result +6 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result +6 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc +17 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa +26 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc +18 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub +9 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub +11 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub +11 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub +13 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/openssh_new_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_dsa_key +12 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key +5 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_rsa_key +15 -0
- package/node_modules/ssh2/test/test-exec.js +578 -0
- package/node_modules/ssh2/test/test-integration-openssh.js +486 -0
- package/node_modules/ssh2/test/test-keygen.js +60 -0
- package/node_modules/ssh2/test/test-misc-client-server.js +1460 -0
- package/node_modules/ssh2/test/test-openssh.js +261 -0
- package/node_modules/ssh2/test/test-protocol-crypto.js +631 -0
- package/node_modules/ssh2/test/test-protocol-keyparser.js +177 -0
- package/node_modules/ssh2/test/test-server-hostkeys.js +138 -0
- package/node_modules/ssh2/test/test-sftp.js +842 -0
- package/node_modules/ssh2/test/test-shell.js +109 -0
- package/node_modules/ssh2/test/test-userauth-agent-openssh.js +110 -0
- package/node_modules/ssh2/test/test-userauth-agent.js +171 -0
- package/node_modules/ssh2/test/test-userauth.js +611 -0
- package/node_modules/ssh2/test/test-worker-imports.js +25 -0
- package/node_modules/ssh2/test/test.js +20 -0
- package/node_modules/ssh2/util/build_pagent.bat +2 -0
- package/node_modules/ssh2/util/pagent.c +88 -0
- package/node_modules/ssh2/util/pagent.exe +0 -0
- package/node_modules/tweetnacl/.npmignore +4 -0
- package/node_modules/tweetnacl/AUTHORS.md +28 -0
- package/node_modules/tweetnacl/CHANGELOG.md +221 -0
- package/node_modules/tweetnacl/LICENSE +24 -0
- package/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md +20 -0
- package/node_modules/tweetnacl/README.md +459 -0
- package/node_modules/tweetnacl/nacl-fast.js +2388 -0
- package/node_modules/tweetnacl/nacl-fast.min.js +2 -0
- package/node_modules/tweetnacl/nacl.d.ts +98 -0
- package/node_modules/tweetnacl/nacl.js +1175 -0
- package/node_modules/tweetnacl/nacl.min.js +1 -0
- package/node_modules/tweetnacl/package.json +58 -0
- package/package.json +95 -89
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
// TODO: add more rekey tests that at least include switching from no
|
|
2
|
+
// compression to compression and vice versa
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const assert = require('assert');
|
|
6
|
+
const { spawn, spawnSync } = require('child_process');
|
|
7
|
+
const { chmodSync, readdirSync } = require('fs');
|
|
8
|
+
const { join } = require('path');
|
|
9
|
+
const readline = require('readline');
|
|
10
|
+
|
|
11
|
+
const Server = require('../lib/server.js');
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
fixture,
|
|
15
|
+
fixtureKey,
|
|
16
|
+
FIXTURES_DIR,
|
|
17
|
+
mustCall,
|
|
18
|
+
mustCallAtLeast,
|
|
19
|
+
} = require('./common.js');
|
|
20
|
+
|
|
21
|
+
const SPAWN_OPTS = { windowsHide: true };
|
|
22
|
+
const CLIENT_TIMEOUT = 5000;
|
|
23
|
+
|
|
24
|
+
const debug = false;
|
|
25
|
+
const opensshPath = 'ssh';
|
|
26
|
+
let opensshVer;
|
|
27
|
+
|
|
28
|
+
// TODO: figure out why this test is failing on Windows
|
|
29
|
+
if (process.platform === 'win32') {
|
|
30
|
+
console.log('Skipping OpenSSH integration tests on Windows');
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Fix file modes to avoid OpenSSH client complaints about keys' permissions
|
|
35
|
+
for (const file of readdirSync(FIXTURES_DIR, { withFileTypes: true })) {
|
|
36
|
+
if (file.isFile())
|
|
37
|
+
chmodSync(join(FIXTURES_DIR, file.name), 0o600);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
{
|
|
41
|
+
// Get OpenSSH client version first
|
|
42
|
+
const {
|
|
43
|
+
error, stderr, stdout
|
|
44
|
+
} = spawnSync(opensshPath, ['-V'], SPAWN_OPTS);
|
|
45
|
+
|
|
46
|
+
if (error) {
|
|
47
|
+
console.error('OpenSSH client is required for these tests');
|
|
48
|
+
process.exitCode = 5;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const re = /^OpenSSH_([\d.]+)/;
|
|
53
|
+
let m = re.exec(stdout.toString());
|
|
54
|
+
if (!m || !m[1]) {
|
|
55
|
+
m = re.exec(stderr.toString());
|
|
56
|
+
if (!m || !m[1]) {
|
|
57
|
+
console.error('OpenSSH client is required for these tests');
|
|
58
|
+
process.exitCode = 5;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
opensshVer = m[1];
|
|
64
|
+
console.log(`Testing with OpenSSH version: ${opensshVer}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// Key-based authentication
|
|
69
|
+
[
|
|
70
|
+
{ desc: 'RSA user key (old OpenSSH)',
|
|
71
|
+
clientKey: fixtureKey('id_rsa') },
|
|
72
|
+
{ desc: 'RSA user key (new OpenSSH)',
|
|
73
|
+
clientKey: fixtureKey('openssh_new_rsa') },
|
|
74
|
+
{ desc: 'DSA user key',
|
|
75
|
+
clientKey: fixtureKey('id_dsa') },
|
|
76
|
+
{ desc: 'ECDSA user key',
|
|
77
|
+
clientKey: fixtureKey('id_ecdsa') },
|
|
78
|
+
].forEach((test) => {
|
|
79
|
+
const { desc, clientKey } = test;
|
|
80
|
+
const username = 'KeyUser';
|
|
81
|
+
const { server } = setup(
|
|
82
|
+
desc,
|
|
83
|
+
{
|
|
84
|
+
client: {
|
|
85
|
+
username,
|
|
86
|
+
privateKeyPath: clientKey.fullPath,
|
|
87
|
+
},
|
|
88
|
+
server: { hostKeys: [ fixture('ssh_host_rsa_key') ] },
|
|
89
|
+
debug,
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
server.on('connection', mustCall((conn) => {
|
|
94
|
+
let authAttempt = 0;
|
|
95
|
+
conn.on('authentication', mustCallAtLeast((ctx) => {
|
|
96
|
+
assert(ctx.username === username,
|
|
97
|
+
`Wrong username: ${ctx.username}`);
|
|
98
|
+
switch (++authAttempt) {
|
|
99
|
+
case 1:
|
|
100
|
+
assert(ctx.method === 'none',
|
|
101
|
+
`Wrong auth method: ${ctx.method}`);
|
|
102
|
+
return ctx.reject();
|
|
103
|
+
case 2:
|
|
104
|
+
case 3:
|
|
105
|
+
if (authAttempt === 3)
|
|
106
|
+
assert(ctx.signature, 'Missing publickey signature');
|
|
107
|
+
assert(ctx.method === 'publickey',
|
|
108
|
+
`Wrong auth method: ${ctx.method}`);
|
|
109
|
+
assert(ctx.key.algo === clientKey.key.type,
|
|
110
|
+
`Wrong key algo: ${ctx.key.algo}`);
|
|
111
|
+
assert.deepStrictEqual(clientKey.key.getPublicSSH(),
|
|
112
|
+
ctx.key.data,
|
|
113
|
+
'Public key mismatch');
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
assert(false, 'Unexpected number of auth attempts');
|
|
117
|
+
}
|
|
118
|
+
if (ctx.signature) {
|
|
119
|
+
const result =
|
|
120
|
+
clientKey.key.verify(ctx.blob, ctx.signature, ctx.hashAlgo);
|
|
121
|
+
assert(result === true, 'Could not verify publickey signature');
|
|
122
|
+
// We should not expect any further auth attempts after we verify a
|
|
123
|
+
// signature
|
|
124
|
+
authAttempt = Infinity;
|
|
125
|
+
}
|
|
126
|
+
ctx.accept();
|
|
127
|
+
}, 2)).on('ready', mustCall(() => {
|
|
128
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
129
|
+
accept().on('exec', mustCall((accept, reject) => {
|
|
130
|
+
const stream = accept();
|
|
131
|
+
stream.exit(0);
|
|
132
|
+
stream.end();
|
|
133
|
+
}));
|
|
134
|
+
}));
|
|
135
|
+
}));
|
|
136
|
+
}));
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
// Different host key types
|
|
141
|
+
[
|
|
142
|
+
{ desc: 'RSA host key (old OpenSSH)',
|
|
143
|
+
hostKey: fixture('id_rsa') },
|
|
144
|
+
{ desc: 'RSA host key (new OpenSSH)',
|
|
145
|
+
hostKey: fixture('openssh_new_rsa') },
|
|
146
|
+
{ desc: 'DSA host key',
|
|
147
|
+
hostKey: fixture('ssh_host_dsa_key') },
|
|
148
|
+
{ desc: 'ECDSA host key',
|
|
149
|
+
hostKey: fixture('ssh_host_ecdsa_key') },
|
|
150
|
+
{ desc: 'PPK',
|
|
151
|
+
hostKey: fixture('id_rsa.ppk') },
|
|
152
|
+
].forEach((test) => {
|
|
153
|
+
const { desc, hostKey } = test;
|
|
154
|
+
const clientKey = fixtureKey('openssh_new_rsa');
|
|
155
|
+
const username = 'KeyUser';
|
|
156
|
+
const { server } = setup(
|
|
157
|
+
desc,
|
|
158
|
+
{
|
|
159
|
+
client: {
|
|
160
|
+
username,
|
|
161
|
+
privateKeyPath: clientKey.fullPath,
|
|
162
|
+
},
|
|
163
|
+
server: { hostKeys: [ hostKey ] },
|
|
164
|
+
debug,
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
server.on('connection', mustCall((conn) => {
|
|
169
|
+
let authAttempt = 0;
|
|
170
|
+
conn.on('authentication', mustCallAtLeast((ctx) => {
|
|
171
|
+
assert(ctx.username === username,
|
|
172
|
+
`Wrong username: ${ctx.username}`);
|
|
173
|
+
switch (++authAttempt) {
|
|
174
|
+
case 1:
|
|
175
|
+
assert(ctx.method === 'none',
|
|
176
|
+
`Wrong auth method: ${ctx.method}`);
|
|
177
|
+
return ctx.reject();
|
|
178
|
+
case 2:
|
|
179
|
+
case 3:
|
|
180
|
+
if (authAttempt === 3)
|
|
181
|
+
assert(ctx.signature, 'Missing publickey signature');
|
|
182
|
+
assert(ctx.method === 'publickey',
|
|
183
|
+
`Wrong auth method: ${ctx.method}`);
|
|
184
|
+
assert(ctx.key.algo === clientKey.key.type,
|
|
185
|
+
`Wrong key algo: ${ctx.key.algo}`);
|
|
186
|
+
assert.deepStrictEqual(clientKey.key.getPublicSSH(),
|
|
187
|
+
ctx.key.data,
|
|
188
|
+
'Public key mismatch');
|
|
189
|
+
break;
|
|
190
|
+
default:
|
|
191
|
+
assert(false, 'Unexpected number of auth attempts');
|
|
192
|
+
}
|
|
193
|
+
if (ctx.signature) {
|
|
194
|
+
const result =
|
|
195
|
+
clientKey.key.verify(ctx.blob, ctx.signature, ctx.hashAlgo);
|
|
196
|
+
assert(result === true, 'Could not verify publickey signature');
|
|
197
|
+
// We should not expect any further auth attempts after we verify a
|
|
198
|
+
// signature
|
|
199
|
+
authAttempt = Infinity;
|
|
200
|
+
}
|
|
201
|
+
ctx.accept();
|
|
202
|
+
}, 2)).on('ready', mustCall(() => {
|
|
203
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
204
|
+
accept().on('exec', mustCall((accept, reject) => {
|
|
205
|
+
const stream = accept();
|
|
206
|
+
stream.exit(0);
|
|
207
|
+
stream.end();
|
|
208
|
+
}));
|
|
209
|
+
}));
|
|
210
|
+
}));
|
|
211
|
+
}));
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
// Various edge cases
|
|
216
|
+
{
|
|
217
|
+
const clientKey = fixtureKey('openssh_new_rsa');
|
|
218
|
+
const username = 'KeyUser';
|
|
219
|
+
const { server } = setup(
|
|
220
|
+
'Server closes stdin too early',
|
|
221
|
+
{
|
|
222
|
+
client: {
|
|
223
|
+
username,
|
|
224
|
+
privateKeyPath: clientKey.fullPath,
|
|
225
|
+
},
|
|
226
|
+
server: { hostKeys: [ fixture('ssh_host_rsa_key') ] },
|
|
227
|
+
debug,
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
server.on('_child', mustCall((childProc) => {
|
|
232
|
+
childProc.stderr.once('data', mustCall((data) => {
|
|
233
|
+
childProc.stdin.end();
|
|
234
|
+
}));
|
|
235
|
+
childProc.stdin.write('ping');
|
|
236
|
+
})).on('connection', mustCall((conn) => {
|
|
237
|
+
let authAttempt = 0;
|
|
238
|
+
conn.on('authentication', mustCallAtLeast((ctx) => {
|
|
239
|
+
assert(ctx.username === username,
|
|
240
|
+
`Wrong username: ${ctx.username}`);
|
|
241
|
+
switch (++authAttempt) {
|
|
242
|
+
case 1:
|
|
243
|
+
assert(ctx.method === 'none',
|
|
244
|
+
`Wrong auth method: ${ctx.method}`);
|
|
245
|
+
return ctx.reject();
|
|
246
|
+
case 2:
|
|
247
|
+
case 3:
|
|
248
|
+
if (authAttempt === 3)
|
|
249
|
+
assert(ctx.signature, 'Missing publickey signature');
|
|
250
|
+
assert(ctx.method === 'publickey',
|
|
251
|
+
`Wrong auth method: ${ctx.method}`);
|
|
252
|
+
assert(ctx.key.algo === clientKey.key.type,
|
|
253
|
+
`Wrong key algo: ${ctx.key.algo}`);
|
|
254
|
+
assert.deepStrictEqual(clientKey.key.getPublicSSH(),
|
|
255
|
+
ctx.key.data,
|
|
256
|
+
'Public key mismatch');
|
|
257
|
+
break;
|
|
258
|
+
default:
|
|
259
|
+
assert(false, 'Unexpected number of auth attempts');
|
|
260
|
+
}
|
|
261
|
+
if (ctx.signature) {
|
|
262
|
+
const result =
|
|
263
|
+
clientKey.key.verify(ctx.blob, ctx.signature, ctx.hashAlgo);
|
|
264
|
+
assert(result === true, 'Could not verify publickey signature');
|
|
265
|
+
// We should not expect any further auth attempts after we verify a
|
|
266
|
+
// signature
|
|
267
|
+
authAttempt = Infinity;
|
|
268
|
+
}
|
|
269
|
+
ctx.accept();
|
|
270
|
+
}, 2)).on('ready', mustCall(() => {
|
|
271
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
272
|
+
accept().on('exec', mustCall((accept, reject) => {
|
|
273
|
+
const stream = accept();
|
|
274
|
+
stream.stdin.on('data', mustCallAtLeast((data) => {
|
|
275
|
+
stream.stdout.write('pong on stdout');
|
|
276
|
+
stream.stderr.write('pong on stderr');
|
|
277
|
+
})).on('end', mustCall(() => {
|
|
278
|
+
stream.stdout.write('pong on stdout');
|
|
279
|
+
stream.stderr.write('pong on stderr');
|
|
280
|
+
stream.exit(0);
|
|
281
|
+
stream.close();
|
|
282
|
+
}));
|
|
283
|
+
}));
|
|
284
|
+
}));
|
|
285
|
+
}));
|
|
286
|
+
}));
|
|
287
|
+
}
|
|
288
|
+
{
|
|
289
|
+
const clientKey = fixtureKey('openssh_new_rsa');
|
|
290
|
+
const username = 'KeyUser';
|
|
291
|
+
const { server } = setup(
|
|
292
|
+
'Rekey',
|
|
293
|
+
{
|
|
294
|
+
client: {
|
|
295
|
+
username,
|
|
296
|
+
privateKeyPath: clientKey.fullPath,
|
|
297
|
+
},
|
|
298
|
+
server: { hostKeys: [ fixture('ssh_host_rsa_key') ] },
|
|
299
|
+
debug,
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
server.on('connection', mustCall((conn) => {
|
|
304
|
+
let authAttempt = 0;
|
|
305
|
+
conn.on('authentication', mustCallAtLeast((ctx) => {
|
|
306
|
+
assert(ctx.username === username,
|
|
307
|
+
`Wrong username: ${ctx.username}`);
|
|
308
|
+
switch (++authAttempt) {
|
|
309
|
+
case 1:
|
|
310
|
+
assert(ctx.method === 'none',
|
|
311
|
+
`Wrong auth method: ${ctx.method}`);
|
|
312
|
+
return ctx.reject();
|
|
313
|
+
case 2:
|
|
314
|
+
case 3:
|
|
315
|
+
if (authAttempt === 3)
|
|
316
|
+
assert(ctx.signature, 'Missing publickey signature');
|
|
317
|
+
assert(ctx.method === 'publickey',
|
|
318
|
+
`Wrong auth method: ${ctx.method}`);
|
|
319
|
+
assert(ctx.key.algo === clientKey.key.type,
|
|
320
|
+
`Wrong key algo: ${ctx.key.algo}`);
|
|
321
|
+
assert.deepStrictEqual(clientKey.key.getPublicSSH(),
|
|
322
|
+
ctx.key.data,
|
|
323
|
+
'Public key mismatch');
|
|
324
|
+
break;
|
|
325
|
+
default:
|
|
326
|
+
assert(false, 'Unexpected number of auth attempts');
|
|
327
|
+
}
|
|
328
|
+
if (ctx.signature) {
|
|
329
|
+
const result =
|
|
330
|
+
clientKey.key.verify(ctx.blob, ctx.signature, ctx.hashAlgo);
|
|
331
|
+
assert(result === true, 'Could not verify publickey signature');
|
|
332
|
+
// We should not expect any further auth attempts after we verify a
|
|
333
|
+
// signature
|
|
334
|
+
authAttempt = Infinity;
|
|
335
|
+
}
|
|
336
|
+
ctx.accept();
|
|
337
|
+
}, 2)).on('ready', mustCall(() => {
|
|
338
|
+
conn.on('session', mustCall((accept, reject) => {
|
|
339
|
+
const session = accept();
|
|
340
|
+
conn.rekey();
|
|
341
|
+
session.on('exec', mustCall((accept, reject) => {
|
|
342
|
+
const stream = accept();
|
|
343
|
+
stream.exit(0);
|
|
344
|
+
stream.end();
|
|
345
|
+
}));
|
|
346
|
+
}));
|
|
347
|
+
}));
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
function setup(title, configs) {
|
|
353
|
+
const {
|
|
354
|
+
client: clientCfg,
|
|
355
|
+
server: serverCfg,
|
|
356
|
+
allReady: allReady_,
|
|
357
|
+
timeout: timeout_,
|
|
358
|
+
debug,
|
|
359
|
+
noForceServerReady,
|
|
360
|
+
} = configs;
|
|
361
|
+
let clientClose = false;
|
|
362
|
+
let serverClose = false;
|
|
363
|
+
let serverReady = false;
|
|
364
|
+
let client;
|
|
365
|
+
const msg = (text) => {
|
|
366
|
+
return `${title}: ${text}`;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
const timeout = (typeof timeout_ === 'number'
|
|
370
|
+
? timeout_
|
|
371
|
+
: CLIENT_TIMEOUT);
|
|
372
|
+
|
|
373
|
+
const allReady = (typeof allReady_ === 'function' ? allReady_ : undefined);
|
|
374
|
+
|
|
375
|
+
if (debug) {
|
|
376
|
+
serverCfg.debug = (...args) => {
|
|
377
|
+
console.log(`[${title}][SERVER]`, ...args);
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const serverReadyFn = (noForceServerReady ? onReady : mustCall(onReady));
|
|
382
|
+
const server = new Server(serverCfg);
|
|
383
|
+
|
|
384
|
+
server.on('error', onError)
|
|
385
|
+
.on('connection', mustCall((conn) => {
|
|
386
|
+
conn.on('error', onError)
|
|
387
|
+
.on('ready', serverReadyFn);
|
|
388
|
+
server.close();
|
|
389
|
+
}))
|
|
390
|
+
.on('close', mustCall(onClose));
|
|
391
|
+
|
|
392
|
+
function onError(err) {
|
|
393
|
+
const which = (arguments.length >= 3 ? 'client' : 'server');
|
|
394
|
+
assert(false, msg(`Unexpected ${which} error: ${err}`));
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function onReady() {
|
|
398
|
+
assert(!serverReady, msg('Received multiple ready events for server'));
|
|
399
|
+
serverReady = true;
|
|
400
|
+
allReady && allReady();
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function onClose() {
|
|
404
|
+
if (arguments.length >= 3) {
|
|
405
|
+
assert(!clientClose, msg('Received multiple close events for client'));
|
|
406
|
+
clientClose = true;
|
|
407
|
+
} else {
|
|
408
|
+
assert(!serverClose, msg('Received multiple close events for server'));
|
|
409
|
+
serverClose = true;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
process.nextTick(mustCall(() => {
|
|
414
|
+
server.listen(0, 'localhost', mustCall(() => {
|
|
415
|
+
const args = [
|
|
416
|
+
'-o', 'UserKnownHostsFile=/dev/null',
|
|
417
|
+
'-o', 'StrictHostKeyChecking=no',
|
|
418
|
+
'-o', 'CheckHostIP=no',
|
|
419
|
+
'-o', 'ConnectTimeout=3',
|
|
420
|
+
'-o', 'GlobalKnownHostsFile=/dev/null',
|
|
421
|
+
'-o', 'GSSAPIAuthentication=no',
|
|
422
|
+
'-o', 'IdentitiesOnly=yes',
|
|
423
|
+
'-o', 'BatchMode=yes',
|
|
424
|
+
'-o', 'VerifyHostKeyDNS=no',
|
|
425
|
+
|
|
426
|
+
'-vvvvvv',
|
|
427
|
+
'-T',
|
|
428
|
+
'-o', 'KbdInteractiveAuthentication=no',
|
|
429
|
+
'-o', 'HostbasedAuthentication=no',
|
|
430
|
+
'-o', 'PasswordAuthentication=no',
|
|
431
|
+
'-o', 'PubkeyAuthentication=yes',
|
|
432
|
+
'-o', 'PreferredAuthentications=publickey'
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
if (clientCfg.privateKeyPath)
|
|
436
|
+
args.push('-o', `IdentityFile=${clientCfg.privateKeyPath}`);
|
|
437
|
+
|
|
438
|
+
if (!/^[0-6]\./.test(opensshVer)) {
|
|
439
|
+
// OpenSSH 7.0+ disables DSS/DSA host (and user) key support by
|
|
440
|
+
// default, so we explicitly enable it here
|
|
441
|
+
args.push('-o', 'HostKeyAlgorithms=+ssh-dss');
|
|
442
|
+
args.push('-o', 'PubkeyAcceptedKeyTypes=+ssh-dss');
|
|
443
|
+
args.push('-o', 'PubkeyAcceptedAlgorithms=+ssh-dss');
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
args.push('-p', server.address().port.toString(),
|
|
447
|
+
'-l', clientCfg.username,
|
|
448
|
+
'localhost',
|
|
449
|
+
'uptime');
|
|
450
|
+
|
|
451
|
+
client = spawn(opensshPath, args, SPAWN_OPTS);
|
|
452
|
+
server.emit('_child', client);
|
|
453
|
+
|
|
454
|
+
if (debug) {
|
|
455
|
+
readline.createInterface({
|
|
456
|
+
input: client.stdout
|
|
457
|
+
}).on('line', (line) => {
|
|
458
|
+
console.log(`[${title}][CLIENT][STDOUT]`, line);
|
|
459
|
+
});
|
|
460
|
+
readline.createInterface({
|
|
461
|
+
input: client.stderr
|
|
462
|
+
}).on('line', (line) => {
|
|
463
|
+
console.error(`[${title}][CLIENT][STDERR]`, line);
|
|
464
|
+
});
|
|
465
|
+
} else {
|
|
466
|
+
client.stdout.resume();
|
|
467
|
+
client.stderr.resume();
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
client.on('error', (err) => {
|
|
471
|
+
onError(err, null, null);
|
|
472
|
+
}).on('exit', (code) => {
|
|
473
|
+
clearTimeout(client.timer);
|
|
474
|
+
if (code !== 0)
|
|
475
|
+
return onError(new Error(`Non-zero exit code ${code}`), null, null);
|
|
476
|
+
onClose(null, null, null);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
client.timer = setTimeout(() => {
|
|
480
|
+
assert(false, msg('Client timeout'));
|
|
481
|
+
}, timeout);
|
|
482
|
+
}));
|
|
483
|
+
}));
|
|
484
|
+
|
|
485
|
+
return { server };
|
|
486
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
utils: {
|
|
7
|
+
generateKeyPair,
|
|
8
|
+
generateKeyPairSync,
|
|
9
|
+
parseKey,
|
|
10
|
+
},
|
|
11
|
+
} = require('..');
|
|
12
|
+
|
|
13
|
+
const { mustCall } = require('./common.js');
|
|
14
|
+
|
|
15
|
+
const nodeMajor = +/(?<=^v)\d+/.exec(process.version)[0];
|
|
16
|
+
|
|
17
|
+
function tryParse(...args) {
|
|
18
|
+
const ret = parseKey(...args);
|
|
19
|
+
if (ret instanceof Error)
|
|
20
|
+
throw ret;
|
|
21
|
+
return ret;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const inputs = [
|
|
25
|
+
{ args: ['rsa', { bits: 2048 }], sshType: 'ssh-rsa' },
|
|
26
|
+
{ args: ['ecdsa', { bits: 256 }], sshType: 'ecdsa-sha2-nistp256' },
|
|
27
|
+
{ args: ['ecdsa', { bits: 521 }], sshType: 'ecdsa-sha2-nistp521' },
|
|
28
|
+
{ args: ['ed25519'], sshType: 'ssh-ed25519' },
|
|
29
|
+
{ args: ['rsa', { bits: 2048, passphrase: 'foo', cipher: 'aes256-cbc' }],
|
|
30
|
+
sshType: 'ssh-rsa' },
|
|
31
|
+
{ args: ['rsa', { bits: 2048, comment: 'foobarbaz' }], sshType: 'ssh-rsa' },
|
|
32
|
+
];
|
|
33
|
+
(function next() {
|
|
34
|
+
if (inputs.length === 0)
|
|
35
|
+
return;
|
|
36
|
+
const { args, sshType } = inputs.shift();
|
|
37
|
+
if (args[0] === 'ed25519' && nodeMajor < 12) {
|
|
38
|
+
console.log('Skipping ed25519 on node < 12');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const passphrase = (args[1] && args[1].passphrase);
|
|
42
|
+
const comment = ((args[1] && args[1].comment) || '');
|
|
43
|
+
const check = (keys) => {
|
|
44
|
+
let parsed = tryParse(keys.private, passphrase);
|
|
45
|
+
assert.strictEqual(parsed.type, sshType);
|
|
46
|
+
assert.strictEqual(parsed.comment, comment);
|
|
47
|
+
|
|
48
|
+
parsed = tryParse(keys.public);
|
|
49
|
+
assert.strictEqual(parsed.type, sshType);
|
|
50
|
+
assert.strictEqual(parsed.comment, comment);
|
|
51
|
+
};
|
|
52
|
+
console.log(`Testing generateKeyPairSync(${JSON.stringify(args)}) ...`);
|
|
53
|
+
check(generateKeyPairSync(...args));
|
|
54
|
+
console.log(`Testing generateKeyPair(${JSON.stringify(args)}) ...`);
|
|
55
|
+
generateKeyPair(...args, mustCall((err, keys) => {
|
|
56
|
+
assert.ifError(err);
|
|
57
|
+
check(keys);
|
|
58
|
+
next();
|
|
59
|
+
}));
|
|
60
|
+
})();
|