Reputation: 481
I'm trying to connect to my SFTP server (prosftpd) but when I check its logs I find :
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,[email protected]', server sent 'hmac-sha2-256,hmac-sha2-512,[email protected]')
I tried to use the "method" parameter:
ssh2_connect("my-sftp-server.com", 443, array(
"client_to_server" => array(
"mac" => 'hmac-sha2-256,hmac-sha2-512,[email protected]'
But it doesn't work, it seems like this algorithm is not supported by the method ssh2_connect
and on my logs I can see
client sent 'hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,[email protected]'
Is there a way to install new MAC algorithm on my PHP SFTP client?
Upvotes: 2
Views: 2546
Reputation: 202594
PHP SSH2 package uses libssh2 library.
You need libssh2 version 1.7.0 (2016-02-23) or later for hmac-sha2-256
and hmac-sha2-512
. There's no support for [email protected]
.
Alternatively, you can use phpseclib, which supports hmac-sha2-256
ever since version 0.3.8 (2014-09-12). More recent versions support even hmac-sha2-512
and [email protected]
.
Upvotes: 1