/[smeserver]/rpms/smeserver-php/sme10/smeserver-php-3.0.0-bz10904-pass-auth-token-to-fpm.patch
ViewVC logotype

Contents of /rpms/smeserver-php/sme10/smeserver-php-3.0.0-bz10904-pass-auth-token-to-fpm.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Mar 25 03:06:30 2020 UTC (4 years, 7 months ago) by jpp
Branch: MAIN
CVS Tags: smeserver-php-3_0_0-8_el7_sme
* Tue Mar 24 2020 Jean-Philipe Pialasse <tests@pialasse.com> 3.0.0-8.sme
- transfer SERVER auth variables from httpd server to php-fpm pool [SME: 10904]
  this allow easy auth for php app using httpd auth as if using php module

1 diff -Nur smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays
2 --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays 2020-03-24 22:47:45.360000000 -0400
3 +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays 2020-03-24 22:52:37.899000000 -0400
4 @@ -18,6 +18,7 @@
5 ($version) = $version =~ /([0-9]{2})/ unless $version eq '';
6 my $name = lc $key;
7 $OUT .=<<"_EOF";
8 + SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=\$1
9 <FilesMatch \.php\$>
10 SetHandler "proxy:unix:/var/run/php-fpm/php$version-$name.sock|fcgi://localhost"
11 </FilesMatch>
12 diff -Nur smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/php.ini/40DataHandling smeserver-php-3.0.0/root/etc/e-smith/templates/etc/php.ini/40DataHandling
13 --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/php.ini/40DataHandling 2020-03-24 22:47:45.397000000 -0400
14 +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/php.ini/40DataHandling 2020-03-24 23:03:00.496000000 -0400
15 @@ -6,7 +6,11 @@
16 my $ms = $phpcur->prop(PostMaxSize) || $php{PostMaxSize} || "20M";
17 $OUT .= "$ms";
18 }
19 -auto_prepend_file =
20 +auto_prepend_file = {
21 + my $appf = $phpcur->prop(AutoPrependFile) || $php{AutoPrependFile} || "enabled";
22 + $appf = ( "$appf" eq "enabled" ) ? "/usr/share/php/auth_translation.php" : "";
23 + $OUT .= "$appf";
24 +}
25 auto_append_file =
26 default_mimetype = "text/html"
27 default_charset = "UTF-8"
28 diff -Nur smeserver-php-3.0.0.old/root/usr/share/php/auth_translation.php smeserver-php-3.0.0/root/usr/share/php/auth_translation.php
29 --- smeserver-php-3.0.0.old/root/usr/share/php/auth_translation.php 1969-12-31 19:00:00.000000000 -0500
30 +++ smeserver-php-3.0.0/root/usr/share/php/auth_translation.php 2020-03-24 22:56:30.995000000 -0400
31 @@ -0,0 +1,13 @@
32 +<?php
33 +if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
34 + $hash = str_replace('Basic ', '', $_SERVER['REDIRECT_HTTP_AUTHORIZATION']);
35 + $hash = base64_decode($hash);
36 + $_SERVER['HTTP_AUTHORIZATION']=$_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
37 + if (strpos($hash, ':') !== false) {
38 + list( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', $hash, 2);
39 + }
40 +}
41 +if (isset($_SERVER['REDIRECT_REMOTE_USER'])) {
42 + $_SERVER['REMOTE_USER']= $_SERVER['REDIRECT_REMOTE_USER'];
43 +}
44 +?>

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed