For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

sandiksk_35282's avatar
sandiksk_35282
Icon for Altostratus rankAltostratus
Mar 18, 2015

xforwading rule

I have a vip setup , and enabled automap as the DGW of the servers is not F5 have fastl4 profile configured.

trying to get both http and https traffic pass through the vip.

when HTTP_REQUEST { if { [HTTP::method] eq "CONNECT" } {

 HTTP::disable

} }

need assistance to add xforwading in the above irule. HTTP::header insert "X-Forwarded-For" [IP::client_addr]

when HTTP_REQUEST { if { [HTTP::method] eq "CONNECT" } { HTTP::disable } else { if { [HTTP::header insert "X-Forwarded-For" [IP::client_addr] ] } } }

below is the error i am getting 6: error: [missing a script after "if"][]

9 Replies

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    Try this

    when HTTP_REQUEST {
        if { [HTTP::method] eq "CONNECT"} {
            HTTP::disable
        } else {
            HTTP::header insert "X-Forwarded-For" [IP::client_addr] 
        }
    }
    
  • Kunja thanks for your response . But when I changed my proxy VIP from fastl4 profile to http profile and added this irule. now when i change my proxy to point to the vip on port 8080 .

     

    I am getting secure connection failed

     

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    If it's an SSL request, you have to do add "SSL Profile (Client)" and also the "SSL Profile (Server)"

     

  • it is all internet traffic ,so it might be http or https. ssl offload is not performed on the F5 ,and also backend pool members have is very limited for https traffic

     

  • I created VIP type as performance(layer4) Protocol All protocols Protocol Profile (Client) : fastl4 Sourec Address Translation : Automap Persistence : source address vlan and tunnel traffic : ALL Vlans

     

    In order for me to add irule ,i need to change the profile type to either http or fasthttp but it is breaking the connections.

     

    Please let me know your inputs

     

  • THi's avatar
    THi
    Icon for Nimbostratus rankNimbostratus

    If you are not doing ssl offload, you cannot use L7 iRules for the ssl traffic - like the one above.

     

    Are you intending to use the same virtual server for both unencrypted and encrypted traffic? That would make the virtual server iRule a bit complicated as you have to detect ssl handshake to distinguish between those two traffic types. Anyway, if you want to do anything on Layer 7 (like the XFF insertion) for the ssl traffic, you must terminate SSL on the BIG-IP, so open up the encryption. You can then re-encrypt towards the backend servers.

     

    Is it possible to use two virtual servers, same IP, different ports, one for unencrypted and the other for encrypted traffic? Keep in mind that the virtual server is a combination of IP and port, typically port 80 for plain text http and 443 for ssl. You can tie the same iRule to both.

     

    Or are you intending to use BIG_IP as a proxy server (as you are looking for the CONNECT method)? So converting the traffic to tunnel the ssl through?

     

  • If i create 2virtual servers same IP different ports ,

     

    then for http traffic i can use type as : standard

     

    Protocol tcp Protocol Profile : http (enable xforwading) Sourec Address Translation : Automap Persistence : source address vlan and tunnel traffic : ALL Vlans

     

    when i changed back my setting to the above ,all my http connection through proxy also broke.

     

    • THi's avatar
      THi
      Icon for Nimbostratus rankNimbostratus
      Did you initial iRule without the XFF part work?
    • THi's avatar
      THi
      Icon for Nimbostratus rankNimbostratus
      Also if you want to tunnel ssl after seeing the CONNECT method, then only one port is needed, backend must be able to cope with the tunneling, too.