我正在尝试连接到我的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-256
和hmac-sha2-512
。不支持umac-64@openssh.com
。
另外,您也可以使用phpseclib,自version 0.3.8(2014-09-12)起支持hmac-sha2-256
。不支持hmac-sha2-512
或umac-64@openssh.com
。
关于php - 使用客户端服务器ssh2_connect中的MAC算法hmac-sha2-256,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49917495/