Sunday, May 15, 2016

Enable an apache2 module


cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/rewrite.load rewrite.load
sudo service apache2 restart

My webserver installation notes


$ sudo apt-get install build-essential
$ sudo apt-get install openssh-server
$ sudo apt-get install mysql-server
$ sudo apt-get install apache2
$ sudo apt-get install php5
$ sudo apt-get -y install imagemagick
$ sudo apt-get install perlmagick
$ sudo apt-get install libexpat1-dev
$ sudo apt-get install libapache2-mod-perl2
$ sudo apt-get install libapache2-mod-php5
$ sudo apt-get install php5-mysql
$ sudo apt-get install libdbd-mysql-perl
$ sudo apt-get install Sendmail
$ perl -MCPAN -e "install JSON"
$ perl -MCPAN -e "install XML::Parser"
$ perl -MCPAN -e "install XML::Simple"
$ perl -MCPAN -e "install IP::Country"
$ perl -MCPAN -e "install CGI"
$ perl -MCPAN -e "install CGI::Session"
$ perl -MCPAN -e "install DBI"
$ perl -MCPAN

$ cd /etc/apache2/mods-enabled
$ sudo ln -s ../mods-available/rewrite.load rewrite.load
$ sudo ln -s ../mods-available/expire.load expire.load
$ sudo ln -s ../mods-available/perl.load perl.load

Edit php.ini and set short_tag to true

Configure apache to run .pl scripts as CGI

Add mod_perl handler ( Include website cgi-bin to the included library folders in a preloaded perl script)

AddHandler cgi-script .pl

For mod_rewrite and make sure AllowOverride is enabled in your web directory

add linux users to www-data group via the command:
usermod -a -G username

Add & ~E_NOTICE to apache2 php.ini report_errors

use Mail::Sendmail; #instead of use Sendmail;

$dbh->do(q{set sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'}); # to avoid ONLY_FULL_GROUP_BY

Thursday, February 11, 2016

Find hacker patterns

find -name "*.php"
grep . -nrlw --exclude=*.{php,jpg} -e 'eval'
grep . -nrlw --exclude=*.{js,htm,html,jpg} -e '_REQUEST'
grep . -nrlw --exclude=*.{js,htm,html,jpg} -e 'uuid'
grep . -nrlw --exclude=*.{js,htm,html,jpg} -e '$log_email'

Wednesday, February 3, 2016

Configure SVN external editor on Windows


Find and edit the file \users\\AppData\Roaming\Subversion\config
Find the line containing editor-cmd = 
Set your editor command

Tuesday, January 5, 2016

Finding the Windows process that is holding a TCP port


netstat -ano | grep {port_number}

You can then read the process id from the report.