NetSuite Connectivity With sFTP
Integration of applications is becoming a necessity, helping businesses grow while providing the flexibility to plug in solutions and applications that meet the needs of the business. NetSuite helps this growth with its ability to integrate with a number of solutions and softwares available on the market.
Most NetSuite users might already be familiar with the various integration options available. Some integrations require for NetSuite to connect to sFTP servers and file exchange to take place between NetSuite and third-party systems. During the course of this blog, let us delve into how to establish an sFTP connection with NetSuite and the options available to facilitate this connection.
With older versions, such as SuiteScript API 1.0, middleware servers or other external options were required to establish FTP connection, which created dependencies that were expensive and time-consuming. As part of the 2016.2 release, NetSuite launched the N/sftp module, which has the ability to connect to sFTP servers directly from NetSuite and transfer files between the two. There were a few limitations of this library when it was initially introduced by NetSuite:
- Users did not have the ability to list contents on the sFTP server.
- Users could only pull those files from the sFTP for which they had the exact name. If a file was uploaded dynamically with a new name, it would be difficult to pull such files from the sFTP.
However, with recent updates, NetSuite has improved on the N/sftp module, which overcomes these issues, making it easier to use this library and connect with sFTP servers. It is important to note that sFTP is different from FTP. sFTP is a secure file transfer protocol while FTP is an older and less secure way of transferring files. NetSuite supports only sFTP, and does not support FTP.
How to use the SFTP module in NetSuite:
A server host key is required in order to connect to a third party sFTP serve. This is provided by the administrator of the sFTP server. The host key can also be generated using the hostname or IP address of the sFTP server.
Once the host key details of the server have been obtained, the next step is to decide on the authentication method. There are two different methods of authentication –
- Using password GUID (username/password)
- Using Key/Certificate based authentication
The authentication method can be determined by any of the following – the nature of the integration, the security requirements of the sFTP server or the level of security required for the data that is being transferred.
Using Password GUID:
- To use this method, both the username and password are saved in NetSuite
- Password GUID is a value generated from the actual password. It is more secure way of passing credentials to the sFTP server.
- Password GUID allows the users to access a specific sFTP domain
- It restricts usage of the GUID to specific scripts in the NetSuite account with the help of NetSuite script IDs. This way, no other script will be able to use the same GUID to connect to that sFTP.
Using Key/Certificate based authentication:
- This method is considered more secure as the password is not exposed or revealed to anyone
- Use the Key authentication to generate keys (using puTTYgen could be one option) and save the private and public keys.
- After generating the keys, convert the private key to “.PEM” format. (NetSuite currently only supports this format)
- Upload the .PEM format key into Netsuite
- Navigate to Setup > Company > keys
- Click on the create new button and upload the .PEM key
- Enter the Name, Key id and upload the .PEM file in the files section
- Finally, share the public key with the sFTP Server team so that they can use the same to extract the files uploaded from NetSuite
- A point to note – only the following SSH keys are supported by NetSuite
The final step in the usage of sFTP module in NetSuite is to establish connection to the sFTP server from NetSuite and upload/download files from the server. Create a script in NetSuite and use the N/sftp module to achieve this functionality in NetSuite. Once the host key and authentication methods are finalized, using the script to establish connection and exchange files should be simple and straightforward.