MS SQL record

/api/2.0/fo/auth/ms_sql/

[POST]

Create, update, list and delete MS SQL records for authenticated scans of MS SQL Server instances. Compliance scans are supported (using PC).

Requirement - You must configure authentication credentials on target hosts.

Download Qualys User Guide - MS SQL Server 2000 Authentication (.pdf)

Download Qualys User Guide - MS SQL Server 2005-2019 Authentication (.pdf)

Input Parameters

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) User defined comments. Maximum 1999 characters.

Login Credentials

 

username={value}

(Required to create record, optional to update record) The user account to be used for authentication. May include 1-128 characters.

password={value}

(Required to create record, optional to update record) The password corresponding to the user account defined in the record for authentication. May include 1-128 characters.

db_local={0|1}

(Optional to create or update record) Set to 1 when login credentials are for a MS SQL Server database account (for Windows or Unix). Set to 0 when login credentials are for a Microsoft Windows operating system account that is associated with a MS SQL Server database account. For create record, if the db_local parameter is unspecified, the flag is set to 1.

windows_domain={value}

(Required when db_local=0, otherwise invalid)

The domain name where the login credentials are stored when the login credentials are for a Microsoft Windows operating system account that is associated with a MS SQL Server database account. The domain name may include 1-256 characters (ascii).

For an update request when the credentials for the record are for a Microsoft Windows account (db_local=0) and you want to change the record to use credentials for a MS SQL Server account (db_local=1) note the following. You must set windows_domain=’’ (the empty string) to clear the current parameter setting.

auth_os_type={unix|windows}

(Optional when db_local=1) Specify “unix” when the OS type is Unix and “windows” when the OS type is Windows.

mssql_unix_insta_path={value}

(Optional when auth_os_type=unix) Specify the path to the MS SQL Server instance directory on Unix hosts. Sample value: /var/opt/mssql

mssql_unix_conf_path={value}

(Optional when auth_os_type=unix) Specify the path to the MS SQL Server configuration file on Unix hosts. Sample value: /var/opt/mssql/mssq.conf

instance={value}

(Optional to create or update record for Windows, Required to create record for Unix and Optional to update record for Unix) The name of the database instance to be scanned. This is the instance name assigned to the TCP/IP port. Important: This is not the host name that is assigned to the MS SQL Server instance name (see “MS SQL Server Instance Name” in the Qualys online help for information). The instance name may include a maximum of 128 characters (ascii).

If the instance parameter is not specified for Windows, the instance name is set to “MSSQLSERVER”.

These parameters are mutually exclusive: instance and auto_discover_instances=1.

auto_discover_instances={0|1}

(Optional when auth_os_type=windows) Set auto_discover_instances=1 and we’ll find all MS SQL Server instance names on each Windows host. Note that Windows authentication is required in order for us to auto discover instance names. Set up Windows authentication records for the hosts running MS SQL Servers.

These parameters are mutually exclusive: instance and auto_discover_instances=1.

database={value}

(Optional to create or update record) The database name of the database to be scanned. The database name may contain a maximum of 128 characters. For a create request, if the database name is unspecified, the database name is set to “master”.

auto_discover_databases={0|1}

(Optional to create or update record) Set auto_discover_databases=1 and we’ll find all MS SQL Server database names on each host.

These parameters are mutually exclusive: database and auto_discover_databases=1.

port={value}

(Required to create record, optional to update record)

The port number assigned to the database instance to be scanned.

To create a record you must specify one of these parameters: port or auto_discover_ports=1. These parameters are mutually exclusive.

auto_discover_ports={0|1}

Set auto_discover_ports=1 and for each host we’ll find all ports MS SQL Server is running on. Note that Unix/Windows authentication is required for us to auto discover ports. Set up Unix/Windows authentication records for your hosts running MS SQL Server.

To create a record you must specify one of these parameters: port or auto_discover_ports=1. These parameters are mutually exclusive.

Target Hosts

 

ips={value}

You may enter a combination of IPs and IP ranges to identify compliance hosts. Multiple entries are comma separated.

(Optional to update record) Overwrites (replaces) the IP list for the authentication record. The IPs you specify are added and any existing IPs are removed.

For create request, it is required to specify either this parameter or member_domain parameter.

For update request, this parameter and the add_ips or remove_ips or member_domain parameter cannot be specified in the same request.

add_ips={value}

(Optional to update record)  You may enter a combination of IPs and IP ranges to identify compliance hosts. Multiple entries are comma separated.

This parameter is used to update an existing IP list in an existing authentication record. Specifies one or more IP addresses to add to the IP list for the authentication record.

This parameter and the ips or member_domain parameter cannot be specified in the same request.

remove_ips={value}

(Optional for update request only) 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 or member_domain parameter cannot be specified in the same request.

network_id={value}

(Optional and only valid when the networks feature is enabled) The network ID for the record.

member_domain={value}

(Optional and only valid for Windows) Defines the domain of the MS SQL server for the authentication record.

For create request, it is required to specify either this parameter or ips or add_ips parameter.

For update request, this parameter and the ips or add_ips or remove_ips parameter cannot be specified in the same request.

Protocols (Windows only)

 

kerberos={0|1}

(Optional to create or update record) When not specified, Kerberos is enabled allowing the scanning engine to try Kerberos when negotiating authentication to target hosts. Specify kerberos=0 if you do not want Kerberos attempted.

ntlmv2={0|1}

(Optional to create or update record) When not specified, NTLMv2 is enabled allowing the scanning engine to try NTLMv2 when negotiating authentication to target hosts. Specify ntlmv2=0 if you do not want NTLMv2 attempted.

ntlmv1={0|1}

(Optional to create or update record) When not specified, NTLMv1 will not be attempted. Specify ntlmv1=1 to try NTMLv1 when negotiating authentication to target hosts.

 

Sample - Create MS SQL record for Unix

API request

curl -u "USERNAME:PASSWORD" -H "X-Requested-With: Curl" -d "action=create&title=MSSQL_UNIX&username=root&password=root&db_local=1&ips=10.10.10.10&auto_discover_ports=1&auto_discover_databases=1&auth_os_type=unix&instance=mssql&mssql_unix_conf_path=/var/opt/mssql/mssql.conf&mssql_unix_insta_path=/var/opt/mssql" "https://qualysapi.qualys.com/api/2.0/fo/auth/ms_sql/"

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>2021-05-17T08:26:31Z</DATETIME>

   <BATCH_LIST>

     <BATCH>

       <TEXT>Successfully Created</TEXT>

       <ID_SET>

         <ID>103473</ID>

       </ID_SET>

     </BATCH>

   </BATCH_LIST>

 </RESPONSE>

</BATCH_RETURN>

Sample - Create MS SQL record, member domain

API request

curl -u "USERNAME:PASSWORD" -H "X-Requested-With: curl" -d

"action=create&title=mssqlvt1&username=administrator&password=abc123&db_local=1&port=8012&member_domain=sitedomain.com&echo_request=1&comments=aut hcreated&instance=MSSQLSERVER&database=master" "https://qualysapi.qualys.com/api/2.0/fo/auth/ms_sql/"

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>

  <REQUEST>

    <DATETIME>2018-03-20T05:26:31Z</DATETIME>

    <USER_LOGIN>user_john</USER_LOGIN>

    <RESOURCE>

       https://qualysapi.qualys.com/api/2.0/fo/auth/ms_sql/</RESOURCE>

    <PARAM_LIST>

      <PARAM>

        <KEY>action</KEY>

        <VALUE>create</VALUE>

      </PARAM>

      <PARAM>

        <KEY>title</KEY>

        <VALUE>mssqlvt4</VALUE>

      </PARAM>

      <PARAM>

        <KEY>username</KEY>

        <VALUE>administrator</VALUE>

      </PARAM>

      <PARAM>

        <KEY>password</KEY>

        <VALUE>abc123</VALUE>

      </PARAM>

      <PARAM>

        <KEY>db_local</KEY>

        <VALUE>1</VALUE>

      </PARAM>

      <PARAM>

        <KEY>port</KEY>

        <VALUE>8012</VALUE>

      </PARAM>

      <PARAM>

        <KEY>member_domain</KEY>

        <VALUE>sitedomain.com</VALUE>

      </PARAM>

      <PARAM>

        <KEY>echo_request</KEY>

        <VALUE>1</VALUE>

      </PARAM>

      <PARAM>

        <KEY>comments</KEY>

        <VALUE>authcreated</VALUE>

      </PARAM>

      <PARAM>

        <KEY>instance</KEY>

        <VALUE>MSSQLSERVER</VALUE>

      </PARAM>

      <PARAM>

        <KEY>database</KEY>

        <VALUE>master</VALUE>

      </PARAM>

    </PARAM_LIST>

  </REQUEST>

  <RESPONSE>

    <DATETIME>2018-03-20T05:26:31Z</DATETIME>

    <BATCH_LIST>

      <BATCH>

        <TEXT>Successfully Created</TEXT>

        <ID_SET>

          <ID>13907</ID>

        </ID_SET>

      </BATCH>

    </BATCH_LIST>

  </RESPONSE>

</BATCH_RETURN>

Sample - Update MS SQL record, member domain

API request

curl -u "USERNAME:PASSWORD" -H "X-Requested-With: curl" -d

"action=update&echo_request=1&ids=13907&member_domain=webdomain.com"

"https://qualysapi.qualys.com/api/2.0/fo/auth/ms_sql/"

 

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>

  <REQUEST>

    <DATETIME>2018-03-20T05:37:13Z</DATETIME>

    <USER_LOGIN>user_john</USER_LOGIN>

    <RESOURCE>https://qualysapi.qualys.com/api/2.0/fo/auth/ms_sql/

      </RESOURCE>

    <PARAM_LIST>

      <PARAM>

        <KEY>action</KEY>

        <VALUE>update</VALUE>

      </PARAM>

      <PARAM>

        <KEY>echo_request</KEY>

        <VALUE>1</VALUE>

      </PARAM>

      <PARAM>

        <KEY>ids</KEY>

        <VALUE>13907</VALUE>

      </PARAM>

      <PARAM>

        <KEY>member_domain</KEY>

        <VALUE>webdomain.com</VALUE>

      </PARAM>

    </PARAM_LIST>

  </REQUEST>

  <RESPONSE>

    <DATETIME>2018-03-20T05:37:13Z</DATETIME>

    <BATCH_LIST>

      <BATCH>

        <TEXT>Successfully Updated</TEXT>

        <ID_SET><ID>13907</ID>

         </ID_SET>

      </BATCH>

    </BATCH_LIST>

  </RESPONSE>

</BATCH_RETURN>

DTDs for auth type "ms_sql"

<platform API server>/api/2.0/batch_return.dtd

<platform API server>/api/2.0/fo/auth/ms_sql/auth_ms_sql_list_output.dtd