Thursday, January 19, 2012

Get Wikipedia blackout back online via hosts file work around

Wikipedia is on blackout for 24 hours. The blackout code is delivered via JS from the domain

To get wikipedia back online during their blackout append "" to your hosts file.

The line:

will make the domain resolve to your loopback interface for IPv4 (your local machine). It will thus NOT render the HTTP response delivering the JavaScript code that will blackout the wikipedia page. Thus you can use wikipedia as normal.

If you're not familiar with what a hosts file is, here is a short overview.
Or look here on how to edit your hosts file:

These are for windows, however if you're on Linux then it's a lot simpler - like most things Linux.

echo "" >> /etc/hosts

You need to be root to do this, so either do "sudo" or "su root" or "sudo su" etc.

Other workarounds to wikipedia blackout

If you have foxyproxy you can also use that to block specifically by specifying that it proxy to some blackhole.

If you use a proxy configuration script, that would also work. Modify your script to proxy to your favorite blackhole.With a proxy script you can match just the JavaScript file URL, so it is more specific.

There is a number of other ways to block and they should all deliver the same results. 

If you're interested in the JS file delivering the blackout code then with firebug or chrome, inspect the source and then go to "Network" tab. You should see two HTTP requests for The second one is delivering the JavaScript file.You can also use Wireshark to inspect the network traffic and create a Wireshark filter for 

Friday, January 13, 2012

Where is httpd.conf - The Apache Configuration File

Are you tired of searching for the Apache Configuration File, httpd.conf?

To find the location of httpd.conf run the following shell command:

httpd -V

Note the -V option is capitalized. Which will give a response similar to:

Server version: Apache/2.2.21 (Unix)
Server built:   Nov 10 2011 19:22:21
Cpanel::Easy::Apache v3.7.1 rev9999
Server's Module Magic Number: 20051115:30
Server loaded:  APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
Architecture:   32-bit
Server MPM:     Event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/experimental/event"
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D HTTPD_ROOT="/usr/local/apache"
 -D SUEXEC_BIN="/usr/local/apache/bin/suexec"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

The path to httpd.conf can be seen as the HTTPD_ROOT/SERVER_CONFIG_FILE which is /usr/local/apache/conf/httpd.conf in this example.

I've always been using find / -name 'httpd.conf" but this is much faster.

Once you've found httpd.conf you probably want to find the other files being included in the configuration. To do this you can search the httpd.conf file for the "Include" directives.

grep -E "^Include" /usr/local/apache/conf/httpd.conf 

The -E option gives extended regular expression so you can use "^Include" where the "^" character matches the beginning of the line. So only lines beginning with "Include" are returned.

You could follow each included file and recursively follow every included file to get all the included files but this is a good start. Something I also find myself needing is to look at all the configuration files in the apache configuration directory. ie:

find /usr/local/apache/conf -name '*.conf'

That returns every file ending in .conf.

Hope that helps.