metwork-framework / mfdata

metwork/mfdata module
http://metwork-framework.org/
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

sftpsend plugin does not handle ecdsa keys #488

Closed matthieumarrast closed 2 months ago

matthieumarrast commented 2 months ago

We installed an sftpsend plugin configured with an ECDSA key pair.

But we face the below error while connecting to the sftp server:

2024-09-16T14:40:56.970012Z  [WARNING] (mfdata.plugin.main#1565142) Exception: unpack requires a buffer of 4 bytes during SFTP connect {hostname=server user=user}

As per the code https://github.com/metwork-framework/mfdata/blob/master/plugins/sftpsend/main.py the key is read with code: key = paramiko.RSAKey.from_private_key_file(self.sftp_key_file) where it should be paramiko.ecdsakey for an ecdsa key... cf. https://docs.paramiko.org/en/latest/api/keys.html#module-paramiko.ecdsakey

maybe we should add a config for the plugin to identify which class must be used:

# SFTP ssh key algorithm (rsa, ecdsa)
# default: rsa
sftp_key_algorithm=rsa