Forum Discussion

Ronenb's avatar
Ronenb
Icon for Cirrus rankCirrus
Aug 15, 2022

RED/GREEN/BLURE OVA servers for demo lab

Hello   I am buiding a demo lab  Can someone help me to download web servers (red, blue, green)  OVF files ? or can some one share the link where i can download these files ?
  • StephanManthey's avatar
    Aug 15, 2022

    Instead of using using webservers I prefer to have some virtual servers running on a 2nd BIG-IP that will respond like webservers.

    The replies are send by an iRule like this:

    when HTTP_REQUEST {
      set cookielist ""
      foreach cookieinfo [HTTP::header values "Cookie:"] {
        append cookielist [string map -nocase {"; " "<br/>"} $cookieinfo]
      }
      if {[HTTP::cookie exists TestSessionID]} {
        set sessionid "TestSessionID=[HTTP::cookie value TestSessionID]"
      }
      else {
        set sessionid "TestSessionID=[format %09d [expr int(rand()*1e9)]].[format %09d [expr int(rand()*1e9)]]"
      }
    #  use standard color names, i.e. "Blue", "Red", "Green", "Yellow", "Brown", "White", "Magenta", "Pink", "Gray"
      set servercolor "Blue"
      
      if {[string tolower [HTTP::uri]] starts_with "/text"} {
        
        set page \
    "Server
    \[IP::local_addr\]:\[TCP::local_port\]\t[IP::local_addr]:[TCP::local_port]
    \[IP::client_addr\]:\[TCP::client_port\]\t[IP::client_addr]:[TCP::client_port]
    \[HTTP::host\]\t\t\t\t[HTTP::host]
    \[HTTP::uri\]\t\t\t\t[HTTP::uri]
    \[HTTP::path\]\t\t\t\t[HTTP::path]
    \[HTTP::query\]\t\t\t\t[HTTP::query]
    \[HTTP::header X-Forwarded-For\]\t\t[HTTP::header X-Forwarded-For]
    \[HTTP::header Virtual-Server-IP\]\t\t[HTTP::header Virtual-Server-IP]
    \[HTTP::header X-Offloaded-SSL\]\t\t[HTTP::header X-Offloaded-SSL]
    Random Number\t\t\t\t[format %04d [expr int(rand()*1e4)]]\n"
      } else {
        set page \
    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">
    <html><head><title>Server $servercolor</title></head>
    <body text=#000000 bgcolor=$servercolor>
    <h2><font face=Verdana>Server $servercolor</font></h2>
    <font face=Verdana><table border cellpadding=2 bgcolor=#C0C0C0>
    <tr><td>\[IP::local_addr\]:\[TCP::local_port\]</td><td>[IP::local_addr]:[TCP::local_port]&nbsp;</td></tr>
    <tr><td>\[IP::client_addr\]:\[TCP::client_port\]</td><td>[IP::client_addr]:[TCP::client_port]&nbsp;</td></tr>
    <tr><td>\[HTTP::host\]</td><td>[HTTP::host]&nbsp;</td></tr>
    <tr><td>\[HTTP::uri\]</td><td>[HTTP::uri]&nbsp;</td></tr>
    <tr><td>\[HTTP::path\]</td><td>[HTTP::path]&nbsp;</td></tr>
    <tr><td>\[HTTP::query\]</td><td>[HTTP::query]&nbsp;</td></tr>
    <tr><td>\[HTTP::header X-Forwarded-For\]</td><td>[HTTP::header X-Forwarded-For]&nbsp;</td></tr>
    <tr><td>\[HTTP::header Virtual-Server-IP\]</td><td>[HTTP::header Virtual-Server-IP]&nbsp;</td></tr>
    <tr><td>\[HTTP::header X-Offloaded-SSL\]</td><td>[HTTP::header X-Offloaded-SSL]&nbsp;</td></tr>
    <tr><td>Clientside Cookies:</td><td>$cookielist&nbsp;</td></tr>
    <tr><td>Random Number:</td><td><font color=red>[format %04d [expr int(rand()*1e4)]]&nbsp;</font></td></tr>
    </table></font></body></html>"
      }
      HTTP::respond 200 -version auto content "$page" noserver Set-Cookie $sessionid Server "$servercolor" Date "[clock format [clock seconds] -format {%a, %b %d %Y %H:%M:%S GMT} -gmt 1]"
      event disable
      return
    }

    This one can easily be enhanced to mirror different request parameters.

    It works as well for cURL with plain text replies:

    # curl http://10.131.131.184/text/testpath?param=queryparam -H 'Host: app3.lb-net.bit' -sv
    *   Trying 10.131.131.184...
    * Connected to 10.131.131.184 (10.131.131.184) port 80 (#0)
    > GET /text/testpath?param=queryparam HTTP/1.1
    > Host: app3.lb-net.bit
    > User-Agent: curl/7.47.1
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Set-Cookie: TestSessionID=123988933.882004550
    < Server: Blue
    < Date: Mon, Aug 15 2022 17:50:31 GMT
    < Connection: Keep-Alive
    < Content-Length: 385
    <
    Server
    [IP::local_addr]:[TCP::local_port]      10.131.131.184:80
    [IP::client_addr]:[TCP::client_port]    10.131.131.181:43618
    [HTTP::host]                            app3.lb-net.bit
    [HTTP::uri]                             /text/testpath?param=queryparam
    [HTTP::path]                            /text/testpath
    [HTTP::query]                           param=queryparam
    [HTTP::header X-Forwarded-For]
    [HTTP::header Virtual-Server-IP]
    [HTTP::header X-Offloaded-SSL]
    Random Number                           8504