Skip to content

Install the BLE KeyKeeper service on a Raspbian system

Notifications You must be signed in to change notification settings

netz39/ble-keykeeper-role

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BLE Keykeeper Ansible Role

This is the server part of BLE Coin, which allows you to run a script when a user authenticates. Using this service, you will never have to manually use the central's serial interface, everything in that regard will be handled by the service.

Quick Start Guide

0 - Obtain Hardware

  1. Take a look at the project page for more info.
  2. A Raspberry Pi is also recommended.

1 - Prepare central

  1. Download nRF Connect for Desktop and install the Programmer App.
  2. Download the newest release of the firmware files.
  3. Flash the central.hex onto your NRF52840 dongle.

2 - Get ready to flash coins

  1. Look here for more advice.

3 - Install dependencies

  1. Install Ansible.

4 - Run the role

  1. Set up a playbook and inventory
  2. Make sure you have set the door_open_command and ble_keykeeper_dir variables to appropriate values.
  3. Run your playbook

5 - Try it out

  1. Make sure the NRF52840 dongle is connected to the server.
  2. Navigate to your ble_keykeeper_dir and create a new coin with ./ble_gen_coin.py winnie. You can change winnie to any name you like (no spaces).
  3. Flash the newly created coin_xxxxxxxxxxxx.hex onto you coin. You can delete the file after.
  4. Restart the service using systemctl restart ble-keykeeper.service
  5. Press the button on your coin. Does it blink? If yes, it found the central.
  6. Check the service logs with journalctl -u ble-keykeeper.service. Scroll to the bottom - do you see something like [INFO:root:winnies's coin (100%🔋) authenticated]?

Tips and Tricks

  • The service uses a very simple database to save all the required names and keys. It is saved in the central.txt, coins.txt and names.txt files.
  • Every line in coins.txt represents a coin as a space-separated tuple of (address, irk, ltk, spacekey). If you remove a line and restart the service, the respective coin will no longer be able to connect.
  • Each line in names.txt represents an optional name for a coin's address as a space-separated tuple of (address, name). Edit as you like - it will not affect authentication - but don't break the format. Changes will only be applied on service restart.