Bitcoin Forum
November 13, 2024, 04:19:51 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PHP rpcallowip, what am I doing wrong?  (Read 3790 times)
Anonymous
Guest

October 31, 2010, 02:49:28 AM
Last edit: September 11, 2011, 04:32:17 PM by davidonpda
 #1

adg
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2301


Chief Scientist


View Profile WWW
November 01, 2010, 03:37:59 PM
 #2

Looks good to me.

Try to connect then look at the end of bitcoin's debug.log; see if it is even getting the connection.

Also:  did you restart bitcoind after adding the rpcallowip?  The .conf file is only read at startup.

How often do you get the chance to work on a potentially world-changing project?
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2301


Chief Scientist


View Profile WWW
November 01, 2010, 05:05:43 PM
 #3

If bitcoin thinks the connection is not allowed, then it just ignores the connection attempt-- nothing is written to debug.log.  That's probably the right thing to do-- otherwise somebody malicious could try to fill up your hard disk by repeatedly attempting to connect to port 8332.

If you can recompile bitcoind, the "ClientAllowed" routine in rpc.cpp is where a printf() to log connections could go.  But I'd guess either you misspelled "rpcallowip" (I always type rcp instead of rpc...) or have a firewall blocking connections.

If you can ssh into the web server machine (or any other machine, actually), try:
  curl http://machine_or_ip:8332/

If you get "couldn't connect to host" then it is a firewall problem.
If you get "Empty reply from server" then it is an rpcallowip problem.
If you get an HTTP "Authorization Required" or "Authorization Failed" reply, then it is a username/password mismatch (those ARE logged in debug.log, though-- grep for ThreadRPC).

How often do you get the chance to work on a potentially world-changing project?
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
November 01, 2010, 05:18:51 PM
 #4

If bitcoin thinks the connection is not allowed, then it just ignores the connection attempt-- nothing is written to debug.log.  That's probably the right thing to do-- otherwise somebody malicious could try to fill up your hard disk by repeatedly attempting to connect to port 8332.

It is wrong to discard useful information about a potential attack.

This sort of thing is typically solved by rate-limiting.

Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2301


Chief Scientist


View Profile WWW
November 01, 2010, 09:26:46 PM
 #5

Does it work if you (temporarily) set rpcallowip=*  ?

And are you SURE you're running a bitcoind that supports rpcallowip?  Run bitcoind getinfo, and check the "version" value returned (version 0.3.12 or later, if I'm reading the source correctly).

How often do you get the chance to work on a potentially world-changing project?
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2301


Chief Scientist


View Profile WWW
November 02, 2010, 02:21:53 PM
 #6

Ok, looks like two problems-- if rpcallowip=* works, then maybe bitcoin thinks your IP is something else (or maybe there is a bug in the bitcoin rpcallowip code).  Run this on the web server:
Code:
curl http://www.whatismyip.com/automation/n09230945.asp

As to why the PHP code isn't working-- can you turn on error_reporting and get more information on what isn't working?

How often do you get the chance to work on a potentially world-changing project?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!