Bugzilla – Attachment 163104 Details for
Bug 36304
Add ability to have an external list of trusted proxies, for services such as CloudFlare.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch CF::Auth in_iprange to allow for CloudFlare proxying
0001-Add-Cloudflare-support-to-in_iprange-function.patch (text/plain), 1.40 KB, created by
Nicholas van Oudtshoorn
on 2024-03-13 08:17:01 UTC
(
hide
)
Description:
Patch CF::Auth in_iprange to allow for CloudFlare proxying
Filename:
MIME Type:
Creator:
Nicholas van Oudtshoorn
Created:
2024-03-13 08:17:01 UTC
Size:
1.40 KB
patch
obsolete
>From 7ca590fc9c27f7360b2c5d218da2754d7c0676d9 Mon Sep 17 00:00:00 2001 >From: Nicholas van Oudtshoorn <vanoudt@gmail.com> >Date: Wed, 13 Mar 2024 16:10:01 +0800 >Subject: [PATCH] Add Cloudflare support to in_iprange function > >--- > lib/C4/Auth.pm | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/lib/C4/Auth.pm b/lib/C4/Auth.pm >index 9b298ee..ade315c 100644 >--- a/lib/C4/Auth.pm >+++ b/lib/C4/Auth.pm >@@ -2319,8 +2319,13 @@ sub in_iprange { > my @allowedipranges = $iprange ? split(' ', $iprange) : (); > if (scalar @allowedipranges > 0) { > my @rangelist; >- eval { @rangelist = Net::CIDR::range2cidr(@allowedipranges); }; return 0 if $@; >- eval { $result = Net::CIDR::cidrlookup($ENV{'REMOTE_ADDR'}, @rangelist) } || Koha::Logger->get->warn('cidrlookup failed for ' . join(' ',@rangelist) ); >+ eval { @rangelist = Net::CIDR::range2cidr(@allowedipranges); }; return 0 if $@; >+ >+ if (defined $ENV{'HTTP_CF_CONNECTING_IP'}) { >+ eval { $result = Net::CIDR::cidrlookup($ENV{'HTTP_CF_CONNECTING_IP'}, @rangelist) } || Koha::Logger->get->warn('cidrlookup failed for ' . $ENV{'HTTP_CF_CONNECTING_IP'}. ' in '. join(' ',@rangelist) ); >+ } else { >+ eval { $result = Net::CIDR::cidrlookup($ENV{'REMOTE_ADDR'}, @rangelist) } || Koha::Logger->get->warn('cidrlookup failed for ' . $ENV{'REMOTE_ADDR'} . ' in '. join(' ',@rangelist) ); >+ } > } > return $result ? 1 : 0; > } >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36304
:
163104
|
163515
|
163973