mod_rpaf icon indicating copy to clipboard operation
mod_rpaf copied to clipboard

CentOS 7

Open hookbot opened this issue 10 years ago • 7 comments

This is really hard to install on CentOS 7. Is there an rpm that will work like there is for the old CentOS 6?

hookbot avatar Aug 12 '14 20:08 hookbot

This is about as far as I can get:

$ sudo yum install httpd-devel
$ sudo yum install gcc
$ sudo ln -s /usr/bin/apxs /usr/sbin/apxs
$ rpmbuild -ta mod_rpaf-0.6.tar.gz
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -g
record-gcc-switches -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURC
E=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c -o mod_rpaf-2.0.lo mod_rpaf-2.0.c && touch mod_rpaf-2.0.slo
mod_rpaf-2.0.c: In function 'rpaf_cleanup':
mod_rpaf-2.0.c:130:23: error: 'conn_rec' has no member named 'remote_ip'
     rcr->r->connection->remote_ip = apr_pstrdup(rcr->r->connection->pool, rcr->old_ip);
                       ^
mod_rpaf-2.0.c:131:23: error: 'conn_rec' has no member named 'remote_addr'
     rcr->r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(rcr->r->connection->remote_ip);
                       ^
mod_rpaf-2.0.c:131:95: error: 'conn_rec' has no member named 'remote_ip'
     rcr->r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(rcr->r->connection->remote_ip);
                                                                                               ^
mod_rpaf-2.0.c:132:23: error: 'conn_rec' has no member named 'remote_addr'
     rcr->r->connection->remote_addr->sa.sin.sin_family = rcr->old_family;
                       ^
mod_rpaf-2.0.c: In function 'change_remote_ip':
mod_rpaf-2.0.c:145:34: error: 'conn_rec' has no member named 'remote_ip'
     if (is_in_array(r->connection->remote_ip, cfg->proxy_ips) == 1) {
                                  ^
mod_rpaf-2.0.c:164:73: error: 'conn_rec' has no member named 'remote_ip'
             rcr->old_ip = apr_pstrdup(r->connection->pool, r->connection->remote_ip);
                                                                         ^
mod_rpaf-2.0.c:165:44: error: 'conn_rec' has no member named 'remote_addr'
             rcr->old_family = r->connection->remote_addr->sa.sin.sin_family;
                                            ^
mod_rpaf-2.0.c:168:26: error: 'conn_rec' has no member named 'remote_ip'
             r->connection->remote_ip = apr_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
                          ^
mod_rpaf-2.0.c:169:26: error: 'conn_rec' has no member named 'remote_addr'
             r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(r->connection->remote_ip);
                          ^
mod_rpaf-2.0.c:169:93: error: 'conn_rec' has no member named 'remote_ip'
             r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(r->connection->remote_ip);
                                                                                             ^
mod_rpaf-2.0.c:170:26: error: 'conn_rec' has no member named 'remote_addr'
             r->connection->remote_addr->sa.sin.sin_family = AF_INET;
                          ^
apxs:Error: Command failed with rc=65536
.
error: Bad exit status from /var/tmp/rpm-tmp.GxH7xh (%build)


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

hookbot avatar Aug 12 '14 20:08 hookbot

Hi @hookbot

Please show me the apache version? I guess it might be httpd-2.4.6 Since Apache 2.4.1, it have been bundled mod_remoteip module which can rewrite remote ip address. I recommend to use mod_remoteip instead of mod_rpaf.

c.f. http://httpd.apache.org/docs/trunk/mod/mod_remoteip.html

1. replace remote ip

Add this line to httpd.conf or conf.d/mod_remoteip.conf or conf.d/remoteip.conf

RemoteIPHeader X-Forwarded-For

2. change log format

It have to use %a for logging real remote ip.

ref. http://trick77.com/2014/04/06/apache2-2-4-logging-remote-ip-address-using-mod_remoteip/

y-ken avatar Aug 13 '14 00:08 y-ken

Would you please tell me the applying result of this patch?

I found a patch for Apache 2.4.x https://gist.github.com/teriyakisan/2716030

y-ken avatar Aug 13 '14 01:08 y-ken

I installed CentOS 7 Minimal CD. Because I couldn't get your software working on it, I finally gave up and downgrading to CentOS 6.5. Everything is working MUCH easier now, except on my i686 machines. That patch does look nice though.

Maybe it would be best to use #ifdef chunks to define the struct fieldname at the top, then just swap out all that in the code so it will just compile no matter what. I don't have time to do a pull request right now though.

Thanks!

  • Rob

hookbot avatar Aug 13 '14 01:08 hookbot

Thank you for trying this and it's happy to hear working fine on your environment. Yeah, I agree to use #ifdef chunks for compatibility. I'm glad to refine them. But what did you faced the problem with i686 machines?

if you like this repository, please click star button for this. https://github.com/y-ken/mod_rpaf/stargazers

y-ken avatar Aug 13 '14 02:08 y-ken

Oh, it's just that you ONLY provide the rpm for CentOS 6.x 64bit arch. No 32bit. And nothing for CentOS 5.x nor CentOS 7.x. So I'm getting bit by that on a lot of our different servers. But I NEED your mod_rpaf fork because of the "RPAFsetport" REMOTE_PORT ENV correction and the Network block feature of "RPAFproxy_ips", so I can't use the original mod_rpaf since it is lacking those features.

-- Rob

On Tue, Aug 12, 2014 at 8:46 PM, Y.Kentaro [email protected] wrote:

Thank you for trying this and it's happy to hear working fine on your environment. Yeah, I agree to use #ifdef chunks for compatibility. I'm glad to refine them. But what did you faced the problem with i686 machines?

if you like this repository, please click star button for this. https://github.com/y-ken/mod_rpaf/stargazers

— Reply to this email directly or view it on GitHub https://github.com/y-ken/mod_rpaf/issues/3#issuecomment-52003833.

hookbot avatar Aug 13 '14 15:08 hookbot

Hi @hookbot

Please try following command as root to build for 32bit environment.

manual install

# Install various packages to get compile environment
yum -y groupinstall 'Development Tools'

# Install git command to access GitHub repository
yum -y install git

# Install apxs to build extension
yum install httpd-devel

cd /tmp/

# clone it to local
git clone https://github.com/y-ken/mod_rpaf
cd mod_rpaf
make
make install

rpm package

cd /tmp/

# Install various packages to get compile environment
yum -y groupinstall 'Development Tools'

# Install git command to access GitHub repository
yum -y install git

# Install rpm-build to use rpmrebuild command
yum -y install rpm-build

# Install yum-utils to use yumdownloader command
yum -y install yum-utils

# Install rpmdevtools to use rpmdev-setuptree command
yum -y install rpmdevtools

# Setup rpm build configuration for root user
rpmdev-setuptree
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

# Install apxs to build extension
rpm -y install httpd-devel 

# build rpm
git clone https://github.com/y-ken/mod_rpaf
tar czf mod_rpaf.tar.gz mod_rpaf
rpmbuild -ba mod_rpaf/mod_rpaf-fork.spec

# and then, install built package
yum install /path/to/mod_rpaf-fork.i386.rpm

y-ken avatar Sep 12 '14 05:09 y-ken