Monthly Archives: October 2013

Analyze IP addresses accessing your Apache server

The awk command below retrieves the first column of your apache log file which containsscript the IP address of the browser accessing your host (if you have a virtual host setup with the vhost_combined CustomLog you should retrieve column 2 instead).

After retrieving the column it is sorted and all unique values are determined and counted. After that the list of unique values and there count is sorted (reverse) to get the top list of IP’s.

Output of this statement:

 

 

Share

Apache deny and allow access from ipaddress

With help of a .htaccess file we can deny or allow access from a specific ip address or range of ip addresses.

Deny access from all IP addresses in the range 192.168.2.*:

The line order allow,deny means that Apache should first evaluate the allow entries (which states that everyone is allowed access) and then the deny entries (which states that the range 192.168.19.* is denied access). Effectively this means that the range 192.168.19.* is denied access.

Order of evaluation is allow, deny; so this means:
allow access from all
deny access from 192.168.19.

Allow only access from the IP range 192.168.19.*:

Order of evaluation is deny, allow; so this means:
deny access from all
allow from 192.168.19.

Share

Setup proxy ignore list on Ubuntu

Follow these steps to change the proxy ignore list on your Ubuntu installation:

1. Install the dconf-editor:

2. Start the dconf-editor and navigate to System -> Proxy; add your hosts to ignore to the ignore-hosts value.

Logoff and logon for changes to take effect

Your can inspect your current settings with:

 

Share

apt-get through socks5 proxy

Enable temporary proxy for apt-get by editing (create it if not exist /etc/apt/apt.conf  and add the line (change username, password, host and port):

Install the tsocks application:

Remove the line added in the step before from from  /etc/apt/apt.conf

Edit the /etc/socks.conf  file and change the default server to the IP address of your socks server (a domain name does not work!); if applicable also change the port number for your socks connection.

Now to use this new socks proxy go ahead and execute:

Even though you have removed the proxy settings from the /etc/apt/apt.conf  file this should still update your apt list.

 

Share