HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=4)
-   -   Error To Harden PHP5 With Suhosin On CentOS 5.0 (http://www.howtoforge.com/forums/showthread.php?t=29113)

jegavelan 1st December 2008 07:54

Error To Harden PHP5 With Suhosin On CentOS 5.0
 
I am getting this error when i try To Harden PHP5 With Suhosin On CentOS 5.0

rpmbuild -ba php.spec Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.41518
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf php-5.1.6
+ /bin/gzip -dc /usr/src/redhat/SOURCES/php-5.1.6.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd php-5.1.6
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo 'Patch #0 (php-5.1.6-suhosin.patch):'
Patch #0 (php-5.1.6-suhosin.patch):
+ patch -p1 -b --suffix .suhosin -s
+ echo 'Patch #1 (php-5.1.4-gnusrc.patch):'
Patch #1 (php-5.1.4-gnusrc.patch):
+ patch -p1 -b --suffix .gnusrc -s
+ echo 'Patch #2 (php-5.1.4-warnings.patch):'
Patch #2 (php-5.1.4-warnings.patch):
+ patch -p1 -b --suffix .warnings -s
+ echo 'Patch #5 (php-4.3.3-install.patch):'
Patch #5 (php-4.3.3-install.patch):
+ patch -p1 -b --suffix .install -s
+ echo 'Patch #6 (php-5.0.4-norpath.patch):'
Patch #6 (php-5.0.4-norpath.patch):
+ patch -p1 -b --suffix .norpath -s
+ echo 'Patch #7 (php-4.3.2-libtool15.patch):'
Patch #7 (php-4.3.2-libtool15.patch):
+ patch -p1 -b --suffix .libtool15 -s
+ echo 'Patch #13 (php-5.0.2-phpize64.patch):'
Patch #13 (php-5.0.2-phpize64.patch):
+ patch -p1 -b --suffix .phpize64 -s
+ echo 'Patch #14 (php-5.1.6-ecalloc.patch):'
Patch #14 (php-5.1.6-ecalloc.patch):
+ patch -p1 -b --suffix .ecalloc -s
1 out of 2 hunks FAILED -- saving rejects to file Zend/zend_alloc.c.rej
error: Bad exit status from /var/tmp/rpm-tmp.41518 (%prep)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.41518 (%prep)

falko 2nd December 2008 14:42

Did you download the correct Suhosin patch for your PHP version?

random.guy 18th April 2009 22:53

I have this exact same problem with CentOS 5.3 now, and can't figure this out. Everything worked fine with CentOS 5.2, so something critical must have changed. This is the error I get:

Code:

[root@localhost SPECS]# rpmbuild -ba php.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.89704
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf php-5.1.6
+ /bin/gzip -dc /usr/src/redhat/SOURCES/php-5.1.6.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd php-5.1.6
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo 'Patch #0 (php-5.1.6-suhosin.patch):'
Patch #0 (php-5.1.6-suhosin.patch):
+ patch -p1 -b --suffix .suhosin -s
+ echo 'Patch #1 (php-5.1.4-gnusrc.patch):'
Patch #1 (php-5.1.4-gnusrc.patch):
+ patch -p1 -b --suffix .gnusrc -s
+ echo 'Patch #2 (php-5.1.4-warnings.patch):'
Patch #2 (php-5.1.4-warnings.patch):
+ patch -p1 -b --suffix .warnings -s
+ echo 'Patch #5 (php-4.3.3-install.patch):'
Patch #5 (php-4.3.3-install.patch):
+ patch -p1 -b --suffix .install -s
+ echo 'Patch #6 (php-5.0.4-norpath.patch):'
Patch #6 (php-5.0.4-norpath.patch):
+ patch -p1 -b --suffix .norpath -s
+ echo 'Patch #7 (php-4.3.2-libtool15.patch):'
Patch #7 (php-4.3.2-libtool15.patch):
+ patch -p1 -b --suffix .libtool15 -s
+ echo 'Patch #13 (php-5.0.2-phpize64.patch):'
Patch #13 (php-5.0.2-phpize64.patch):
+ patch -p1 -b --suffix .phpize64 -s
+ echo 'Patch #15 (php-5.2.0-includedir.patch):'
Patch #15 (php-5.2.0-includedir.patch):
+ patch -p1 -b --suffix .includedir -s
+ echo 'Patch #16 (php-5.1.6-bug38534.patch):'
Patch #16 (php-5.1.6-bug38534.patch):
+ patch -p1 -b --suffix .bug38534 -s
+ echo 'Patch #17 (php-5.1.6-umask.patch):'
Patch #17 (php-5.1.6-umask.patch):
+ patch -p1 -b --suffix .umask -s
+ echo 'Patch #18 (php-4.3.9-metaphone.patch):'
Patch #18 (php-4.3.9-metaphone.patch):
+ patch -p1 -b --suffix .metaphone -s
+ echo 'Patch #19 (php-5.1.6-zendecase.patch):'
Patch #19 (php-5.1.6-zendecase.patch):
+ patch -p1 -b --suffix .zendecase -s
+ echo 'Patch #20 (php-5.1.6-zendhash.patch):'
Patch #20 (php-5.1.6-zendhash.patch):
+ patch -p1 -b --suffix .zendhash -s
1 out of 2 hunks FAILED -- saving rejects to file Zend/zend_hash.c.rej
error: Bad exit status from /var/tmp/rpm-tmp.89704 (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.89704 (%prep)

Running CentOS 5.3, php src file is php-5.1.6-23.el5.src.rpm, downloaded suhosin-patch-5.1.6-0.9.6.patch.gz and followed these instructions which worked with 5.2. Any kind of help would be really appreciated! Thanks!

random.guy 26th April 2009 03:24

So no one is running the CentOS 5.3 PHP rpm's with the Suhosin patch?

falko 26th April 2009 13:33

I haven't treid this yet, but normally instructions for CentOS 5.x work for 5.0, 5.1, 5.2, 5.3, etc., so I'm not sure what went wrong here.

magenbrot 6th May 2009 10:57

Hi,

I just had the same problem.
My solution was to move the suhosin patch to the end of the patch process.
It seems that there are a few patches that mess around with Zend/zend_hash.c

It now looks like this:
Code:

Patch1: php-5.1.4-gnusrc.patch
Patch2: php-5.1.4-warnings.patch
Patch5: php-4.3.3-install.patch
Patch6: php-5.0.4-norpath.patch
Patch7: php-4.3.2-libtool15.patch
Patch13: php-5.0.2-phpize64.patch
#Patch14: php-5.1.6-ecalloc.patch
Patch15: php-5.2.0-includedir.patch
Patch16: php-5.1.6-bug38534.patch
[...]
Patch104: php-5.1.6-mbstring-overload-func.patch
Patch105: php-5.1.6-gdoverflow.patch
Patch106: php-5.1.6-suhosin.patch
[...]
%setup -q
%patch1 -p1 -b .gnusrc
%patch2 -p1 -b .warnings
%patch5 -p1 -b .install
%patch6 -p1 -b .norpath
%patch7 -p1 -b .libtool15
%patch13 -p1 -b .phpize64
#%patch14 -p1 -b .ecalloc
%patch15 -p1 -b .includedir
[...]
%patch103 -p1 -b .cve5814
%patch104 -p1 -b .mbstring-overload-func
%patch106 -p1 -b .suhosin

PHP builds fine now:

Code:

Wrote: /usr/src/redhat/SRPMS/php-5.1.6-23.2.src.rpm
Code:

This server is protected with the Suhosin Extension 0.9.27


All times are GMT +2. The time now is 06:32.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.