Tuesday, September 28, 2010

Wicd: customizing networks configuration

Hey,

As a good Xfce user I know some gnome-kde alternative applications. One of the best of this crew is certainly Wicd, a Network manager. First of all it handles wired and wireless networks in a cute graphical environment, but most important it works flawlessly with many wireless cards and chipset, has a ndiswrapper support and it is relatevely easy to open a backdoor and create your profile as you need.

I mean if you have a strange wifi setup due to your system admin at work or internet provider at home, or a reserved wifi connection in your university campus, you can create a simple text file to send required parameters to wifi-supplicant wich still does its job.
The starting point of today's tip is the folder where you can find all the encryption protocols files:
ls /etc/wicd/encryption/templates
As you can see there are many files, each named as the protocol that it contains, and a summary file, called active, in which are listed all the active protocols.

So the next step is to understand what a protocol file contain. Thank God they are plain text, so open it easily as, (for example)
geany wep-shared
let's look at that file: the first part is what we can call a header

name = WEP Shared/Restricted
author = Dan O'Reilly
version = 1
require key *Key
-----

then it comes the configuration for wpa_supplicant:

ctrl_interface=/var/run/wpa_supplicant 
network={
ssid="$_ESSID"
scan_ssid=$_SCAN
key_mgmt=NONE
auth_alg=SHARED
wep_key0=$_KEY
wep_tx_keyidx=0
priority=5
}

It is quite easy to understand how we have to mix our ingredients in this recipe.

We have keywords, constants and variables.

Keywords are coming from the wpa_supplicant.conf sintax, you can get lots of examples just with man wpa_supplicant.conf: there you should find the keywords that fit your needs, just take care to look the conf for your same network kind.


Talking about constants they are very readable here, or the may vary from network to network, that's why we have variables: they are given by the user, or auto-filled with info coming from the network scanning. In the example you can recognize them as they begin with "$_". In your configuration you can require a variable to be filled by the user writing its name in the "required" line of the header.

So get your network configuration parameters and take a look at them. There should be some sensible data (pw, username): those are the one you want to type into the application GUI, the other can be constants or internal variables.

In conclusion you can translate the config file structure as follows:

name = My custom config name
author = ME!
version = Version#
require key *Key variable *Variable_Name_Displayed_in_GUI
-----
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="$_ESSID" <---------- auto filled
scan_ssid=$_SCAN  <---------- auto filled
key_mgmt=NONE
auth_alg=SHARED
wep_key0=$_KEY <----------filled by the user
wep_tx_keyidx=0
priority=5
}

Last advices:
  • In variables displayed names underscore are translated into spaces. Spaces are used just to separate a var from the next ones
  • Remember to update the "active" summary adding the name of your config file unless it was just some practice and you don't need that configuration :P
  • Without the required variables set by th user the network config won't be accepted.
  • Keep your wifi safe ^_^

    Cheers

    No comments:

    Post a Comment

    Loading...