The HAProxy Guide To - AxelIt

Transcription

The HAProxy Guide toMulti-Layer SecurityDefense in Depth Usingthe Building Blocks ofHAProxyChad Lavoie

Table of ContentsOur Approach to Multi-Layer Security4Introduction to HAProxy ACLs6Formatting an ACL7Fetches11Converters12Flags13Matching Methods14Things to do with ACLs16Selecting a Backend18Setting an HTTP Header20Changing the URL21Updating Map Files21Caching23Using ACLs to Block Requests23Updating ACL Lists26Conclusion27Introduction to HAProxy Stick Tables28Uses of Stick Tables29Defining a Stick Table31Making Decisions Based on Stick Tables44Other Considerations49Conclusion54Introduction to HAProxy Maps55The Map File56Modifying the Values60The HAProxy Guide to Multi-Layer Security2

Putting It Into Practice68Conclusion72Application-Layer DDoS Attack Protection73HTTP Flood74Manning the Turrets75Setting Request Rate Limits77Slowloris Attacks81Blocking Requests by Static Characteristics82Protecting TCP (non-HTTP) Services86The Stick Table Aggregator89The reCAPTCHA and Antibot Modules90Conclusion93Bot Protection with HAProxyHAProxy Load BalancerBot Protection Strategy949596Beyond Scrapers105Whitelisting Good Bots109Identifying Bots By Their Location111Conclusion114The HAProxy Enterprise WAF1 15A Specific Countermeasure1 16Routine Scanning1 17HAProxy Enterprise WAF1 24Retesting with WAF Protection1 26Conclusion1 29The HAProxy Guide to Multi-Layer Security3

Our Approach toMulti-Layer SecurityD efending your infrastructure can involve a dizzyingnumber of components: from network firewalls tointrusion-detection systems to access control safeguards.Wouldn't it be nice to simplify this? We always like to be thebearer of good news. So, do you know that the HAProxy loadbalancer—which you might already be using—is packed fullof security features?HAProxy is used all over the globe for adding resilience tocritical websites and services. As a high-performance,open-source load balancer that so many companies dependon, making it reliable gets top billing and it's no surprise thatthat's what people know it for. However, the samecomponents that you might use for sticking a client to aserver, routing users to the proper backend, and mappinglarge sets of data to variables can be used to secure yourinfrastructure.In this book, we decided to cast some of these battle-testedcapabilities in a different light. To start off, we'll introduce youThe HAProxy Guide to Multi-Layer Security4

to the building blocks that make up HAProxy: ACLs, sticktables, and maps. Then, you will see how when combinedthey allow you to resist malicious bot traffic, dull the power ofa DDoS attack, and other handy security recipes.HAProxy Technologies, the company behind HAProxy, ownsits mission to provide advanced protection for those whoneed it. Throughout this book, we'll highlight areas whereHAProxy Enterprise, which combines the stable codebase ofHAProxy with an advanced suite of add-ons, expert supportand professional services, can layer on additional defenses.At the end, you'll learn about the HAProxy Web ApplicationFirewall, which catches application-layer attacks that aremissed by other types of firewalls. In today's threat-richenvironment, a WAF is an essential service.This book is for those new to HAProxy, as well as thoselooking to learn some new tricks. In the end, if we'veheightened your awareness to the attacks leveraged byhackers and the creative ways of shutting them down, thenwe'll feel like we've done our job.The HAProxy Guide to Multi-Layer Security5

Introduction toHAProxy ACLsW hen IT pros add load balancers into theirinfrastructure, they’re looking for the ability to scale out theirwebsites and services, get better availability, and gain morerestful nights knowing that their critical services are no longersingle points of failure. Before long, however, they realize thatwith a full-featured load balancer like HAProxy Enterprise,they can add in extra intelligence to inspect incoming trafficand make decisions on the fly.For example, you can restrict who can access variousendpoints, redirect non-HTTPS traffic to HTTPS, and detectand block malicious bots and scanners; you can defineconditions for adding HTTP headers, change the URL orredirect the user.Access Control Lists , or ACLs, in HAProxy allow you to testvarious conditions and perform a given action based on thosetests. These conditions cover just about any aspect of arequest or response such as searching for strings or patterns,checking IP addresses, analyzing recent request rates (viaThe HAProxy Guide to Multi-Layer Security6

stick tables), and observing TLS statuses. The action you takecan include making routing decisions, redirecting requests,returning static responses and so much more. While usinglogic operators ( AND , OR , NOT ) in other proxy solutions mightbe cumbersome, HAProxy embraces them to form morecomplex conditions.Formatting an ACLThere are two ways of specifying an ACL—a named ACL andan anonymous or in-line ACL . The first form is a named ACL:acl is static path -i -m beg /staticWe begin with the acl keyword, followed by a name, followedby the condition. Here we have an ACL named is static . ThisACL name can then be used with i f and unless statementssuch as use backend be static if is static . This formis recommended when you are going to use a given conditionfor multiple actions.acl is static path -i -m beg /staticuse backend be static if is staticThe condition, p ath -i -m beg /static , checks to see ifthe URL starts with /static . You’ll see how that works alongwith other types of conditions later in this chapter.The second form is an anonymous or in-line ACL:The HAProxy Guide to Multi-Layer Security7

use backend be static if { path -i -m beg /static}This does the same thing that the above two lines would do,just in one line. For in-line ACLs, the condition is containedinside curly braces.In both cases, you can chain multiple conditions together.ACLs listed one after another without anything in betweenwill be considered to be joined with an and. The conditionoverall is only true if both ACLs are true. ( Note: meanscontinue on same line)http-request deny if { path -i -m beg /api } { src 10.0.0.0/16 }This will prevent any client in the 1 0.0.0.0/16 subnet fromaccessing anything starting with /api , while still being able toaccess other paths.Adding an exclamation mark inverts a condition:http-request deny if { path -i -m beg /api } !{ src 10.0.0.0/16 }Now only clients in the 1 0.0.0.0/16 subnet are allowed toaccess paths starting with /api while all others will beforbidden.The IP addresses could also be imported from a file:The HAProxy Guide to Multi-Layer Security8

http-request deny if { path -i -m beg /api } { src -f /etc/hapee-1.9/blacklist.acl }Within blacklist.acl you would then list individual or a rangeof IP addresses using CIDR notation to block, as follows:192.168.122.3192.168.122.0/24You can also define an ACL where either condition can betrue by using :http-request deny if { path -i -m beg /evil } { path -i -m end /evil }With this, each request whose path starts with / evil (e.g./evil/foo ) or ends with /evil (e.g. /foo/evil ) will be denied.You can also do the same to combine named ACLs:acl starts evil path -i -m beg /evilacl ends evil path -i -m end /evilhttp-request deny if starts evil ends evilWith named ACLs, specifying the same ACL name multipletimes will cause a logical OR of the conditions, so the lastblock can also be expressed as:The HAProxy Guide to Multi-Layer Security9

acl evil path beg /evilacl evil path end /evilhttp-request deny if evilThis allows you to combine ANDs and ORs (as well as namedand in-line ACLs) to build more complicated conditions, forexample:http-request deny if evil !{ src 10.0.0.0/16 }This will block the request if the path starts or ends with / evil ,but only for clients that are not in the 10.0.0.0/16 subnet.Did you know? Innovations such as Elastic Binary Trees orEB trees have shaped ACLs into the high performing featurethey are today. For example, string and IP address matchesrely on EB trees that allow ACLs to process millions of entrieswhile maintaining the best in class performance andefficiency that HAProxy is known for.From what we’ve seen so far, each ACL condition is brokeninto two parts—the source of the information (or a fetch),such as path and s rc , and the string it is matching against. Inthe middle of these two parts, one can specify flags (such as-i for a case-insensitive match) and a matching method ( begto match on the beginning of a string, for example). All ofthese components of an ACL will be expanded on in thefollowing sections.The HAProxy Guide to Multi-Layer Security10

FetchesNow that you understand the basic way to format an ACLyou might want to learn what sources of information you canuse to make decisions on. A source of information in HAProxyis known as a fetch . These allow ACLs to get a piece ofinformation to work with.You can see the full list of fetches available in thedocumentation. The documentation is quite extensive andthat is one of the benefits of having HAProxy EnterpriseSupport. It saves you time from needing to read throughhundreds of pages of documentation.Here are some of the more commonly used fetches:srcReturns the client IP address that madethe requestpathReturns the path the client requestedThe HAProxy Guide to Multi-Layer Security11

url param(foo)Returns the value of a given URL parameterreq.hdr(foo)Returns the value of a given HTTP requestheader (e.g. User-Agent or Host)ssl fcA boolean that returns true if the connectionwas made over SSL and HAProxy is locallydeciphering itConvertersOnce you have a piece of information via a fetch, you mightwant to transform it. Converters are separated by commasfrom fetches, or other converters if you have more than one,and can be chained together multiple times.Some converters (such as lower and upper ) are specified bythemselves while others have arguments passed to them. Ifan argument is required it is specified in parentheses. Forexample, to get the value of the path with / static removedfrom the start of it, you can use the regsub converter with aregex and replacement as arguments:The HAProxy Guide to Multi-Layer Security12

path,regsub( /static,/)As with fetches, there are a wide variety of converters, butbelow are some of the more popular ones:lowerChanges the case of a sample to lowercaseupperChanges the case of a sample to uppercasebase64Base64 encodes the specified string (good formatching binary samples)fieldAllows you to extract a field similar to awk. Forexample if you have “a b c” as a sample and runfield( ,3) on it you will be left with “c”bytesExtracts some bytes from an input binary samplegiven an offset and length as argumentsmapLooks up the sample in the specified map file andoutputs the resulting valueFlagsYou can put multiple flags in a single ACL, for example:path -i -m beg -f /etc/hapee/paths secret.aclThis will perform a case insensitive match based on thebeginning of the path and matching against patterns storedThe HAProxy Guide to Multi-Layer Security13

in the specified file. There aren’t as many flags as there arefetch/converter types, but there is a nice variety.Here are some of the commonly used ones:-iPerform a case-insensitive match (so a sample ofFoO will match a pattern of Foo)-fInstead of matching on a string, match from an ACLfile. This ACL file can have lists of IP’s, strings, regexes,etc. As long as the list doesn’t contain regexes, thenthe file will be loaded into the b-tree format and canhandle lookups of millions of items almost instantly-mSpecify the match type. This is described in detailin the next section.You’ll find a handful of others if you scroll down from the ACLBasics section of the documentation.Matching MethodsThe HAProxy Guide to Multi-Layer Security14

Now you have a sample from converters and fetches, such asthe requested URL path via path , and something to matchagainst via the hardcoded path /evil . To compare the formerto the latter you can use one of several matching methods. Asbefore, there are a lot of matching methods and you can seethe full list by scrolling down (further than the flags) in theACL Basics section of the documentation. Here are somecommonly used matching methods:strPerform an exact string matchbegCheck the beginning of the string with the pattern,so a sample of “foobar” will match a pattern of “foo”but not “bar”.endCheck the end of a string with the pattern, so asample of foobar will match a pattern of bar butnot foo.subA substring match, so a sample of foobar will matchpatterns foo, bar, oba.regThe pattern is compared as a regular expressionagainst the sample. Warning: This is CPU hungrycompared to the other matching methods and shouldbe avoided unless there is no other choice.foundThis is a match that doesn’t take a pattern at all. Thematch is true if the sample is found, false otherwise.This can be used to (as a few common examples) seeif a header ( req.hdr(x-foo) -m found ) is present, ifa cookie is set ( cook(foo) -m found ), or if a sampleis present in a map( src,map(/etc/hapee-1.9/ip to country.map)-m found ).The HAProxy Guide to Multi-Layer Security15

lenReturn the length of the sample (so a sample of foowith -m len 3 will match)Up until this point, you may have noticed the use of path -mbeg /evil for comparing our expected path / evil with thebeginning of the sample we’re checking. It uses the matchingmethod b eg . There are a number of places where you can usea shorthand that combines a sample fetch and a matchingmethod in one argument. In this example p ath beg /foo andpath -m beg /foo are exactly the same, but the former iseasier to type and read. Not all fetches have variants withbuilt-in matching methods (in fact, most don’t), and there’s arestriction that if you chain a fetch with a converter you haveto specify it using a flag (unless the last converter on thechain has a match variant, which most don’t).If there isn’t a fetch variant of the desired matching method,or if you are using converters, you can use the m flag notedin the previous section to specify the matching method.Things to do with ACLsNow that you know how to define ACLs, let’s get a quick ideafor the common actions in HAProxy that can be controlled byACLs. This isn’t meant to give you a complete list of all theconditions or ways that these rules can be used, but ratherprovide fuel to your imagination for when you encountersomething with which ACLs can help.The HAProxy Guide to Multi-Layer Security16

Redirecting a RequestThe command h ttp-request redirect location sets theentire URI. For example, to redirect non-www domains totheir www variant you can use:http-request redirect location http://www.%[hdr(host)]%[capture.req.uri] unless { hdr beg(host) -i www }In this case, our ACL, hdr beg(host) -i www , ensures thatthe client is redirected unless their Host HTTP header alreadybegins with www.The command h ttp-request redirect scheme changesthe scheme of the request while leaving the rest alone. Thisallows for trivial HTTP-to-HTTPS redirect lines:http-request redirect scheme https if !{ ssl fc }Here, our ACL !{ ssl fc } checks whether the request didnot come in over HTTPS.The command h ttp-request redirect prefix allows youto specify a prefix to redirect the request to. For example, thefollowing line causes all requests that don’t have a URL pathbeginning with /foo to be redirected to /foo/{original URIhere} :The HAProxy Guide to Multi-Layer Security17

http-request redirect prefix /foo if !{ path beg /foo }For each of these a code argument can be added to specify aresponse code. If not specified it defaults to 302. Supportedresponse codes are 301, 302, 303, 307, and 308. Forexample:redirect scheme code 301 https if !{ ssl fc }This will redirect HTTP requests to HTTPS and tell clientsthat they shouldn’t keep trying HTTP. Or for a more secureversion of this, you could inject the Strict-Transport-Securityheader via h ttp-response set-header .Selecting a BackendIn HTTP ModeThe use backend line allows you to specify conditions forusing another backend. For example, to send trafficrequesting the HAProxy Stats webpage to a dedicatedbackend, you can combine use backend with an ACL thatchecks whether the URL path begins with / stats :use backend be stats if { path beg /stats }The HAProxy Guide to Multi-Layer Security18

Even more interesting, the backend name can be dynamicwith log-format style rules (i.e. %[ fetch method ]). In thefollowing example, we put the path through a map and usethat to generate the backend name:use backend be %[path,map beg(/etc/hapee-1.9/paths.map)]If the file paths.map contains /api api as a key-value pair,then traffic will be sent to be api , combining the prefix b ewith the string a pi . If none of the map entries match andyou’ve specified the optional second parameter to the mapfunction, which is the default argument, then that default willbe used.use backend be %[path,map beg(/etc/hapee-1.9/paths.map, mydefault)]In this case, if there isn’t a match in the map file, then thebackend be mydefault will be used. Otherwise, without adefault, traffic will automatically fall-through this rule insearch of another use backend rule that matches or thedefault backend line.In TCP ModeWe can also make routing decisions for TCP mode traffic, forexample directing traffic to a special backend if the traffic isSSL:The HAProxy Guide to Multi-Layer Security19

tcp-request inspect-delay 10suse backend be ssl if { req.ssl hello type gt 0 }Note that for TCP-level routing decisions, when requiringdata from the client such as needing to inspect the request,the inspect-delay statement is required to avoid HAProxypassing the phase by without any data from the client yet. Itwon’t wait the full 10 seconds unless the client stays silentfor 10 seconds. It will move ahead as soon as it can decidewhether the buffer has an SSL hello message.Setting an HTTPHeaderThere are a variety of options for adding an HTTP header tothe request (transparently to the client). Combining thesewith an ACL lets you only set the header if a given conditionis true.add-headerAdds a new header. If a header of thesame name was sent by the client this willignore it, adding a second header of thesame name.set-headerWill add a new header in the same way asadd-header , but if the request already hasa header of the same name it will beoverwritten. Good for security-sensitive flagsthat a client might want to tamper with.The HAProxy Guide to Multi-Layer Security20

replace-headerApplies a regex replacement of thenamed header (injecting a fake cookieinto a cookie header, for example)del-headerDeletes any header by the specifiedname from the request. Useful forremoving an x-forwarded-for headerbefore option forwardforadds a new one (or any custom headername used there).Changing the URLThis allows HAProxy to modify the path that the clientrequested, but transparently to the client. Its value acceptslog-format style rules (i.e. % [ fetch method ] ) so you canmake the requested path dynamic. For example, if youwanted to add /foo/ to all requests (as in the redirect exampleabove) without notifying the client of this, use:http-request set-path /foo%[path] if !{ path beg /foo }There is also s et-query , which changes the query stringinstead of the path, and s et-uri , which sets the path andquery string together.Updating Map FilesThese actions aren’t used very frequently, but open upinteresting possibilities in dynamically adjusting HAProxyThe HAProxy Guide to Multi-Layer Security21

maps. This can be used for tasks such as having a loginserver tell HAProxy to send a clients’ (in this case by sessioncookie) requests to another backend from then on:http-request set-var(txn.session id) cook(sessionid)use backend be %[var(txn.session id), map(/etc/hapee-1.9/sessionid.map)] if { var(txn.session id), map(/etc/hapee-1.9/sessionid.map) -m found }http-response set-map(/etc/hapee-1.9/sessionid.map) %[var(txn.session id)] %[res.hdr(x-new-backend)] if { res.hdr(x-new-backend) -m found }default backend be loginNow if a backend sets the x -new-backend header in aresponse, HAProxy will send subsequent requests with theclient’s sessionid cookie to the specified backend. Variablesare used as, otherwise, the request cookies are inaccessibleby HAProxy during the response phase—a solution you maywant to keep in mind for other similar problems that HAProxywill warn about during startup.There is also the related del-map to delete a map entry basedon an ACL condition.The HAProxy Guide to Multi-Layer Security22

Did you know? As with most actions, http-response set-maphas a related action called http-request set-map. This isuseful as a pseudo API to allow backends to add and removemap entries.CachingNew to HAProxy 1.8 is small object caching, allowing thecaching of resources based on ACLs. This, along withhttp-response cache-store , allows you to store selectrequests in HAProxy’s cache system. For example, given thatwe’ve defined a cache named icons , the following will storeresponses from paths beginning with / icons and reuse themin future requests:http-request set-var(txn.path) pathacl is icons path var(txn.path) -m beg /icons/http-request cache-use icons if is icons pathhttp-response cache-store icons if is icons pathUsing ACLs to BlockRequestsNow that you’ve familiarized yourself with ACLs, it’s time todo some request blocking!The HAProxy Guide to Multi-Layer Security23

The command h ttp-request deny returns a 403 to theclient and immediately stops processing the request. This isfrequently used for DDoS/Bot mitigation as HAProxy candeny a very large volume of requests without bothering theweb server.Other responses similar to this include http-requesttarpit (keep the request hanging until t imeout tarpitexpires, then return a 500—good for slowing down bots byoverloading their connection tables, if there aren’t too manyof them), h ttp-request silent-drop (have HAProxy stopprocessing the request but tell the kernel to not notify theclient of this – leaves the connection from a client perspectiveopen, but closed from the HAProxy perspective; be aware ofstateful firewalls).With both deny and tarpit you can add the deny status flagto set a custom response code instead of the default 403/500that they use out of the box. For example usinghttp-request deny deny status 429 will cause HAProxyto respond to the client with the error 429: Too ManyRequests.In the following subsections we will provide a number ofstatic conditions for which blocking traffic can be useful.HTTP Protocol VersionA number of attacks use HTTP 1.0 as the protocol version, soif that is the case it’s easy to block these attacks using thebuilt-in ACL H TTP 1.0 :The HAProxy Guide to Multi-Layer Security24

http-request deny if HTTP 1.0Contents of the user-agent StringWe can also inspect the User-Agent header and deny if itmatches a specified string.http-request deny if { req.hdr(user-agent) -m sub evil }This line will deny the request if the -m sub part of theuser-agent request header contains the string evil anywherein it. Remove the -m sub , leaving you withreq.hdr(user-agent) evil as the condition, and it will bean exact match instead of a substring.Length of the user-agent StringSome attackers will attempt to bypass normal user agentstrings by using a random md5sum, which can be identifiedby length and immediately blocked:http-request deny if { req.hdr(user-agent) -m len 32 }Attackers can vary more with their attacks, so you can rely onthe fact that legitimate user agents are longer while alsobeing set to a minimum length:The HAProxy Guide to Multi-Layer Security25

http-request deny if { req.hdr(user-agent) -m len le 32 }This will then block any requests which have a user-agentheader shorter than 32 characters.PathIf an attacker is abusing a specific URL that legitimate clientsdon’t, one can block based on path:http-request deny if { path /api/wastetime }Or you can prevent an attacker from accessing hidden files orfolders:http-request deny if { path -m sub /. }Updating ACL ListsUsing lb-updateACL files are updated when HAProxy is reloaded to read thenew configuration, but it is also possible to update itscontents during runtime.HAProxy Enterprise ships with a native module calledlb-update that can be used with the following configuration:The HAProxy Guide to Multi-Layer Security26

dynamic updateupdate id /etc/hapee-1.9/whitelist.acl url http://192.168.122.1/whitelist.acl delay 60sHAPEE will now update the ACL contents every 60 secondsby requesting the specified URL. Support also exists forretrieving the URL via HTTPS and using client certificateauthentication.Using the Runtime APITo update the configuration during runtime, simply use theRuntime API to issue commands such as the .2.3.4" socat stdio /var/run/hapee-lb.sockConclusionThat’s all folks! We have provided you with some examples toshow the power within the HAProxy ACL system. The abovelist isn’t exhaustive or anywhere near complete, but it shouldgive you the building blocks needed to solve a vast array ofproblems you may encounter quickly and easily. Use yourimagination and experiment with ACLs.The HAProxy Guide to Multi-Layer Security27

Introduction toHAProxy Stick TablesH TTP requests are stateless by design. However, thisraises some questions regarding how to track user activities,including malicious ones, across requests so that you cancollect metrics, block users, and make other decisions basedon state. The only way to track user activities between onerequest and the next is to add a mechanism for storing eventsand categorizing them by client IP or other key.Out of the box, HAProxy Enterprise and HAProxy give you afast, in-memory storage called stick tables . Released in 2010,stick tables were created to solve the problem of serverpersistence. However, StackExchange, the network of Q&Acommunities that includes Stack Overflow, saw the potentialto use them for rate limiting of abusive clients, aid in botprotection, and tracking data transferred on a per client basis.They sponsored further development of stick tables toexpand the functionality. Today, stick tables are an incrediblypowerful subsystem within HAProxy.The HAProxy Guide to Multi-Layer Security28

The name, no doubt, reminds you of sticky sessions used forsticking a client to a particular server. They do that, but also alot more. Stick tables are a type of key-value storage wherethe key is what you track across requests, such as a client IP,and the values consist of counters that, for the most part,HAProxy takes care of calculating for you. They arecommonly used to store information like how many requestsa given IP has made within the past 10 seconds. However,they can be used to answer a number of questions, such as: How many API requests has this API key been usedfor during the last 24 hours?What TLS versions are your clients using? (e.g. canyou disable TLS 1.1 yet?)If your website has an embedded search field, whatare the top search terms people are using?How many pages is a client accessing during a timeperiod? Is it enough as to signal abuse?Stick tables rely heavily on HAProxy’s access control lists, orACLs. When combined with the Stick Table Aggregatorthat’s offered within HAProxy Enterprise, stick tables bringreal-time, cluster-wide tracking. Stick tables are an areawhere HAProxy’s design, including the use of Elastic BinaryTrees and other optimizations, really pays off.Uses of Stick TablesThere are endless uses for stick tables, but here we’llhighlight three areas: server persistence, bot detection, andcollecting metrics.The HAProxy Guide to Multi-Layer Security29

Server persistence, also known as sticky sessions, is probablyone of the first uses that comes to mind when you hear theterm “stick tables”. For some applications, cookie-based orconsistent hashing-based persistence methods aren’t a goodfit for one reason or another. With stick tables, you can haveHAProxy store a piece of information, such as an IP address,cookie, or range of bytes in the request body (a username orsession id in a non-HTTP protocol, for example), andassociate it with a server. Then, when HAProxy sees newconnections using that same piece of information, it willforward the request to the same server. This is really useful ifyou’re storing application sessions in memory on yourservers.Beyond the traditional use case of server persistence, you canalso use stick tables for defending against certain types of botthreats. Request floods, login brute force attacks, vulnerabilityscanners, web scrapers, slow loris attacks—stick tables candeal with them all.A third area we’ll touch on is using stick tables for collectingmetrics. Sometimes, you want to get an idea of what is goingon in HAProxy, but without enabling logging and having toparse the logs to get the information in question. Here’swhere the power of the Runtime API comes into play. Usingthe API, you can read and analyze stick table data from thecommand line, a custom script or executable program. Thisopens the door to visualizing the data in your dashboard ofchoice. If you prefer a packaged solution, HAProxy Enterprisecomes with a fully-loaded dashboard for visualizing sticktable data.The HAProxy Guide to Multi-Layer Security30

Defining a Stick TableA stick table collects and stores data about requests that areflowing through your HAProxy load balancer. Think of it like amachine that color codes cars as they enter a race track. Thefirst step then is setting up the amount of storage a sticktable should be allowed to use, how long data should be kept,and what data you want to observe.

HAProxy Enterprise, which combines the stable codebase of HAProxy with an advanced suite of add-ons, expert support and professional services, can layer on additional defenses. At the end, you'll learn about the HAProxy Web Application Firewall, which catches application-layer attacks that are missed by other types of firewalls.