php - 使用客户端服务器ssh2_connect中的MAC算法hmac-sha2-256

标签 php ssh sftp

我正在尝试连接到我的SFTP服务器(prosftpd),但是当我查看其日志时,我发现:

2018-04-19 11:00:48,303 mod_sftp/0.9.9[18488]: no shared client-to-server MAC algorithm found (client sent 'hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com', server sent 'hmac-sha2-256,hmac-sha2-512,umac-64@openssh.com')



我尝试使用“方法”参数:
ssh2_connect("my-sftp-server.com", 443, array(
    "client_to_server" => array(
      "mac" => 'hmac-sha2-256,hmac-sha2-512,umac-64@openssh.com'

但是它不起作用,看来ssh2_connect方法不支持该算法,在我的日志中我可以看到

client sent 'hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com'



有没有办法在我的PHP SFTP客户端上安装新的MAC算法?

最佳答案

PHP SSH2 package使用libssh2 library

您需要libssh2 version 1.7.0(2016-02-23)或更高版本才能使用hmac-sha2-256hmac-sha2-512。不支持umac-64@openssh.com

另外,您也可以使用phpseclib,自version 0.3.8(2014-09-12)起支持hmac-sha2-256。不支持hmac-sha2-512umac-64@openssh.com

关于php - 使用客户端服务器ssh2_connect中的MAC算法hmac-sha2-256,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49917495/

相关文章:

php - 完整的 Material list

php - 循环遍历数组并按值删除/取消设置

php - JSON数据没有解析?

http - 无需ssh访问权限即可轻松读取docker日志的简便方法

python - 从 SFTP 服务器打开 Astropy FITS 文件

Java 小程序上传文件和文件夹,同时保持目录结构完整

javascript - 使用 javascript 验证密码

ssh - bin/sh,bin/bash,sbin/nologin,bin/tcsh等有什么区别?

linux - SSH_MSG_CHANNEL_REQUEST exec 之后,sshd 是否将数据发送到 stdin

java - 如何在使用 JSch SFTP 库时解析 Java UnknownHostKey?