Tuesday, September 15, 2015

How to resolve MojoExecutionException error when build the OpenOlat project?

Try to download the OpenOlat version 10.3 source code as a gzip file from its portal, unzip the source code and build the project in maven. MojoExecutionException error message as shown below is displayed when "mvn clean package" command is executed.

[ERROR] Failed to execute goal org.openolat.mojo:buildnumber-maven-plugin:1.2.0:
hgchangeset (default) on project openolat-lms: Command failed.
[ERROR] EXECUTION FAILED
[ERROR] Execution of cmd : id failed with exit code: 255.
[ERROR] Working directory was:
[ERROR] D:\Projects\OpenOlat\openolat103
[ERROR] Your Hg installation seems to be valid and complete.
[ERROR] Hg version: 3.5+5 (OK)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.openolat.mojo:buildnumber-maven-plugin:1.2.0:hgchangeset (default) on project
 openolat-lms: Command failed.
EXECUTION FAILED
  Execution of cmd : id failed with exit code: 255.
  Working directory was:
    D:\Projects\OpenOlat\openolat103
  Your Hg installation seems to be valid and complete.
    Hg version: 3.5+5 (OK)

Reason

The OpenOlet mojo plugin can't be found, please refer to pom.xml

<plugin> 
     <groupid>org.openolat.mojo</groupid>
     <artifactid>buildnumber-maven-plugin</artifactid>
     <version>1.2.0</version>
     <executions>
          <execution>
               <phase>validate</phase>
	       <goals>
	            <goal>hgchangeset</goal>
	       </goals>
	  </execution>
     </executions>
     <configuration>
          <docheck>true</docheck>
	  <doupdate>true</doupdate>
     </configuration>
</plugin>

The proper way to build OpenOlat should be
  • Install TortoiseHg version 3.5
  • Clone the OpenOlat source code from http://hg.openolat.org/openolat103
  • Rebuild the project with "mvn clean package" command, you should be able to build the war file.



Sunday, September 6, 2015

How to shutdown the Apache web server process running at the background in Mac machine?

Run the command below to shutdown Apache Web Server background process in your mac machine

sudo killall httpd
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist

Monday, August 17, 2015

How to reset your first installed mysql database password?

  • For newly installed mysql database, the default database password is empty
  • In order to reset the password, type in the "mysql" command at terminal window. 
  • Type in the command below to reset the password
mysql > UPDATE mysql.user SET password=password('password') WHERE user='root' AND host='localhost';
  • If the error message as shown below is displayed
ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
  • Add the 2 parameter to my.cnf file
[mysqld]
skip-grant-tables
skip-networking
  • Restart mysql services
  • Type in command "mysql" to login into mysql, rerun the command below, you should be able to reset your root password
mysql > UPDATE mysql.user SET password=password('password') WHERE user='root' AND host='localhost';
mysql > FLUSH PRIVILEGES; 

Tuesday, August 11, 2015

How to delete external app from LaunchPad?

  • For external application that displayed at LaunchPad, long click doesn't called up the cross symbol to allow the user to delete away the app.
  • Below are some alternative way that I have come across from internet that might be useful
  • Launch the "Terminal" window
# cd ~/Library/Application\ Support/Dock
# ls
  • By listing the files in the folder, you will be able to find the database file
  • Run the command below to delete away the application from LaunchPad
# sqlite3 [DATABASENAME].db "DELETE from apps WHERE title='[APPNAME]';"

[DATABASENAME] represent the database name that we discovered at previous steps
[APPNAME] represent the name of the app
  • Run the command below to restart the launchpad. Voila, the external application is removed from LaunchPad.
# killall Dock

Monday, August 10, 2015

How to setup "Basic" authentication to phpPgAdmin at Apache web server?


  • Run the command below to add user to ".htpasswd" file


# htpasswd [DIRECTORY]/.htpasswd [USERNAME]

[DIRECTORY] represent the folder that store the password
[USERNAME] represent the user login id

Note: Password/Retype password will be prompted after the command above has been executed


  • Open configuration file httpd.conf , add the configuration as described below

<Directory "/var/www/phpPgAdmin">
    AuthName "Secure Area"
    AuthType Basic
    AuthUserFile [DIRECTORY]/.htpasswd
    require valid-user
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


Restart Apache server, voila, your phpPgAdmin is protected now.


Wednesday, July 15, 2015

Technic to monitor Apache server performance

iftop tool installation

Enter the command below

# wget http://pkgs.repoforge.org/iftop/iftop-0.17-1.el6.rf.x86_64.rpm
# rpm -ivh iftop-0.17-1.el6.rf.x86_64.rpm

Run the "iftop" command to launch the tool to monitor the network card

Check the number of CPU

Enter the command below

# nproc

nmon tool installation

Enter the command below

# wget http://nmon.sourceforge.net/docs/MPG_nmon_for_Linux_14a_binaries.zip
# unzip MPG_nmon_for_Linux_14a_binaries.zip
# ./nmon_x86_64_centos5

Scripts to check Apache connection

Came across the script below from internet and found out it is helpful to monitor the number of concurrent connection to Apache server. Just show it for sharing purpose

#!/bin/bash

[ $# -eq 0 ] && { echo "Usage: $0 " ; exit 1; }

while true
do
        clear;
        echo "Number of Apache Active Connections:";
        netstat -an | grep 443 | grep tcp | grep -v 0.0.0.0 | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort | wc -l;
        echo;
        #echo "Current Active IP's:";
        netstat -an | grep 443 | grep tcp | grep -v 0.0.0.0 | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort;
        sleep $1;
done

Simple Shell scripts to load test the Apache server

The scripts download sample.pdf from Apache to time the download time and produce CSV report.

#!/bin/bash

for ((i=1; i <= 200 ; i++))
do
    curl -s -w "iPad($i)",%{time_connect},%{time_starttransfer},%{time_total}\\n  -o "sample$i.pdf" https://[SERVER_NAME]/sample.pdf >> report.csv &
done

Wednesday, April 29, 2015

How to detecting PHP-CGI vulnerabilities (CVE-2012-1823)?

System Environment

ZenMap: 6.47
PHP version: 5.3.3
Redhat 2.6
[IP ADDRESS]: The server IP address

Verify the PHP-CGI vulnerabilities

1. In order to find and detect any PHP-CGI vulnerabilities, download ZenMap scanner from https://nmap.org/download.html.

2. Type in the command as described below in the ZenMap scanner.

nmap -p 80 --script http-vuln-cve2012-1823 [IP ADDRESS]

3. Or type in the command as described below in the ZenMap scanner.

nmap -p 80 --script http-vuln-cve2012-1823 --script-args uri=/login.php IP [IP ADDRESS]

4. Click on "Scan" button, the scanning process will start. If no vulnerabilities found, no error message will be displayed.



5. If vulnerabilities is found, "Vulnerabilities" warning message will be displayed

Investigation

For Redhat version 2.6, “CVE-2012-1823 - Apache / PHP5.x Remote Code Execution Exploit” vulnerability has been patched in Redhat security patch “RHSA-2012:0546-1”

In order to confirm that the Linux server has been patched properly, run the command below to check

yum list installed > /tmp/yum-list.txt