Barracuda Load Balancer ADC REST API Version 2 Barracuda Networks Inc. 3175 S. Winchester Blvd Campbell, CA 95008 http://www.barracuda.com Copyright Notice Copyright 2004-2017, Barracuda Networks, Inc. www.barracuda.com All rights reserved. Use of this product and this manual is subject to license. Information in this document is subject to change without notice. Trademarks Barracuda Load Balancer ADC is a trademark of Barracuda Networks. All other brand and product names mentioned in this document are registered trademarks or trademarks of their respective holders. Contents BARRACUDA LOAD BALANCER ADC REST API ......................................................................................................... 1 AVAILABILITY ......................................................................................................................................................... 1 VERSION ................................................................................................................................................................ 1 REVISION HISTORY ................................................................................................................................................. 1 CHANGE LOG .......................................................................................................................................................... 2 ACCESSING THE API ............................................................................................................................................... 3 AUTHENTICATION .................................................................................................................................................. 4 LOGGING OUT ........................................................................................................................................................ 6 REQUEST FORMAT ................................................................................................................................................. 7 RESPONSE FORMAT ............................................................................................................................................... 8 RESOURCE SUMMARY ........................................................................................................................................... 8 VIRTUAL SERVICE GROUPS ................................................................................................................................................ 8 VIRTUAL SERVICES .......................................................................................................................................................... 9 VIRTUAL SERVICE PARAMETERS ......................................................................................................................................... 9 Service Configuration ............................................................................................................................................ 9 Load Balancing .................................................................................................................................................... 10 Instant SSL ........................................................................................................................................................... 10 Caching ............................................................................................................................................................... 11 Compression ........................................................................................................................................................ 11 Service Monitoring .............................................................................................................................................. 11 Persistence .......................................................................................................................................................... 12 Notifications ........................................................................................................................................................ 12 Headers and URLs ............................................................................................................................................... 13 Keepalive and Timeouts....................................................................................................................................... 13 SSL Offloading ..................................................................................................................................................... 13 Security Policy ...................................................................................................................................................... 14 FTP Passive .......................................................................................................................................................... 14 Certificates .......................................................................................................................................................... 15 Servers ................................................................................................................................................................. 15 SERVER PARAMETERS .................................................................................................................................................... 15 Server Configuration ............................................................................................................................................ 15 SSL ....................................................................................................................................................................... 16 Server Monitor .................................................................................................................................................... 16 Advanced Options ............................................................................................................................................... 17 Content Rules ...................................................................................................................................................... 17 CONTENT RULE PARAMETERS ......................................................................................................................................... 18 Basic Configuration ............................................................................................................................................. 18 Caching ............................................................................................................................................................... 18 Compression ........................................................................................................................................................ 19 Load Balancing .................................................................................................................................................... 19 Persistence .......................................................................................................................................................... 19 Rule Group Servers .............................................................................................................................................. 20 RULE GROUP SERVER PARAMETERS ................................................................................................................................. 20 Server Configuration ............................................................................................................................................ 20 SSL ....................................................................................................................................................................... 21 Server Monitor .................................................................................................................................................... 21 Advanced Options ............................................................................................................................................... 22 Security Policies ................................................................................................................................................... 22 SECURITY POLICY PARAMETERS ....................................................................................................................................... 23 Name ................................................................................................................................................................... 23 Request Limits ..................................................................................................................................................... 23 Cookie Security .................................................................................................................................................... 24 URL Protection ..................................................................................................................................................... 24 Parameter Protection .......................................................................................................................................... 25 Cloaking .............................................................................................................................................................. 26 URL Normalization .............................................................................................................................................. 26 Global ACLs .......................................................................................................................................................... 26 Action Policy ........................................................................................................................................................ 27 Attack Action Parameters.................................................................................................................................... 27 Data Theft Protection .......................................................................................................................................... 27 Data Theft Element Parameters .......................................................................................................................... 28 Monitor Groups ................................................................................................................................................... 28 Monitors .............................................................................................................................................................. 28 RESOURCE DESCRIPTIONS .................................................................................................................................... 29 VIRTUAL SERVICE GROUPS .............................................................................................................................................. 29 Create a Service Group ........................................................................................................................................ 29 Rename a Service Group ...................................................................................................................................... 30 Retrieve Service Groups ....................................................................................................................................... 30 Delete a Service Group ........................................................................................................................................ 32 VIRTUAL SERVICES ........................................................................................................................................................ 33 Create a Service ................................................................................................................................................... 33 Update a Service .................................................................................................................................................. 35 Retrieve Services .................................................................................................................................................. 36 Delete a Service ................................................................................................................................................... 38 VIRTUAL SERVICE PARAMETERS ....................................................................................................................................... 39 Service Configuration .......................................................................................................................................... 39 Load Balancing .................................................................................................................................................... 41 Instant SSL ........................................................................................................................................................... 42 Caching ............................................................................................................................................................... 43 Compression ........................................................................................................................................................ 44 Service Monitoring .............................................................................................................................................. 45 Service Monitoring (continued) ........................................................................................................................... 50 Persistence .......................................................................................................................................................... 54 Notifications ........................................................................................................................................................ 56 Headers and URLs ............................................................................................................................................... 57 Keepalive and Timeouts....................................................................................................................................... 58 SSL Offloading ..................................................................................................................................................... 58 Security Policy ...................................................................................................................................................... 62 FTP Passive .......................................................................................................................................................... 63 CERTIFICATES .............................................................................................................................................................. 64 Generate a Self-Signed Certificate ......................................................................................................................... 64 Upload a Signed Certificate .................................................................................................................................. 66 Upload a Trusted Certificate ................................................................................................................................. 69 Download a Certificate ........................................................................................................................................ 70 SERVERS ..................................................................................................................................................................... 71 Create a Server .................................................................................................................................................... 71 Update a Server ................................................................................................................................................... 72 Retrieve Servers ................................................................................................................................................... 73 Delete a Server .................................................................................................................................................... 75 Server Parameters ............................................................................................................................................... 76 Server Monitor (continued) ................................................................................................................................. 84 SNAT RULES ......................................................................................................................................................... 90 GET SNAT RULES ......................................................................................................................................................... 90 CREATE A NEW SNAT RULE ........................................................................................................................................... 91 EDIT AN SNAT RULE ..................................................................................................................................................... 92 DELETING AN SNAT RULE .............................................................................................................................................. 94 CONTENT RULES .................................................................................................................................................. 95 CREATE A CONTENT RULE ............................................................................................................................................... 95 UPDATE A CONTENT RULE .............................................................................................................................................. 96 RETRIEVE CONTENT RULES .............................................................................................................................................. 97 DELETE A CONTENT RULE ............................................................................................................................................... 99 CONTENT RULE PARAMETERS ........................................................................................................................................ 100 Basic Configuration ........................................................................................................................................... 100 Caching ............................................................................................................................................................. 101 Compression ...................................................................................................................................................... 102 Load Balancing .................................................................................................................................................. 102 Persistence ........................................................................................................................................................ 103 RULE GROUP SERVERS ....................................................................................................................................... 106 CREATE A RULE GROUP SERVER .................................................................................................................................... 106 UPDATE A RULE GROUP SERVER .................................................................................................................................... 107 RETRIEVE RULE GROUP SERVERS .................................................................................................................................... 108 DELETE A RULE GROUP SERVER ..................................................................................................................................... 110 Request and Response Examples ....................................................................................................................... 110 RULE GROUP SERVER PARAMETERS ................................................................................................................................ 111 Server Configuration .......................................................................................................................................... 111 SSL ..................................................................................................................................................................... 112 Server Monitor .................................................................................................................................................. 113 Server Monitor (continued) ............................................................................................................................... 118 Advanced Options ............................................................................................................................................. 121 LOGS .................................................................................................................................................................. 123 TO RETRIEVE THE ACCESS LOGS..................................................................................................................................... 124 TO RETRIEVE THE AUDIT LOGS ...................................................................................................................................... 128 TO RETRIEVE THE CONNECTION LOGS ............................................................................................................................. 130 TO RETRIEVE THE NETWORK FIREWALL LOGS ................................................................................................................... 131 TO RETRIEVE THE SYSTEM LOGS .................................................................................................................................... 132 TO RETRIEVE THE WEB FIREWALL LOGS .......................................................................................................................... 135 SECURITY POLICIES ............................................................................................................................................. 137 CREATE A CUSTOM SECURITY POLICY .............................................................................................................................. 137 Request and Response Examples ....................................................................................................................... 137 UPDATE A SECURITY POLICY .......................................................................................................................................... 138 Request and Response Examples ....................................................................................................................... 138 RETRIEVE SECURITY POLICIES......................................................................................................................................... 139 Request and Response Examples ....................................................................................................................... 139 DELETE A SECURITY POLICY ........................................................................................................................................... 141 Request and Response Examples ....................................................................................................................... 141 SECURITY POLICY PARAMETERS ..................................................................................................................................... 142 Name ................................................................................................................................................................. 142 Request Limits ................................................................................................................................................... 142 Cookie Security .................................................................................................................................................. 143 URL Protection ................................................................................................................................................... 144 Parameter Protection ........................................................................................................................................ 145 Cloaking ............................................................................................................................................................ 146 URL Normalization ............................................................................................................................................ 147 GLOBAL ACLS ..................................................................................................................................................... 148 CREATE A GLOBAL ACL RULE ......................................................................................................................................... 148 Request and Response Examples ....................................................................................................................... 149 UPDATE A GLOBAL ACL RULE ....................................................................................................................................... 150 Request and Response Examples ....................................................................................................................... 151 RETRIEVE GLOBAL ACL RULES ....................................................................................................................................... 152 Request and Response Examples ....................................................................................................................... 152 DELETE A GLOBAL ACL RULE ........................................................................................................................................ 153 Request and Response Examples ....................................................................................................................... 153 ACTION POLICY .................................................................................................................................................. 154 RETRIEVE THE ATTACK ACTIONS FOR AN ATTACK GROUP..................................................................................................... 154 Request and Response Examples ....................................................................................................................... 155 UPDATE AN ATTACK ACTION ......................................................................................................................................... 157 Request and Response Examples ....................................................................................................................... 157 ATTACK ACTION PARAMETERS ....................................................................................................................................... 158 DATA THEFT PROTECTIONS ................................................................................................................................ 159 CREATE A CUSTOM DATA THEFT ELEMENT ....................................................................................................................... 159 Request and Response Examples ....................................................................................................................... 160 UPDATE A DATA THEFT ELEMENT ................................................................................................................................... 160 Request and Response Examples ....................................................................................................................... 160 RETRIEVE DATA THEFT ELEMENTS ................................................................................................................................. 161 Request and Response Examples ....................................................................................................................... 161 DELETE A DATA THEFT ELEMENT .................................................................................................................................... 163 Request and Response Examples ....................................................................................................................... 163 DATA THEFT ELEMENT PARAMETERS .............................................................................................................................. 164 ALLOW/DENY RULES .......................................................................................................................................... 165 ALLOW/DENY RULES FOR URLS .................................................................................................................................... 165 To Add a URL ACL Rule ...................................................................................................................................... 165 To Retrieve URL ACL Rules................................................................................................................................. 167 To Update a URL ACL Rule ................................................................................................................................ 168 To Delete a URL ACL Rule .................................................................................................................................. 170 ALLOW/DENY RULES FOR HEADERS ............................................................................................................................... 170 To Add a Header ACL......................................................................................................................................... 170 To Retrieve Header ACL ..................................................................................................................................... 171 To Update a Header ACL ................................................................................................................................... 173 To Delete a Header ACL..................................................................................................................................... 174 MONITOR GROUPS ............................................................................................................................................ 175 CREATE A MONITOR GROUP .......................................................................................................................................... 175 RETRIEVE MONITOR GROUPS ........................................................................................................................................ 176 DELETE A MONITOR GROUP ......................................................................................................................................... 177 MONITORS......................................................................................................................................................... 178 CREATE A MONITOR .................................................................................................................................................... 178 UPDATE A MONITOR ................................................................................................................................................... 179 RETRIEVE MONITORS .................................................................................................................................................. 180 DELETE A MONITOR .................................................................................................................................................... 181 MONITOR PARAMETERS ............................................................................................................................................... 181 MONITOR PARAMETERS (CONTINUED) ............................................................................................................................ 186 PERL IMPLEMENTATION..................................................................................................................................... 190 BARRACUDA::REST:API DEPENDENCIES.......................................................................................................................... 190 INSTALL THE BARRACUDA::REST:API MODULE ................................................................................................................. 191 PERL MODULE METHODS ............................................................................................................................................ 191 new ................................................................................................................................................................... 192 login .................................................................................................................................................................. 193 logout ................................................................................................................................................................ 193 create ................................................................................................................................................................ 194 list...................................................................................................................................................................... 195 get ..................................................................................................................................................................... 196 update ............................................................................................................................................................... 197 remove .............................................................................................................................................................. 198 OBJECT DESCRIPTIONS ................................................................................................................................................. 199 Virtual Service Groups ....................................................................................................................................... 199 Virtual Services .................................................................................................................................................. 200 Certificates ........................................................................................................................................................ 202 Servers ............................................................................................................................................................... 206 Content Rules .................................................................................................................................................... 208 Rule Group Servers ............................................................................................................................................ 210 Security Policies ................................................................................................................................................. 212 Global ACLs ........................................................................................................................................................ 213 Action Policy ...................................................................................................................................................... 216 Data Theft Protections ...................................................................................................................................... 217 Monitor Groups ................................................................................................................................................. 220 Monitors ............................................................................................................................................................ 221 SAMPLE SCRIPTS ......................................................................................................................................................... 231 HTTP Scripts ....................................................................................................................................................... 231 HTTPS Scripts ..................................................................................................................................................... 231 EXAMPLE PERL CODE .................................................................................................................................................. 232 Barracuda Load Balancer ADC REST API Version 2 Barracuda Load Balancer ADC REST API Barracuda Load Balancer ADC REST API The Barracuda Load Balancer ADC Representational State Transfer (REST) Application Programming Interface (API) lets you remotely administer and configure your Barracuda Load Balancer ADC. In general, the API is useful for performing large configurations by automating the manual configuration available on the web interface. For example, you can use the REST API to create services. You identify resources by their URIs and use HTTP methods to send requests to the Barracuda Load Balancer ADC. Your application can then parse the response, which is always returned using JavaScript Object Notation (JSON). You can use any programming language to interact with the API. Code examples in this reference guide are written in Curl. If you are using Perl, see the Perl Implementation section of this guide. If you have any questions after reading this API guide, please contact Barracuda Networks Technical Support at +1-408-342-5400 or email [email protected]. Availability The REST API is available for all Barracuda Load Balancer ADC models running firmware version 5.4 or version 6.0. Version The most recent version of the Barracuda Load Balancer ADC REST API is version 2. The REST API version is separate from the firmware version for the appliance. For a list of the changes that are included in the current API version, see the Change Log section. Revision History Date Revision Description January 6, 2015 1 Published guide for the Barracuda Load Balancer ADC REST API version 2 to Barracuda Campus. May 29, 2015 2 Resolved errors and added SNAT rules. September 7, 2016 3 Revised formatting. February 17, 2017 4 Added logs. See Barracuda Campus for the latest revision of this guide 1 B arracuda Load Balancer ADC REST API Version 2 Change Log Change Log The following changes are included in Barracuda Load Balancer ADC REST API version 2: Virtual Services Added virtual services group object. Introduced POST, GET, PUT, and DELETE for Virtual Service Groups. Added protocol parameter. Added parameters for Instant SSL services. Added caching parameters. Added compression parameters. Added enabled parameter and passive mode to security object. Added load_threshold and polling_interval parameters. Replaced load_url and snmp_community_string with adaptive_param. For service_monitor, changed test_method to test. For service_monitor, changed status_code to code. Added post_body field to service_monitor. Added sni, sni_strict, sni_domain, sni_certs, ciphers, cipher_list, enable_client_authentication, enforce_client_certificate, and trusted_certificates to ssl_offloading. Also changed enable_tsl* to ssl_enable_tls*. Added client_ip_addr_header, ignore_case, and keepalive_request fields. Added ftp_pasv_config options. Changed security.passive to security.mode. Removed the round_robin option from lb_policy. Added tcp_keepalive_timeout to enable keepalive probes. Changed weighted_least_requests to weighted_least_connection. Added last_resort_action under Load Balancing for Virtual Services. Changed ssl_offloading.sni_domain to ssl_offloading.sni_domains. Added sni_ecdsa_certs, ecdsa_status, and ecdsa_certificate. Added ignore_expect_header. SNAT Rules Introduced GET, POST, PUT, and DELETE for SNAT rules. Content Rules Changed server URI to have virtual_service_group before virtual_service for content rules. Security Policies Introduced POST, GET, PUT, and DELETE for Security Policies. 2 See Barracuda Campus for the latest revision of this guide
Description: