Skip to content

TFA

4 posts with the tag “TFA”

Encrypted credentials for Amazon AWS command line client

In this quick post I will show you how to use the password manager “password-store1 to securely store your credentials used by the Amazon Webservices command line client.

AWS CLI Logo
AWS CLI Logo.

The installation for Mac and Linux system is fairly easy:

Terminal window
pip install awscli

The credentials are stored as key-value pairs inside a PGP-encrypted file. Every time you call the AWS CLI tool, your keys will be decrypted and directly passed to the aws tool.

Use pass to add your keys in the store:

Terminal window
pass edit providers/aws

An editor opens. Use the following format:

User: stv0g
Access-Key: AKB3ASJGBS3GOMXK6KPSQ
Secret-Key: vAAABn/PMAksd235gAs/FSshhr42dg2D4EY3

Add the following snippet to your ~/.bashrc:

Terminal window
function aws {
local PASS=$(pass providers/aws)
local AWS=$(which aws)
# Start original aws executable with short-lived keys
AWS_ACCESS_KEY_ID=$(sed -En 's/^Access-Key: (.*)/\1/p' <<< "$PASS") \
AWS_SECRET_ACCESS_KEY=$(sed -En 's/^Secret-Key: (.*)/\1/p' <<< "$PASS") $AWS $@
}

Then use the cli tool aws as usual:

Terminal window
aws iam list-access-keys { "AccessKeyMetadata": [ { "UserName": "stv0g", ...`
  1. I covered password-store already a few times earlier: Use YubiKey and Password-store for Ansible credentials, Workshop: Security Token.

Use Yubikey and Password-store for Ansible credentials

I spent some time over the last months to improve the security of servers and passwords. In doing so, I started to orchestrate my servers using a configuration management tool called Ansible. This allows me to spin-up fresh servers in a few seconds and to get rid of year-old, polluted and insecure system images.

Ansible loves Yubico
Ansible loves Yubico.

My ‘single password for everything’ has been replaced by a new password policy which enforces individual passwords for every single service. This was easier than I previously expected:

To unlock the ‘paranoid’ level, I additionally purchased a Yubikey Neo token to handle the decryption of my login credentials in tamper-proof hardware. ‘pass’ is just a small shell script to glue several existing Unix tools together: Bash, pwgen, Git, xclip & GnuPG (obeying the Unix philosophy). The passwords are stored in simple text files which are encrypted by PGP and stored in a directory structure which is managed in a Git repository.

Yubikey Neo und Neo-n
Yubikey Neo und Neo-n.

There are already a tons of tutorials which present the tools I describes above. I do not want to repeat all of it. So, this post is dedicated to solve some smaller issues I encountered.

Workshop: Security Token

Der Open Source Arbeitskreis (OSAK) der Fachschaft FSMPI, veranstaltet nun zum zweiten Mal eine Crypto Party auf der sich Interessierte über Verschlüsselung und verwandte Themen informieren können.

Ich möchte hier die Gelegenheit nutzen um etwas Werbung für diese Veranstaltung zu machen. Genaue Infos findet Ihr unten im Flyer.

Dieses Mal wird es auch einen kleinen Workshop von mir geben:

„I know none of my passwords“

Ich werde in circa 20 Min eine kurze Übersicht über Security Tokens wie beispielsweise den Yubikey oder die OpenPGP Smartcard geben. Dabei wird der Fokus auf verschiedenen Anwendungsszenarien wie One-Time-Passwords, Logins, sowie E-Mail Verschlüsselung liegen.

Update: Hier sind die Vortragsfolien und das Handout:

Download:Präsentation
Download:Handout
Cryptoparty im Sommersemester 2015
Cryptoparty im Sommersemester 2015.

HIDeKey

HIDeKey USB Security Token
HIDeKey USB Security Token.

Als Abschlussprojekt und Vorbereitung auf meine Betreuer Tätigkeit für die Mikrocontroller-AG des MMI’s habe ich mich näher mit dem USB-Bus und dem darauf aufbauenden HID-Protokoll befasst.

HIDeKey ist ein kleiner USB-Stick, der als HID-Tastatur vom Rechner erkannt wird und beliebge Zeichenketten und Tastenkombinationen an den Host-Rechner senden kann.

Mein Ziel war es ein kleinen Hardware-Dongle zu entwickeln welcher Passwörter, TANs und Onetime-Tokens direkt an jeden beliebigen Rechner senden kann. Meine Passwörter sind im verschlüsselt EEPROM des Mikrocontrollers gespeichert. Beim Drücken, des Tasters auf dem Stick, wird das Passwort eingegeben.

Als Hardware nutze ich die zuvor vorgestellten USBasp Programmieradapter aus China, deren Firmware ich durch eine eigene ersetzt habe. Mit einem zusätzlichen Taster lässt sich so über ein kleines Menü zwischen 10 User-Passwort-Kombination wählen.

Neue Passwörter können mit einem kleinen Konsolen-Programm direkt über den Rechner einprogrammiert werden.

HIDeKey soll auch zur Generierung von One Time Passwords (OTP) genutzt werden können. Da er sich wie ein gewöhnliche USB-Tastatur verhält, kann er auch unterwegs am Schlüsselbund in Internet-Cafes und Rechner-Pools genutzt werden.

Quelltext und Schaltpläne gibt auf Codeberg: /stv0g/hidekey .

In meinem Wiki ist auch noch etwas Dokumentation gesammelt.

HIDeKey ist wie die meisten meiner Projekte als OpenSource veröffentlicht. Ich freue mich über jede Verbesserung, Erweiterung oder andere Beiträge zu diesem Projekt 😊.