How to config MAC(message authentication code) using curl command

0

I want to download file via curl with sftp, like this

curl --insecure "sftp://1.1.1.1:22" --user 'root:123123'

and the sftp server make a security config(/etc/ssh/sshd_config, MACs hmac-sha2-512,hmac-sha2-256), so curl can't make connection with server, there is error logs in message.log

fatal: no matching mac found: client hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com server hmac-sha2-512,hmac-sha2-256 [preauth]

how can I config the mac with curl?

cloudy

Posted 2019-10-31T08:13:55.533

Reputation: 1

curl use the libssh2 to execute sftp operation, and old libssh2 don't support new HMAC algorithm, and I compile curl with the newest libssh, it works – cloudy – 2019-11-01T10:30:37.583

Answers

0

1.compile openssl

./config -fPIC no-shared no-threads no-asm --prefix=/usr1/local/ssl

2.compile libssh2

./configure --prefix=/usr1/local/ssh2 --exec-prefix=/usr1/local/ssh2 --includedir=/usr1/local/ssh2 --disable-examples-build

3.need move include file location to adjust the curl requirement

mkdir /usr1/local/ssh2/include

mv /usr1/local/ssh2/*.h /usr1/local/ssh2/include/

4.compile curl

./configure --prefix=/usr1/local/curl --with-libssh2=/usr1/local/ssh2 --with-ssl=/usr1/local/ssl

5.it works

cloudy

Posted 2019-10-31T08:13:55.533

Reputation: 1