Howto: Use BlueProximity and your cellphone for security

摘自: ubuntuforums.org  被阅读次数: 141


yangyi 于 2008-04-16 19:14:15 提供


What is it?
BlueProximity is a clever program by Lars Friedrichs that sets up your computer to lock itself when your phone is out of bluetooth range, and unlock itself when it comes close enought again.

Why do I want it?
Ultimate coolness! Nothing is as super cool as just walking up to your computer and watch it come alive without you doing anything. Ok, it can be argued that this is semi-useful, but we will all do it for the coolness factor


How to do it?
First, we need to install dependencies:

Code:
sudo apt-get install bluez-utils python-gtk2 python-glade2 python-configobj python-bluez
We need a newer version of the python-support package.

You can get one from here:

Code:
wget http://security.ubuntu.com/ubuntu/pool/main/p/python-support/python-support_0.7.5_all.deb
Install it:

Code:
sudo dpkg -i python-support_0.7.5_all.deb

Now lets get the BlueProximity program:

Code:
wget http://ovh.dl.sourceforge.net/sourceforge/blueproximity/blueproximity_1.2.4-0ubuntu1_all.deb (from official site)

- alternate download link -
wget http://mirrors.kernel.org/ubuntu/pool/universe/b/blueproximity/blueproximity_1.2.4-0ubuntu1_all.deb (from ubuntu universe (hardy?) repositories)
Install it:
Code:
sudo dpkg -i blueproximity_1.2.4-0ubuntu1_all.deb

Ok, now it is time to set this up:

Phone settings:
  • Activate bluetooth
  • Scan for your computer and authorize it so you won't need a password

Blueproximity settings:

Code:
blueproximity
  • Scan for devices and select "Use selected device"
  • Then scan channels and select one that comes up as "usable"

That should be it! Now fiddle a bit with your proximity details, don't set them too low but not to high either. I get pretty good results with the settings below, but this will of course differ according to the placement of your computer.

Settings

My settings are:
  • Lock: Distance: 7 | time: 10 - thus it won't lock at once if bluetooth connection gets disrupted, something it seems to do for a second or two.
  • Unlock: Distance: 3 | time: 3 - Unlocks very fast when I get close.

Turning the monitor off
It would be more useful if this could turn the monitor on/off as well, right? If you want this enter the BlueProximity preferences, click the locking tab and use this command::
  • Locking Command: gnome-screensaver-command -l && xset dpms force off
  • Unlocking command: xset dpms force on && gnome-screensaver-command -d
I noticed I had to change the unlock time to 1 to give the monitor time to turn on before I sat down.


Add the program to your startup list:
Of course you want to have it starting with Ubuntu. Go system > preferences > sessions. You should be on the "startup programs" tab. Click "Add" and type "blueproximity" (without the "") and a name and description you want.

This was tested by me on Ubuntu Gutsy with a Samsung D900, and works great. If you try this, please report what phone you got it working with - or not. I don't see this not working because it only really depends on bluetooth from the phone, but you never know. It will be kind of useless if you can't authorize a device on your phone.

Working phones
  • Blackberry 7100i
  • Lg CX245
  • Lg EnV (9900)
  • LG F2400 - might need this guide: http://www.linuxquestions.org/linux/...s_under_Ubuntu
  • LG Voyager
  • Motorola e815 with Verizon firmware
  • Moto RAZR V3m with Verizon firmware
  • Nokia 6230
  • Samsung D900
  • Samsung U600
  • Samsung X820
  • Sanyo Katana
  • Sony Ericsson K610i
  • Sony Ericsson K750i
Non-working phones
  • None as of today

Scripts
As some users have alredy pointed out, there are several cool possiblities for this. Many things can be accomplished with simple or more advanced scripts. Despite my very limited knowledge of bash scripts, I attached a simple set of scripts that will do the following:
  • Turn on / off screensaver
  • Turn on / off monitor
  • Check if Amarok is playing and pause - then unpause. If amarok is stopped, this will do nothing.
  • Change your pidgin status to away / available*
*To get the pidgin status to work you need libpurple-bin. (install: sudo apt-get install libpurple-bin)

To use them, download the attached scripts archive, unpack it, make them all executable and stick them in /usr/bin*. If you only want some of the functions, edit the bp_lock and bp_unlock files. Then go into BlueProximity preferences - locking tab and put "bp_lock" and "bp_unlock" as locking and unlocking command.
*command is: sudo cp bp_* /usr/bin

I'm sure more knowledgeable users can make better scripts, but these does the trick for my use

Links
FAQ
  • What happens if the phone runs out of power?
  • Nothing. You can still unlock your computer the traditional way. You don't need the phone at all.
  • Where did the python-support install go?
  • I changed it to a safer and faster method. If you need the other one, plase ask me.
Attached Files
File Type: gz scripts.tar.gz (792 Bytes, 21 views)

Original link: http://ubuntuforums.org/showthre...