/api/2.0/fo/auth/postgresql/
[POST]
Create, update, list and delete PostgreSQL records for authenticated scans of PostgreSQL 9.x, PostgreSQL 10.x, PostgreSQL 11.x and PostgreSQL 12.x instances running on Windows or Unix. Compliance scans are supported (using PC).
Requirement - You must configure login credentials on target hosts before scanning.
Qualys User Guide - PostreSQL Authentication (.zip)
Tip - We strongly recommend you create one or more dedicated user accounts to be used solely by the Qualys Cloud Platform to authenticate to PostgreSQL database instances.
Parameter |
Description |
action={action} |
(Required) Specify create, update, delete (using POST) or list (using GET or POST). See List Auth Records for type |
echo_request={0|1} |
(Optional) Specify 1 to view (echo) input parameters in the XML output. By default these are not included. |
ids={value} |
(Required to update or delete record) Record IDs to update/delete. Specify record IDs and/or ID ranges (for example, 1359-1407). Multiple entries are comma separated. |
title={value} |
(Required to create record) A title for the record. The title must be unique. Maximum 255 characters (ascii). |
comments={value} |
(Optional to create or update record) User defined comments. Maximum of 1999 characters. |
PostgreSQL |
|
pgsql_win_conf_file={value} |
(Optional) The full path to the PostgreSQL configuration file on your Windows assets (IP addresses). The file must be in the same location on all assets for this record. |
pgsql_unix_conf_file={value} |
(Optional) The full path to the PostgreSQL configuration file on your Unix assets (IP addresses). The file must be in the same location on all assets for this record. |
pgsql_db_name={value} |
(Required to create record) The database instance you want to authenticate to. |
port={value} |
(Optional) The port where the database instance is running. Default is 5432. |
ssl_verify={0|1} |
(Optional) SSL verification is skipped by default. Set to 1 if you want to verify the server’s certificate is valid and trusted. |
hosts={value} |
(Required if ssl_verify=1) A list of FQDNs for all host IP addresses on which a custom SSL certificate signed by a trusted root CA is installed. |
Login Credentials |
|
username={value} |
(Required to create record, optional to update record) The username of the account to be used for authentication. If password is specified this is the username of a PostgreSQL account. If login_type=vault is specified, this is the username of a vault account. Maximum 255 characters (ascii). |
password={value} |
(To create record password or login_type=vault is required) The password of the PostgreSQL account to be used for authentication. Maximum 100 characters (ascii). |
login_type=vault |
(To create record password or login_type=vault is required) Set to vault if a third party vault will be used to retrieve password. Vault parameters need to be provided in the record. |
Keys, Passphrase |
|
client_key_type={value} |
(Optional) Client key type basic (default) or vault. |
client_key={value} |
(Optional if client_key_type=basic) Client key content, if private key not in vault. |
client_key_vault_type={value} |
(Required if client_key_type=vault) The third party vault to be used to retrieve the private key. Certain vaults support this capability. |
client_key_vault_id={value} |
(Required if client_key_type=vault) The ID of the vault to get the private key from. Vault parameters: client_key_folder={value} and client_key_file={value} are required vault settings. |
passphrase_type={value} |
(Optional) Passphrase type can be basic (default) or vault. |
passphrase={value} |
(Optional if passphrase_type=basic) The passphrase value. |
client_cert={value} |
(Optional if passphrase_type=basic) The passphrase certificate content. |
passphrase_vault_type={value} |
(Required if passphrase_type=vault) The vault where the private key passphrase is stored. For example CA Access Control, CyberArk AIM, Thycotic Secret Server. |
passphrase_vault_id={value} |
(Required if passphrase_type=vault) The ID of the vault to get the passphrase from. |
Target Hosts |
|
ips={value} |
(Required to create record) The IP address(es) the server will log into using the record’s credentials. Multiple entries are comma separated. (Optional to update record) IPs specified will overwrite existing IPs in the record, and existing IPs will be removed. This parameter and the add_ips parameter or the remove_ips parameter cannot be specified in the same request. |
add_ips={value} |
(Optional to update record) Add IPs and/or ranges to the IPs list for this record. Multiple IPs/ranges are comma separated. This parameter and the ips parameter cannot be specified in the same request. |
remove_ips={value} |
(Optional to update record) IPs to be removed from your record. You may enter a combination of IPs and ranges. Multiple entries are comma separated. This parameter and the ips parameter cannot be specified in the same request. |
network_id={value} |
(Optional to create or update record, and valid when the networks feature is enabled) The network ID for the record. |
API request
curl -u "USERNAME:PASSWORD" -H "X-Requested-With: curl sample" -d "action=create&title=API_POSTGRE_2&username=root&password=abc123&pgsql_db_name=presql&ips=10.10.10.35&pgsql_unix_conf_path=/etc&network_id=4002"
"https://qualysapi.qualys.com/api/2.0/fo/auth/postgresql/" > file.xml
XML output
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE BATCH_RETURN SYSTEM "https://qualysapi.qualys.com/api/2.0/batch_return.dtd">
<BATCH_RETURN>
<RESPONSE>
<DATETIME>2018-03-27T20:17:42Z</DATETIME>
<BATCH_LIST>
<BATCH>
<TEXT>Successfully Created</TEXT>
<ID_SET>
<ID>84307</ID>
</ID_SET>
</BATCH>
</BATCH_LIST>
</RESPONSE>
</BATCH_RETURN>
API request
curl -u "USERNAME:PASSWORD" -H 'X-Requested-With: curl' -d
"action=create&title=api-windows-postgres&pgsql_win_conf_path=C:\Program Files\PostgreSQL\11\data\postgresql.conf&pgsql_db_name=postgres&username=qualys_scan&password=password&ips=10.10.10.35" "https://qualysapi.qualys.com/api/2.0/fo/auth/postgresql"
XML output
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE BATCH_RETURN SYSTEM "https://qualysapi.qualys.com/api/2.0/batch_return.dtd">
<BATCH_RETURN>
<RESPONSE>
<DATETIME>2020-01-28T10:55:39Z</DATETIME>
<BATCH_LIST>
<BATCH>
<TEXT>Successfully Created</TEXT>
<ID_SET>
<ID>72178</ID>
</ID_SET>
</BATCH>
</BATCH_LIST>
</RESPONSE>
</BATCH_RETURN>
API request
curl -u "USERNAME:PASSWORD" -H "X-Requested-With: Curl Sample" -d "action=update&ids=84307&add_ips=10.10.10.40-10.10.10.42" "https://qualysapi.qualys.com/api/2.0/fo/auth/postgresql/" > file.xml
XML output
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE BATCH_RETURN SYSTEM "https://qualysapi.qualys.com/api/2.0/batch_return.dtd">
<BATCH_RETURN>
<RESPONSE>
<DATETIME>2018-04-10T21:01:57Z</DATETIME>
<BATCH_LIST>
<BATCH>
<TEXT>Successfully Updated</TEXT>
<ID_SET>
<ID>78782</ID>
</ID_SET>
</BATCH>
</BATCH_LIST>
</RESPONSE>
</BATCH_RETURN>
API request
curl -u "USERNAME:PASSWORD" -H 'X-Requested-With: curl' -d
"action=update&ids=72178&pgsql_win_conf_path=C:\Program Files\PostgreSQL\11\data\postgresql11.conf"
"https://qualysapi.qualys.com/api/2.0/fo/auth/postgresql"
XML output
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE BATCH_RETURN SYSTEM "https://qualysapi.qualys.com/api/2.0/batch_return.dtd">
<BATCH_RETURN>
<RESPONSE>
<DATETIME>2020-01-28T11:06:36Z</DATETIME>
<BATCH_LIST>
<BATCH>
<TEXT>Successfully Updated</TEXT>
<ID_SET>
<ID>72178</ID>
</ID_SET>
</BATCH>
</BATCH_LIST>
</RESPONSE>
</BATCH_RETURN>
<platform API server>/api/2.0/batch_return.dtd
<platform API server>/api/2.0/fo/auth/postgresql/auth_postgresql_list_output.dtd