Go to file
2024-11-27 21:50:31 -05:00
.idea Test Makefile on Pi 2024-11-19 21:50:22 -05:00
c initial b? 2024-11-27 21:50:31 -05:00
go Config page should work 2024-11-22 13:56:43 -05:00
.gitignore Some C and Make magic 2024-11-20 08:34:30 -05:00
build.sh blah 2024-11-20 00:26:05 -05:00
README.md Remove power button bind 2024-11-27 21:31:52 -05:00

P2FA

Hardware 2FA Manager

Prep build environment:

  • LG:
wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
make
sudo make install
  • BCM2835
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install 

Required libs:

  • make
  • cmake
  • python3
  • python3-pip
  • gpiod
  • i2c-tools
  • libgpiod-dev
  • libpng-dev
  • libncurses-dev

Build

./build.sh

Executable will be in the "c" directory If moving to an alternate directory, ensure the c/libs/libgo_p2fa.so is copied.

To enable the i2c device, add the following to the bottom of /boot/firmware/config.txt

dtoverlay=i2c-rtc,ds3231,gpio-shutdown,gpio_pin=20,active_low=1,gpio_pull=up

Reference this walk through for more info
Reference this walk through to configure the power button. Make sure to use GPIO pin 20 instead of 3

Set GPIO pins

pinctrl set 6 pd
pinctrl set 12 pd
pinctrl set 13 pd
pinctrl set 16 pd
pinctrl set 19 pd
pinctrl set 20 pd
pinctrl set 22 pd
pinctrl set 27 pd

Configuration

To add a config, create a text file in the ~/.totp directory (if it doesn't exist then create it). The name of the file will be what is populated on the device.
Ex: "google.txt" will be displayed as "google"

File Format:

key: (Base32 Key, REQUIRED)
hash: (sha1, sha256, sha512, or hmac. OPTIONAL) (default is sha1)
timestep: (int representing duration in seconds between codes, default is 30, OPTIONAL)
counter: (int between 6 and 10 inclusive, HOTP counter, default is 6, OPTIONAL)
digits: (int between 1 and 10 inclusive, how many digits to generate, default is 6, OPTIONAL) 

Example:

key: GGAMSYNKW3H7HEKK
hash: sha1
timestep: 30
counter: 6
digits: 6