How to get exit node ip in PHP app running on tor/lighttpd -


i'm having trouble getting ip address of exit node hits hidden service (php). no matter try, comes local (127.0.0.1), if it's going through proxy.

i have tor configured this:

hiddenserviceport 80 127.0.0.1:9028 

and lighty this:

server.port = 9028 

which means hit against hidden service should arrive through tor on virtual port 80, directed 9028 on lightly, , served end user.

i have privoxy installed don't believe has tor hidden services (i've confirmed thru privoxy debug logs).

i've tried code this:

if (!empty($_server['http_client_ip'])) {         return $_server['http_client_ip']; } else if (!empty($_server['http_x_forwarded_for'])) {      return $_server['http_x_forwarded_for']; } return $_server['remote_addr']; 

but headers don't include forwarding ip information.

what missing? why can't lightly see exit node ip address? there way configure proxy in there somewhere alter headers , inject x-forwarded header? don't care lookup exit node in public database - want ip address.

you need check more server vars that. this:

$ipaddress = ”; if ($_server[‘http_client_ip’] != ‘127.0.0.1’) $ipaddress = $_server[‘http_client_ip’]; else if ($_server[‘http_x_forwarded_for’] != ‘127.0.0.1’) $ipaddress = $_server[‘http_x_forwarded_for’]; else if ($_server[‘http_x_forwarded’] != ‘127.0.0.1’) $ipaddress = $_server[‘http_x_forwarded’]; else if ($_server[‘http_forwarded_for’] != ‘127.0.0.1’) $ipaddress = $_server[‘http_forwarded_for’]; else if ($_server[‘http_forwarded’] != ‘127.0.0.1’) $ipaddress = $_server[‘http_forwarded’]; else if ($_server[‘remote_addr’] != ‘127.0.0.1’) $ipaddress = $_server[‘remote_addr’]; else $ipaddress = 'unknown'; 

hopefully helps.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -