## 2FA Device from Scrap
[![2FA Device from Scrap](https://developer.run/pic/2fa_small.png)](https://developer.run/pic/2fa.png) Let me tell you about a gadget that I'm especially proud of. It's not elegant or inventive in any way, but I really like it, because it was built from scrap parts, extremely simple and does its job well. The requirement was to create 2FA device, so multiple persons could use it. One of the possible solutions could be to use an old smartphone, but you know about [security of old smartphones](https://www.tomsguide.com/us/old-phones-unsafe,news-24846.html) right? ### Hardware 1. Raspberry Pi (the first one), some case and SD card 1. Old credit card, because it holds screws well, and is easy to shape using a stationery knife 1. NumPad Keyboard because it has arrows `↑`, `↓` necessary to scroll through Bash history and `Enter` key. (Sometimes you need to connect a full keyboard to do maintenance) 1. [RTC module](https://www.google.com/search?tbm=isch&q=DS3231+raspberry+pi) to keep time while Raspberry is off 1. Some random 1.8 20x8 display. Can't remember where it came from, but it was less than 5 bucks on eBay 1. Lots of duct tape ### Software 2FA keys are really simple. [This article](https://thirld.com/blog/2016/01/16/generating-two-factor-authentication-codes-on-linux/) explains the approach. Basically, the device runs minimal Linux with `oathtool` installed. Bash shell is shown, and all you do is scroll through `oathtool --base32 --totp "$(cat keyfile.key)"` history using `↑`, `↓` arrows. New keys are copied using USB. The device is secure because it will be never connected to the internet. For some reason [miniwi.flf](https://github.com/xero/figlet-fonts/blob/master/miniwi.flf) [figlet font](https://developer.run/26) is not working in tty, so I've created [simple script](https://github.com/dmi3/bin/blob/master/print-numbers.py) to draw fonts especialy designed for 20x8 screens: ``` ▐ ██ ██ ▌▐ ██ ██ ▐ ▐ ▐ ▌▐ ▌ ▌ ▐ ██ ██ ██ ██ ██ ▐ ▌ ▐ ▐ ▐ ▌▐ ▐ ██ ██ ▐ ██ ██ ``` ↑ This should look like image bellow if your fonts are not messed up: ![Font for 20x8 screens](//developer.run/pic/2fa_font.png) 🏷️DIY