AKAMAI True-Client-IP

I am having issues passing the True-Client-IP from AKAMAI.

They pass the end users IP via a variable called True-CLient-IP

Does anyone know an easy way to be able send the end users IP to Apache so that correct logging of the users IP address is recorded rather than AKAMAI’s ?

Thanks.

is apache’s default gateway bigip?

if yes, can we just snat to true-client-ip’s value when sending traffic to apache?

I have a SNAT setup for my OUTBOUND TRAFFIC to route out through this 1 IP… it has always been this way…

Yes, my Gateway on all of my Web Servers is set to the LTM-3400 192.168.1.1

True-client-IP is just a header, so you should either be able to:

  1. Send it to syslog

    log local0. “[IP::client_addr]:[TCP::client_port]: True-Client-IP: [HTTP::header value True-Client-IP]”

  2. And/or just let the header pass through the BIG-IP to Apache.

How would I do this?

in an iRule?

an http profile?

If an iRule, can you post code?

Many thanks.

When I created and enabled a HTTP profile called Akamai-true-client-ip (*** with everything DISABLED inside of it ****)

and then created this iRule below and enabled it:

when HTTP_REQUEST {

Check if the True-Client-IP HTTP header has an IP address if {not ([catch {IP::addr [HTTP::header True-Client-IP] mask 255.255.255.255}])}{

No error parsing the header as an IP address, so use it for SNATing
  snat [HTTP::header True-Client-IP]

} }

The correct END USER IP is now being passed from Akamai to my Apache Web Servers.

So it looks good, but I have a few questions:

  1. Are there any performance issues I may now face since I turned on an HTTP Profile?

    I have never used one before…

  2. Under General Properties - it says Name and Parent Profile, for Parent Profile it is http

Does it use any of the variables from the http since it is the one selected in the drop down? But when you go to Settings for my new HTTP profile, I have everything disabled.

I just want to make sure that I am not going to get any performance issues having set it up in this way…

Thanks.

Are there any performance issues I may now face since I turned on an HTTP Profile?

if your unit is not under heavily loaded, i think it is pretty okay.

Does it use any of the variables from the http since it is the one selected in the drop down? But when you go to Settings for my new HTTP profile, I have everything disabled.

disabling means to use setting in parent profile (i.e. http).

General Properties Name: Parent Profile: http

Then it goes into Settings

I have everything grayed out so it does not use any settings.

I do not want it to use the settings from the main http profile it has OneConnect turned on, Reponse Chuning to Selective, and Maximum Header Size and other features I have never used or turned on.

I thought if I setup a brand new HTTP profile and called it something else other than http and enabled that one to use for my VIP and kept the settings off inside of it that it would not use anything from ‘http’

I do not want it to use the settings from the main http profile it has OneConnect turned on, Reponse Chuning to Selective, and Maximum Header Size and other features I have never used or turned on.

in that case, you cannot use http profile and have to parse tcp payload (http header) yourself (e.g. TCP::collect).

How would I do that?

Also, if I go into http can I just disable those other features

such as:

Cookie Encryption Passphrase Confirm Cookie Encryption Passphrase Maximum Header Size 32768 bytes Pipelining - just set to Disable Insert X-Forward-For - just set to Disable LWS Maximum Columns is set to 80 - what is unlimited 0 ?

Compression is set to Disabled URI Compression Not Configured Content Compression Content List Include List text/ application(xml|x-javascript) Preferred Method: gzip Minimum Content Length: 1024 bytes Compression Buffer Size: 4096 byes gzip Compression Level - 1- Least Compression (Fastest) gzip Memory Level - 8 kilobytes gzip Windows Size - 16 kilobytes Vary Header is CHECKD to Enabled CPU Saver is also Checked to ENABLE CPU Saver High Threshold 90% CPU Saver Low Threshold 75%

Ram Cache: Disabled So even though I see variables under it, does that mean they are being ignored for Ram cache since it says Disabled? (they are not grayed out though)

If you just use a new HTTP profile with no options ticked on the right hand side it is not changing any traffic as it passes through the F5. The only reason you need this profile is so the iRule has access to layer seven application traffic. Without it you cannot use the HTTP::header commands.

However using the SNAT command the way you have means you have changed the source IP address to that of the clients direct address. This means any return traffic will go directly back to the client and not the Akami server. If the client is not expecting this traffic it will be dropped so make sure that is your intention.

A better way would be to get Apache to log the specific header for you in its logs. Then you don’t need an iRule, you don’t even need a HTTP profile. See http://goo.gl/FxuChE for an example.

How would I do that?

e.g.

[root@ve11a:Active:Changes Pending] config  tmsh list ltm virtual bar
ltm virtual bar {
    destination 172.28.20.111:80
    ip-protocol tcp
    mask 255.255.255.255
    pool foo
    profiles {
        tcp { }
    }
    rules {
        myrule
    }
    source 0.0.0.0/0
    source-address-translation {
        type automap
    }
    vs-index 28
}
[root@ve11a:Active:Changes Pending] config  tmsh list ltm pool foo
ltm pool foo {
    members {
        200.200.200.101:80 {
            address 200.200.200.101
        }
    }
}
[root@ve11a:Active:Changes Pending] config  tmsh list ltm rule myrule
ltm rule myrule {
    when CLIENT_ACCEPTED {
  TCP::collect
}
when CLIENT_DATA {
  if { [TCP::payload] starts_with "GET" } {
    set snat_cmd "snat [findstr [TCP::payload] "True-Client-IP" 16 \r\n]"
    eval $snat_cmd
  }
  TCP::release
  TCP::collect
}
}

 packet trace i.e. source 172.28.20.17 is translated to 1.1.1.1 when sending to pool member/server 200.200.200.101

[root@ve11a:Active:Changes Pending] config  ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.20.17(34623) <-> 172.28.20.111(80)
1377937424.0187 (0.0010)  C>S
---------------------------------------------------------------
GET / HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: 172.28.20.111
Accept: */*
True-Client-IP: 1.1.1.1

---------------------------------------------------------------

New TCP connection 2: 1.1.1.1(34623) <-> 200.200.200.101(80)
1377937424.0216 (0.0028)  C>S
---------------------------------------------------------------
GET / HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: 172.28.20.111
Accept: */*
True-Client-IP: 1.1.1.1

---------------------------------------------------------------

anyway, i think using http profile is easier. alternative solution is what kevin suggested.

I am using SNAT Translations configured for OUTBOUND traffic, and it always went out through 1 IP.

It was setup that way from the beginning.

So what you are saying is that with the new config the way I set it up, it will still use my current SNAT Translation and send outbound traffic via my SNAT?

I just went in to see the statistics and there are active connections on the SNAT

Is doing it this way more convoluted and could cause connectivity issues since I am using a new HTTP profile and iRule?

Is the Apache log option a more optimized way of doing it?

I copied it below:

LogFormat “%v %{CF-Connecting-IP}i (via cloudflare:%h) %l %u %t \”%r\" %>s %b" cloudflare CustomLog “|rotatelog.. etc” cloudflare

So all I have to do is enter the above line, and replace CF-Connection-IP with True-Connect-IP and it should work?

if I kept it with the http profile and iRule are there any performance issues I am facing?

Should I turn off OneConnect Transformations ? Should I turn off Pipelining? Should I turn off Insert-X-Forward-For ? What about LWS Maximum Columns that is set to 80 ?

Compresion is set to Disabled URI Compression is set to Not Configured

Should I make some tweaks to ‘http’ for better performance?

in my Apache config, I have this:

LogFormat “%h %l %u %t \”%r\" %>s %b \“%{Referer}i\” \“%{User-Agent}i\”" combined LogFormat “%h %l %u %t \”%r\" %>s %b" common LogFormat “%{Referer}i → %U” referer LogFormat “%{User-agent}i” agent

Do I append to it, or remove it with this?

LogFormat “%v %{True-Connect-IP}i (via akamai:%h) %l %u %t \”%r\" %>s %b" akamai CustomLog “|rotatelog.. etc” akamai

what else do I need to modify? The actual Virtual Host Directives for each domain that is hosted in that httpd.conf file , or is having it outside of the Virtual Host going to act as global settings for how the logs are handled/written/recorded… ?

Thanks.

Yes.

Yes to both questions above? So what you are saying is that with the new config the way I set it up, it will still use my current SNAT Translation and send outbound traffic via my SNAT? LogFormat “%v %{CF-Connecting-IP}i (via cloudflare:%h) %l %u %t \”%r\" %>s %b" cloudflare CustomLog “|rotatelog.. etc” cloudflare So all I have to do is enter the above line, and replace CF-Connection-IP with True-Connect-IP and it should work?

I think you will find this link will show you of an example of someone updating logs to to this [http://goo.gl/t9CxPg](http://goo.gl/t9CxPg)

The correct link is http://goo.gl/t9CxPg

Yes to the second question.