Barracuda Email Security Api Guide
Barracuda Email Security Api Guide
2
1.1 General APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1.1 Config.get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.1.1.1 Config.get - Tied Variable Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.1.2 Config.list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.1.3 Config.set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.1.4 Config.create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.1.5 Config.delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.1.6 Config.add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
1.1.7 Config.remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
1.1.8 Config.reload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
1.1.9 Config.varlist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
1.1.10 Config.var_attr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
1.2 APIs for the Barracuda Email Security Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
1.2.1 User.create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
1.2.2 User.list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
1.2.3 User.remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
1.2.4 User.update_pref . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
1.2.5 Domain.add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
1.2.6 Domain.delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
1.3 Use Case Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
1.4 Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Barracuda Email Security Gateway Administrator's Guide - Page 2
The General APIs section covers "generic" APIs that may be used with all Barracuda Networks appliances that support an API. For
more information, see General APIs.
The APIs for the Barracuda Email Security Gateway section covers APIs that are specific only to the Barracuda Email Security
Gateway. For more information, see APIs for the Barracuda Email Security Gateway.
The framework of the API provides for the programmer to get or set variables inside an XML-RPC request that correspond to field values in the
configuration database in the Barracuda Email Security Gateway. Some languages such as Perl, for example, provide wrappers for XML-RPC
requests, providing an interface to form the request.
Conversely, most things that correspond to "action" type buttons in the web interface cannot be configured by the APIs. For example, from the B
ASIC > Administration page, you can click a button to take the system offline, to shut it down, or to clear the message log, but you cannot
execute these "actions" via the APIs. An exception to this is the Reload feature/button – there is an API to re-apply the system configuration.
Make sure not to use an editor that may add special characters. Also make sure to use single quotes to surround literal values in your
calls, and use double quotes to surround variables.
my $url = "http://$cuda_ip:80/cgi-mod/api.cgi?password=help";
my $result = $xmlrpc->call('config.set', {
type => 'domain',
path => 'barracuda.com',
mta_relay_advanced_host => '1.3.3.7'
});
Two of the methods in the General APIs section, config.varlist and config.var_attr, are utilities that provide information on scope and attributes of
configuration variables to help you understand how to access and use them. Calling these methods prior to using the other APIs will provide a
good reference of the configuration variables.
XML-RPC Model
In the APIs, action parameters are received as XML strings that comply with the XML-RPC specification, which can be viewed here: http://www.X
MLrpc.com/spec. This requires that requests for all actions be in the form of an HTTP POST request. All actions are rolled into one CGI script (for
example: api.cgi) and map to an XML-RPC method, and the parameters are those needed for the action to complete.
For example, the get action maps to the config.get XML-RPC method and all the parameters needed for the get will be sent in the XML body.
The Perl module XML::RPC (note that this is not a part of the standard Perl distribution) will be used by api.cgi to retrieve the requested method
and parameters. Once this is done, the action is performed and the response is sent back to the client. When an error is detected, a response
that complies with the fault response of the XML-RPC specification is sent (see examples below). This response contains both a fault code and a
meaningful fault string. See Error Codes for a list and explanation of fault codes.
To make the request, use the base URL of your Barracuda Email Security Gateway that you use for connecting to the web interface and append
the script name you wish to use. For example, if your script is called 'api.cgi', your URL might look something like this: http://barracuda.mydoma
in.com:8000/cgi-mod/api.cgi
Parameters used to build the request typically include some or all of the following:
variable – A required parameter that tells the API which variable to return from the configuration. For example, the configuration variable
'scana_block_level' represents the global Spam Scoring Limit block level as set on the BASIC > Spam Checking page in the web
interface. To get or set this variable's value, you'd put 'scana_block_level' in the XML request body specified as a variable:
<name>variable</name>
<value>
<string><![CDATA[scana_block_level]]></string>
</value>
password – A required parameter which the API uses to authenticate access to a page and which is set by the administrator on the
BASIC > Administration page in the API Password field. See the contents of 'my $url' in the Single Value Request / Response example
below, which uses a password of '1234'.
type – A parameter that specifies the class/scope of a variable. The "scope" of a variable would be one of either global (for global
settings), domain (for per-domain settings) or user (for per-user settings).
If the variable is a "tied variable", however, one or more other variables are related to it, so multiple variables will be specified in the XML request.
For example, on the BLOCK/ACCEPT > IP Reputation page, a custom RBL domain name or IP address is associated with, or "tied to" an
"action" of Block, Quarantine or Tag. The variable names to set, which you'll see in the configuration file, are mta_rbl_custom_name and
mta_rbl_custom_action respectively. In this case, the "type" would be 'mta_rbl_custom_name'.
path – A parameter that typically corresponds to scope_data which refers to the particular instance of the object. For variables with
global scope, the path is an empty string because there can be only one instance of global and it is the "starting point" in the same
manner, for example, as the root (/) directory in Unix. So all variable and objects under global scope have type as 'global' and path as an
empty string.
When setting the value of a variable or variables that have a type of 'domain', the path would be expressed as the domain name. When working
with tied variables such as 'httpd_acl_ip_config_address' which relates to a value of 'httpd_acl_ip_config_netmask', for example, the path would
be expressed as the actual IP address corresponding to 'httpd_acl_ip_config_address', as shown in this example:
To get the value of httpd_acl_ip_config_netmask corresponding to the httpd_acl_ip_config_address of 192.168.1.1 , the arguments would be:
type: httpd_acl_ip_config_address
path: 192.168.1.1
variable: httpd_acl_ip_config_netmask
To set the value of the global Block level, call the config.set method and set the variable scana_block_level to the desired value. Both calls deal
with a single value. In the configuration, you'll see this entry for the global Spam Scoring Limit Block level, indicating that the current setting is '9'
on the scale from 0-10:
Example: Perl
The config.get request would look something like this as called from a Perl script. The additional examples in further sections of this guide will
only show the call from a Perl script.
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
# IP Address of your Barracuda
my $cuda_ip = '192.168.126.98';
my $url = "http://$cuda_ip:80/cgi-mod/api.cgi?password=help" ;
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request 'POST', $url;
my $xml = qq|
Here's the XML:
<?xml version="1.0" encoding="UTF8"?>
<methodCall>
<methodName>config.get</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>variable</name>
<value><string><![CDATA[scana_block_level]]></string>
</value>
</member>
<member>
<name>type</name>
<value><string><![CDATA[global]]></string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
|;
# setup transport object with request object
$req->content_type('text/xml');
$req->content($xml);
# send the request over transport object
my $res = $ua->request($req);
# show the response from the Barracuda
print $res->as_string;
# END
The request is an HTTP POST to the /cgi-mod/api.cgi '. The POST data is an XML body that contains the request method config.get inside the
<methodName> tag. The requested method is config.get since we are trying to retrieve the global Block level.
Note that the mandatory parameters needed for completing this action, "variable" (name of the configuration variable) and "password", are
contained inside the <struct> tag. Each parameter is identified by the name (<name> tag) and the value (<value> tag). Possible types for each
parameter are restricted by the types listed in the XML-RPC specification.
This example includes only the mandatory parameters. Optional parameters can be added to the XML body using the format mentioned and will
be processed accordingly. Sample output for the request would look something like this:
HTTP/1.1 200 OK
Connection: close
Date: Thu, 24 Jun 2010 18:41:47 GMT
Server: BarracudaHTTP 2.0
Content-Type: text/xml; charset=UTF-8
Client-Date: Thu, 24 Jun 2010 18:42:08 GMT
Client-Peer: 192.168.126.98:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
All responses will contain the 200 OK success status code. Content-type of the response will be text/XML. The actual response, i.e. the value of
the requested configuration variable, will be sent inside the <value> tag.
Multi-Value Response
Responses that contain multiple values will send the values back as an XML-RPC array. The example below is a request for a list of domains
configured as Accepted Email Recipient Domain(s) on the Barracuda Email Security Gateway, which can be set from the BASIC > IP
Configuration page in the web interface and which are stored in the configuration database in the domain variable.
The response may include multiple values, returned as an array inside the <array> tag. The format of the XML response body looks like this,
returning three (domain name) values:
Error responses use the XML-RPC faultCode and faultString formats. The error code will be the value of the faultCode member and the error
string will be the valueError Response of the faultString member. See Error Codes for a list of faultCodes and descriptions of possible errors.
Here's an example of an error response, showing the XML:
OK <?XML version="1.0"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><i4>500</4></value>
</member>
<member>
<name>faultString</name>
<value>
<string>No such variable in configuration</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
Example: PHP
This example calls the user.create API to create a new user account, which is covered in the APIs for the Barracuda Email Security Gateway s
ection of this guide. The library used for this example can be found on the following sourceforge page: http://sourceforge.net/projects/phpxmlrpc/
In the code the library is included as a file. Make sure this file is readable from within your environment.
<?php
include("xmlrpc.inc");
$y = new xmlrpcval(
array(
"user" => new xmlrpcval("[email protected]", "string")
), "struct");
$m = new xmlrpcmsg('user.create');
$m->addParam($y);
$c = new xmlrpc_client("/cgi-mod/api.cgi?password=[APIPassword]", "[BarracudaIP]",
[BarracudaPort]);
$r = $c->send($m);
if (!$r->faultCode()) {
$v = $r->value();
print $r->serialize();
} else {
print "Fault <BR>";
print "Code: " . htmlentities($r->faultCode()) . "<BR>" .
"Reason: '" . htmlentities($r->faultString()) . "'<BR>";
}
?>
Example: Java
This example calls the user.create API to create a new user account, which is covered in the APIs for the Barracuda Email Security Gateway
section of this guide. In the example, a key value pair is created using a standard Map class and added into a Vector list.
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import java.net.URL;
import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;
public class BarracudaAPI {
public static void main(String[] argv) {
try {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new
URL("http://[BarracudaIP]:[BarracudaPort]/cgi-mod/api.cgi?password=[APIPassword]"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
// Create key value pair
Map keyVals = new Hashtable();
keyVals.put("user","[email protected]");
// Start building the parameter list
Vector params = new Vector();
// Add key parameter
params.add( keyVals );
Object result = client.execute("user.create", params);
System.out.println(result);
} catch( Exception ex) {
ex.printStackTrace();
}
}
}
To determine the name of the variable you want to configure, log into the Barracuda Email Security Gateway web interface as admin. On the
page where you configure the setting, highlight the value field, right click and select Inspect Element. The input_id typically contains the name of
the configuration variable. See the blue highlight in the figure below: the part of the input_id after UPDATE_ is the variable name. In this case, it
is alerts_email_address.
General APIs
The API interfaces presented in this section are general in that they are applicable to the Barracuda Email Security Gateway as well as to other
Barracuda Networks appliances. The examples presented here are specific to the Barracuda Email Security Gateway.
Example: Config.get
Use this method to retrieve values of variables in the system configuration. If the variable requested has only a single value (Spam Tag
Configuration Subject Tag level, for example), the output will be different than the output for a variable that contains a list (users, domains, etc.).
This method gets the value of the variable in the object of $type named $path. The return $value is a reference to an array if it is multi-valued, i.e.
a list.
Refer to the example in Single Value Response for getting a variable with a single value and to Multi-value Response for getting a variable that
contains a list. Arguments to the method can be specified by just adding the parameter in the XML request.
Parameters Allowed
The following variables are used with the config.get method. These variables should be provided as part of the request XML in the HTTP POST
request.
variable – A required parameter that tells the API which variable to return.
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
type – A required parameter that specifies the class/scope of a variable.
path – A required parameter that is the qualified name of an object for which the value is required. Note that the value for path is an
empty string for getting a variable under global scope.
Get the Value of a Variable under Global Scope - System Alerts Email Address
Getting the current value of a system variable uses the config.get method. This example gets the value of the System Alerts Email Address vari
able, typically set from the BASIC > Administration page.
Arguments
type: 'global'
variable: alerts_email_address
The name of the variable, alerts_email_address, is shown in the <input_id>, to the right of Update_.
Note that the name tag indicates that the API applies to a single variable in the configuration. The value tag indicates that the expected value of
that variable is a string, and takes the variable name noted above, alerts_email_address, as the input.
Be sure to use single quotes to surround literal values in your calls, and use double quotes to surround variables.
use strict;
use warnings;
use XML::RPC;
Here is the XML response returned after running the above Perl script, returning [email protected] as the System Alerts Email
Address:
<methodResponse>
<params>
<param>
<value>
<string><![CDATA[[email protected]]]></string>
</value>
</param>
</params>
</methodResponse>
For more examples, see Config.get and Config.get - Tied Variable Examples.
Config.get
Parameters Allowed
The following variables are used with the config.get method. These variables should be provided as part of the request XML in the HTTP POST
request:
variable – A required parameter that tells the API which variable to return.
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
type – A required parameter that specifies the class/scope of a variable.
path – A required parameter that is the qualified name of an object for which the value is required. Note that the value for path is an
empty string for getting a variable under global scope.
Example 1: Get the value of a variable under global scope - System Alerts Email Address
Getting the current value of a system variable uses the config.get method. This example gets the value of the System Alerts Email Address vari
able, typically set from the BASIC > Administration page.
Arguments
type: 'global'
variable: alerts_email_address
Sample Request
Response
OK <?XML version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<string><![CDATA[Block]]></string>
</value>
</param>
</params>
</methodResponse>
Example 2: Get the value of a variable under global scope - Subject Tag for Spam Messages
Get the value of a variable, scana_subject_tag in this case, under global scope. This example will return the Subject Tag string to be inserted by
the Barracuda Email Security Gateway in the subject of a message determined to be spam. This setting is configured from the BASIC > Spam
Checking page for the global setting. Note that the path value is an empty string and can be left out, since the scope, or type, is global.
Arguments
type: 'global'
variable: scana_subject_tag
Sample Request
Response
OK <?XML version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<string><![CDATA[Block]]></string>
</value>
</param>
</params>
</methodResponse>
This example gets the value of the Spam Scoring Limit block level, scana_pd_block_level, for domain thisdomain.net. Since this variable is
in per-domain scope, the type is 'domain' and the path argument must specify a value for the domain you're working with. In the configuration,
this variable is listed like this:
Arguments
type: 'domain'
path: 'thisdomain.net'
variable: 'scana_pd_block_level'
Sample Request
Response
This example gets the netmask value, httpd_acl_ip_config_netmask, tied to the Allowed API IP/Range value, httpd_acl_ip_config_address, set
on the BASIC > Administration page. These IP addresses allow access to the Barracuda Email Security Gateway via SNMP queries to retrieve
error information or to administer the system via the API. In the request, the IP address is specified in the path. These variables appear in the
configuration like this:
Arguments
type: httpd_acl_ip_config_address
path: 192.168.1.1
variable: httpd_acl_ip_config_netmask
Sample Request
Response
This example gets the action (Block, Tag, Quarantine) currently assigned to a custom reputation blocklist (RBL) which can be set from the BLOC
K/ACCEPT > IP Reputation page in the web interface. The call gets the value of the mta_rbl_custom_action variable, which is set to "Block",
corresponding to the mta_rbl_custom_name sbl.spamblocklist.org, which is under global scope. These variables appear in the configuration like
this:
Arguments
type: 'mta_rbl_custom_name'
path: 'sbl.spamblocklist.org'
variable: 'mta_rbl_custom_action'
Sample Request
Response
This example gets the netmask currently assigned to a configured IP whitelist, which can be set from the BLOCK/ACCEPT > IP Filters page in
the web interface. The call gets the value of the mta_acl_ip_allow_netmask variable, which is set to "255.255.255.255", corresponding to the
mta_acl_ip_allow_address 2.2.2.2, which is under domain scope with scope_data of thisdomain.net. These variables appear in the
configuration like this:
# Whitelist Netmask
mta_acl_ip_allow_netmask = 255.255.255.255
# Whitelist Address
mta_acl_ip_allow_address = 2.2.2.2
Arguments
type: 'mta_acl_ip_allow_address'
path: 'thisdomain.net:2.2.2.2'
variable: 'mta_acl_ip_allow_comment'
Sample Request
Response
Config.list
This method lists the children of child_type ('domain', in this case) under the object parent_path of type 'parent_type'.
Parameters Allowed
The following variables are used by the config.list method and should be provided as part of the request XML in the HTTP POST request:
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
type – A required parameter that tells the API about the class/scope of the parent container.
path – A required parameter that is the qualified name of a parent object. Note that the value for path is an empty string for getting a
variable under global scope.
child_type – A required parameter that specifies the child class/scope to list.
List all the children of type 'domain' under scope 'global'. This call returns a list of all domains for which the Barracuda Email Security Gateway
will accept email, and which can be created and viewed from the DOMAINS page of the web interface. Each instance of the child_type (domain)
appears in the configuration like this:
#scope:<domain>::scope_data: = 'thisdomain.net'
#scope:<domain>::scope_data = 'barracuda.com'
Arguments
type: 'global'
path: ''
child_type: 'domain'
Sample Request
Response
This example lists all values for the tied object mta_rbl_custom_name, under global scope. Custom RBLs are created from the web interface on
the BLOCK/ACCEPT > IP Reputation page and have an associated action of Block, Tag or Quarantine. In the configuration, the three RBLs
configured in this example would appear like this:
Arguments
type: 'global'
path: ''
child_type: 'mta_rbl_custom_name'
Sample Request
Response
Config.set
Use this method to set the values of variables in the system configuration. This method sets the variables(s) with the given values(s) for the
object of type $type, identified by $path.
Parameters Allowed
The following variables are used by the config.set method and should be provided as part of the request XML in the HTTP POST request:
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
type – A required parameter that specifies the class/scope of an object.
path – A required parameter that is the qualified name of an object for which the values are to be set.
variable list – This is a required parameter that tells the API what variables are to be set and the corresponding values.
Example 1: Set the value for a scoped object under global scope
Set the value for a scoped object under global scope. This example sets the value of Spam Score limit block level to '4' for the xyz.com domain.
In the web interface, this value would be set from the BASIC > Spam Checking page after clicking on the Manage Domain link for xyz.com on
the DOMAINS page.
Arguments
type: 'domain',
path: 'xyz.com'
variable list: scana_pd_block_level = 4
Sample Request
Response
Set the values of https_port to '443' and mta_rate_control to '40'. The value for Web Interface HTTPS/SSL port can be set on the ADVANCED >
Secure Administration page of the web interface, and the value of Rate Control is set on the BLOCK/ACCEPT > Rate Control page. These
variables appear in the configuration like this (values not yet set):
Arguments
type: 'global'
path: ''
variable list: https_port => 443, mta_rate_control => 40
Sample Request
Set the value of httpd_acl_ip_config_netmask to 255.255.128.0 for the httpd_acl_ip_config_address of 192.168.130.222. Note that these
variables are available in the configuration only if you have entered values for Allowed API IP/Range in the BASIC > Administration page, and
would appear in the configuration like this:
Arguments
type: 'httpd_acl_ip_config_address'
path: '192.168.130.222'
variable-value list: httpd_acl_ip_config_netmask =255.255.128.0
Sample Request
Config.create
This method creates an object of a given type and name under the specified parent path. Required variables will be set to their defaults if they
have one; otherwise you must ensure that they have a value before a commit.
Parameters Allowed
The following variables are used by the config.create method and should be provided as part of the request XML in the HTTP POST request:
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
parent_type – A required parameter that tells the API about the class/scope of the parent container.
parent_path – A required parameter that is the qualified name of a parent object under which a new object will be created.
type – A required parameter that specifies the child's class/scope to be created.
name – A required parameter that specifies the name of an object to be created.
variable list – An optional parameter that tells the API which variable(s) to set in the new object.
Create a new domain entry of 'xyz.com' under global scope and set the value of variable scana_pd_block_level (per-domain Spam Block level)
to '5'.
Arguments
parent_type: 'global'
parent_path: ''
type: 'domain'
name: 'xyz.com'
variable list: scana_pd_block_level = '5'
Sample Request
Create a tied object mta_rbl_custom_name of 'spamblocklist.org' with an mta_rbl_custom_action of 'Block'. The resulting entries in the
configuration would look something like this:
Arguments
parent_type:'global'
parent_path: ''
type: 'mta_rbl_custom_name'
name: 'spamblocklist.org'
variable list: mta_rbl_custom_action = Block
Sample Request
Config.delete
Parameters Allowed
The following variables are used by the config.delete method. These variables should be provided as part of the request XML in the HTTP POST
request.
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
type – A required parameter which specifies the class/scope of an object.
path – A required parameter which is the qualified name of an object to be deleted.
Arguments
type: 'domain'
path: 'xyz.com'
variable-value list: httpd_acl_ip_config_netmask = 255.255.128.0
Sample Request
Example 2: Delete a tied object and its tied variable values – global scope
Delete the global tied object mta_rbl_custom_name 'xyz.com' along with all of its tied variables. In this example, the tied variable is
mta_rbl_custom_action, which stores the action (Block, Tag or Quarantine) to take with messages originating from IP addresses in custom
external RBLs. These variables appear in the configuration like this:
Arguments
type: 'mta_rbl_custom_name'
path: 'xyz.com'
Sample Request
Response
Example 3: Delete a tied object and its tied variable values – domain scope
Delete the per-domain tied variable mta_sender_allow_address along with its tied variable values. This example deletes the Allowed Email
Address and Domains tied variable values 'test1.com' and 'test2.com' for the domain ‘barracuda.com’.
Arguments
type: 'mta_sender_allow_address'
path: 'barracuda.com'
Sample Request
Config.add
This method adds the given values to the list variable. This method will not add values to tied variables, and a value added must not already exist
in the list. For adding values to tied variables, use the config.create method.
Parameters Allowed
The following parameters are used by the config.add method and should be provided as part of the request XML in the HTTP POST request:
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
parent_type – A required parameter that tells the API about the class/scope of the parent container.
parent_path – A required parameter which is the qualified name of a parent object
variable – A required parameter that specifies the variable for which values will be added.
values – A required parameter specifying a list of values to be added.
Arguments
parent_type: 'global'
parent_path: ''
variable: 'mta_trusted_relay_host'
values: ['192.168.128.34', '192.168.128.2']
Sample Request
Config.remove
Use this method to remove the given value(s) from the list variable. This will not remove values from tied variables. For removing values from tied
variables, use the config.delete method.
Parameters Allowed
The following parameters are used by the config.remove method and should be provided as part of the request XML in the HTTP POST request:
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
parent_type – A required parameter that tells the API about the class/scope of the parent container.
parent_path – A required parameter which is the qualified name of a parent object.
variable – A required parameter that specifies the variable for which values should be removed.
values – A required parameter specifying a list of values to be removed.
Removes host/domain name values 'mytrustedrelay1.com' and 'mytrustedrelay2.com from the mta_trusted_relay_host list. These Trusted Relay
Host/Domain names are added or deleted on the ADVANCED > Outbound page in the web interface and represent trusted relays on the
Barracuda Email Security Gateway.
Arguments
parent_type: 'global',
parent_path: ''
variable: 'mta_trusted_relay_host'
values: ['mytrustedrelay1.com', 'mytrustedrelay2.com']
Sample Request
Response
Config.reload
Use this method to re-apply the system configuration, as can be done with the Reload button on the BASIC > Administration page of the web
interface. The output of a successful call is a simple '200 OK' response - results are shown below.
Parameters Allowed
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
Sample Request
Config.varlist
Use this method to list all the variables of the configuration and their attributes. This is a good method to call prior to using other APIs so you have
a reference of the configuration variables.
Parameters Allowed
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
Sample Request
Response
</member>
<member>
<name>choices</name>
<value>
<array>
<data/>
</array>
</value>
</member>
<member>
<name>required</name>
<value>
<i4>1</i4>
</value>
</member>
<member>
<name>class</name>
<value>
<string>
<![CDATA[global]]>
</string>
</value>
</member>
<member>
<name>type</name>
<value>
<string>
<![CDATA[ip_address]]>
</string>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>mta_outbound_max_queue_lifetime
</name>
<value>
<struct>
<member>
<name>min</name>
<value>
<string></string>
</value>
</member>
<member>
<name>max</name>
<value>
<string></string>
</value>
</member>
<member>
<name>default</name>
<value>
<i4>48</i4>
</value>
</member>
<member>
<name>description</name>
<value>
<string>
<![CDATA[Outbound Queue Max Message Lifetime(hours):]]>
</string>
</value>
</member>
<member>
<name>choices</name>
<value>
<array>
<data/>
</array>
</value>
</member>
<member>
<name>required</name>
<value>
<i4>1</i4>
</value>
</member>
<member>
<name>class</name>
<value>
<string>
<![CDATA[global]]>
</string>
</value>
</member>
<member>
<name>type</name>
<value>
<string>
<![CDATA[float]]>
</string>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>auth_radius_server</name>
<value>
<struct>
<member>
<name>min</name>
<value>
<string></string>
</value>
</member>
<member>
<name>max</name>
<value>
<string></string>
</value>
</member>
<member>
<name>default</name>
<value>
<string></string>
</value>
</member>
<member>
<name>description</name>
<value>
<string></string>
</value>
</member>
<member>
<name>choices</name>
<value>
<array>
<data/>
</array>
</value>
</member>
<member>
<name>required</name>
<value>
<string></string>
</value>
</member>
<member>
<name>class</name>
<value>
<string>
<![CDATA[domain]]>
</string>
</value>
</member>
<member>
<name>type</name>
<value>
<string>
<![CDATA[text]]>
</string>
</value>
</member>
</struct>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
Config.var_attr
Parameters Allowed
The following variables should be provided as part of the request XML in the HTTP POST request.
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
domain – A required parameter that specifies the variable for which attributes are required.
Example: List the attributes and their values for global Block level.
This example lists the attributes of global blocking: min level, max level, current setting, etc. and returns the current value for each attribute.
Sample Request
Response
<member>
<name>default</name>
<value>
<i4>7</i4>
</value>
</member>
<member>
<name>description</name>
<value>
<string>
<![CDATA[Spam Block Level]]>
</string>
</value>
</member>
<member>
<name>choices</name>
<value>
<array>
<data/>
</array>
</value>
</member>
<member>
<name>required</name>
<value>
<i4>1</i4>
</value>
</member>
<member>
<name>class</name>
<value>
<string>
<![CDATA[global]]>
</string>
</value>
</member>
<member>
<name>type</name>
<value>
<string>
<![CDATA[float]]>
</string>
</value>
</member>
</struct>
</value>
</member>
</struct
</value>
</param>
</params>
</methodResponse>
In this Section:
User.create
User.list
User.remove
User.update_pref
Domain.add
Domain.delete
User.create
This method creates a user account for the user as specified. The output of a successful call is a simple '200 OK'.
Parameters Allowed
These variables should be provided as part of the request XML in the HTTP POST request:
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
domain – A required parameter that specifies the user account to be created.
Arguments
user: [email protected]
Sample Request
User.list
This method simply lists all the user accounts currently on the system.
Parameters Allowed
The following variable should be provided as part of the request XML in the HTTP POST request:
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
Sample Request
Response
User.remove
Use this method to remove a user account for the user as specified. The output of a successful call is a simple '200 OK'.
Parameters Allowed
The following variables are used by the user.remove method and should be provided as part of the request XML in the HTTP POST request:
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
domain – A required parameter that specifies the user account to be removed.
Arguments
user: [email protected]
Sample Request
Response
User.update_pref
This method updates the preferences for the user account specified. The output of a successful call is a simple '200 OK'.
Parameters Allowed
The following variables are used by the user.update_pref method. These variables should be provided as part of the request XML in the HTTP
POST request.
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
domain – A required parameter that specifies the user account whose preference is to be updated.
First, use the config.set method to set the user- specific variables for preferences, then use this method to update the preferences.
Arguments
user: [email protected]
Sample Request
Domain.add
Use this method to add a domain, then use the config.set method to configure settings for that domain in a separate call. Use this method in a
loop to add multiple domains. The output of a successful call is a simple '200 OK'.
Parameters Allowed
The following variables are used by the domain.add method. These variables should be provided as part of the request XML in the HTTP POST
request.
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
domain – A required parameter that specifies the domain to be created.
Arguments
domain: xyz.com
Sample Request
Domain.delete
This method deletes the specified domain. The output of a successful call is a simple '200 OK'.
Parameters Allowed
The following variables are used by the domain.delete method. These variables should be provided as part of the request XML in the HTTP
POST request.
password – A required parameter which the API uses to authenticate access to a page and which is set by your administrator.
domain – A required parameter that specifies the domain to be deleted.
Arguments
domain: xyz.com
Sample Request
Use the config.add method to add any email senders to the whitelist for a particular user account. This list of senders are not blocked even if the
message matches spam rules. Virus scanning is still applied based on the policy set by the administrator. Whitelisting may be performed by full
email address ("[email protected]") or domain only ("domain.com").
Important: Per-User Quarantine must be enabled for the domain via the web interface BEFORE you attempt to add per-user whitelist entries. To
do so, first, from the DOMAINS > Domain Manager page, click Manage Domain for the particular domain. For example, if the user account is cu
[email protected], click on Manage Domain for barracuda.com. At the domain level, navigate to the BASIC > Quarantine page and set
Quarantine Type to Per-User. Finally, set Enable User Features to Yes.
Arguments:
my $value1 = '[email protected]';
my $value2 = '[email protected]';
my $user_account = '[email protected]';
Sample Request:
Use the config.create method to add any IP addresses or networks to the blocklist for a particular domain. This example adds an IP address to
the blocklist for the specified domain and adds values to the per-domain tied variables listed below. The mta_acl_ip_block_action is set to
'quarantine' for mail from the IP address added to the blocklist, and the mta_acl_ip_block_netmask is set to 255.255.255.0 since we're adding an
individual IP address. A comment of 'Blocked IP address' is added as well.
# Domain – xyz.mydomain.net
# Variable – mta_acl_ip_block_address (domain scope): 10.5.36.59
# Tied variables – mta_acl_ip_block_netmask, mta_acl_ip_block_action, mta_acl_ip_block_comment.
Arguments:
type: mta_acl_ip_block_address
parent_path: xyz.mydomain.net
mta_acl_ip_block_netmask: 255.255.255.0
mta_acl_ip_block_action: 'Quarantine'
mta_acl_ip_block_comment: 'Blocked IP Address'
Sample Request:
This example uses the config.create method described in the previous section. Using config.create you can add regular expressions to a content
filter, which is a global setting. For more details about using regular expressions and content filtering, see the BLOCK/ACCEPT > Content
Filtering page. The output of a successful call is a simple '200 OK'.
Arguments:
Sample Request:
<name>apply_to_header</name>
<value>
<string><![CDATA[0]]></string>
</value>
</member>
<member>
<name>apply_to_body</name>
<value>
<string><![CDATA[1]]></string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
Use Case – Listing Explicit Users (Valid Recipients) and Aliases at the Global Level
Use the config.list method to list valid recipients and aliased accounts at the global level - i.e. not domain-specific. Explicit Users and aliased
email accounts are added or deleted on the ADVANCED > Explicit Users page of the web interface. In this case, the Type, or scope, is blank
(empty) to indicate global. Note that the ‘variable’ ‘list_valid_recipient_aliases’ is not actually a variable as defined in the configuration; rather, it is
an indicator to the API of what is being listed by the config.list call.
Sample Request:
Use the domain.add method, described in the previous section, in a loop to add multiple domains for which the Barracuda Email Security
Gateway should process email. These domains will then be listed in the DOMAINS > Domain Manager page of the web interface.
To configure the domains, use the config.set method for each domain. This example configures the 'Spam Score limit block level' to 4 for n
domains, by setting the scana_pd_block_level variable, if you put the request in a loop. In the web interface, you'll see this value on the BASIC >
Spam Checking page after clicking on the Manage Domain link for each domain.
Use the config.list method to list valid recipients and aliased accounts for a domain. Valid Recipients and aliased email accounts are added or
deleted on the per-domain USERS > Valid Recipients page of the web interface. In this case, the Type, or scope, is ‘domain’, and this call
returns a list of all valid recipients and aliased email accounts for the domain ‘mymail.net’. Note that the ‘variable’ ‘list_valid_recipient_aliases’ is
not actually a variable as defined in the configuration; rather, it is an indicator to the API of what is being listed by the config.list call.
Sample Request:
Use the config.set method to add valid recipients and aliases for a domain. This case adds a primary account and two email aliases for the
domain ‘testqa.com'. Aliased accounts are added or deleted on the per-domain USERS > Valid Recipients page of the web interface and are
linked to a 'primary account', which receives quarantined mail for the aliased accounts. The primary valid recipient is added first, followed by a
number of aliases. See the per-domain USERS > Valid Recipients page of the web interface for details about alias linking.
Note that the ‘member’ name ‘new_valid_recipient_aliases’ is an indicator to the API of what is being set by the config.set call. Make sure the
domain is present in the Barracuda Email Security Gateway before adding recipients and aliases.
Arguments:
path: testqa.com
type: domain
child_type: global
my $domain = "testqa.com";
my $primary_valid_recip = '[email protected]';
Sample Request:
Use the config.delete method to delete valid recipients and aliases for a domain.This example deletes the valid recipient and aliases for the
domain ‘testqa.com’. Valid recipients and aliased accounts are added or deleted on the per-domain USERS > Valid Recipients page of the web
interface. Note that the variable ‘delete_valid_recipient_aliases’ is not actually a variable as defined in the configuration; rather, it is an indicator to
the API of what is being deleted by the config.delete call.
In this example, '[email protected]', '[email protected]' are the aliases to be deleted. Make sure the domain for which you are deleting aliased
accounts is present in the Barracuda Email Security Gateway. The list of per-domain aliased user accounts to be deleted can be specified in the
'Values' variable in the XML request.
Arguments:
path: testqa.com
type: domain
my $domain = "testqa.com";
my $user2 = '[email protected]';
my $user3 = '[email protected]';
Sample Request:
Error Codes
See the Error Response format under the XML-RPC Request and Response for an example of how the faultCodes (error codes), shown below,
will be returned with the XML response.
400 Required arguments are missing Too few arguments: <error message>
401 Machine does not have access rights Your machine does not have access rights to
administer...
406 API was called with incorrect parameters Incorrect parameters for API call
425 Input object or variable is not valid Config: Error: Invalid variable: <variable
name used in api> Config: Error:
variable <variable name used in api>
not recognized
Config: Error: Invalid object type:
<variable name used in api>
Config: Error: <variable name used in
api> is not tied to <parent
type>
Config: Error: <variable name used in
api> does not belong to any
class
427 The object does not exist in the database Config: Error: Could not find tied object:
<parent type>, <parent path> [<parent
type>]
Config: Error: Could not find scoped
object: <parent type>, <parent path>
[global]
Config: Error: Could not find scoped
object: <parent type>, <parent path>
[<old parent type>, <old parent path>]
428 Input value being set is not valid Config: Error: Could not find values to delete
in <parent path>: <list of invalid values>
450 The method you used is unknown Unknown method called <API method>