There are two ways to import data sources to Guardium, and automate the process:
1 - Data sources, if maintained in a CSV file can be uploaded in bulk to the system. I attached a CSV example, here is how you upload the file. From the GUI, navigate to Harden | Vulnerability Assessment | Customer Uploads and select "
Upload CSV to Create/Update Datasources". Sample file attached.
2 - REST API
REST Call Example:
Step 1: Register the Client in the CLI
CLI> grdapi register_oauth_client client_id=ABC grant_types=password
ID=0
{"client_id":"ABC","client_secret":"3b68f4d8-bb2f-4722-a49c-678bdc3507ab","grant_types":"password","scope":"read,write","redirect_uri":"
https://someApp"}
Step 2: Obtain a token (from any machine that can access the Guardium machine) using the client secret and client Id from Step1:
curl -k -X POST -d 'client_id=ABC&grant_type=password&client_secret=3b68f4d8-bb2f-4722-a49c-678bdc3507ab&username=USER&password=PASSWORD'
https://GuardiumMachine.Company.com:8443/oauth/token {"access_token":"acb1bc03-a59d-48b3-a649-b7db09d7ac97","token_type":"bearer","expires_in":9684,"scope":"read write"}
Step 3: Your REST Call using the token obtained in Step2. This example calls a create datasource:
curl -k --header "Authorization:Bearer acb1bc03-a59d-48b3-a649-b7db09d7ac97" -i -H "Content-Type:application/json" -X POST -d '{"application":"Security Assessment", "description":"MyDataSourceDescription","name":"MyDataSourceName", "host":"my_host.myCompany.com", "type":"DB2", "serviceName":"servName", "user":"myUser","password":"PASSWD"}'
https://GuardiumMachine.Company.com:8443/restAPI/datasource HTTP/1.1 200 OK
X-FRAME-OPTIONS: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'
https://ibm.biz/GuardiumUpdateCheck https://ibm.biz/GuardiumUpdateCheckQA https://*.ibm.com; img-src 'self' data:
https://*.ibm.com; connect-src 'self'; frame-src 'self'
https:; style-src 'self' https: 'unsafe-inline'; font-src 'self' https: 'unsafe-inline'
Strict-Transport-Security: max-age=31536000
Set-Cookie: JSESSIONID=25431BA26CD45EF3C4FF1A767261D5D3; Path=/; Secure; HttpOnly
Cache-Control: max-age=86400
Expires: Fri, 08 Mar 2019 20:40:41 GMT
Access-Control-Allow-Methods: POST, GET, PUT, DELETE
Access-Control-Allow-Headers: authorization, origin, X-Requested-With, Content-Type, Accept
Access-Control-Max-Age: 18000
Content-Type: application/json;charset=UTF-8
Content-Length: 35
Date: Thu, 07 Mar 2019 20:40:41 GMT
Server: SQL Guard
{
"ID": 20002,
"Message": ""
}
Note: I provided only the required parameters, this specific call allows for more detailed datasource creation, to see all parameters from the CLI:
CLI> guardapi create_datasource --help=true
grdapi create_datasource --help=true
ID=0
available since version:
v9.5
function parameters:
application - String- required- Constant values list
compatibilityMode - String
conProperty - String
customURL - String
cyberarkConfigName - String- Constant values list
cyberarkObjectName - String
dbInstanceAccount - String
dbInstanceDirectory - String
dbName - String
description - String
externalPasswordTypeName - String- Constant values list
host - String- required
importServerSSLcert - Boolean
KerberosConfigName - String
name - String- required
password - String
port - Integer
savePassword - Boolean
serviceName - String
severity - String- Constant values list
shared - String- Constant values list
type - String- required- Constant values list
useExternalPassword - Boolean
useKerberos - Boolean
useLDAP - Boolean
user - String
useSSL - Boolean
To get a Constant values list for a parameter, call the function with --get_param_values=<param-name>
------------------------------
Dan Price
------------------------------