AlgoSec

Algosec AppViz, Firewall Analyzer (AFA) and FireFlow(AFF).

Network Security · AlgoSec

Details

IDAlgoSec
ProviderAlgoSec
CategoryNetwork Security
From Version5.0.0
Supported ModulesAgentix XSIAM

README

Algosec AppViz, Firewall Analyzer (AFA) and FireFlow(AFF).

Configure AlgoSec on XSOAR


  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for AlgoSec.
  3. Click Add instance to create and configure a new integration instance.
    • Name: a textual name for the integration instance.
    • Server URL (e.g. https://192.168.0.1)
    • Credentials
    • Trust any certificate (not secure)
    • Use system proxy settings
  4. Click Test to validate the URLs, token, and connection.

Commands


You can execute these commands from the XSOAR CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

  1. algosec-get-ticket
  2. algosec-create-ticket
  3. algosec-get-applications
  4. algosec-get-network-object
  5. algosec-query

1. algosec-get-ticket


Retrieves a FireFlow change request by its ID

Base Command

algosec-get-ticket

Input
Argument Name Description Required
ticketId ID of requested change request Required
Context Output

There is no context output for this command.

2. algosec-create-ticket


Creates a new FireFlow change request

Base Command

algosec-create-ticket

Input
Argument Name Description Required
description A free text description of the issue Optional
devices A list of device names, on which the change should be made Optional
action The device action to perform for the traffic. This can be either
of the following: \U0010FC00 1 - Allow the traffic \U0010FC00 0 - Block the
traffic
Required
destAddress The destination address to perform the action on Required
sourceAddress The source address to perform the action on Required
requestor The email address of the requestor Required
subject The change request’s title Required
service The device service or port for the connection, for example, “http” or Mandatory “tcp/123” Required
user The user for the connection Required
application The application for the connection Required
Context Output

There is no context output for this command.

3. algosec-get-applications


Find applications containing network objects related to IP address using AppViz

Base Command

algosec-get-applications

Input
Argument Name Description Required
address The IP/Subnet to search Required
type The search method for the address Optional
Context Output

There is no context output for this command.

4. algosec-get-network-object


Find network objects related to IP address

Base Command

algosec-get-network-object

Input
Argument Name Description Required
address The IP/Subnet to search Required
type The search method for the address (default is INTERSECT) Optional
Context Output

There is no context output for this command.

5. algosec-query


Performs a batch traffic simulation query using Firewall Analyzer

Base Command

algosec-query

Input
Argument Name Description Required
source source(s) for the query. Multiple values are separated by commas (,) Required
destination destination(s) for the query. Multiple values are separated by commas (,) Required
service service(s) for the query. Multiple values are separated by commas (,) Required
user user for the query Optional
application application for the query Optional
Context Output

There is no context output for this command.

Configuration parameters

  • server — Server URL (e.g. https://192.168.0.1) (required)
  • credentials — Credentials (required)
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (5)

  • algosec-create-ticket

    Creates a new FireFlow change request

  • algosec-get-applications

    Find applications containing network objects related to IP address using AppViz

  • algosec-get-network-object

    Find network objects related to IP address

  • algosec-get-ticket

    Retrieves a FireFlow change request by its ID

  • algosec-query

    Performs a batch traffic simulation query using Firewall Analyzer

var username = params.credentials.identifier;
var password = params.credentials.password;
var server = params.server.replace(/[\/]+$/, '');
var insecure = params.insecure;
var proxy = params.proxy;
var baseAFF = server + '/WebServices/WSDispatcher.pl';
var baseAFA = server + '/afa/php/ws.php';
var baseBF = server + '/BusinessFlow/rest/v1/network_objects/find';

function fillInSoapContent(content, service) {
    var request = service === 'AFF' ? '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsh="https://www.algosec.com/WSHandler"><soapenv:Header/><soapenv:Body>%content%</soapenv:Body></soapenv:Envelope>' : '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:afa="https://www.algosec.com/afa-ws"><soapenv:Header/><soapenv:Body>%content%</soapenv:Body></soapenv:Envelope>';
    return replaceInTemplates(request, {content: content});
}

function fillInSOAPRequestTemplate(method, content, service) {
    var template = service === 'AFF' ? '<wsh:%method%><FFWSHeader><version>1</version></FFWSHeader>%content%</wsh:%method%>' : '<afa:%method%>%content%</afa:%method%>';
    return fillInSoapContent(replaceInTemplates(template, {content: content, method: method}), service);
}

var responseDict = {
    'authenticate': /<sessionId xsi:type="xsd:string">(.*)<\/sessionId/,
    'getTicket': /<soap:Body>((.|\n)*)<\/soap:Body/,
    'createTicket': /<soap:Body>((.|\n)*)<\/soap:Body/,
    'ConnectRequest': /<SessionID>(.*)<\/SessionID/,
    'DisconnectRequest': /<ns1:DisconnectResponse>(.*)<\/ns1:DisconnectResponse/,
    'QueryRequest': /<SOAP-ENV:Body>((.|\n)*)<\/SOAP-ENV:Body/
};

var commandToMethod = {
    'algosec-get-ticket': 'getTicket',
    'algosec-create-ticket': 'createTicket',
    'algosec-query': 'QueryRequest'
};

var commandToURL = {
    'algosec-get-applications': '/applications',
    'algosec-get-network-object': ''
};

var sessionData = '<sessionId>%sessionId%</sessionId>';
var methodDict = {
    'authenticate': '<username>%username%</username><password>%password%</password>',
    'getTicket': sessionData + '<ticketId>%ticketId%</ticketId>',
    'trafficLines': '<trafficLines><action>%action%</action><trafficDestination><address>%destAddress%</address></trafficDestination><trafficService><service>ftp</service></trafficService><trafficSource><address>%sourceAddress%</address></trafficSource><trafficUser><user>%user%</user></trafficUser><trafficApplication><application>%application%</application></trafficApplication></trafficLines>',
    'createTicket': sessionData + '<ticket><requestor>%requestor%</requestor><subject>%subject%</subject>%trafficLines%</ticket>',
    'ConnectRequest': '<UserName>%username%</UserName><Password>%password%</Password>',
    'DisconnectRequest': '<SessionID>%sessionId%</SessionID>',
    'QueryRequest': '<SessionID>%sessionId%</SessionID><QueryInput>%query%</QueryInput>',
    'QueryInput': '<Source>%source%</Source><Destination>%destination%</Destination><Service>%service%</Service>'
};

var affCommands = ['algosec-create-ticket', 'algosec-get-ticket'];
var bfCommands = ['algosec-get-applications', 'algosec-get-network-object'];

function createTemplate(method, args) {
    switch (method) {
        case 'createTicket':
            var trafficLines =
            (args.description ? '<description>"%description%"</description>' : '') +
            methodDict['trafficLines'];
            return replaceInTemplates(methodDict[method], {trafficLines: trafficLines});
        case 'QueryRequest':
            var query = methodDict['QueryInput'] +
            (args.user ? '<User>%user%</User>' : '') +
            (args.application ? '<Application>%application%</Application>' : '');
            return replaceInTemplates(methodDict[method], {query: query});
        default:
            return methodDict[method];
    }
}

function sendSOAPRequest(method, args, service) {
    var req = fillInSOAPRequestTemplate(method, replaceInTemplates(createTemplate(method, args), args), service);
    var res = http(
        service === 'AFF' ? baseAFF : baseAFA,
        {
            Method: 'POST',
            Body: req
        },
        insecure,
        proxy
    );
    if (res.StatusCode < 200 || res.StatusCode >= 300) {
            throw 'Failed to ' + method + ', request status code: ' + res.StatusCode + ' and Body: ' + res.Body + '.';
        }
    return res.Body;
}

function sendRESTRequest(url, args) {
    var res = http(
        baseBF + url + encodeToURLQuery(args),
        {
            Method: 'GET',
            Username: username,
            Password: password
        },
        insecure,
        proxy
    );
    if (res.StatusCode < 200 || res.StatusCode >= 300) {
            throw 'Failed to ' + url + ', request status code: ' + res.StatusCode + ' and Body: ' + res.Body + '.';
        }
    return res.Body;
}

function sendAndParse(method, args, service) {
    var responseXML = sendSOAPRequest(method, args, service);
    var match = responseDict[method].exec(responseXML);
    if (match && match[1]) {
        return match[1];
    }
    throw method +' failed';
}

if (command === 'test-module') {
    if (sendAndParse('authenticate', {username: username, password: password}, 'AFF')) {
        return 'ok';
    }
    return 'something is wrong';
}

if (affCommands.indexOf(command) !== -1) {
    args.sessionId = sendAndParse('authenticate', {username: username, password: password}, 'AFF');
    return JSON.parse(x2j(sendAndParse(commandToMethod[command], args, 'AFF')));
}

if (bfCommands.indexOf(command) !== -1) {
    return JSON.parse(sendRESTRequest(commandToURL[command] ,args));
}

args.sessionId = sendAndParse('ConnectRequest', {username: username, password: password}, 'AFA');
res = JSON.parse(x2j(sendAndParse(commandToMethod[command], args)));
sendAndParse('DisconnectRequest', {sessionId: args.sessionId}, 'AFA');
return res;