Surfing the Web using SSH Tunnel

, , No Comments »

Sometimes, you are connected to an internet which is unknown/insecure such as public WiFi hotspots or you are just surfing the internet at work.  In these type of scenarios you might want to secure your connection so no one can sniff at what or where you’re surfing. One way to create a secure connection is to create an SSH tunnel, and have your web browser use it as a SOCKS proxy.

The first requirement is to have a remote host running an SSH server. e.g. a box at home running OpenSSH. Then, you need to have an SSH client installed on your local machine, for Windows you can use PuTTY.

Establish an SSH tunnel using PuTTY:

Create a new PuTTY session

Run PuTTY and create a new session to connect to the remote host. Fill in the hostname, the port (usually 22), make sure SSH is checked.

PuTTY Session

Configure the Secure Tunnel

Click on “Tunnels” on the left panel to set up dynamic fowarding for a local port. Under “Add new forwarded port” type in the port number (e.g. 4080) for the source port, leave the destination blank, and check Auto and Dynamic. Then click the “Add” button. You should see D4080 listed in the “Forwarded Ports” box.

PuTTY Tunnel

Establish an SSH tunnel on Linux:

Use the following command:

$ ssh -D 4080 username@remote_host_server

The tunnel is created when you login to the SSH server.

Configuring Your Web Browser:

To use the SSH tunnel as a SOCKS proxy you need to change the connection settings in the browser.

In the Firefox Connection Settings:

  • Check “Manual Proxy Configuration:”
  • Fill in 127.0.0.1 for the “SOCKS Host:” and 4080 for “Port:”
  • Check “SOCKS v5″

Firefox Proxy Settings

Once everything is done you are now surfing the web securely.

Upgrading Gallery2

, No Comments »

The most reliable way to upgrade Gallery2 is to do a complete replacement.

To ensure a safer upgrade, it’s recommended that you deactivate or even uninstall all the plugins installed, and change the theme back to default theme of Gallery2 to Matrix.

Gallery 2 Plugins

Gallery2 Matrix Theme

Download and extract the latest version of Gallery2.

$ cd /var/www/
$ wget http://downloads.sourceforge.net/gallery/gallery-2.2.5-minimal.tar.gz
$ tar -zxvf gallery-2.2.5-minimal.tar.gz

I like to use symbolic links to help me easily replace older version with newer one.

$ mv gallery2 gallery-2.2.5
$ ln -s gallery-2.2.5 gallery2

Copy the existing g2data directory to the new Gallery2 directory e.g.

$ cp -R ./gallery-2.2.4/g2data_e76ab32e8b ./gallery-2.2.5

Run the install script by pointing your browser to the base url of your website (e.g http://gallery.vincentkong.com), which will bring you through an installation wizard to setup Gallery.

Gallery Installer

When the Storage Setup is reached, Gallery will ask to specific a directory g2data where all the images will be stored. Enter the same directory which was just copied previously.  e.g. /var/www/gallery-2.2.5/g2data_e76ab32e8b

Gallery 2 Database Setup Upgrade

When the Database Setup is reached.  Click on the “Reuse Existing Tables” button.

Gallery Database Setup Upgrade

When the Version Check is reached by the installer it will bring you to the Gallery Upgrader script, where you continue with the Upgrade wizard.

Gallery 2 Version Check

Gallery 2 Upgrade Welcome

In the Upgrading the Gallery Core Module it’s recommended to back the exist database before continuing. e.g.

$ mysqldump -u username -p gallery_database > gallery_database.sql

Gallery 2 Upgrade Core

The Upgrade Plugins is the final step in the upgrade process.

Gallery 2 Upgrade Plugin

Gallery 2 Upgrade Finish

Gallery2 Quickstart Guide

, No Comments »

Gallery is an open source PHP web application that enables management of digital photos and other media.

Installing Gallery2

Download and extract the latest version of Gallery2, I choose the Minimal version

$ wget http://downloads.sourceforge.net/gallery/gallery-2.2.4-minimal.tar.gz
$ tar -zxvf gallery-2.2.4-minimal.tar.gz
$ cp gallery2/* /var/www/gallery

Create a database for gallery to use, for MySQL

mysql> create database databasename
mysql> grant SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON databasename.* TO 'username'@'localhost' identified by 'password'

Run the install script by pointing your browser to the base url of your website (e.g http://gallery.vincentkong.com), which will bring you through an installation wizard to setup Gallery.

Gallery Installer

When the Storage Setup is reached, Gallery will ask to specific a directory g2data where all the images will be stored. It is recommend that this directory is not web accessible, however if that’s not possible then add a randomize string to the end of the directory e.g. g2data_e76ab32e8b. Create the directory and set read/write permission to it.

$ cd /var/www/gallery
$ mkdir g2data_e76ab32e8b
$ chmod 777 g2data_e76ab32e8b

Storage Setup

Continue with the installation until the Create a config file step is reached, which then requires the config.php file to be created with read/write permissions

$ cd /var/www/gallery
$ touch config.php
$ chmod 666 config.php

After the installation has been completed, it’s recommended that write permission be removed from the config.php file.

$ chmod 644 config.php

Securing Gallery

It’s important to have the Gallery secure, here are a few things which can be done:

  • Prevent the viewing of the Gallery code by adding the following to the Apache configuration file or by creating a .htaccess in the Gallery root directory.
    <FilesMatch "\.(inc|class)$">
        Deny from all
    </FilesMatch>
  • If the g2data directory is web accessible it should be block from access with the following:
    <Directory /var/www/gallery/g2data>
        Deny from all
    </Directory>

For more information on securing Gallery refer to the Security Guide.

Troubleshooting

The thumbnails are not displaying for the albums.

  • To generate thumbnails Gallery2 requires the GD Library for PHP.  To install the GD Library in Ubuntu:
    $ apt-get install php5-gd

WordPress Quickstart Guide

, No Comments »

WordPress is an open source blog publishing system written in PHP with a MySQL database.

Installing WordPress

Download and the latest release of WordPress.

$ wget http://wordpress.org/latest.tar.gz

Extracting the file will create a new directory wordpress, move all the files into the a web server’s public HTML directory.

$ tar -zxvf latest.tar.gz
$ mv wordpress/* /var/www/wordpress

Create a MySQL database and user for Wordpress

mysql> CREATE DATABASE databasename;
mysql> GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'localhost' IDENTIFIED BY 'password';

Create a wp-config.php file and modify it to specific your WordPress settings.

$ cp wp-config-sample.php wp-config.php
$ nano wp-config.php

define('DB_NAME', 'putyourdbnamehere');
define('DB_USER', 'usernamehere');
define('DB_PASSWORD', 'yourpasswordhere');
define('DB_HOST', 'localhost');

The database character set, normally should not be changed.
define('DB_CHARSET', 'utf8');

The database collation should normally be left blank.
define('DB_COLLATE', '');

In version 2.5 WordPress introduced a new optional entry called SECRET_KEY, which enables better encryption of information stored in the user’s cookies.

define('SECRET_KEY', 'put your unique phrase here');

It’s recommend to change the value of the SECRET_KEY to a unique phrase. To help generate a unique phrase visit the WordPress secret key generation site. For more information on the SECRET_KEY refer to the Editing wp-config.php page.

Run the install script by pointing your browser to the URL of your website (e.g http://www.vincentkong.com).

WordPress Welcome

After the installation has been successful, it’s recommend that you immediately login and change the randomly generated password.

WordPress Success

Creating a favicon for Your Webpage

, No Comments »

A favicon is a little custom icon that appears next to a website’s URL in the address bar of a web browser. The easily way to create a favicon is to take an image with the same dimension and reduce the size to 16 pixel by 16 pixel, then save it as an Windows Icon Format. Of course if your image is too big or too complex then the results might not be appealing. I recommend that you use a 64 pixel by 64 pixel image for best results.

GIMP is a free software which allows you to do this. If you like to use Photoshop you can download a plugin from Telegraphics.

If you don’t want to go through the hassle of using graphics software to create your favicon there are website available which can do the work for you. One that I find works well is Dynamic Drive FavIcon Generator.

The easily way to install the favicon is to name the file favicon.ico and upload it to the root directory of your website. Another option is to embed your favicon with HTML code similar to the following:

<link rel="shortcut icon" href="http://www.yourwebsite.com/image/favicon.ico" type="image/x-icon"/>

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in