I was trying to figure out why the su command didn’t have any effect and returned me back to the current user shell. The reason was that in /etc/passwd the users shell is defined as /bin/false
To switch to that user account I ended up using the following command
su -s /bin/sh
That works for me. I’m using Centos 5.9
I’m still trying to figure out how to block users of the onion network aka TOR from using some of my sites. I’ve found that TOR actually provides a mechanism using reverse dns lookups to help you identify tor exit nodes and take appropriate action.
Here is the TOR page that describes how to use TorDNSEL
Another resource that may prove valuable is this fellow who put up an example php script to make use of this method to identify tor users.
TOR PHP Example
The problem I was trying to solve was a clean and quick way to get the country code quickly for a range of ip addresses. There are many available libraries out there to do this but the one I found to be the easiest to use is provided via a web service which can be accessed from any scripting language to automate the process.
The only step required is a quick and free signup for an api key from this URL: http://ipinfodb.com/ip_location_api.php
Then you can use the service like this:
Which will return something like follows in your web browser:
OK;;188.8.131.52;US;UNITED STATES;CALIFORNIA;MOUNTAIN VIEW;94043;37.3861;-122.084;-08:00