mirror of
https://github.com/curl/curl.git
synced 2026-08-24 19:23:38 +03:00
haproxy: add --haproxy-clientip flag to spoof client IPs
CURLOPT_HAPROXY_CLIENT_IP in the library Closes #10779
This commit is contained in:
parent
9ad23c38e5
commit
0a75964d0d
21 changed files with 267 additions and 4 deletions
|
|
@ -96,6 +96,7 @@ DPAGES = \
|
|||
globoff.d \
|
||||
happy-eyeballs-timeout-ms.d \
|
||||
haproxy-protocol.d \
|
||||
haproxy-clientip.d \
|
||||
head.d \
|
||||
header.d \
|
||||
help.d \
|
||||
|
|
|
|||
29
docs/cmdline-opts/haproxy-clientip.d
Normal file
29
docs/cmdline-opts/haproxy-clientip.d
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Long: haproxy-clientip
|
||||
Help: Sets client IP in HAProxy PROXY protocol v1 header
|
||||
Protocols: HTTP
|
||||
Added: 8.2.0
|
||||
Category: http proxy
|
||||
Example: --haproxy-clientip $IP
|
||||
See-also: proxy
|
||||
Multi: single
|
||||
---
|
||||
Sets a client IP in HAProxy PROXY protocol v1 header at the beginning of the
|
||||
connection.
|
||||
|
||||
For valid requests, IPv4 addresses must be indicated as a series of exactly
|
||||
4 integers in the range [0..255] inclusive written in decimal representation
|
||||
separated by exactly one dot between each other. Heading zeroes are not
|
||||
permitted in front of numbers in order to avoid any possible confusion
|
||||
with octal numbers. IPv6 addresses must be indicated as series of 4 hexadecimal
|
||||
digits (upper or lower case) delimited by colons between each other, with the
|
||||
acceptance of one double colon sequence to replace the largest acceptable range
|
||||
of consecutive zeroes. The total number of decoded bits must exactly be 128.
|
||||
|
||||
Otherwise, any string can be accepted for the client IP and will be sent.
|
||||
|
||||
It replaces `--haproxy-protocol` if used, it is not necessary to specify both flags.
|
||||
|
||||
This option is primarily useful when sending test requests to
|
||||
verify a service is working as intended.
|
||||
|
|
@ -208,6 +208,8 @@ Socks5 GSSAPI NEC mode. See \fICURLOPT_SOCKS5_GSSAPI_NEC(3)\fP
|
|||
Proxy authentication service name. \fICURLOPT_PROXY_SERVICE_NAME(3)\fP
|
||||
.IP CURLOPT_HAPROXYPROTOCOL
|
||||
Send an HAProxy PROXY protocol v1 header. See \fICURLOPT_HAPROXYPROTOCOL(3)\fP
|
||||
.IP CURLOPT_HAPROXY_CLIENT_IP
|
||||
Spoof the client IP in an HAProxy PROXY protocol v1 header. See \fICURLOPT_HAPROXY_CLIENT_IP(3)\fP
|
||||
.IP CURLOPT_SERVICE_NAME
|
||||
Authentication service name. \fICURLOPT_SERVICE_NAME(3)\fP
|
||||
.IP CURLOPT_INTERFACE
|
||||
|
|
|
|||
63
docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.3
Normal file
63
docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.3
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
.\" **************************************************************************
|
||||
.\" * _ _ ____ _
|
||||
.\" * Project ___| | | | _ \| |
|
||||
.\" * / __| | | | |_) | |
|
||||
.\" * | (__| |_| | _ <| |___
|
||||
.\" * \___|\___/|_| \_\_____|
|
||||
.\" *
|
||||
.\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
.\" *
|
||||
.\" * This software is licensed as described in the file COPYING, which
|
||||
.\" * you should have received as part of this distribution. The terms
|
||||
.\" * are also available at https://curl.se/docs/copyright.html.
|
||||
.\" *
|
||||
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
.\" * copies of the Software, and permit persons to whom the Software is
|
||||
.\" * furnished to do so, under the terms of the COPYING file.
|
||||
.\" *
|
||||
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
.\" * KIND, either express or implied.
|
||||
.\" *
|
||||
.\" * SPDX-License-Identifier: curl
|
||||
.\" *
|
||||
.\" **************************************************************************
|
||||
.\"
|
||||
.TH CURLOPT_HAPROXY_CLIENT_IP 3 "8 May 2023" libcurl libcurl
|
||||
.SH NAME
|
||||
CURLOPT_HAPROXY_CLIENT_IP \- set HAProxy PROXY protocol client IP
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXY_CLIENT_IP,
|
||||
char *client_ip);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
When this parameter is set to a valid IPv4 or IPv6, the library will
|
||||
not send this address in the HAProxy PROXY protocol
|
||||
v1 header at beginning of the connection.
|
||||
|
||||
This option is primarily useful when sending test requests to verify that
|
||||
a service is working as intended.
|
||||
|
||||
.SH DEFAULT
|
||||
no HAProxy header will be sent
|
||||
.SH PROTOCOLS
|
||||
HTTP, HAProxy PROTOCOL
|
||||
.SH EXAMPLE
|
||||
.nf
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
CURLcode ret;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
curl_easy_setopt(curl, CURLOPT_HAPROXY_CLIENT_IP, "1.1.1.1");
|
||||
ret = curl_easy_perform(curl);
|
||||
}
|
||||
.fi
|
||||
.SH AVAILABILITY
|
||||
Along with HTTP. Added in 8.2.0.
|
||||
.SH RETURN VALUE
|
||||
Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
|
||||
.SH SEE ALSO
|
||||
.BR CURLOPT_PROXY "(3), "
|
||||
.BR CURLOPT_HAPROXYPROTOCOL "(3), "
|
||||
|
|
@ -186,6 +186,7 @@ man_MANS = \
|
|||
CURLOPT_GSSAPI_DELEGATION.3 \
|
||||
CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 \
|
||||
CURLOPT_HAPROXYPROTOCOL.3 \
|
||||
CURLOPT_HAPROXY_CLIENT_IP.3 \
|
||||
CURLOPT_HEADER.3 \
|
||||
CURLOPT_HEADERDATA.3 \
|
||||
CURLOPT_HEADERFUNCTION.3 \
|
||||
|
|
|
|||
|
|
@ -643,6 +643,7 @@ CURLOPT_FTPSSLAUTH 7.12.2
|
|||
CURLOPT_GSSAPI_DELEGATION 7.22.0
|
||||
CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS 7.59.0
|
||||
CURLOPT_HAPROXYPROTOCOL 7.60.0
|
||||
CURLOPT_HAPROXY_CLIENT_IP 8.2.0
|
||||
CURLOPT_HEADER 7.1
|
||||
CURLOPT_HEADERDATA 7.10
|
||||
CURLOPT_HEADERFUNCTION 7.7.2
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@
|
|||
--globoff (-g) 7.6
|
||||
--happy-eyeballs-timeout-ms 7.59.0
|
||||
--haproxy-protocol 7.60.0
|
||||
--haproxy-clientip 8.2.0
|
||||
--head (-I) 4.0
|
||||
--header (-H) 5.0
|
||||
--help (-h) 4.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue