Tuesday, June 9, 2009

Install Subversion under RedHat Enterprise Linux4

This morning I tried to install Subversion 1.5.1 on Red Hat Enterprise Linux 4. This turned out to be a slightly more complicated than just easy. Because I ran into some dependency issues.

I downloaded Subversion 1.5.1 at: http://summersoft.fay.ar.us/pub/subversion/1.5.1/rhel-4/i386/.

Running rpm gave me the following depencency issues:

rpm -ihv subversion-1.5.1-1.i386.rpm
error: Failed dependencies:
apr >= 0.9.7 is needed by subversion-1.5.1-1.i386
apr-util >= 0.9.7 is needed by subversion-1.5.1-1.i386
libneon.so.27 is needed by subversion-1.5.1-1.i386
neon >= 0.26.1 is needed by subversion-1.5.1-1.i386

To solve this download the following libraries:
Summerset is one of the suppliers of the subversion binaries. I found that they did quite a good job on providing the necessary libraries for the different Linux flavors. At least the ones I needed. However, although subversion 1.5.1 needed the arp libraries, they were not found in the subversion/1.5.1/rhel-4 folder. So I fetched them from the subversion/1.4.6/rhel-4 folder.

Since subversion needed a specific neon-shared-object, I could not do it in one go, because at dependency check the system-object was not there. Therefor I first installed neon and neon-devel:

rpm -ihv neon-0.27.2-1.i386.rpm neon-devel-0.27.2-1.i386.rpm
Preparing... ########################################### [100%]
1:neon-devel ########################################### [ 50%]
2:neon ########################################### [100%]

Then the rest could be installed in one go:
rpm -Uhv subversion-1.5.1-1.i386.rpm apr-0.9.12-2.i386.rpm apr-util-0.9.12-1.i386.rpm
Preparing... ########################################### [100%]
1:apr ########################################### [ 33%]
2:apr-util ########################################### [ 67%]
3:subversion ########################################### [100%]

Getting Subversion

Getting Subversion

The best available version of Subversion is: 1.6.2

You can install Subversion by compiling its source code release directly, or you can install one of the prepackaged binaries if there is one for your operating system. Unless a release has "alpha", "beta", or "rc" in its name, it is tested and considered stable for production use. Once you have Subversion installed, most of your questions can be answered at our help section.

When upgrading, just install "on top of" the older release. Subversion 1.x is forward-compatible with any newer 1.y. No repository upgrade is required. As long as client and server both have the same major release number (1), olders clients will work with newer servers and newer clients will work with older servers. The only caveat is that if the client and server minor release numbers don't match (e.g., 1.0 and 1.1), then some of the features of the newer release may not be activated.

Source Code

To build Subversion from a source code release:

  1. Download the latest distribution from the Source Releases Area.
    Windows users should download .zip files. For all other operating systems, download .tar.gz or .tar.bz2 files.

  2. Build and install it according to the instructions in the INSTALL file in the top level of the distribution. You will end up with a 'svn' binary in the subversion/svn/ subdirectory (or installed in /usr/local/bin/, if you ran 'make install'.)

Binary Packages

The Subversion project does not officially endorse or maintain any binary packages of the Subversion software. However, volunteers have created binary packages for different distributions and platforms, and as a convenience, we maintain a list of links to them here. If there are any problems with or questions about the different binary packages please send email to the Subversion users mailing list.

NOTE: Binary packages usually come out about a week after the corresponding source release. Please don't post to the mailing lists asking when a binary package for a given platform will be ready. The packagers already know when new source releases come out, and work as fast as they can to make binaries available.

Subversion Binary Packages
AIX
logo
Debian
logo
Debian Project
apt-get install subversion
HP-UX
logo
Fedora
logo
Fedora Project
yum install subversion
Mac OS X
logo
Fink package (Requires Fink)
MacPorts (Requires MacPorts)
openCollabNet (Universal) Apple's Developer Tools
FreeBSD
logo
FreeBSD Project
cd /usr/ports/devel/subversion;
make install
Red Hat
logo
CollabNet (Certified binaries)
SummerSoft (Red Hat 8,9 +)
NetBSD
logo
pkgsrc
cd /usr/pkgsrc/devel/subversion;
make install clean
Solaris
logo
CollabNet (Certified binaries, SPARC & x86)
Sunfreeware (SPARC & i386)
OpenBSD
logo
OpenBSD Project
pkg_add subversion
Windows
logo
CollabNet (Certified binaries)
Tigris.org: Apache 2.0 or Apache 2.2
SlikSVN: 32 and 64 bit client MSI
VisualSVN (VisualSVN Server)
Ubuntu
logo
Ubuntu Packages
apt-get install subversion

Note: Apache 2.0 and Apache 2.2 are not binary-compatible. If you plan to use mod_dav_svn be sure that you obtain the correct version for your version of Apache.

Package Maintainers

Saturday, March 21, 2009

Developing a DHCPv6 server & Client on Linux

Speaker Name Swaroop Krishnamurthy, Nikhil U Moorthy, Mehnaz Farooqui
Company Aditi Technologies, IT Solutions & Infosys
Talk Title Developing a DHCPv6 server & Client on Linux
Track Development
Scope Technical
Synopsis Abstract

Dynamic Host Configuration Protocol (DHCP) has evolved from BOOTP and RARP on networks that had diskless nodes that used a server to boot from. This was the era of centralised computing. With the proliferation of distributed computing (DC), a protocol like DHCP was needed. DHCP addresses the resource boot strap needs of such a DC environment, which sought centralised resource management.

Recently, the Internet Protocol (IP) has made sufficient changes to the basic protocol and a new version, IPv6 is standardised and available. There is a need to extend the functionality of DHCP to IPv6 based networks too. However, there is a basic difference in the way IPv6 infrastructure work compared to IPv4 infrastructure – significantly no ARP !

The presentation is targeted at systems administrators and developers. The talk is divided into two parts. The first part starts with a brief focus on the evolution of DHCP from older protocols, covers its basic functionality, mentions the difference between IPv4 and IPv6 mechanisms and ends with a brief exposure to the current DHCPv6 Internet draft. The second part of the talk starts with the design decisions that went into coding the DHCPv6 server and client on Linux, the experiences in coding, the choices made (threads or no threads), usage of timers and ends with a demonstration (if permitted onstage) of the alpha version of this code.
Speaker Profile This talk is intended to be covered by three speakers. All three speakers are involved in an effort to develop an open source implementation of the DHCPv6 protocol in Linux. The following is a brief profile of each of the speakers

Nikhil U Moorthy is a B.E in Computer Science from the Visweshwaraiah Institute of Technology. He is a software engineer working at IT Solutions, Bangalore. His basic interest is in the broad area of Computer Networking and IPv6.He plans to register for a PhD programme, shortly.

Mehnaz Farooqui is a B.E in Computer Science from the Visweshwaraiah Institute of Technology.currently employed at Infosys Technologies, Bangalore as a software engineer. Her areas of interest are Computer Networking, studying IPv6 deployment problems and Database applications on main frames.

Swaroop Krishnamurthy is a B.E in Computer Science from the Visweshwaraiah Institute of Technology, currently employed at Aditi Technologies. His interests are in software systems design, Internet software and Networking Technologies.

Download Slideshow
No of Downloads - 4245
OpenOffice Format

(Click here to learn more about OpenOffice, the free office suite for Linux, Windows, etc.)


PowerPoint Format

Monday, February 16, 2009

What is CAPTCHA? How can I use it?

What is CAPTCHA? How can I use it?

What is Captcha?
In a CAPTCHA test (an acronym for "Completely Automated Public Turing test to tell Computers and Humans Apart," also sometimes spelled in lowercase), an image of letters is dynamically generated. The letters, because they're part of an image and not text (e.g. text that you could cut and paste), are difficult for a spambot or other computer program to read. Yet, a person has little trouble reading the letters in a captcha image.

Using a captcha test on a website is a great way to ensure, for instance, that a person and not a spambot is filling out a web form. Also, a captcha can make it difficult for a person to continuously resubmit form information and overwhelm the form's purpose.

For users who have a solid grounding in PHP and how HTML forms work, this example will show how to implement a captcha test:

  1. Enable the GD extention in your site's PHP settings by logging into OnSite. Once you are logged in go to the PHP Configurator which is under the Other Tools heading. Within the PHP Configurator click on the Extensions link on the left hand side of the page. You will now see a heading for Graphics, make sure the checkbox for the GD extention is checked. Now click on the Save Changes button near the top of the page.


  2. Download (in Firefox, right-click and choose "Save link as..." or in Internet Explorer, right-click and choose "Save target as...") this captcha-gen.php PHP script and place it in the same directory as your form.


  3. Add the following image and text input to your form:


    Captcha Text:


  4. Inside the action script of your form, make sure to call session_start(); and add the following check before you process the form information.

    if( isset($_REQUEST['phrase']) &&
    isset($_SESSION['phrase']) &&
    strlen($_REQUEST['phrase']) > 0 &&
    strlen($_SESSION['phrase']) > 0 )
    {

    if( $_REQUEST['phrase'] == $_SESSION['phrase'] )
    {

    //This is where you will process the form input.

    //This will prevent the form from being
    //resubmitted multiple times.
    unset($_SESSION['phrase']);
    }
    else
    {

    //This is where you want to process
    // a bad guess at the Captcha phrase.

    print( "I'm sorry the Captcha phrase was incorrect!" );
    }

    }
    else
    {

    //This is where you want to process
    // a direct request or a re-submision
    // after the phrase was removed from
    // the session.

    print( "You must pass the Captcha test to use this form!" );

    }

    ?>


Make sure that all three of the above files are in the same directory and it should work.

The above method uses a PEAR module to create the captcha image. You can either look at the source code of captcha-gen.php or look at the Test_CAPTCHA site http://pear.php.net/package/Text_CAPTCHA/docs to learn more. The site also has another example of how to implement a captcha test.

You can read more about the CAPTCHA project here: Captcha.net

Solutions to errors occured while uploading file in php

http://www.modwest.com/help/kb5-219.html

if your PHP handler is CGI, you must use php.ini.
It depends on your server’s configuration.

here is I quoted it;

“If you have php error logging with reporting set to E_ALL then you will see the PHP Error reported:

PHP Warning: POST Content-Length of 9470478 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

The problem is unset or incorrect settings in your /etc/php.ini file.

To allow file uploads larger than the default 8 megabytes, put these settings in your /etc/php.ini:

post_max_size = 16M
upload_max_filesize = 16M

You can check phpinfo() output to make sure that those values get set correctly.

Also make sure that your script does not have an html form input tag for MAX_FILE_SIZE that is smaller (in bytes) than the size of the files that you are trying to upload.

Now you will be able to upload files up to 16 megabytes.

NOTE: although PHP.net lists post_max_size as being a PHP_INI_PERDIR, because of the way we run PHP in CGI, this cannot be changed in your .htaccess file. However, there is a workaround:

Copy your current php.ini file into the directory that you require the custom post_max_size in.

**THE NEXT STEP IS VERY IMPORTANT**
Obviously, we don’t want the outside world to have access to your settings in your php.ini file. The solution? Drop an .htaccess file in the same directory with the following lines in it:

Deny From All

This will deny any web requests to any file in that directory ending in .ini; thus preventing your PHP settings from being seen by others.

Now you have a secure php.ini file that you can modify settings in to affect the .php files within that directory.”

Uploading large(big) files in PHP using .htaccess

Most of the web servers are configured such a way that a user can only upload the maximum file size of 2MB. So there might be the problem for the people who wants to upload the .pdf file of size around 15MB. But, you can increse the maximum upload file size limit by using .htaccess file.

Here is a small tips for you which you can use to upload such a large file using file field of the form and move_uploaded_file() function in PHP.

1) Create a .htaccess file in the root folder of web server.

2) Put the following code in side the .htaccess file and save it.

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200

Now you can upload the file-size up-to 20MB in a simple way using file field in your html form and move_uploaded_file() function available in PHP. In the above .htaccess file, uploading capability is increased by the four parameter first one is maximum file size for uploading, second one is maximum size of the post data , third one is maximum time in seconds a script is allowed to run before it is terminated by the parser and last one is maximum time in seconds a script is allowed to parse input data such as like file uploads, POST and GET data.

You can change the above parameter to upload the bigger file size than 20MB.

Monday, February 9, 2009

How To: Manual Network Configuration without the need for Network Manager

How To: Manual Network Configuration without the need for Network Manager

In setting up their wireless connection for the first time, Im discovering many individuals having problems connecting through Network Manager or other GUI wireless connection tools. In fact my Network Manager is intermittently buggy, connecting sometimes and not others. This guide benefits all users in case the GUI tools are not working, and is useful for testing a wireless connection during initial installation of wireless drivers since it provides for good debugging output.

Clarification to those about to read this Guide
1. This method provides the most low level method to establish your network connection. It is the least common denominator. It does not use any reference to the /etc/network/interfaces file, as this file requires a method that is more high level.
2. If you are interested in making modifications to your /etc/network/interfaces guide to establish your connection, possibly Weiman01's guide covering this topic would be more applicable to your situation: http://ubuntuforums.org/showthread.php?t=318539. This method however uses processes that are more high level. If editing or use of the /etc/network/interfaces file fails, I would recommend reading the guide provided below, as it is "lower level".

Unencrypted/ WEP / WPA (PSK and EAP-TLS) connections will be covered in this guide.
This guide is for anyone attempting to establish a network connection manually at the command line.

Pre-requisites
1. Properly installed network driver -- This guide can be used to troubleshoot driver installation to see if it is properly functioning
2. The ESSID of your router must be broadcasted and not hidden
3. Knowlege of your wireless cards driver (please see Prerequisite #4 to determine driver). Those using the r8187/r818x driver please see the end of the guide
4. Knowledge of your wireless card's Interface Name - The user must know the proper interface of the wireless connection (wlan0, eth1, rausb1, etc). To discover this information, at command line type:

Code:
lshw -C network
There may be multiple interfaces listed, however look under the section appropriate to your wireless device for the line labeled logical name. Here is an example:

Code:
  *-network              
description: Wireless interface
product: BCM4306 802.11b/g Wireless LAN Controller
vendor: Broadcom Corporation
physical id: 0
bus info: pci@06:00.0
logical name: wlan0
version: 03
serial: 00:12:17:35:17:10
width: 32 bits
clock: 33MHz
capabilities: bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=ndiswrapper+lsbcmnds driverversion=1.48rc1+Cisco-Linksys ,LLC.,02/1 ip=192.168.1.101 latency=64 multicast=yes wireless=IEEE 802.11g
resources: iomemory:3c000000-3c001fff irq:11
In the example above the interface name is wlan0. I will refer to the interface name throughout the rest of this guide as .

Attention All Users: Please Read
****All users of Atheros or Intel Chipsets (ipw****) -- Although lshw may list your interface as wmaster0 or wifi0 -- PLEASE NOTE this refers to the actual assigned interface name to the device, HOWEVER you interact through an assigned VIRTUAL INTERFACE!!!. Your will NEVER USE wmaster0 or wifi0 as the device name. If you type iwconfig, this may give you information on the assigned virtual interface used to access the physical device. -- BOTTOM LINE -- You will never use wmaster0 or wifi0 as the interface name, rather some other interface such as wlan0 of eth1. Please check ifconfig or iwconfig for cross referencing!!


***Please note -- as there exist exceptions to every rule, an exception applies to Atheros chipset employing the madwifi kernel module. Atheros cards are typically identified as wifi0. This is the physical logical name of the device. When working with madwif modules however, one or more virtual interfaces are made for every actual device. All configurations must be completed using the virutal interface device rather than the actual interface to the device. In most cases, Atheros chipsets will need to use the ath0 interface rather than the wifi0 interface.

For people first setting up their connection, please note that the above also lists the driver used for the network card. In the example above, the driver used is ndiswrapper. If your network device comes back UNCLAIMED or there is no driver listed, then you have not correctly installed the driver for your device. You must review the procedures for installation of your wireless driver.

For those wanting to use static IP addresses, please see section at bottom of guide regarding configuration for static IP addresses

__________________________________________________ __________________________
Unencrypted Connection

All commands typed at the command line:
Code:
sudo ifconfig  down
sudo dhclient -r
sudo ifconfig up
sudo iwconfig essid "ESSID_IN_QUOTES"
sudo iwconfig mode Managed
sudo dhclient
__________________________________________________ __________________________
WEP Connection

You must have either your 64bit or 128 bit HEX Key or the ASCII Equivalent of your HEX Key.

Code:
sudo ifconfig  down
sudo dhclient -r
sudo ifconfig up
sudo iwconfig essid "ESSID_IN_QUOTES"
sudo iwconfig key HEX_KEY <<<-------- If using ASCII Equivalent, this is s:ASCII_KEY (please make note of the prefix s:)
****Additional Comand that may be needed -- sudo iwconfig key open <<<----See note below
sudo iwconfig mode Managed
sudo dhclient
***The security mode may be open or restricted, and its meaning depends on the card used. With most cards, in open mode no authentication is used and the card may also accept non-encrypted sessions, whereas in restricted mode only encrypted sessions are accepted and the card will use authentication if available.
__________________________________________________ __________________________
WPA Connection - WPA-PSK or WPA2-PSK (PSK=Pre-Shared Key) or WPA-EAP-TLS

For uses of Ra-based chipsets: rt61, rt73, rt2500 please skip directly to the WPA Section entitled WPA with Ra based chipsets

Requirements: In most cases the wpa_supplicant package is required in order to connect via WPA. If you have a working ethernet or unencrypted/WEP wireless connection, this package may be installed via:
Code:
sudo aptitude install wpasupplicant
If only wireless is available, I would recommend that an unencrypted connection first by established and tested first before directly proceeding to make a WPA connection. WPA adds another layer of complexity.

WPA-PSK - Covers WPA(1) and WPA(2)

1. Creation of /etc/wpa_supplicant.conf file

At command line:
Code:
gksu gedit /etc/wpa_supplicant.conf
Inside the file add the following for WPA(1):

Code:
ap_scan=1
ctrl_interface=/var/run/wpa_supplicant

network={
ssid="ESSID_IN_QUOTES"
scan_ssid=0
proto=WPA
key_mgmt=WPA-PSK
psk="ASCII PSK Password in Quotes"
pairwise=TKIP
group=TKIP
}
For WPA(2) (see this thread: http://ubuntuforums.org/showthread.php?t=607410):
Code:
ctrl_interface=/var/run/wpa_supplicant

network={
ssid="ESSID_IN_QUOTES"
psk="ASCII PSK Password in Quotes"
key_mgmt=WPA-PSK
proto=RSN WPA
pairwise=CCMP TKIP
group=CCMP TKIP
}
***Word of caution -- In some cases I have found WPA(2) to have different settings than the above. Some Broadcom cards use the pairwise/group TKIP cipher for WPA2 rather than CCMP. I would suggest all initially use WPA(1) and then later convert to WPA2 since some variations to the above may be needed

**WPA2 capabilities must also be built-into the driver set used with your hardware. If using ndiswrapper with an old windows driver, the driver may not contain code for wpa2.

2. Connect via command line
Code:
sudo ifconfig  down
sudo dhclient -r
sudo wpa_supplicant -D<****see footer below***> -i -c/etc/wpa_supplicant.conf -dd

***Note that starting with the -dd flag will create a lot of debuggin output.
If you choose to use the -dd flag to troubleshoot your connection, you must
open up a separate terminal and type the rest of the commands listed below in a
separate terminal window. You can also replace the -dd flag with the -B flag to
send the process to the background, avoiding the need to open up a separate
terminal window (however no debugging output will be generated)

sudo dhclient
***footer
The value listed here is dependent on the driver you have installed. Typing man wpa_supplicant at command line will give you the full gamut of choices however most recent versions of wpa_supplicant only recognize wext as the appropriate value (Despite all the information on the internet). If you would like to verify what drivers besides wext your installed version of wpa_supplicant recognizes, type at the command line:
wpa_supplicant -l
And look specifically at the section called drivers:

Here is what my stock wpa_supplicant lists for its drivers:

drivers:
wext = Linux wireless extensions (generic)
atmel = ATMEL AT76C5XXx (USB, PCMCIA)
wired = wpa_supplicant wired Ethernet driver

Other drivers can be compiled into wpa_supplicant if you compile wpa_supplicant, however please not that in recent kernel versions this is unnecessary. wext will work for ndiswrapper, madwifi, intel, etc.

WPA-PSK with Ra Based Chipsets

Ra cards do not require the wpa_supplicant package to use WPA. Here is how to connect from the command line with these cards:
References: http://ubuntuforums.org/showthread.p...=serial+monkey, http://rt2x00.serialmonkey.com/wiki/...owto#Using_WPA

WPA-PSK(1)
Code:
sudo ifconfig  down
sudo dhclient -r
sudo ifconfig up
sudo iwconfig essid "ESSID_IN_QUOTES"
sudo iwpriv set AuthMode=WPAPSK
sudo iwpriv set EncrypType=TKIP
sudo iwpriv set WPAPSK="YOUR_WPA_PSK_KEY"
sudo dhclient
For WPA-PSK(2), I have no working configuration yet. If someone would like to help me refine these instructions for WPA2 with Ra-based chipsets, I would appreciate your help!

WPA EAP-TLS
Information Provided Referenced from http://www.codealias.info/technotes/...x_client_setup
Thanks to CodeAlias for Providing Information

1. Prepare TLS Certificates

EAP-TLS requires client TLS certificates to be installed in the system. You need to ask the administrators in your institution to provide you your own TLS certificate.

In the most common cases, your admin will issue you a .p12 file and a password.

We need to create three files from this .p12 certificate

These files are cacert.pem, cert.pem and key.pem (The names may vary). Assuming that your certificate file name is example.p12, run the following :
Code:
 openssl pkcs12  -in example.p12  -out cacert.pem -cacerts -nokeys
openssl pkcs12 -in example.p12 -out cert.pem -clcerts -nokeys
openssl pkcs12 -in example.p12 -out key.pem -nocerts
Put the three generated files somewhere in the file system of your wireless device (e.g /etc/certs)

2. Configuration of the wpa_supplicant.conf file

Edit the wpa_supplicant configuration file (e.g. /etc/wpa_supplicant.conf), ant put the following:

Code:
  network={
ssid="ESSID_IN_QUOTES"
scan_ssid=1
key_mgmt=WPA-EAP
pairwise=CCMP TKIP
group=CCMP TKIP
eap=TLS
identity="XXXXX@yourdomain.com"
ca_cert="/etc/certs/cacert.pem"
client_cert="/etc/certs/cert.pem"
private_key="/etc/certs/key.pem"
private_key_passwd="YOUR-PASSWORD"
}
---“YOUR-PASSWORD” is the password provided by your administrator when your received your .p12 certificate

3. Connect via the command line
Code:
sudo ifconfig  down
sudo dhclient -r
sudo wpa_supplicant -D<****see footer below***> -i -c/etc/wpa_supplicant.conf -dd

***Note that starting with the -dd flag will create a lot of debuggin output.
If you choose to use the -dd flag to troubleshoot your connection, you must
open up a separate terminal and type the rest of the commands listed below in a
separate terminal window. You can also replace the -dd flag with the -B flag to
send the process to the background, avoiding the need to open up a separate
terminal window (however no debugging output will be generated)

sudo dhclient
***footer
The value listed here is dependent on the driver you have installed. Typing man wpa_supplicant at command line will give you the full gamut of choices however most recent versions of wpa_supplicant only recognize wext as the appropriate value (Despite all the information on the internet). If you would like to verify what drivers besides wext your installed version of wpa_supplicant recognizes, type at the command line:
wpa_supplicant -l
And look specifically at the section called drivers:

Here is what my stock wpa_supplicant lists for its drivers:

drivers:
wext = Linux wireless extensions (generic)
atmel = ATMEL AT76C5XXx (USB, PCMCIA)
wired = wpa_supplicant wired Ethernet driver

Other drivers can be compiled into wpa_supplicant if you compile wpa_supplicant, however please not that in recent kernel versions this is unnecessary. wext will work for ndiswrapper, madwifi, intel, etc.
__________________________________________________ __________________________
A successful connection in all cases will similarly result in: (Example Provided Below):
Code:
user@computer:~$ sudo dhclient wlan0
There is already a pid file /var/run/dhclient.pid with pid 134993416
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/wlan0/00:12:17:35:17:10
Sending on LPF/wlan0/00:12:17:35:17:10
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPOFFER from 192.168.1.1
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.101 -- renewal in 299133 seconds.
The computer in this example has received an IP address of 192.168.1.101

__________________________________________________ __________________________
Users of RTL 8180, RTL8185, RTL 8187 using the built in native r8187 / r818x drivers

By default the r8187 and r818x drivers are blacklisted due to a know bug. These drivers are usuable however with a twist to the above methods

If you want to try using these drivers, please load the kernel modules:
Code:
sudo modprobe r818x
sudo modprobe r8187
These drivers require a bogus or extra letter be suffixed to the essid name in order for these drivers to work
For example if your are trying to connect to a router with essid=Router, at he command line you would type essid=Routerx. Notice the extra x or bogus character. I have provided an example using the unencrypted connection procedure below, however this extra character needs to be used if attempting to connect to all network types (unencrypted/ WEP / WPA)

Code:
sudo ifconfig  down
sudo dhclient -r
sudo ifconfig up
sudo iwconfig essid "Routerx"
sudo iwconfig mode Managed
sudo dhclient
If these drivers work for you, and you would like these drivers to load automatically at startup for you, avoiding to have to type sudo modprobe everytime, please edit your blacklist file:

Code:
gksu gedit /etc/modprobe.d/blacklist
And comment out (or prefix the following lines with a # sign). You want the following lines to appear as below:
Code:
#blacklist r8187
#blacklist r818x

__________________________________________________ __________________________
Static IP Addresses

Im going to give an example of how to configure your interface using a static IP address using an unencrypted wireless connection. The two lines highlighted below however can be used with WEP and WPA connections. Values in italics must be customized to meet your particular situation

Code:
sudo ifconfig  down
sudo dhclient -r
sudo ifconfig 192.168.1.100 netmask 255.255.255.0 up
sudo route add default gw 192.168.1.1

sudo iwconfig essid "ESSID_IN_QUOTES"
sudo iwconfig mode Managed
If when using static IP addresses you are getting a problem with name resolution, you will have to specifiy specific dns (domain name servers) in order to translate URLs to IP addresses. Unfortunately there is not an easy way to configure this from the command line. This requires that you edit the /etc/resolv.conf file and manually enter the domain name server(s) you want to use. In many cases users can specifiy their router, their internet service providers dns servers, or use opendns (or use all three). Up to three nameservers can be specified.

Code:
sudo gedit /etc/resolv.conf
and add the nameservers you want to use, one to a line, in the following format.
Code:
nameserver 
***Spaceboy909 has also reported that when using this technique with static IP addresses, network manager has to be uninstalled because it keeps trying to reset the connection. In order to uninstall networkmanager:

In Ubuntu:
Code:
sudo aptitude uninstall network-manager-gnome
In Kbuntu:
Code:
sudo aptitude uninstall knetworkmanager
__________________________________________________ _________________________
Setting the Wireless Interface to Connect at Boot ***Courtesy of Maricaibo

If you are successful in bringing up the Interface Manually, the commands may be placed inside the /etc/rc.local file to run the commands at boot, and establish a wireless connection. There is no GUI to give visual confirmation of the connection. The user should type ifconfig at the command line to verify an IP address has indeed been granted by the router.

The process of adding the commands to the /etc/rc.local file is documented below (this connects to an unencrypted network -- to connect to a WEP or WPA encrypted network, some modifications as used above will need to be added):

Code:
gksu gedit /etc/rc.local
This opens up the file in the gedit utility and allows you to make changes and save the file

Code:
ifconfig <wired network connection interface> down
ifconfig <wireless network connection interface> down
dhclient -r
iwconfig essid
iwconfig mode Managed
ifconfig up
dhclient
Be sure this text goes into the /etc/rc.local file BEFORE the line reading "exit 0".

Save and close the /etc/rc.local file.

Open up a Terminal window (the shell) and type in:

Code:
sudo chmod +x /etc/rc.local
This command turns the rc.local file into an executable that will run at startup. Here's an example of what the /etc/rc.local file should contain. Your device names may be different:

Code:
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

ifconfig eth0 down
ifconfig wlan0 down
dhclient -r wlan0
iwconfig wlan0 essid "ESSID_IN_QUOTES"
iwconfig wlan0 mode Managed
ifconfig wlan0 up
dhclient wlan0

exit 0
NOTE: The first line in the rc.local file downs your wired connection, so if for some reason you need the wired connection back just open up a Terminal window (shell) and type:

sudo up
sudo dhclient
__________________________________________________ __________________________
Useful Commands

ifconfig - lists IP address (similar to ipconfig in Windows)
iwlist scan - shows wireless networks that are available in the area along with basic encryption information
lshw -C network - Shows interface and driver associated with each networking device
lspci -nn - Shows hardware connected to the pci bus
lsusb - Shows USB connected hardware
lshw -C usb - Additional info on USB related hardware (good for USB dongles)
cat /etc/modprobe.d/blacklist - List modules that will not be loaded by the Operating System at boot time
lsmod - lists currently loaded kernel modules. (Example usage - lsmod | grep ndiswrapper)
route -n - Lists kernel IP routing table -- Good for troubleshooting problems with the gateway (netstat -rn = equivalent command)
sudo route add default gw 192.168.1.1 - Example of how to set the default gateway to 192.168.1.1
sudo route del default gw 192.168.1.1 - Example of how to delete the default gateway setting
sudo modprobe ***** - Loads the kernel module **** . (Example usage - sudo modprobe ndiswrapper, sudo modprobe r818x, sudo modprobe ath_pci)
sudo modprobe -r **** - Unloades the kernel module ****. (Example usage - sudo modprobe -r ndiswrapper)
sudo ifup/ifdown - Brings up/down the interface and clears the routing table for the specified interface
sudo ifconfig up/down - Brings up/down the interface for the specified interface
sudo dhclient - Request IP address from DNS server for specified interface
sudo dhclient -r - Release IP address associated with specified interface
sudo iptables -L - Lists firewall rules
dmesg | more - Lists boot log -- good for troubleshooting problems with modules/drivers not being loaded
uname -r - Displays kernel version
/etc/iftab (Feisty and pre-releases (Edgy, etc)) - /etc/udev/rules.d/70-persistent-net.rules (Gutsy) - File which assigns logical names (eth0, wlan0, etc) to MAC addresses
cat /etc/resolv.conf - Lists DNS servers associated with network connections (Network Manager)
/etc/dhcp3/dhclient.conf - File which sets or modifies dns (domain name servers) settings

__________________________________________________ __________________________
References for Specific Wireless Chipsets - Please see Link if Your Specific Chipset is Not Working with Above Tutorial's Instructions

Official Broadcom site for bcm43xx firmware - http://linuxwireless.org/en/users/Drivers/b43
Broadcom 64bit Drivers for Use with Ndiswrapper - http://www.linuxant.com/driverloader/drivers.php
Broadcom Guid for Ubuntu Hardy/Intrepid and Ibex -- A very informative sight! - http://linuxfans.betaserver.org/inde...ides&Itemid=61 - Author Ayuthia

Ra chipsets - Serial Monkey Drivers - rt2500, rt73, rt61, rt2570 drivers - http://ubuntuforums.org/showthread.p...=serial+monkey - Author diepruis
rt2500 chipsets with the Serial Monkey rt2500 CVS driver - http://ubuntuforums.org/showthread.p...ghlight=rt2500 - Author zoiks
Ralink RT2860 (m)PCI(e) (RT2760/RT2790/RT2860/RT2890) - http://ubuntuforums.org/showthread.php?t=1045703 - Author Fass
Rutilt - A Network Manager Like GUI for Ra Chipsets - http://ubuntuforums.org/showthread.p...ghlight=rutilt - Author sulilogs
Ndiswrapper Official Compatibility Reference - http://linuxfans.betaserver.org/ndis_drivers/toc.html - Author Ayuthia (Borrowed from the Ex-Official Ndiswrapper Site)
Ndiswrapper installation for Broadcom chipsets - http://ubuntuforums.org/showthread.php?t=475963 - Author Jamie Jackson
Ndiswrapper General Installation Guide - SVN, Troubleshooting Tips (My Personal Guide) - http://ubuntuforums.org/showthread.php?t=574501 - Author KevDog
Madwifi website for certain Atheros Chipsets - http://madwifi.org/ -- If your Atheros chipset is listed on this website - it should work out of the box with installation of the linux restricted drivers package for your kernel version
Atheros 5006eg Chipset work-around - Card apparently listed as 5007eg - http://ubuntuforums.org/showpost.php...5&postcount=14 - Author ugm6hr
Does your madwifi connection keep dropping??? Possible solution -- http://ubuntuforums.org/showthread.php?t=540101 = Author robnz/tranalbert
Realtek win98 driver - http://www.majorgeeks.com/Realtek_RT...0XP_d5165.html - For use with ndiswrapper if native r818x, r8187 driver is buggy
Realtek win98 driver installation - http://ubuntuforums.org/showthread.p...highlight=8187 - Author Panurge
Realtek - Installation with Native Driver - http://ubuntuforums.org/showthread.php?t=567505
Realtek 8187B Native Patch for Realtek 818x USB Devices -- Relevant only to rtl8187B USB wireless devices - Toshiba Laptops - http://www.datanorth.net/~cuervo/rtl8187b/ - Author Cuervo

__________________________________________________ __________________________
Wireless Security
WPA with EAP-TLS - http://www.codealias.info/technotes/...x_client_setup

__________________________________________________ __________________________
Other Interesting Sites

Control Programs Kept in Swap vs Memory - http://ubuntuforums.org/showpost.php...&postcount=150
If your Wireless Freezes after Suspend/Resume - Check here - http://ubuntuforums.org/showpost.php...7&postcount=12 - Author Harty83
DNS related problems?? - Configuration for OpenDNS servers - http://ubuntuforums.org/showthread.php?t=543659 - Author noob12
Turn off/Disable IPv6 - http://ubuntuforums.org/showthread.php?t=282034 - Author handy
General Linux Page Discussing Network Setups - Default Gateways - http://linux-ip.net/html/basic-changing.html
Log Files -- Your Friend to Debug almost anything on your System - https://help.ubuntu.com/community/Li...f98267e009db55
Using OpenVPN to bridge networks - http://ubuntuforums.org/showthread.php?t=752127 - Author SpaceTeddy

Sources : http://ubuntuforums.org

Crontab

What Is Crontab?

A crontab is a simple text file that holds a list of commands that are to be run at specified times. These commands, and their related run times, are controlled by the cron daemon and are executed in the system's background. More information can be found by viewing the crontab's man page. We will run through a simple crontab example later.


How Does It Work?

The system maintains a crontab for each user on the system. In order to edit or create a crontab, you must use the text editor that is specified by your system. The nano text editor is the default text editor on my system. This text editor must be opened with the command crontab using the -e option. To create a crontab open a term and type:

Code:
crontab -e
The nano text editor will open with a blank window for the desired times and commands to be entered. Each line represents a seperate crontab entry - also known as a "cron job". If you are not familiar with the nano text editor you should obtain a tutorial for it as that information is beyond the scope of this post.


Crontab Sections

Each of the sections is separated by a space, with the final section having one or more spaces in it. No spaces are allowed within Sections 1-5, only between them. Sections 1-5 are used to indicate when and how often you want the task to be executed. This is how a cron job is layed out:

minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command

Code:
01 04 1 1 1 /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on any Monday which falls on January 1st. An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used. Code:

Code:
01 04 * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.

Comma-seperated values can be used to run more than one instance of a particular command within a time period. Dash-seperated values can be used to run a command continuously. Code:

Code:
01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.

The "/usr/bin/somedirectory/somecommand" text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. The crontab will begin running as soon as it is properly edited and saved.


Crontab Options

The -l option causes the current crontab to be displayed on standard output.
The -r option causes the current crontab to be removed.
The -e option is used to edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables.

After you exit from the editor, the modified crontab will be checked for accuracy and, if there are no errors, installed automatically.


Crontab Example

Below is an example of how to setup a crontab to run updatedb, which updates the slocate database: Open a term and type "crontab -e" (without the double quotes) and press enter, type the following line, substituting the full path for the one shown below, into the editor:

Code:
45 04 * * * /usr/bin/updatedb
Save your changes and exit the editor.

Crontab will let you know if you made any mistakes. The crontab will be installed and begin running if there are no errors. That's it. You now have a cron job setup to run updatedb, which updates the slocate database, every morning at 4:45.

Note: The double-ampersand (&&) can also be used in the "command" section to run multiple commands consecutively.

Code:
45 04 * * * /usr/sbin/chkrootkit && /usr/bin/updatedb
The above example will run chkrootkit and updatedb at 4:45am daily - providing you have all listed apps installed.

How to Use the Cron and Crontab commands

How to Use the Cron and Crontab commands

The 'Cron' Command

The cron command starts a process that executes commands at specified dates and times. Regularly scheduled commands can be specified according to instructions found in the crontab files in the directory /var/spool/cron/crontabs. Users can submit their own crontab files via the crontab command.

The 'Crontab' Command

Crontab copies the specified file or standard input if no file is specified, into a directory that holds all users' crontabs.

SYNOPSIS:

  • crontab [file]
  • crontab -e [-u username]
  • crontab -r [-u username]
  • crontab -l [-u username]

The -e option edits a copy of the current users' crontab file or creates an empty file to edit if crontab does not exist.

The-r option removes a user's crontab from the crontab directory.

The -l options lists the crontab file for the invoking user.

Setting up a Crontab job

A crontab file consists of lines of six fields each.The fields are separated by spaces or tabs. The first five are integers that specify the following:

  1. minute (0-59),
  2. hour (0-23),
  3. day of the month (1-31),
  4. month of the year (1-12),
  5. day of the week (0-6 with 0=Sunday).

Each of these patterns may be either an asterisk (meaning all valid values) or a list of elements separated by commas. An element is either a number or two numbers separated by a minus sign ( meaning an inclusive range). Notice the time is in 24 hour format, 0 is midnight and 13 is one in the afternoon.

The sixth field of a line in a crontab file is a string to be executed by the shell at the specified times by the first fife fields. A percent character in this field (unless escaped by \) is translated to a newline character. Only the first line (up to a % or end of line) of the command field is executed by the shell. The other lines are made available to the command as standard input.

Any line beginning with a # is a comment and is ignored.

Example

To illustrate, 0 0 1,15 1 would run a command on the first and fifteenth of each month, as well as on every Monday at exactly midnight. To specify days by only one field, the other field should be set to *. The entry, 0 23 * * 1 would run a command only on Mondays at eleven PM.

A minute specification of 0,30 would indicate the job is to be run on the hour and half hour. Likewise, a day of the month entry of 1,15 would initiate execution on the first and fifteenth of the month.

Make sure you include an explicit path to your programs or scripts that you want to run by crontab. Let's assume we want to execute a Perl program, autoclose.cgi, every day at midnight. Additionally assume the full path to the script is /home/www/yourdirectory/cgi-bin. The full crontab command would be: 0 0 * * * /home/www/yourdirectory/cgi-bin/autoclose.cgi

Execute at midnight, every day of the month, every month of the year, and every day of the week.

If you're not sure of the full path to your script, go to the directory and issue the command:

pwd

This is the "print working directory" command. The requirement for explicit paths also apply to any "require" library file used in a Perl script.

The line:

0 0 1,15 * 1 /home/www/yourdirectory/cgi-bin/autoclose.cgi

runs the command on the first and fifteeth of each month, as well as on every Monday.

The line:

0 0 * * 1 /home/www/yourdirectory/cgi-bin/autoclose.cgi

runs a the command only on Mondays.

Putting it all together

Creating your first crontab job is a three-part process:

  1. Prepare the absolute path to the program or script that you want to run,
  2. Create a text file containing a line to schedule the job as described above for crontab fields,
  3. Upload the text file to your system cron.


When preparing program to run or creating scripts to run remember that crontab jobs are background tasks. There is no terminal attached to a crontab job so there should be no print statements that normally write to the screen. (It is possible to redirect such print statements.) The same consideration hold true for requesting user input.

Let's assume that we want to run this script:

/home/www/yourdirectory/cgi-bin/autoclose.cgi

Next create a file to hold your crontab instructions. Let's call it "cron.txt". Let's also have our script execute at zero minute every hour. Put the following crontab command line in the text file "cron.txt" and save this file as a text file: 0 * * * * /home/www/yourdirectory/cgi-bin/autoclose.cgi

The last step is uploading the contents of your "cron.txt" file to the system crontab spool area. Enter the following at the system prompt.

crontab cron.txt

Source : http://www.tech-geeks.org/contrib/mdrone/cron&crontab-howto.htm

Tuesday, January 6, 2009

Usefull Link

http://www.electrictoolbox.com/2008-summary-posts/