Bugzilla – Attachment 181916 Details for
Bug 39789
Add ability to specify an alternative header to X-Forwarded-For for finding the real IP address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39789: Change syspref to config option
Bug-39789-Change-syspref-to-config-option.patch (text/plain), 3.99 KB, created by
Kyle M Hall (khall)
on 2025-05-05 12:25:03 UTC
(
hide
)
Description:
Bug 39789: Change syspref to config option
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2025-05-05 12:25:03 UTC
Size:
3.99 KB
patch
obsolete
>From d28cf0005717baf836b6de38638bfb05660db896 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 5 May 2025 11:49:13 +0000 >Subject: [PATCH] Bug 39789: Change syspref to config option > >--- > C4/Context.pm | 2 +- > Koha/Middleware/RealIP.pm | 2 +- > debian/templates/koha-conf-site.xml.in | 1 + > .../data/mysql/atomicupdate/bug_39789.pl | 20 ------------------- > .../en/modules/admin/preferences/admin.pref | 5 ----- > 5 files changed, 3 insertions(+), 27 deletions(-) > delete mode 100755 installer/data/mysql/atomicupdate/bug_39789.pl > >diff --git a/C4/Context.pm b/C4/Context.pm >index 2780e790ca6..f82415617d1 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -880,7 +880,7 @@ variable to be set correctly. > sub set_remote_address { > if ( C4::Context->config('koha_trusted_proxies') ) { > require CGI; >- if ( my $ReverseProxyIpHeader = C4::Context->preference('ReverseProxyIpHeader') ) { >+ if ( my $ReverseProxyIpHeader = C4::Context->config('reverse_proxy_ip_header') ) { # Updated here > my $header = CGI->http($ReverseProxyIpHeader); > > if ($header) { >diff --git a/Koha/Middleware/RealIP.pm b/Koha/Middleware/RealIP.pm >index be5c5c61e63..32cdc56e728 100644 >--- a/Koha/Middleware/RealIP.pm >+++ b/Koha/Middleware/RealIP.pm >@@ -51,7 +51,7 @@ sub call { > my $self = shift; > my $env = shift; > >- my $ReverseProxyIpHeader = C4::Context->preference('ReverseProxyIpHeader'); >+ my $ReverseProxyIpHeader = C4::Context->config('reverse_proxy_ip_header'); > if ( $ReverseProxyIpHeader && $env->{$ReverseProxyIpHeader} ) { > my @trusted_proxy = $self->trusted_proxy ? @{ $self->trusted_proxy } : undef; > >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index 1f034a26c54..4b6fc202d10 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -343,6 +343,7 @@ __END_SRU_PUBLICSERVER__ > <!-- Configuration for X-Forwarded-For --> > <!-- > <koha_trusted_proxies>1.2.3.4 2.3.4.5 3.4.5.6</koha_trusted_proxies> >+ <reverse_proxy_ip_header>HTTP_X_FORWARDED_FOR</reverse_proxy_ip_header> > --> > > <!-- Elasticsearch Configuration --> >diff --git a/installer/data/mysql/atomicupdate/bug_39789.pl b/installer/data/mysql/atomicupdate/bug_39789.pl >deleted file mode 100755 >index eccf377e44a..00000000000 >--- a/installer/data/mysql/atomicupdate/bug_39789.pl >+++ /dev/null >@@ -1,20 +0,0 @@ >-use Modern::Perl; >-use Koha::Installer::Output qw(say_warning say_success say_info); >- >-return { >- bug_number => "29789", >- description => "Add new system preference ReverseProxyIpHeader", >- up => sub { >- my ($args) = @_; >- my ( $dbh, $out ) = @$args{qw(dbh out)}; >- >- my $rv = $dbh->do( >- q{ >- INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) >- VALUES ('ReverseProxyIpHeader','HTTP_X_FORWARDED_FOR',NULL,'Header environment variable ','free') >- } >- ); >- >- say $out "Added new system preference 'ReverseProxyIpHeader'"; >- }, >-}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >index afd40d21d6f..eac9b14907b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >@@ -107,11 +107,6 @@ Administration: > 1: "Yes" > 0: "No" > - (Disable only when remote IP address changes frequently.) >- - >- - Look in the header >- - pref: ReverseProxyIpHeader >- class: url >- - for IP addresses that http requests have been forwarded from. > - > - "Set logged in library for staff by matching their current IP to the library configuration: " > - pref: StaffLoginLibraryBasedOnIP >-- >2.39.5 (Apple Git-154)
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 39789
:
181718
|
181720
|
181915
|
181916
|
181917
|
181918
|
181919
|
181920
|
181921
|
182299
|
182300
|
182395
|
182396
|
182397
|
182841
|
182842
|
182843
|
182844
|
182846
|
182847
|
182848
|
182849
|
183215