MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Technical Helps => Topic started by: WISTFUL on 2013-02-20, 23:11:29

Title: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-20, 23:11:29
I use bind as DNS server.
In my WHMCS "License Information" section 127.0.0.1 will be detected as the "Valid IP" instead my server IP!
How can I fix it?
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-20, 23:27:26
Also I return this change (http://forum.mratwork.com/viewtopic.php?f=5&t=1335&p=3348#p3348) to normal but does not help me!
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-21, 00:13:43
Every make a new thread please inform your system as desciption in viewtopic.php?f=10&t=684 (http://forum.mratwork.com/viewtopic.php?f=10&t=684)

Who's remember your server config except yourself.

Ask to WHMCS about your issue or googling with match keywords.
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-21, 00:31:17
I have CentOS 6.3 (64 bit) on KVM VPS
I'm using kloxo-mr 6.5.0.c.2013022001 by nginx-proxy + bind

I've configured my webserver as follows:
Php Branch : php54_(as_5.4.11)
Php Type : php-fpm_event
Enable Php 5.2 (use Lxphp) As Secondary Php
Apache Memory Optimize : default
Mysql Convert : to-myisam
-------------------------------------------
I reported issue to WHMCS support team and they said:
Quote
I am afraid that the IP shown is what is being reported by your server, so if this is incorrect, it would indicate an issue with your server's configuration and may need to be investigated by your hosting provider or server administrator.
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-21, 01:00:53
It's maybe mod_rpaf not install on your system.

Install with 'yum install mod_rpaf'. After success, copy rapf.conf with 'cp -f /home/apache/etc/conf.d/rpaf.conf /etc/httpd/conf.f/rpaf.conf'
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-21, 01:07:25
Quote from: "'yum install mod_rpaf'"
Package mod_rpaf-0.6-4.mr.el6.x86_64 already installed and latest version
Nothing to do
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-21, 13:09:07
# cp -f /home/apache/etc/conf.d/rpaf.conf /etc/httpd/conf.f/rpaf.conf
Code: [Select]
cp: cannot create regular file `/etc/httpd/conf.f/rpaf.conf': No such file or directoryInstead it there is /etc/httpd/conf.d/rpaf.conf that have exact content to /home/apache/etc/conf.d/rpaf.conf
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-21, 13:40:12
Yes, you right about rpaf.conf... but different context possible different effect
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-21, 13:59:05
Do you mean that I should create /conf.f directory and then run 'cp -f /home/apache/etc/conf.d/rpaf.conf /etc/httpd/conf.f/rpaf.conf'?
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-21, 14:00:16
Right command is 'cp -f /home/apache/etc/conf.d/rpaf.conf /etc/httpd/conf.d/rpaf.conf'
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-21, 14:17:42
Still Valid IP = 127.0.0.1
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-21, 15:24:49
Have you restart httpd, nginx and php-fpm after install or modified module config?
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-21, 15:46:20
I do that but still same result.

I've found information that I think may help fix server's configuration!

WHMCS > Utilities > System > PHP Info >
Code: [Select]
_SERVER["SERVER_NAME"] domain.ltd
_SERVER["SERVER_ADDR"] 127.0.0.1

_ENV["SERVER_NAME"] domain.ltd
_ENV["SERVER_ADDR"] 127.0.0.1
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-21, 15:48:59
Also same data on:
Code: [Select]
<?php
phpinfo
();
?>
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-21, 16:35:40
Try:
1. copy /home/nginx/conf/globals/proxy.conf /home/nginx/conf/globals/custom.proxy.conf
2. edit custom.proxy.conf where change 127.0.0.1 tp your ip
3. run fixweb
3. restart nginx
4. test again with phpinfo script
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-21, 16:54:22
I replace all 127.0.0.1 with my server IP in custom.proxy.conf

Now issue solved.
But:
Code: [Select]
_ENV["REMOTE_ADDR"] = server IP
_SERVER["REMOTE_ADDR"] = server IP
Is it OK?
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-22, 09:47:46
Do you find any other solution that auto detects server IP as "SERVER_ADDR" (without manual editing proxy.conf) and also detect correct local IP as "REMOTE_ADDR"?

I have problem with your current solution.
In default proxy.conf file, below code returns domain.ltd when referred from http://www.domain.ltd (http://www.domain.ltd) and is correct. but after customizing proxy.conf, return www.domain.ltd and is not correct.
Code: [Select]
parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST )
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-22, 11:27:59
Read http://www.electrictoolbox.com/php-http ... -variable/ (http://www.electrictoolbox.com/php-http-referer-variable/) about httpd-referer.
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-22, 11:47:00
Thanks mustafa,

But my cade is okay. because when I test it on other servers or using default proxy.conf It works well!
Please find a solution for main problem.

In addition, This solution does not return correct local IP as _ENV["REMOTE_ADDR"] and _SERVER["REMOTE_ADDR"] so can not be a permanent solution ...
(also may create other problems that are not yet known)
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-22, 11:52:25
Quote from: "WISTFUL"
Thanks mustafa,

But my cade is okay. because when I test it on other servers or using default proxy.conf It works well!
Please find a solution for main problem.

In addition, This solution does not return correct local IP as _ENV["REMOTE_ADDR"] and _SERVER["REMOTE_ADDR"] so can not be a permanent solution ...
(also may create other problems that are not yet known)
I will not correct this issue because it's related how to proxy work.

And it's not related to your main issue (WHMCS license).

Just modified your custom.proxy.conf and your php code where if found 'www.' then remove 'www.'.
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-22, 12:17:34
In your opinion, is this normal that $_SERVER['SERVER_ADDR'] does not return IP address of the server in PHP?!

http://php.net/manual/en/reserved.variables.server.php (http://php.net/manual/en/reserved.variables.server.php)
Quote
'SERVER_ADDR'
   The IP address of the server under which the current script is executing.
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-22, 13:14:56
Please read this issue:
http://forum.nginx.org/read.php?2,14165 ... msg-141655 (http://forum.nginx.org/read.php?2,141655,141655#msg-141655)
Title: Re: Lockal IP detected on WHMCS License Information
Post by: MRatWork on 2013-02-22, 13:46:08
I know your reference. Again, I don't have a plan for changing '127.0.0.1:30080' to 'real_ip:30080' as standard config for Kloxo-MR.

The reason:
1. You can access your domain with 'http://yourdomain.com/' (that mean 'http://yourdomain.com:80/') or 'http://yourdomain.com:30080/'.

Why?. Because you can see '<VirtualHost *:30080>' in domain config for apache (it's mean apache listen all ip with port 30080).

If someone know, he can DDOS this 'http://yourdomain.com:30080/'. Httpd not have mechanism for prevent DDOS. It's different with Nginx.

For better prevent, modified '<VirtualHost *:30080>' to '<VirtualHost 127.0.0.1:30080>'.

2. Using '127.0.0.1' for communicate between nginx/lighttpd to httpd is 'standard'.

3. Identified ip via $_server or other function of php directry is bad code. Better with 'small' trick for more accurate. But, it's WHMCS problem and not Kloxo-MR itself.

Simple rule, WHMCS must adjust their code for nginx/lighttpd-proxy and not otherwise.
Title: Re: Lockal IP detected on WHMCS License Information
Post by: WISTFUL on 2013-02-22, 15:50:50
Perfect answer, thank you very much!

Is there any way that we can set $_SERVER['SERVER_ADDR'] variable globaly? (e.g by .htaccess or php.ini)