Mypapit GNU/Linux blog is now served with CloudFlare!

After long and careful consideration, I decided to enable CloudFlare for my blog.

CloudFlare is a content delivery network which aims to enhance website security and performance. CloudFlare CDN offers protection againts many forms of malicious activity including: spammers, email harvesters, SQL Injection, XSS, denial-of-service attack and suspicious web requests. Therefore saving valueable bandwidth from the web hosting machine.

My Personal Experience with CloudFlare
After a while using CloudFlare, I’ve notice that:

  • My site uses less bandwidth
  • The php-fcgi uses less (valueable RAM)
  • Less comment spam received from blogs
  • Site loads faster, not prone to being bogged down during peak hour

So far, so good, I love using CloudFlare…

How to back up files periodically using rsnapshot and NFS in Ubuntu Linux

rsnapshot is a utility that uses rsync to synchronize files between two directories. rsnapshot makes it easier for system admin to backup crucial system data files regularly with minimal bandwidth and effort.

This guide assumes that you’ve already installed nfs-client and rsnapshot via “apt-get” utility in your Debian/Ubuntu Linux system.

Assumptions:
The backup server is connected in the same LAN as the main computer. The backup server is mounted as NFS on the main computer, ip address of the backup server is 192.168.1.100.

Step 1: Create a script to mount backup server filesystem
This is to ensure that the backup server is available at least hourly (or daily, depending on your requirements), save the file as “mount-backup-server.sh”

File content:

#!/usr/bin/bash
# mount-backup-server.sh
mount 192.168.1.100:/backup-point/  /media/backup/

Step 2: Ensure the mount script is run hourly

sudo cp mount-backup-server.sh /etc/cron.hourly
sudo chmod a+x /etc/cron.hourly/mount-backup-server.sh

Continue reading “How to back up files periodically using rsnapshot and NFS in Ubuntu Linux”

How to limit MySQL port access to specific network

MySQL service port are not meant to be accessible to the outside world as it would become a security concern to the administrator.

Although MySQL server (mysqld) by itself has a built-in mechanism to deny access from unauthorized ip-address, it still does not protect it from being overwhelmed by multiple malicious requests or buffer overflow attack directed to the server.

One of the solution is to limit the MySQL port access to trusted network using iptables

This assume your trusted network has the address within the range of 192.168.1.1-192.168.1.254


iptables -A INPUT -i eth0 -p tcp -s 192.168.1.0/24 --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT

MySQL server (mysqld) uses port 3306.

Note: Always assume the internet as the untrusted network!

Quick and Dirty Network File sharing with Python

Ever find yourself in need to share file over the network quickly, but find yourself lacking time to setup a proper NFS or samba share? Here’s a way to do this with the good old Python CLI.

  • First, go to the directory that you want to share, for example ~/Desktop
  • Then run this command "python -m SimpleHTTPServer"
  • You may access the folder from a remote computer using any webrowser using the url – http://192.168.1.20:8000, change the ip address accordingly
Simple HTTP Server
file sharing with python

You may find this technique offers limited options to share files, but its a real time saver!

B43 broadcom linux driver supported chipset

Supported chipset for b43 Broadcom Linux drivers are :

  • bcm4303 (802.11b-only chips)
  • bcm4306
  • bcm4311 rev 2 / bcm4312 (needs patches for 2.6.24)
  • bcm4309 (only the 2.4GHz part)
  • bcm4318

and unsupported are:

  • BCM 4309 and BCM 4312 is not supported.
  • BCM 4328/4329

Please refer to this post, Ubuntu Hardy Heron : Wifi Broadcom Support with b43 driver for a guide to activate B43 Linux driver in order to use wifi function in your laptop.

Source : Ubuntu: Enabling Broadcom BCM43xx Based Wireless

Enable Network Printer Sharing with Ubuntu Linux computers

Having a shared printer within a computer network is a nice thing to have. Since all computers within the network can access a remote printer to print documents. Maintenance cost is much more cheaper and easier since you only need to service only a single printer within a network.

Here’s how to enable Printer sharing with Ubuntu (or other Linux based computers) through GNOME :

At the computer with the printer

Administer Printers Ubuntu
  • First at the Desktop, go to System->Administration->Printing. A dialog will appear
  • Go to Server Settings, and check the “Share published printers connected to this system” checkbox

    Administer Printers Ubuntu

  • You may, optionally select “Allow users to cancel any job”
  • Click Apply, and close the dialog

At the client computer(s)

Network Printer Sharing Ubuntu, using Samba

  • From the Desktop, go to System->Administration->Printing. A dialog will appear
  • Check “Show shared printers from other systems” checkbox. Click Apply
  • Repeat the first step, this time click “Refresh Printer Queues” button. You shall see the list of shared printer from the server computer
  • Repeat this on other computers on the network to share the printer

That is all to it! Now you can print documents across your computer network.