19
DNSSEC Keys in SmartcardHSM OpenSC on Mac OS Luis D Espinoza Sanchez & Eberhard W Lisse University of Costa Rica & Namibian Network Information Centre 2015-02-09 Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 1 / 19

DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

DNSSEC Keys in SmartcardHSMOpenSC on Mac OS

Luis D Espinoza Sanchez & Eberhard W Lisse

University of Costa Rica & Namibian Network Information Centre

2015-02-09

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 1 / 19

Page 2: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Introduction

DNSSEC is Easy!

Is it Secure?

Secure DNSSEC is Expensive!

Is it really?

So, what were we looking for?

An easy, secure and cheap DNSSEC solution

for .NA;for demonstration purposes;for fun (see slide 19)

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 2 / 19

Page 3: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

IntroductionRegistry System without DNSSEC

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Page 4: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

IntroductionRegistry System with DNSSEC

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 4 / 19

Page 5: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

IntroductionHardware Keys

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 5 / 19

Page 6: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

IntroductionWhy Mac?

SmartcardHSM

Di�erent Brands

Smartcard Readers

Di�erent Brands

Open Source So�ware

OpenSCBIND 9

HomebrewMacPorts

Virtual Box

Centos 6

OS X 10.10.2

Native Drivers for the Readers

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 6 / 19

Page 7: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Proof of ConceptNot Production Grade. Yet.

Why Mac?

Name Servers usually don’t run on Netbooks

BSDUbuntuCentos

It’s fun (see slide 19)

No auditing (Ceremony)

Can be added later from Richard Lamb’s Ceremony documentation

Key in Hardware adds some security

Physical Access to Server is required

Servers are usually in secure data center

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 7 / 19

Page 8: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

ImplementationBash

Consolidate Richard Lamb’s Ceremony Scripts

into 1 single script50 lines

dialogto display/modify Environment Variables

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 8 / 19

Page 9: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Set Environment VariablesBash

DATE=‘date -u +%Y%m%d%H%M%S‘DOMAIN=naPASSWORD=RichardLambPATH=~/Downloads/dccom:$PATHPIN1=123456PKCS11_LIBRARY_PATH=/Library/OpenSC/lib/opensc-pkcs11.soSOPIN="3537363231383830"CKALABEL="ksk.""$DOMAIN"".""$DATE"

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 9 / 19

Page 10: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

InitializationPrepare the Card

sc-hsm-tool –initialize –so-pin $SOPIN \–pin $PIN1

Erase the Card

sc-hsm-tool –initialize –so-pin $SOPIN \–pin $PIN1 –dkek-shares 2

Device Key Encryption Key (DKEK) shares are used to derive theactual keys

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 10 / 19

Page 11: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Create 2 DKEK Shares

sc-hsm-tool –create-dkek-share dkek-share-1.pbe \–so-pin $SOPIN –pin $PIN1 \–password $PASSWORD

sc-hsm-tool –create-dkek-share dkek-share-2.pbe \–so-pin $SOPIN –pin $PIN1 \–password $PASSWORD

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 11 / 19

Page 12: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Import the DKEK Shares

sc-hsm-tool –import-dkek-share dkek-share-1.pbe \–so-pin $SOPIN –pin $PIN1 \–password $PASSWORD

sc-hsm-tool –import-dkek-share dkek-share-2.pbe \–so-pin $SOPIN –pin $PIN1 \–password $PASSWORD

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 12 / 19

Page 13: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Generate 2 ZSKsWhy 2?

dnssec-keygen -r /dev/random -a 8 -b 1024 \$DOMAIN.

dnssec-keygen -r /dev/random -a 8 -b 1024 \$DOMAIN.

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 13 / 19

Page 14: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Generate KSK Inside the Card

pkcs11-tool –module $PKCS11_LIBRARY_PATH \-l –pin $PIN1 –keypairgen –key-type rsa:2048 \–read-object –type pubkey \–output-file "$CKALABEL"".pub" \–label "$CKALABEL"

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 14 / 19

Page 15: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

VerificationDump the Card

pkcs15-tool -D

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 15 / 19

Page 16: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Wrap the KeyExport and encrypt (wrapped with shares) copy of the private key

sc-hsm-tool –wrap-key "$CKALABEL"".wrap" \–key-reference 1 –pin $PIN1

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 16 / 19

Page 17: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

hcardsign (Bash script)Generate pre-KSK-signed DNSKEY RRsets for future use

relies on

pkcs11-backup -f$CKALABEL:8:257:$DOMAIN. \-S 0 -P $PIN1Open Source (Richard Lamb)

Doesn’t currently compile on the MacWill do so RSN

Not an issue

Works on LinuxNot required in production

Less Safe

Demonstrated here only to show functionality

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 17 / 19

Page 18: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

Make Backup Card From Wrapped KeyRepeat steps for additional cards

sc-hsm-tool –initialize –so-pin $SOPIN –pin $PIN1sc-hsm-tool –initialize –so-pin $SOPIN \–pin $PIN1 –dkek-shares 2sc-hsm-tool –import-dkek-share dkek-share-1.pbe \–so-pin $SOPIN –pin $PIN1 \–password $PASSWORDsc-hsm-tool –import-dkek-share dkek-share-2.pbe \–so-pin $SOPIN –pin $PIN1 \–password $PASSWORDsc-hsm-tool –unwrap-key $CKALABEL"".wrap" \–key-reference 1 –pin $PIN1

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 18 / 19

Page 19: DNSSEC Keys in SmartcardHSM - ICANN › meetings › singapore2015 › ... · Introduction Registry System without DNSSEC Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 3 / 19

The Real ReasonThis is fun!

Espinoza & Lisse (NA-NiC) SmartcardHSM 2015-02-09 19 / 19