Archive for the ‘Linux’ category

Count IP’s in Apache/httpd log file

February 12th, 2012

Just a quick method to count how many times an IP has accessed your webserver.

from the command line type:

awk '{!a[$1]++}END{for(i in a) if ( a[i] >10 ) print a[i],i }' filename

where filename is the name/location of the file, example: /var/log/httpd/access_log

if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d
BTC: 1PY95KFPTEJTR7f2NnSgaB6xB9pwDJkcJz

PHP/HTTP max upload error

November 18th, 2011

There are several reasons that you cannot upload a file with a script. The following are 2 possible reasons.

The first, simple enough, is the file size is too large. To fix this just modify the “upload_max_filesize” modifier in php.ini. To determine the location of the php.ini being used by that domain quickly create a phpinfo() page. (simple page with ) this will display the information.

note: remove this file afterwards as it gives information on your server and can be considered a security risk

The other possible reason, and you need to look at your error logs to verify this is if you are getting a similar error message to this:

 mod_fcgid: HTTP request length 138361 (so far) exceeds MaxRequestLen (131072), referer:

or something similar.

This indicates that the apache configuration needs a little tweaking.

do a quick search for the file: fcgid.conf
modify it by adding the following line

FcgidMaxRequestLen 200000000

This sets the limit to 200MB.
Example file would look like:

<IfModule mod_fcgid.c>

<IfModule !mod_fastcgi.c>
    AddHandler fcgid-script fcg fcgi fpl
</IfModule>

  FcgidIPCDir /var/run/mod_fcgid/sock
  FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm

  FcgidIdleTimeout 40
  FcgidProcessLifeTime 30
  FcgidMaxProcesses 20
  FcgidMaxProcessesPerClass 8
  FcgidMinProcessesPerClass 0
  FcgidMaxRequestLen 200000000
  FcgidConnectTimeout 30
  FcgidIOTimeout 45
  FcgidInitialEnv RAILS_ENV production
  FcgidIdleScanInterval 10

</IfModule>

if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d
BTC: 1PY95KFPTEJTR7f2NnSgaB6xB9pwDJkcJz

PCI compliance – Vulnerability SSL Version 2 (v2) Protocol Detection linux

July 15th, 2011

Simple enough to fix on apache.

Load the ssl.conf file and add at the bottom the following:

SSLProtocol -ALL +SSLv3 +TLSv1

then restart apache.

To test the connection on the command line type:

openssl s_client -ssl2 -connect google.com:443

if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d
BTC: 1PY95KFPTEJTR7f2NnSgaB6xB9pwDJkcJz

Plesk – Cannot delete/remove IP’s

April 30th, 2011

In plesk, even if you remove the IP via the interface or eth0 file it will not remove the IP from the server.

You must first make sure that the IP is not being used by any hosting/domain. Once it has no usage, then it is possible to either remove the IP using the GUI, or the command line:

/opt/psa/bin/ipmanage -r XXX.XXX.XXX.XXX

If it is still being used you will get an error like this:

Unable to remove IP address:
The IP address 207.150.203.116 is already used for hosting.

If it works:

rndc: connect failed: 127.0.0.1#953: connection refused
named: no process killed
SUCCESS: IP address '207.150.201.197' removed sucessfully.
if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d
BTC: 1PY95KFPTEJTR7f2NnSgaB6xB9pwDJkcJz

Linux – Find out OS release Version

April 14th, 2011

An alternative to “uname -a” is “lsb_release -a”

It will produce an output similar to :

LSB Version:   :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:
printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:   Red Hat Enterprise Linux Server release 6.0 (Santiago)
Release:       6.0
Codename:      Santiago
if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d
BTC: 1PY95KFPTEJTR7f2NnSgaB6xB9pwDJkcJz