API KEY Username Too Long for FTP Settings on Camera
Using an API KEY as a username for FTP triggering works great. But some cameras limit usernames to 32 characters and a 30 character API KEY with the simulated e-mail address won't fit.
Using an API KEY as a username for FTP triggering is a good idea. But it has some requirements that are important to understand.
- It must be a Sub-Account API KEY that can authenticate Websocket
- Structure must simulate an Email address, [API KEY]@Shinobi
- It must fit in the username field on the camera.
Shinobi generates a 30-character API KEY. Some cameras have an FTP username field that only supports 32 characters so adding the simulated e-mail address isn’t possible.
Two possible solutions are either use the Username you use to login to the Shinobi dashboard or shorten the API KEY. You should avoid storing login usernames and passwords on cameras as they are the least secure and most compromised components in the video network.
How to Shorten the FTP [API KEY] to Fit FTP username Fields.
*This Method Edits the MariaDB database CCIO which Shinobi Depends upon. Edit at your own Risk*
These instructions are for Ubuntu, but other systems will be similar.
In your Shinobi Web Create an API KEY
In the Left Column of the Shinobi Web click on API Keys Add New - Can Authenticate Websocket with your desired IP range (local network) You will see the new API key on the right side. You will need to edit this in MariaDB using an editor like DBeaver.
Install DBeaver - a free cross-platform database tool.
You can use PPA repository to easily install/upgrade DBeaver on Debian Linuxes. Mostly it is the same as regular Debian repo, but it is hosted on Launchpad.
sudo add-apt-repository ppa:serge-rider/dbeaver-ce sudo apt-get update sudo apt-get install dbeaver-ce
Connect to the Shinobi Database
Run DBeaver-ce from App console or command line. It is a GUI application.
Click on Database – New Database Connection Select MariaDB – Next Unless you have changes the default settings you should only need to add: Database: ccio Username: majesticflame Press Test Connection to validate settings. Once everything is correct, click Finish Find and Edit API KEY In the Database Navigator expand ccio – Databases – Tables Double click on API Find the API Key you created earlier and double click on it under the code column. Edit the API key to the desired length. i.e., 24 characters Press Save at the bottom of the application. You may receive a No unique key error – Use All columns.
You now have an API KEY that will fit in the FTP username field that is 32 characters long.