https://netsuiteprofessionals.com logo
r

razer456

03/29/2022, 5:42 AM
Hi, I need to make a SFTP connection from NetSuite to a bank. like I will need a connection, and they will provide me a username, hostKey ,URL and Passguid right? and i just have to upload the file there at the given directory?
Copy code
var connection = sftp.createConnection({
        username: 'username',
        passwordGuid: '123456789',
        url: '<http://url.server.com|url.server.com>',
        hostKey: ''
    });
    //log.error('CONNECTION',connection);

    var myFileToUpload = file.create({
        name: internalID + '.json',
        fileType: file.Type.JSON,
        contents: postData,
        description: 'SO', 
        encoding: file.Encoding.UTF8
    });


    connection.upload({
    directory: username + '/',
    filename: internalID + '.json',
    file: myFileToUpload,
    replaceExisting: false
   });
b

battk

03/29/2022, 8:40 AM
sftp supports 2 authentication methods, the traditional username/password or a username/private key
your bank gets to choose which they support, which usually means the username/private key
its also unusual for them to provide the host key themselves, its something that you will have to manage
r

razer456

03/30/2022, 7:42 PM
they use username/private key,
so they won't provide host key or password guid
then how am i suppose to get it?
b

battk

03/31/2022, 1:54 AM
i already gave the docs for managing the host key
Uploading Private SSH Keys goes over how to upload a private key to netsuite
keep in mind that its fairly common for the bank to generate the ssh keys themselves, so you want to check with the bank to see if they expect you to give them a public key or if they will give you a private key
r

razer456

04/01/2022, 3:44 PM
they dont generate
they have told us to create the SSH keys
is this scary?
b

battk

04/01/2022, 3:45 PM
its normal for sftp
r

razer456

04/01/2022, 3:45 PM
aha
what is the file format?
b

battk

04/01/2022, 3:46 PM
dont expect to be able to do this without learning how sftp works and how to use it
r

razer456

04/01/2022, 3:46 PM
right
b

battk

04/01/2022, 3:46 PM
file format is upto the bank
r

razer456

04/01/2022, 3:46 PM
what to i refer to learn ?
because i have to do it
b

battk

04/01/2022, 3:52 PM
best will probably be having access to a sftp server that you can practice with
r

razer456

04/01/2022, 3:59 PM
right
what is a host key? is it the public key generated with ssh private key?
is that host?
b

battk

04/01/2022, 4:02 PM
there are 2 pairs of keys involved
the private key / public key of the server
and the private key / public key of the client (you)
the host key is the public key of the server
r

razer456

04/01/2022, 4:03 PM
gotcha! okay the public key is the host key
and the passwors guid is the private key
password guid*
r

razer456

04/01/2022, 4:04 PM
right
b

battk

04/01/2022, 4:04 PM
the password guid is used with the username/password combination
r

razer456

04/01/2022, 4:08 PM
Copy code
var strHostKey = "AAAA888888888888888888888q7Rq1";

			  var objConnection = sftp.createConnection({
				  username: 'netsuite',
				  keyId: 'custkeynsacs_brav_edw_sftp',
				  url: '<http://secungs.com|secungs.com>',
				  port: 22,
				  hostKey: strHostKey
			  });
see here where i put the private key?
i mean here username and password
hostkey can is the public key
b

battk

04/01/2022, 4:10 PM
public key is too ambiguous
there are 2 pairs of keys
both with a public key
r

razer456

04/01/2022, 4:11 PM
i give public key to the bank
and use the private key myself
in the hostkey: (myprivatekey) right?
i need to see how this exactly goes
b

battk

04/01/2022, 4:12 PM
the host key is unrelated to any of the keys you generate
its the public key of the sftp server
r

razer456

04/01/2022, 4:13 PM
who will give me that?
and where will i use the private key
and what will i do of the public key?
b

battk

04/01/2022, 4:14 PM
i gave you 2 links to documentation earlier
you will need to read both of them
r

razer456

04/01/2022, 4:14 PM
aha right
i will go through that
also one last question please
what is the MT102 for text file?
in wire transfers?
is that like a rule or something?
I can create that file, looks pretty simple.
but the ACH one creeps me out
its something CDD or CDX or PPP something
how do i generate that?
b

battk

04/01/2022, 4:18 PM
mt102 sounds like a swift file format
r

razer456

04/01/2022, 4:18 PM
yes ye s
it is
are you god?
b

battk

04/01/2022, 4:19 PM
that was a quick search
r

razer456

04/01/2022, 4:19 PM
but still the ACH one is i am concerned with
b

battk

04/01/2022, 4:19 PM
though i do recognize ach without searching
r

razer456

04/01/2022, 4:20 PM
all these files do i create thorugh coding each line?
b

battk

04/01/2022, 4:20 PM
not sure about the swift one
the ach one has headers and trailers, so you will be doing summaries of lines
r

razer456

04/01/2022, 4:36 PM
yeah exactly
so i have do ach through code right?
SFTP Connection suiteapp
b

battk

04/01/2022, 4:45 PM
Electronic Bank Payments is the netsuite feature related to generating bank payment files
its essentially generating payment files via templates
the sftp connector suiteapp is designed to move these files to bank via sftp
the functionality is implemented in suitescript, so a lot of the things in there will relate to suitescript apis
r

razer456

04/04/2022, 9:03 AM
aha!
I will take a look at this, thanks!
I read the links you provided
Should i generate the private and public keys myself using putty
or IT support does it better?
also is the host key is the public key or should i ask the bank for it?