Home Blog Page 8732

Roaming with your Linux laptop: Using QuickSwitch

Author: JT Smith

By Mohit Muthanna

Most Linux laptop users don’t leave home without their trusted sword. They use it at home, at work, at client sites and on the bus. A problem while moving around with these laptops is profile management; having to change IP addresses, DNS addresses, gateways, proxy servers, etc., every time one changes his location is simply a pain. Most people a trouble remembering what files to edit, or just typing in the new addresses all the time. I had this problem, and most of the utilities available on the net were incomplete, limited, or just did not do what I want.

Enter QuickSwitch, a free, Open-Sourced utility that helps Linux laptop users maintain roaming network profiles. I initially wrote it to accomplish a simple task as painlessly as possible. It consisted of a Perl script and a configuration file. You entered the details of your different environments as “profiles” in the configuration file and ran the script whenever you needed to change environments; and in an instant it reconfigures the network card, updates the routing table and DNS entries and switched a bunch of important files around. Since then, QuickSwitch has evolved to a mature feature-rich utility used by a large population of Linux laptop users.

Features

QuickSwitch now sports many useful features, some of which include: DHCP/BOOTP support; wireless LAN configuration; selecting profiles on startup through kernel parameters; a text mode graphical interface; and dynamic file swapping. And it does all this on the fly, without having to restart the machine. Visit the QuickSwitch home page for more details on what QuickSwitch can accomplish.

Installing QuickSwitch

QuickSwitch’s latest version (at the time of writing this article) is 0.14-2. QuickSwitch requires there to be a working Perl 5 interpreter, which is installed by default with most distributions of Linux.

To install QuickSwitch, first download the tarball from the downloads section of the QuickSwitch site, then:

tar -zxvf QuickSwitch-0.14.tar.gz
cd QuickSwitch
./INSTALL.sh

This installs the “switchto” executable in /usr/bin and copies a sample switch.conf file to /etc. Red Hat users note that a file called switchto already exists in /usr/bin, and you may want to rename the QuickSwitch program, or install it somewhere else. The installation script is nothing more than a shell script that copies the files to their destinations.

Configuring QuickSwitch

Configuring QuickSwitch is simply a matter of editing the self-documenting sample configuration file located in /etc/switch.conf. The sample file includes some application defaults and about three sample profiles. The configuration file is split into three sections, one global section for defaults such as paths etc., one for the dynamic file swapping feature and one for the profiles.

To demonstrate, we will setup Quickswitch to switch between our home and work profiles.

Let us first examine a few of the lines in the global section. This section is named config and identified by the title in the square brackets. The first thing you have here is the default network device, which is set to eth0. This tells QuickSwitch which card to configure when switching profiles and can be overridden inside a profile. The servicefilename token specifies the location of the file to store the last working configuration. This is handy when you’re restarting your laptop and just want QuickSwitch to use the last used profile.

[config]
device=eth0
servicefilename=/etc/switchto.last

Below are paths to some of the standard programs used by QuickSwitch. Notice they are all commented out. In general, if an option in the file is commented out, it represents a default value which can be changed by uncommenting the line and changing it.

# ifconfig=/sbin/ifconfig
# iwconfig=/usr/local/sbin/iwconfig
# netstat=/bin/netstat
# route=/sbin/route
# etc? Etc?

The lines below are DHCP defaults. This depends on the DHCP client software you’re using; the default is set to pump, which is the client included with Red Hat.

# For DHCP/BOOTP on RedHat systems (default)
# dhcpconfig=pump -i
#
# Uncomment for DHCP on other systems
# dhcpconfig=dhcpcd

The following lines are used to execute scripts before and after a profile switch. They can be overridden inside of a profile. The example here executes the command xhost + before a profile switch. This is handy if you’re changing profiles inside of an X window session, and it prevents unauthorized connection errors.

execpre=xhost +
# execpost=

Setting useansi to 0 disables the color debug messages on ANSI terminals. The colors that follow it are user definable.

# useansi=1
# color_ok=32;1
# color_error=31;1
# color_debug=33;1

As you can see, most of the above were commented out and were defaults and did not even have to be included in the file. You will only need to change them if you have a notoriously non-standard Linux installation.

Now let us create two profiles, one for home and one for work. Naming the profiles is a matter of entering a name inside of the square brackets that begins a section. The lines that follow it are the configuration values for that profile.

Here, you see the work profile.

[work]
description=Work Settings
address=192.168.1.51
netmask=255.255.255.0
gateway=192.168.1.137
hostname=prometheus
FQHostname=prometheus.itsits.com
domain=itsits.com
search=itsits.com
dns1=192.168.1.51
dns2=192.168.1.52

The top line (in the square brackets) defines the name of the profile as identifiable by QuickSwitch. The next line defines a description which is used by the GUI switcher. All downhill from here, you have the IP address, network mask, default gateway, hostname, fully qualified hostname etc. The domain and search tokens are used to specify the default domain name and the default search domains during name resolution. And dns1 and dns2 are primary and secondary DNS addresses.

Our home profile is a bit more complicated. (Shouldn’t it be? We are geeks, aren’t we?)

[home]
device=eth1
description=Home settings
address=dhcp
hostname=vera
domain= supercamel.myip.net
search= supercamel.myip.net edgesolutions.ca
dns1=192.168.240.121
dns2=192.168.230.211
usehosts=/etc/hosts.home
nfsexports=/etc/exports.home
nisdomain=supercamel

Here, we’re using DHCP to configure our card and hence not specifying the address, netmask, etc. The usehosts token sets up a symbolic link to an alternate hosts file and nfsexports sets up a link to an alternate exports file. An NIS domain name is also set up here. Notice also that we have overridden the global device and are configuring another card. Also note that QuickSwitch calls exportfs automatically to tell the NFS daemon to reread its configuration file.

Running QuickSwitch

All you have to do now when you get to work is type:

switchto work

And as if by magic, you’re ready to roll. If you want to see what’s happening behind the scenes, use the -d parameter which sets the debug level:

switchto -d 2 work

If you want to back up those files (/etc/hosts, /etc/resolv.conf etc) before switching them, use the -b switch.

To see a list of available profiles, run QuickSwitch with the -l switch.

Now you want this toy to set you up on startup. If you’re using LILO as your boot manager you can simply append the parameter SWITCHTO=profilename on startup, as so:

LILO: linux SWITCHTO=work

Or you can use the append token in your LILO configuration file as so:


image=zImage
	label=home
	root=/dev/sda1
	append="SWITCHTO=home"
	read-only
image=/boot/zImage
	label=work
	root=/dev/sda1
	append="netswitch=work"
	read-only
image=zImage
	label=last
	root=/dev/sda1
	read-only

All you need to do to enable this feature is add the line /usr/bin/switchto -s to your rc.local or similar startup file. Using this method, if you do not specify a kernel parameter; QuickSwitch uses the last selected profile.

One-time switching

QuickSwitch parameters can be supplied on the command line for those one-time client visits. This is a very useful feature that lightens the burden of having to go out and edit all the required files.

To temporarily switch the network profile, type the new details in as so:

switchto ip:192.168.1.12 netmask:255.255.255.0
gw:192.168.1.51 dns1:192.168.1.51

QuickSwitch then goes about its business reconfiguring the card, and swapping the files around. To learn more about the available parameters just type in switchto without any parameters or visit the QuickSwitch page.

Dynamic File Swapping

As of version 0.12, QuickSwitch comes with a feature called dynamic file swapping. With this, users have more flexibility and control over which files can be swapped for which profiles. Let us say, for example, a user uses a different printer and plugs into a separate monitor when she gets to work. Using the dynamic file switching feature, the /etc/printcap file and the XF86Setup files can be swapped in the work profile. To use this feature, we first define some swappable files in the files section, as so:


[files]
samba=/etc/smb.conf
printcap=/etc/printcap
xconfig=/usr/lib/X11/etc/XF86Setup

The tokens on the left of the “=” sign are used as identifiers inside of a profile, when when used cause the file to be symbolically linked. Let us edit our work profile as an example, using our newly defined files section.


[work]
ip=192.168.0.232
netmask=255.255.255.0
...
...
printcap=/etc/printcap.work
xconfig=/usr/lib/X11/etc/XF86Setup.work

When QuickSwitch switches to the profile named work, it notices the printcap and xconfig parameters in the both the files section and the work profile. It now knows that these files need to be switched and it creates a symbolic link named /etc/printcap pointing to /etc/printcap.work. It does the same for xconfig. This way a user can maintain configurations for other programs that QuickSwitch does not know about.

If a file needs a daemon to be restarted after a switch, add the command to the execpost parameter. For example, if you’re swapping your Samba shares around, you can add the following line to the profile to have the Samba daemon restarted:

/etc/rc.d/init.d/smb restart

Using the GUI

QuickSwitch comes with a text-based graphical profile selector you could use on startup to switch your profiles around. For the GUI to run, you must first install the Perl Curses and the Curses::Widgets modules. These modules are easily available on CPAN and straightforward to set up.

The program is called switcher and is included with the QuickSwitch distribution. If you have installed the main QuickSwitch executable in a non-standard location, or changed its name, edit /etc/switch.conf and set the parameter switchtopath to the new path. Switcher uses this to call QuickSwitch to set a profile.

Switcher can be made to run on startup by adding it to your rc.local or equivalent startup file.

Closing Notes

A lot of information about QuickSwitch was covered in this article, and as you can see, it is a very configurable and easy-to-use tool. QuickSwitch can also be integrated with other software to have it auto-detect a network, can be used to configure wireless LAN cards, and make you coffee every morning. OK, maybe not coffee, but there are still far too many features to be covered here. You can get more information by visiting the QuickSwitch home page.

Mohit Muthanna is a systems/network
integration based in Toronto, Ontario.

Category:

  • Linux

Mozilla Milestone 0.9.7 browser-suite released

Author: JT Smith

From an anonymous reader: MozillaQuest Magazine (MozillaQuest.com) reports: “The Mozilla Organization released the Milestone 0.9.7 edition of its Mozilla browser suite earlier today — on schedule this time. According to the release notes, Mozilla 0.9.7 sports a new ChatZilla release (8.5) and further implements some new features that were added in Mozilla 0.9.6 — such as favicons (shortcut icons) and mail message labels. Much as with Mozilla 0.9.6, Mozilla Milestone 0.9.7 endured a clumsy branching. However, with Mozilla Milestone 0.9.7, the Mozilla folks were able to get Mozilla 0.9.7 out the door on schedule. Check this MozillaQuest.com story for details and download links.”

Slashdot interview with Lessig

Author: JT Smith

Mikael Pawlo writes, “Slashdot just published an interesting interview with professsor Lawrence Lessig. Lessig talks about the future of copyright, the need for action and what things regulate creativity.”

Working without copyleft

Author: JT Smith

Mikael Pawlo writes, ” O’Reilly Network published an interesting take on how to choose license when developing software. According to authors Bjørn Reese and Daniel Stenberg it’s possible to be a supporter of open source and not be a fan of copyleft and the GNU General Public License.”

Category:

  • Open Source

Linux 2.5.1-dj5

Author: JT Smith

Dave Jones: “Mostly resync stuff.”

Patch against 2.5.1 vanilla is available from:
http://www.codemonkey.org.uk/patches/2.5/patch-2.5.1-dj5.diff.bz2

Some of these fixes still haven't found their way back to Marcelo yet
but should show up in 2.4.17-rc3 / 2.4.18pre1 with any luck.

2.5.1-dj5
o   Merge 2.5.2pre1.
o   Merge 2.4.17final.
o   Gravis ultrasound PnP update                (Andrey Panin)


Category:

  • Linux

Mozilla 0.9.7 released

Author: JT Smith

Jeremy M. Dolan writes: “The Mozilla Organization is proud to announce the
release
of milestone 0.9.7. Some of the major changes since 0.9.6 include:
S/MIME
mail support,
DOM Inspector,
web site icons in bookmarks (aka favicons),
digest authentication,
and complete page saving (images, Javascript, CSS)!

Approximately 1,586 bugs were fixed since 0.9.6,
and we feel this milestone is the best yet. Performance and stability continues to improve as
we near the 1.0 mark.


Complete release notes are available
, which you
are highly encouraged to read (c’mon, at least browse them!).

If you’re interested in helping out, there’s some great information on the
Getting Involved page.”

Category:

  • Open Source

TurboPrint for Linux review

Author: JT Smith

Jonny5 writes: “In preparation for the transition from windows to a Linux based workstation, the main focus is that of peripheral compatibility. Sure Linux is rock solid stable, and has an almost totally customizable GUI, but dammit, if my hardware won’t work, what’s the point? LinuxLookup.com has done a full review of TurboPrint for Linux v1.43. TurboPrint is a software suite with the claim it’s “Printer set-up and configuration is as simple as on Windows or MacOS”. That claim peaked our interest, and the following review was born. The full review is available here.”

Category:

  • Linux

RedHat: Powertools: ‘Mailman’ update

Author: JT Smith

Red Hat: “Updated Mailman packages are now available for Red Hat PowerTools 7 and 7.1. These updates fix cross-site scripting bugs which might allow another server to be used to gain a user’s private information from a server running Mailman.”


---------------------------------------------------------------------
                   Red Hat, Inc. Red Hat Security Advisory

Synopsis:          Updated Mailman packages available
Advisory ID:       RHSA-2001:169-10
Issue date:        2001-12-11
Updated on:        2001-12-20
Product:           Red Hat Powertools
Keywords:          cross-site scripting
Cross references:  RHSA-2001:168 RHSA-2001:170
Obsoletes:         
---------------------------------------------------------------------

1. Topic:

Updated Mailman packages are now available for Red Hat PowerTools 7 and
7.1.  These updates fix cross-site scripting bugs which might allow another
server to be used to gain a user's private information from a server
running Mailman.

2. Relevant releases/architectures:

Red Hat Powertools 7.0 - alpha, i386

Red Hat Powertools 7.1 - alpha, i386

3. Problem description:

A server running Mailmain versions prior to 2.0.8 will send certain
user-modifiable data to clients without escaping embedded tags.  This data
may contain scripts which will then be executed by an unwary client,
possibly transmitting private information to a third party.

The Common Vulnerabilities and Exposures project (cve.mitre.org) has
assigned the name CAN-2001-0884 to this issue.

4. Solution:

Before applying this update, make sure all previously released errata
relevant to your system have been applied.

To update all RPMs for your particular architecture, run:

rpm -Fvh [filenames]

where [filenames] is a list of the RPMs you wish to upgrade.  Only those
RPMs which are currently installed will be updated.  Those RPMs which are
not installed but included in the list will not be updated.  Note that you
can also use wildcards (*.rpm) if your current directory *only* contains the
desired RPMs.

Please note that this update is also available via Red Hat Network.  Many
people find this an easier way to apply updates.  To use Red Hat Network,
launch the Red Hat Update Agent with the following command:

up2date

This will start an interactive process that will result in the appropriate
RPMs being upgraded on your system.

5. Bug IDs fixed  (http://bugzilla.redhat.com/bugzilla for more info):



6. RPMs required:

Red Hat Powertools 7.0:

SRPMS: 
ftp://updates.redhat.com/7.0/en/powertools/SRPMS/mailman-2.0.8-0.7.0.src.rpm

alpha: 
ftp://updates.redhat.com/7.0/en/powertools/alpha/mailman-2.0.8-0.7.0.alpha.rpm

i386: 
ftp://updates.redhat.com/7.0/en/powertools/i386/mailman-2.0.8-0.7.0.i386.rpm

Red Hat Powertools 7.1:

SRPMS: 
ftp://updates.redhat.com/7.1/en/powertools/SRPMS/mailman-2.0.8-1.src.rpm

alpha: 
ftp://updates.redhat.com/7.1/en/powertools/alpha/mailman-2.0.8-1.alpha.rpm

i386: 
ftp://updates.redhat.com/7.1/en/powertools/i386/mailman-2.0.8-1.i386.rpm



7. Verification:

MD5 sum                          Package Name
--------------------------------------------------------------------------
5c0035f2b55edfaae6aa2f0aded1908a 7.0/en/powertools/SRPMS/mailman-2.0.8-0.7.0.src.rpm
98b8f4d6d142c8b6b72fd93dd43be6a6 7.0/en/powertools/alpha/mailman-2.0.8-0.7.0.alpha.rpm
9a897b9b69fb2a547846b02ba0b46886 7.0/en/powertools/i386/mailman-2.0.8-0.7.0.i386.rpm
7247f28d0c41f0844f13dfc594ea0ccf 7.1/en/powertools/SRPMS/mailman-2.0.8-1.src.rpm
841f778f07ef0464019c348f58eaa358 7.1/en/powertools/alpha/mailman-2.0.8-1.alpha.rpm
23d42ac2e45b24de1e051cdc2855d32a 7.1/en/powertools/i386/mailman-2.0.8-1.i386.rpm
 

These packages are GPG signed by Red Hat, Inc. for security.  Our key
is available at:
     http://www.redhat.com/about/contact/pgpkey.html

You can verify each package with the following command:
    rpm --checksig  

If you only wish to verify that each package has not been corrupted or
tampered with, examine only the md5sum with the following command:
    rpm --checksig --nogpg 

8. References:
 
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2001-0884http://mail.python.org/pipermail/mailman-announce/2001-November/000031.htmlhttp://www.cert.org/advisories/CA-2000-02.htmlhttp://www.cgisecurity.org/advisory/7.txt


Copyright(c) 2000, 2001 Red Hat, Inc.


Category:

  • Linux

Survey: Java outstrips .Net for IT pros

Author: JT Smith

ZDNet: “Web services are not just a hype by suppliers looking for new sales; they will take off in 2002, and the majority will be based on Java rather than Microsoft’s .Net alternative, according to a poll of enterprise IT professionals run by ZDNet UK’s Tech Update channel.” Read more here.

KDE and GNOME bleed Xmas code

Author: JT Smith

The Register: “KDE put the first cut of its version 3.0 desktop out yesterday, less than a week after GNOME issued Platform Beta of its 2.0 desktop. Reports of how many have been hurt, or how badly, by this code are hard to find as independent reports are scant. But you can find out for yourselves…”

Category:

  • Open Source