Hash for wpa supplicant password

Configuring WLAN on a linux host there are 2 ways to configure a wireless access on a wireless host.

First way is one can use an application like:

  • wicd
  • NM (network manager)

which generates a working wpa_supplicant.conf file for your machine/laptop. Sometimes with hashes somtimes without. Generally speaking the configuring overhead is out of the scope and one barely to no possibility to control how the working wpa_supplicant configuration is structured and where data is stored.

Second way is to generate a wpa_supplicant.conf file by yourself, which could look like this:

network={
    ssid="example"
    key_mgmt=WPA-EAP
    eap=PEAP
    identity="user@example.com"
    password="MySecretPassword"
    ca_cert="/etc/cert/ca.pem"
    phase1="peaplabel=1"
    phase2="auth=MSCHAPV2"
}

Instead of setting password in cleartext it is possible to generate a hash and use the keyword hash in the password line. This kind of hash is also called NT-hash (sometimes). To generate a working hash use openssl/libressl library with following command:

user % echo -n MySecretPassword | iconv -t utf16le | openssl md4 (stdin)= f38de32ad5224f05be73c6f542266937

The resulting wpa_supplicant.conf configuration part:

...
    network={
            ssid="example"
            key_mgmt=WPA-EAP
            eap=PEAP
            identity="user@example.com"
            password=hash:f38de32ad5224f05be73c6f542266937
            ca_cert="/etc/cert/ca.pem"
            phase1="peaplabel=1"
            phase2="auth=MSCHAPV2"
    }
...

Finally, restrict file permissions and adjust the system file owner:

root # chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
root # chown root:root /etc/wpa_supplicant/wpa_supplicant.conf

Finished.

Switching git branch

While using git as a useful feature using branches. A software I am using implemented a new feature Support for Xrandr the main developer created a branch for it called ta/randr. As a git user I was not familar with switching branches. I can not even say I was aware of it in SVN or CVS or RCS. Never used it becasuse there was no such a use case for me. I have always been using either $HEAD or some older version of the source tree. Since I am keen to try out the new piece of software on FVWM (software I am speaking of) I needed to switch to this particular branch. This feature was not available yet on the $HEAD. A git fetch outputlooked like this:

user@host % git fetch
remote: Counting objects: 519, done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 519 (delta 344), reused 327 (delta 327), pack-reused 153
Receiving objects: 100% (519/519), 307.31 KiB | 507.00 KiB/s, done.
Resolving deltas: 100% (406/406), completed with 188 local objects.
From https://github.com/fvwmorg/fvwm
   d5d07f5..e74f913  master     -> origin/master
 * [new branch]      coverity_scan -> origin/coverity_scan
 * [new branch]      default-config -> origin/default-config
 * [new branch]      ta/ar-warnings -> origin/ta/ar-warnings
 * [new branch]      ta/clang-extra -> origin/ta/clang-extra
   3001ee4..4afa9ce  ta/deprecate -> origin/ta/deprecate
 * [new branch]      ta/developer-doc -> origin/ta/developer-doc
 + e67dd0c...fade120 ta/docs-to-md -> origin/ta/docs-to-md  (forced update)
 * [new branch]      ta/install -> origin/ta/install
 + 1ef3ea9...d0150f4 ta/multiborder -> origin/ta/multiborder  (forced update)
 * [new branch]      ta/new-config-format -> origin/ta/new-config-format
 * [new branch]      ta/possible-fix-icon-pr -> origin/ta/possible-fix-icon-pr
 * [new branch]      ta/randr   -> origin/ta/randr
 * [new branch]      ta/remove-common-calls -> origin/ta/remove-common-calls
 * [new branch]      ta/silence-clang-warnings -> origin/ta/silence-clang-warnings
   efc364b..bedab2e  ta/todo    -> origin/ta/todo
 * [new branch]      ta/travis-sudo-false -> origin/ta/travis-sudo-false
 * [new branch]      ta/usedecor-macro -> origin/ta/usedecor-macro

To show all avaliable branches use following command:

user@host % git branch -av
* master                                   d5d07f5 [behind 30] Fix startup ordering for AllocColorset
  remotes/origin/HEAD                      -> origin/master
  remotes/origin/coverity_scan             f1b824b Travis CI: Coverity
  remotes/origin/default-config            e37061c Remove FVWM_USERDIR from config
  remotes/origin/master                    e74f913 Add note about how to merge pull-requests
  remotes/origin/new-parser                50622b5 Fixup mvwm-specific fallout
  remotes/origin/ta/deprecate              4afa9ce Remove FvwmDebug
  remotes/origin/ta/developer-doc          e74f913 Add note about how to merge pull-requests
  remotes/origin/ta/docs-to-md             fade120 Manpage: FvwmBanner
  remotes/origin/ta/fix-colorset-alloc     d5d07f5 Fix startup ordering for AllocColorset
  remotes/origin/ta/fvwmdx                 7ea056f FvwmDX: a module for per-screen window-switching
  remotes/origin/ta/new-config-format      5026166 config: Add crude heredoc parser example
      remotes/origin/ta/new-default-config     4f57c0a Few tweaks: update programs, etc.
  remotes/origin/ta/possible-fix-icon-pr   0c5211e Expose: don't flush accumulated events
  remotes/origin/ta/randr                  fb678c2 TEMP: debug

To switch to the desired branch use following command: (here ta/randr)

user@host % git checkout origin/ta/randr

Verfiy on which branch currently working on

user@host % git branch -v
* (HEAD detached at origin/ta/randr) fb678c2 TEMP: debug
  master e74f913 Add note about how to merge pull-requests

A last note regarding autoconf, sometimes while running autoconf one can receive such a error message:

user@host % autoconf
configure.ac:20: error: possibly undefined macro: AM_INIT_AUTOMAKE
    If this token and others are legitimate, please use m4_pattern_allow.
            See the Autoconf documentation.
configure.ac:21: error: possibly undefined macro: AM_SILENT_RULES

This can be fixed by running autoreconf --install option

user@host % autoreconf --install
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.15 line 3936.
configure.ac:159: installing 'etc/compile'
configure.ac:265: installing 'etc/config.guess'
configure.ac:265: installing 'etc/config.sub'
configure.ac:20: installing 'etc/install-sh'
configure.ac:20: installing 'etc/missing'
bin/Makefile.am: installing 'etc/depcomp'
Testing WM configuration without closing current session

While using a window manager like FVWM after changing the configuration it is needed to restart the current session to view the change. That is what usually one would do. However there is a possibility to view the changes without leaving the current WM session. It is possible to start a WM in the current WM. Generally this post is taken form (Thomas Adam's article)[https://plus.google.com/+ThomasAdamXteddy/posts/YqzdH3jeAEg] about this. He describes a testing environment using FVWMConsole and the xorg-server Xephyr application.

Start Xephyr:

 Xephyr :3 -ac -screen 1024x768 &

Export the terminal:

DISPLAY=:3

Start now the WM inside the same Terminal

fvwm -f ~/.fvwm/config

Et voila. This way you can test a WM configuration without restarting each time your running session.

Creating patches

This is a reminder for myself. Sometimes, rarely I discover bugs while running free software, if I can fix the bug it would be a pity not to attach a patch to the bugtracker to make the work of developers easier.

Creating a patch file:

diff -u old.file new.file > new.patch

Apply a patch using the patch command:

patch -p0 < patchfile

That is all one need to know to create and apply a patch on top of working directory.