Content is empty
If you don't find the content you expect, please try another search term
Last updated:2023-05-22 19:48:05
If KAD is enabled, the IP address recorded in access logs of a web server will be the IP address of a KAD instance, and the real IP addresses of clients are hidden.
If you add an HTTP header to the packets forwarded by KAD, the web server can then record real IP addresses of clients in logs.
Example of the HTTP header in NGINX:
'$http_x_forwarded_for - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer"' '"$http_user_agent" ';
Example of the HTTP header in Apache:
LogFormat "%{X-FORWARDED_FOR}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
Example of the HTTP header in ASP:
Request.ServerVariables("X_FORWARDED_FOR")
Example of the HTTP header in PHP:
$_SERVER["HTTP_X_FORWARDED_FOR"]
Example of the HTTP header in JSP:
request.getHeader("X_FORWARDED_FOR")
You can use the following method to obtain real IP addresses of clients on an origin server running CentOS or Fedora OS. For other operating systems, consult the Kingsoft Cloud technical support team.
uname -r
command to view the kernel version of the host.Step 1: View the kernel version.
If the kernel version is 3.10.0-957.1.3.el7.x86_64, the source code is as follows:
# uname -r
# 3.10.0-957.1.3.el7.x86_64
Step 2: Download the RPM package based on the kernel version.
Download the centosrpm package, and find the RPM package corresponding to the kernel version.
If the RPM package is not found, you can obtain it from the CentOS official website at https://wiki.centos.org/HowTos/I_need_the_Kernel_Source.
# rpm -ivh kernel-devel-3.10.0-327.el7.x86_64.rpm
Step 3: Install dependencies.
# sudo yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto
$ sudo yum install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel gcc
$ sudo yum install ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel
Step 4: Compile and install the TTM module.
# unzip centos-kgwttm_v4.zip
# cd kgwttm
# ./build.sh
# rpm -ivh *.rpm
# sh /usr/local/bin/kgwttm-insmod.sh
# lsmod |grep kgwttm
Pure Mode