You can use the following command to list all the loaded modules in apache (both DSO and Static)
———-

 

# apachectl -t -D DUMP_MODULES

 

———-

The output will be something like
———
dir_module (static)
actions_module (static)
userdir_module (static)
alias_module (static)
rewrite_module (static)
so_module (static)
auth_passthrough_module (shared)
bwlimited_module (shared)
php5_module (shared)
fcgid_module (shared)
proxy_module (shared)

Comments No Comments »

There have been many stories for the last 2 days about a stack overflow vulnerability in nginx. Luckily NGINX put out a patch for it yesterday. If you subscribe to their channel, the update is simple yum update.

# yum update nginx

# nginx -v
nginx version: nginx/1.4.1

Further Reading:

 

Comments No Comments »

So this is a simple change that will apply to php and not really to the web service. I took this from an apache tip page. So if you curl your page’s headers you should see your version of php listed as “X-Powered-By”

neoproxy@apex[~]$ curl -I 8bitpipe.com
HTTP/1.1 200 OK
Date: Thu, 28 Feb 2013 15:11:02 GMT
Server: nginx
Connection: Keep-Alive
X-Pingback: http://8bitpipe.com/xmlrpc.php
Content-Type: text/html; charset=UTF-8
X-Powered-By: PHP/5.3.3

To turn this off, go into php.ini and find expose_php and change it to off. This is on by default so if you can’t find it, add the following in the [php] section:

expose_php = Off

Afterwards you will need to restart php-cgi, php-fpm, or apache, depending on what you’re using. Then when you check the headers:

neoproxy@apex[~]$ curl -I 8bitpipe.com
HTTP/1.1 200 OK
Date: Thu, 28 Feb 2013 15:17:34 GMT
Server: nginx
Connection: Keep-Alive
X-Pingback: http://8bitpipe.com/xmlrpc.php
Content-Type: text/html; charset=UTF-8

  • http://www.ducea.com/2006/06/16/apache-tips-tricks-hide-php-version-x-powered-by/
  • http://www.php.net/manual/en/ini.core.php#ini.expose-php

Comments No Comments »

As a test, I created 3 accounts one yahoo, one gmail, and one hotmail. All have the same username and were created about the same time. I’m curious to see which one gets unsolicited mail first.

Comments No Comments »

Much to my surprise, nginx has it’s own repo. You can find more info here:

http://wiki.nginx.org/Install

I’ve been using the one from the epel repo and it is a couple minor versions behind.

nginx x86_64 1.0.15-2.el6 epel
nginx x86_64 1.2.4-1.el6.ngx nginx

Comments No Comments »

Here is s snippet of code to check if a file exists so you don’t end up having your script run twice and edit the same file accidentally.

LOCK_FILE=/var/lock/`basename $0`
(set -C; : > $LOCK_FILE) 2> /dev/null
if [ $? != "0" ]; then
echo “Lock File exists – exiting”
exit 1
fi

### Place your script content here ###

trap ‘rm $LOCK_FILE’ EXIT

Comments 2 Comments »

I install APC for customers all the time, but never benchmarked any specific performance test. I have seen the effect and would suggest some sort of caching service for a website. Well, I noticed I didn’t have APC on my server, so I thought I would do some bench marking and install. Here is the results of using apache’s benchmark command against my nginx server:

Before APC

Server Software: nginx/0.8.54
Server Hostname: 8bitpipe.com
Server Port: 80

Document Path: /
Document Length: 41342 bytes

Concurrency Level: 50
Time taken for tests: 111.764 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 41643000 bytes
HTML transferred: 41342000 bytes
Requests per second: 8.95 [#/sec] (mean)
Time per request: 5588.215 [ms] (mean)
Time per request: 111.764 [ms] (mean, across all concurrent requests)
Transfer rate: 363.86 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.0 1 7
Processing: 687 5455 743.2 5424 7066
Waiting: 683 5451 743.2 5420 7063
Total: 693 5456 742.5 5425 7067

Percentage of the requests served within a certain time (ms)
50% 5425
66% 5559
75% 5728
80% 5855
90% 6260
95% 6459
98% 6595
99% 6680
100% 7067 (longest request)

After APC

Server Software: nginx/0.8.54
Server Hostname: 8bitpipe.com
Server Port: 80

Document Path: /
Document Length: 41342 bytes

Concurrency Level: 50
Time taken for tests: 78.133 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 41643000 bytes
HTML transferred: 41342000 bytes
Requests per second: 12.80 [#/sec] (mean)
Time per request: 3906.663 [ms] (mean)
Time per request: 78.133 [ms] (mean, across all concurrent requests)
Transfer rate: 520.48 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.5 1 4
Processing: 555 3816 623.6 3727 5867
Waiting: 551 3812 623.7 3722 5863
Total: 559 3817 623.4 3727 5867

Percentage of the requests served within a certain time (ms)
50% 3727
66% 3833
75% 3977
80% 4084
90% 4462
95% 4894
98% 5546
99% 5635
100% 5867 (longest request)

This is a noticeable difference on this simple test without any tuning to APC (my nginx install is fairly stock also).

Comments No Comments »

Recently had to dump a mysql database that was larger than the available space. Here’s a quick one-liner to compress the dump and pipe it over ssh to another destination.

# mysqldump DATABASE | gzip -c –fast |ssh user@destination.domain.com ‘cat > /home/user/DATABASE.sql.gz’

Comments 1 Comment »

See a suspicious IP on your box and wonder what it’s doing? Here’s a one-liner that will list the files that IP is accessing:

# lsof -p $(netstat -npat | gawk ‘$5 ~ /127.0.0.1/ {print $7}’ | cut -d”/” -f1 | tail -n1)

Comments No Comments »

Well with the claim of Anonymous‘ attempt to take down the internet a couple days ago(which they denied), one of the words that keep popping up is

“…the use of computers and computer networks as a means of protest to promote political end”hacktivist. According to wikipedia defines hacktivism as

This is not to be confused with hacktavision, which is hacking your old activision game console to play mame games.

I am curious as to what these people are protesting as all I ever seem to hear is that they are attacking someone to protest something. I personally don’t feel that a protest has as much weight as individuals publicly voicing there opinions. Anonymity seems to fall into obscurity in my opinion. Now if you tell everyone who you are and still hacktivate an attack, always remember, it’s the martyr that gets all the credit.

Further Reading:

 

Comments No Comments »