I need to use a private rsa key to connect to a server, the file contains the key as follows.
-----BEGIN OPENSSH PRIVATE KEY-----
key
-----END OPENSSH PRIVATE KEY-----
when I try to upload it, Setup/Compagny/Keys/add I get the following error: Unexpected Error
If I try to convert it to .pem with the following bash command:
ssh-keygen -p -N "" -m pem -f /path/to/key
(console log Key has comment 'amillet@LAPTOP-Q89B7RU7' Your identification has been saved with the new passphrase)
I am able to create the key so I am trying to establish a connection with the code bellow :
sftp.createConnection({
username: ID_OF_CONNECTION,
keyId: KEY_ID
hostKey: HOST_KEY,
url: URL_SERVER,
port: PORT_SERVER,
});
I get the following error:"FTP_CANNOT_ESTABLISH_CONNECTION", "details": "Could not establish connection to Auth fail. ",
I then tried to connect via FileZilla with the same file (KEY_ID) and the same information, except the HOST_KEY is retrieved by filezilla
In my code HOST_KEY is the result of
ssh-keyscan -t rsa -p ${PORT_SERVER} ${URL_SERVER}
executed from my terminal
I can't understand why the same information from fileZilla allows me to connect to the server but not from NEtsuite.
I assume you're using the key Id from Setup -> Company Keys
your sample is missing the hostKeyType parameter
hostKeyType: 'rsa'
so:
sftp.createConnection({
username: ID_OF_CONNECTION,
keyId: KEY_ID
hostKey: HOST_KEY,
hostKeyType: 'rsa',
url: URL_SERVER,
port: PORT_SERVER,
});