sknowlton
05/23/2022, 7:48 PMcgi.remote_addr
is now the local network address of NGINX. for everybodylmajano
05/23/2022, 7:53 PMbdw429s
05/23/2022, 7:53 PMbdw429s
05/23/2022, 7:54 PMbdw429s
05/23/2022, 7:54 PMX-Forwarded-For support disabled by default
bdw429s
05/23/2022, 7:54 PMsknowlton
05/23/2022, 7:55 PMsknowlton
05/23/2022, 7:55 PMbdw429s
05/23/2022, 7:55 PMsknowlton
05/23/2022, 7:56 PMsknowlton
05/23/2022, 7:56 PMsknowlton
05/23/2022, 7:56 PMbdw429s
05/23/2022, 8:02 PMbdw429s
05/23/2022, 8:03 PMsknowlton
05/23/2022, 8:04 PMdocker pull ortussolutions/commandbox
and then our build process does the restsknowlton
05/23/2022, 8:04 PMbdw429s
05/23/2022, 8:06 PMthisOldDave
05/23/2022, 8:57 PMwil-shiftinsert
05/24/2022, 8:53 AMX-Forwarded-For support disabled by defaultJust out of curiosity, what’s commandbox doing with this header?. I assume it is always passed from your proxy and available in your lucee instance behind the proxy. Is it fully blocked and not available anymore if you do
useProxyForwardedIP=false
?
Not sure what the status is now, but there are quite some scenario’s where at least TWO different sources are trying to set a X-Forwarded-For
header. For example we had a situation where both nginx and haproxy were trying to set this header. This resulted in a comma delimited string of ipadresses, so don’t think you are safe if you just trust the value set by your loadbalancer. A similar scenario can happen if you use some WAF or content delivery network.sknowlton
05/24/2022, 1:30 PMremote_addr
value in the CGI scope with it. If useProxyForwardedIP
is false, then the value is the 'actual' remote address ... of the proxy.sknowlton
05/24/2022, 1:31 PMsknowlton
05/24/2022, 1:31 PMwil-shiftinsert
05/24/2022, 1:34 PMwil-shiftinsert
05/24/2022, 1:35 PMstring function getRealIP(){
var headers = getHTTPRequestData( false ).headers;
// When going through a proxy, the IP can be a delimtied list, thus we take the last one in the list
if ( structKeyExists( headers, "x-cluster-client-ip" ) ) {
return trim( listLast( headers[ "x-cluster-client-ip" ] ) );
}
if ( structKeyExists( headers, "X-Forwarded-For" ) ) {
return trim( listFirst( headers[ "X-Forwarded-For" ] ) );
}
return len( cgi.remote_addr ) ? trim( listFirst( cgi.remote_addr ) ) : "127.0.0.1";
}
sknowlton
05/24/2022, 1:35 PMwil-shiftinsert
05/24/2022, 1:41 PMsknowlton
05/24/2022, 1:42 PMbdw429s
05/24/2022, 4:02 PMSo what’s the extra security here?I'm not sure what "extra security" means 🙂 but it's more secure by default. Say, you configure your CF administrator, a server rule, or some code in your CF application to lock down access to a feature based on the IP address of the incoming request. If your server is not in front of a proxy which overrides the x-forwarded-for HTTP header, a hacker can simply set their own header that claims to have been forwarded on behalf of
127.0.0.1
and they just bypassed half of the IP-based restrictions out there.bdw429s
05/24/2022, 4:02 PMbdw429s
05/24/2022, 4:03 PMcgi.remote_addr
wil-shiftinsert
05/24/2022, 4:08 PM