1

I have recently installed httpd on a Centos 6 server. From what I see suEXEC was compiled with the values below;

 -D AP_DOC_ROOT="/var/www"
 -D AP_GID_MIN=100
 -D AP_HTTPD_USER="apache"
 -D AP_LOG_EXEC="/var/log/httpd/suexec.log"
 -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
 -D AP_UID_MIN=500
 -D AP_USERDIR_SUFFIX="public_html"

I was wondering if there's a way to change these values without compiling Apache from scratch?

  • As far as i know, recompile suexec/apache will be needed. However, you can use the rpm sources to make things easier. – user34720 Jun 14 '13 at 16:50
  • Is this a self compiled version of apache or out of one of the yum repositories for CentOS 6? – slm Jun 14 '13 at 18:53
  • it was the one from official CentOS repo. – compixtr Jun 16 '13 at 18:30
0

It's not possible to augment the options a tool was complied with so you're left to re-compile it yourself if you need additional options added in. With a package like httpd (Apache) on a RedHat based distro this isn't too bad.

You'll essentially need 3 things to do this:

  1. dependencies installed for httpd
  2. source RPM version of httpd
  3. an rpmbuild area

dependencies

You can use the tool yum-builddep to help in the effort. This tool will download all the packages required to build & install a given RPM. So you'll need to get yourself a version of the httpd RPM. But make sure to get it's source version typically named src.rpm files. For example:

mypackage-1.0.0-1.src.rpm

source RPM

For CentOS 6.2 you could download this source RPM: - http://vault.centos.org/6.2/os/Source/SPackages/httpd-2.2.15-15.el6.centos.src.rpm

build environment

I typically use a tool to set this up for me, rpmdev-setuptree.

$ yum install rpmdevtools
$ rpmdev-setuptree

Now change directories to your newly built rpmbuild area, and install the source RPM so that we can begin to modify how it get's built:

$ cd ~/rpm
$ rpm -ivh httpd-2.2.15-15.el6.centos.src.rpm

How we need to edit the httpd.spec file. This is the file that details how the eventual binary RPM should be constructed:

$ nano SPEC/httpd.spec

You'll need to find a section in this file where configure is being invoked. I usually search for the string --prefix. This next step is where you can add your modifications which will change how suexec get's built.

excerpt of configure stanza from httpd.spec

../configure \
        --prefix=%{_sysconfdir}/httpd \
        --exec-prefix=%{_prefix} \
        --bindir=%{_bindir} \
        --sbindir=%{_sbindir} \
        --mandir=%{_mandir} \
        --libdir=%{_libdir} \
        --sysconfdir=%{_sysconfdir}/httpd/conf \
        --includedir=%{_includedir}/httpd \
        --libexecdir=%{_libdir}/httpd/modules \
        --datadir=%{contentdir} \
        --with-installbuilddir=%{_libdir}/httpd/build \
        --with-mpm=$mpm \
        --with-apr=%{_prefix} --with-apr-util=%{_prefix} \
        --enable-suexec --with-suexec \
        --with-suexec-caller=%{suexec_caller} \
        --with-suexec-docroot=%{contentdir} \
        --with-suexec-logfile=%{_localstatedir}/log/httpd/suexec.log \
        --with-suexec-bin=%{_sbindir}/suexec \
        --with-suexec-uidmin=500 --with-suexec-gidmin=100 \
        --enable-pie \
        --with-pcre \
        $*

Save the file and now you're ready to build your version of httpd.

building source RPM

The following command will build your RPM:

$ rpmbuild -ba SPEC/httpd.spec

If all goes correctly you should be left with a new version of the RPM in the RPM directory here: RPM/httpd-2.2.15-15.el6.centos.x86_64.rpm.

Now you can install it like any other normal RPM.

References

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.