Generic Client
Secberus has developed a generic Push API client program, written in Golang. The software is free to use and edit for any user of Secberus. The generic client reads data from files in either JSON or YAML format and uses the data within to execute the GRPC endpoints of the Push API.
In the near future, Secberus will provide compiled versions of the application for various platforms, but for the time being, the source code is fetchable from Github at the URL: https://github.com/secberus/push-api-cli.
Building
To build the application, you need a recent version of Go installed, at least version 1.22. To find out more about how to download and install Golang, check this reference.
Once you have Go installed and setup on your system, building the software should be as easy as running,
cd push-api-cli/
go build -o push-api-cli .
Configuration
The push-api-cli application expects the credentials file that was provided by Secberus when a new Push API data source was created in the platform to be installed at the location $HOME/.s6s/config
by default. The location the application looks for the file in can be changed by providing the environment variable S6S_CREDENTIALS_FILE=/path/to/file
to the application.
The file as it is downloaded from Secberus will be in the correct format for the client, but for reference, the file format is:
{
"endpoint": "push.secberus.io:7744",
"x509_certificate": "-----BEGIN CERTIFICATE-----\n...",
"private_key": "-----BEGIN ECDSA KEY-----\n...",
"ca_bundle": "-----BEGIN CERTIFICATE-----\n..."
}
A user can create multiple different Push API data sources in the Secberus platform. Each new instance of a Push API data source will have its own credentials file. The same push-api-cli application can be used to upload data to Secberus as different data sources by pointing it to different credentials files.
Running
The push-api-cli can execute the following commands.
Create a Table
Before any data can be uploaded to the Secberus data warehouse, the structure of the data must be defined. This command reads a table structure from a file and creates the table in the Secberus data warehouse.
push-api-cli create-table -f <create-table.json>
Delete a Table
Delete a table created by the Push API client.
push-api-cli delete-table <tablename>
Truncate Table
The truncate table command zeroes out a table. The table itself will remain, but all records within will be deleted.
push-api-cli truncate-table <tablename>
Get Table Details
Get the details of a table created by the Push API client.
push-api-cli get-table <tablename>
List Tables
List each table that has been created with the Push API client.
push-api-cli list-tables
Upsert Records
Upsert data records into a table that was previously created via the create-table command.
push-api-cli upsert-records -f <records.json>
Sync Data
The Sync Data command combines the create-table and upsert-records commands into a single command. For each record in the file, if the table the record belongs to does not already exist, the table will be created then the record(s) for that table will be upserted.
push-api-cli sync-data -f <sync-data.json>
Note
Each instance of a Push API data source has individual credentials. A client authenticated with a specific credential can only see and manipulate the tables and records added with the same credentials. For example, the list-tables command will only list the tables that were created with the Push API client using the same credentials.
Updated 18 days ago