Dnssec 20122014
Dnssec 20122014
Workshop
Jakarta,
Indonesia
19-‐20
December
2014
Hosted
by
PANDI
Presenters
• Champika
Wijayatunga
– Security
Engagement
Manager
(APAC)
–
ICANN
[email protected]
Acknowledgements
• Dave
Piscitello,
ICANN
• Rick
Lamb,
ICANN
• Mauricio
Vergara,
ICANN
• Bill
Manning
• APNIC,
NSRC,
ISOC
Agenda
• Day
1
– DNS
Concepts
– BIND
configuraOons
– Recursive
Servers
– AuthoritaOve
Name
Servers
– Zone
delegaOons
• Day
2
– DNS
Security
– DNSSEC
– Key
management
– TroubleshooOng
Brief
Overview
of
the
DNS
5
The World’s Network – the Domain Name System
6
Functions that ICANN Coordinates
8
What is a domain?
• A
domain
is
a
node
in
the
Internet
name
space
– A
domain
includes
all
its
descendants
• Domains
have
names
– Top-‐level
domain
(TLD)
names
are
generic
or
country-‐specific
– TLD
registries
administer
domains
in
the
top-‐level
– TLD
registries
delegate
labels
beneath
their
top
level
delegaOon
.
org gov com ... AF ... ZW
icann ncfta irs ftc google msn co
www ssac google
Names in generic Top Level Domains Names in country-code TLDs
9
Root Servers
L-Root
+ Geographical diversity via Anycast
+ Around 160 dedicated servers
+ Presence on every continent
+ On normal basis 15 ~ 25 kqps
+ That is app 2 billion DNS queries a day
11
L-Root presence
12
L-Root stats
13
What is the New gTLD Program?
Internationalized Domain
Names and non Latin-based innovation
characters
Managed by ICANN =
security and
multistakeholder input
stability
14
What are the benefits?
Competition
15
1930total
number of applications received
911
675
North America
Europe
24
South America
17
303
Africa
Asia Pacific
16
Domain name registration 101
How to register a domain:
• Choose a string e.g., example!
• Visit a registrar to check string
availability in a TLD
• Pay a fee to register the name
• Submit registration information
• Registrar and registries manage:
– “string” + TLD
(managed in registry DB)
– Contacts, DNS
(managed in Whois)
– DNS, status
(managed in Whois DBs)
– Payment information
17
OperaOonal
elements
of
the
DNS
• AuthoritaOve
Name
Servers
host
zone
data
– The
set
of
“DNS
data”
that
the
registrant
publishes
• Recursive
Name
Resolvers
(“resolvers”)
– Systems
that
find
answers
to
queries
for
DNS
data
• Caching
resolvers
– Recursive
resolvers
that
not
only
find
answers
but
also
store
answers
locally
for
“TTL”
period
of
Ome
• Client
or
“stub”
resolvers
– Soeware
in
applicaOons,
mobile
apps
or
operaOng
systems
that
query
the
DNS
and
process
responses
18
DNS:
Internet’s
directory
assistance
• Client
“stub”
resolvers
What
is
the
IPv6
ask
quesOons
address
for
www.icann.org?
– Soeware
in
applicaOons,
mobile
apps
or
operaOng
systems
that
issue
DNS
queries
and
process
responses
19
Domain
name
“directory
assistance”
How
does
a
resolver
find
the
IP
address
of
ICANN.ORG?
• Resolvers
find
answers
by
asking
quesOons
iteraJvely
m.root-servers.net
Here’s
a
list
of
ORG
TLD
name
servers.
Ask
root
name
servers
for
Ask
one
of
these.
IPv6
address
of
ICANN.ORG
a0.org.afilias-nst.info
Here’s
a
list
of
ICANN
name
Ask
a0.org.afilias-‐nst.info
servers.
for
IPv6
address
of
Ask
one
of
these.
dns1.icann.org ICANN.ORG
The
IPv6
adddress
of
www.icann.org
Ask
ns.icann.org
for
2001:500:88:200::7
for
IPv6
address
of
ICANN.ORG
ns.icann.org
20
DNS Resource Records (RR)
• Unit of data in the Domain Name System
• Define attributes for a domain name
Label! !TTL !Class! Type !Data!
www ! !3600 ! IN ! A! 192.168.0.1!
}
!
server2 !A !10.20.30.40!
RRset
!
server1 !AAAA !2001:123:456::1!
server2 !AAAA !2001:123:456::2!
!!
} RRset
What is a DNS zone data?
• DNS
zone
data
are
hosted
at
an
authoritaJve
name
server
• Each
“cut”
has
zone
data
(root,
TLD,
delegaOons)
• DNS
zones
contain
resource
records
that
describe
• name
servers,
•
IP
addresses,
• Hosts,
• Services
• Cryptographic
Only
US
ASCII-‐7
leQers,
digits,
and
hyphens
keys
&
signatures…
can
be
used
as
zone
data.
In
a
zone,
IDNs
strings
begin
with
XN-‐-‐
23
Common
DNS
Resource
Records
Time to live (TTL)
• How long RRs are accurate
Start of Authority (SOA) RR
• Source: zone created here
• Administrator’s email
• Revision number of zone file
Name Server (NS)
• IN (Internet)
• Name of authoritative server
Mail Server (MX)
• IN (Internet)
• Name of mail server
Sender Policy Framework (TXT)
• Authorized mail senders
24
Common
DNS
Resource
Records
Name server address record
• NS1 (name server name)
• IN (Internet)
• A (IPv4) * AAAA is IPv6
• IPv4 address (192.168.0.1)
Web server address record
• www (world wide web)
• IN (Internet)
• A (IPv4) * AAAA is IPv6
IPv4 address (192.168.0.2)
File server address record
• FTP (file transfer protocol)
• IN (Internet)
• CNAME means “same address
spaces and numbers as www”
25
Where
can
I
get
root
zone
data?
• IANA
Root
Zone
Management
– hmp://www.iana.org/domains/root/files
Unrestricted access
(no account required)
26
What is caching? What
is
the
IPv6
• IteraOve
resolvers
may
cache
address
for
DNS
records
they
receive
icann.org
from
other
name
servers
as
My Mac
they
process
client
queries
– Speeds
up
resoluOon
– Saves
bandwidth
I’ll
cache
this
– Responses
are
non-‐authorita,ve
response
• Are
cached
records
valid
forever?
My local resolver
27
Places where DNS data lives
Master
Slave server
Registry DB
RegistraOon
Data
Directory
Services
Whois
Databases containing records of registrations
30
DNS
Security
Symmetric vs. Asymmetric Key
Symmetric
Asymmetric
generally
fast
Can
be
1000
Omes
slower
Same
key
for
both
encrypOon
and
Uses
two
different
keys
(public
and
decrypOon
private)
DecrypOon
key
cannot
be
calculated
from
the
encrypOon
key
Key
lengths:
512
to
4096
bits
Used
in
low-‐volume
Hash Functions
• produces
a
condensed
representaOon
of
a
message
(hashing)
• The
fixed-‐length
output
is
called
the
hash
or
message
digest
• A
hash
funcOon
takes
an
input
message
of
arbitrary
length
and
outputs
fixed-‐length
code.
The
fixed-‐length
output
is
called
the
hash,
or
the
message
digest,
of
the
original
input
message.
• A
form
of
signature
that
uniquely
represents
the
data
• Uses:
– Verifying
file
integrity
-‐
if
the
hash
changes,
it
means
the
data
is
either
compromised
or
altered
in
transit.
– Digitally
signing
documents
– Hashing
passwords
Hash Functions
• Message
Digest
(MD)
Algorithm
– Outputs
a
128-‐bit
fingerprint
of
an
arbitrary-‐length
input
– MD4
is
obsolete,
MD5
is
widely-‐used
• Secure
Hash
Algorithm
(SHA)
– SHA-‐1
produces
a
160-‐bit
message
digest
similar
to
MD5
– Widely-‐used
on
security
applicaOons
(TLS,
SSL,
PGP,
SSH,
S/MIME,
IPsec)
– SHA-‐256,
SHA-‐384,
SHA-‐512
are
also
commonly
used,
which
can
produce
hash
values
that
are
256,
384,
and
512-‐bits
respecOvely
• RIPEMD
– Derived
from
MD4,
but
performs
– RIPEMD-‐160
is
the
most
popular
version
DNS Security - Background
• The
original
DNS
protocol
wasn’t
designed
with
security
in
mind
– It
has
very
few
built-‐in
security
mechanism
• As
the
Internet
grew
wilder
&
wollier,
IETF
realized
this
would
be
a
problem
– For
example
DNS
spoofing
was
to
easy
• DNSSEC
and
TSIG
were
develop
to
help
address
this
problem
• Some
security
problems:
– Using
reverse
DNS
to
impersonate
hosts
– Soeware
bugs
(buffer
overflows,
bad
pointer
handling)
– Bad
crypto
(predictable
sequences,
forgeable
signatures)
– Cache
poisoning
(purng
inappropriate
data
into
the
cache)
https://wiki.tools.isoc.org/DNSSEC_History_Project
DNS Cache Poisoning
3
1
www.example.com 192.168.1.99
I want to access
www.example.com QID=64569
QID=64570 (pretending to be
the authoritative
QID=64571 match!
zone)
2
QID=64571
Client DNS Caching Root/GTLD
Server
QID=64571
3
www.example.com 192.168.1.1
Webserver
(192.168.1.1) ns.example.com
DNS Amplification
• A
type
of
reflecOon
amack
combined
with
amplificaOon
– Source
of
amack
is
reflected
off
another
machine
– Traffic
received
is
bigger
(amplified)
than
the
traffic
sent
by
the
amacker
• UDP
packet’s
source
address
is
spoofed
DNS Amplification
Root/GTLD
Queries
for
www.example.com
ns.example.com
www.example.com 192.168.1.1
Compromised
Machines
(spoofed IP)
Victim Machine
Attacker
Securing the Nameserver
• Run
the
most
recent
version
of
the
DNS
soeware
– Apply
the
latest
patches
• Hide
version
• Restrict
queries
– Allow-query { acl_match_list; };
• Prevent
unauthorized
zone
transfers
– Allow-transfer { acl_match_list; };
• Run
BIND
with
the
least
privilege
(use
chroot)
• Randomize
source
ports
– don’t
use
query-source
opOon
• Secure
the
box
• Use
TSIG
and
DNSSEC
TransacOon
Signature
(TSIG)
DNS Protocol Vulnerability
• DNS
data
can
be
spoofed
and
corrupted
between
master
server
and
resolver
or
forwarder
• The
DNS
protocol
does
not
allow
you
to
check
the
validity
of
DNS
data
– Exploited
by
bugs
in
resolver
implementaOon
(predictable
transacOon
ID)
– Polluted
caching
forwarders
can
cause
harm
for
quite
some
Ome
(TTL)
– Corrupted
DNS
data
might
end
up
in
caches
and
stay
there
for
a
long
Ome
• How
does
a
slave
(secondary)
know
it
is
talking
to
the
proper
master
(primary)?
DNS: Data Flow
Zone administrator
1"
4"
Zone file master Caching forwarder
2"
3" 5"
Dynamic
updates
slaves
resolver
DNS Vulnerabilities
Corrupting data" Impersonating master"
Cache impersonation"
Zone administrator
1"
4"
Zone file master Caching forwarder
2"
3" 5"
Dynamic
updates
slaves
resolver
Cache pollution by"
Data spoofing"
Unauthorized updates"
Dynamic
updates
slaves
resolver
Unauthorized updates"
What is TSIG?
• A
mechanism
for
protecOng
a
message
from
a
primary
to
secondary
and
vice
versa
• A
keyed-‐hash
is
applied
(like
a
digital
signature)
so
recipient
can
verify
the
message
– DNS
quesOon
or
answer
– &
the
Omestamp
• Based
on
a
shared
secret
-‐
both
sender
and
receiver
are
configured
with
it
– TSIG/TKEY
uses
DH,
HMAC-‐MD5,
HMAC-‐SHA1,
HMAC-‐SHA224,
HMAC-‐SHA512
among
others
What is TSIG - Transaction
Signature?
• TSIG
(RFC
2845)
– authorizing
dynamic
updates
&
zone
transfers
– authenOcaOon
of
caching
forwarders
• Used
in
server
configuraOon,
not
in
zone
file
TSIG example
verification"
AXFR" AXFR"
Slave" Master"
KEY:
KEY:
%sgs!f23fv! %sgs!f23fv!
Response: Zone"
SOA " SOA "
…" …"
SOA" SOA"
verification"
TSIG steps
1. Generate
secret
4. Test
TSIG - Names and Secrets
• TSIG
name
– A
name
is
given
to
the
key,
the
name
is
what
is
transmimed
in
the
message
(so
receiver
knows
what
key
the
sender
used)
>ls
Kns1-ns2.pcx.net.+157+15921.key
Kns1-ns2.pcx.net.+157+15921.private
TSIG – Generating a Secret
• TSIG
should
never
be
put
in
zone
files
– might
be
confusing
because
it
looks
like
RR:
Dynamic
updates
slaves
resolver
!
mailbox !A !192.168.10.2 !!
!! ! !NSEC www.example.net. A NSEC RRSIG!
WWW ! !A !192.168.10.3 !!
!! ! !TXT !Public webserver!
!! ! !NSEC example.net. A NSEC RRSIG TXT!
Delegation Signer (DS)
• Establishes
the
chain
of
trust
from
parent
to
child
zones
• Found
in
the
parent’s
zone
file
• In
this
example,
irrashai.net
has
been
delegated
from
.net.
This
is
how
it
looks
like
in
.net
zone
file
Key ID
irrashai.net. IN NS ns1.irrashai.net.
NS ns2.irrashai.net. DNSKEY algorithm (RSASHA1)
IN DS 19996 5 1 (
CF96B018A496CD1A68EE7 Digest type: 1 = SHA1
C80A37EDFC6ABBF8175 ) 2 = SHA256
IN DS 19996 5 2 (
6927A531B0D89A7A4F13E11031
4C722EC156FF926D2052C7D8D70C50
14598CE9 )
Delegation Signer (DS)
• DelegaOon
Signer
(DS)
RR
indicates
that:
– delegated
zone
is
digitally
signed
– indicated
key
is
used
for
the
delegated
zone
• Parent
is
authoraOve
for
the
DS
of
the
childs
zone
– Not
for
the
NS
record
delegaOng
the
childs
zone!
– DS
should
not
be
in
the
childs
zone
Types of Keys
• Zone
Signing
Key
(ZSK)
– Sign
the
RRsets
within
the
zone
– Public
key
of
ZSK
is
defined
by
a
DNSKEY
RR
• Key
Signing
Key
(KSK)
– Signed
the
keys
which
includes
ZSK
and
KSK
and
may
also
be
used
outside
the
zone
• Trusted
anchor
in
a
security
aware
server
• Part
of
the
chain
of
trust
by
a
parent
name
server
• Using
a
single
key
or
both
keys
is
an
operaOonal
choice
(RFC
allows
both
methods)
Creation of keys
• Zones
are
digitally
signed
using
the
private
key
• Can
use
RSA-‐SHA-‐1,
DSA-‐SHA-‐1
and
RSA-‐MD5
digital
signatures
• The
public
key
corresponding
to
the
private
key
used
to
sign
the
zone
is
published
using
a
DNSKEY
RR
Chain of Trust
• DNSSEC
is
based
on
trust
• Root
is
on
top
of
the
chain
of
trust.
– Root
servers
were
signed
on
July
15,
2010.
ImplemenOng
DNSSEC
Setting up a Zone
• Enable
DNSSEC
in
the
configuraOon
file
(named.conf)
– dnssec-enable yes; dnssec-validation yes;
• Create
key
pairs
(KSK
and
ZSK)
– dnssec-keygen -a rsasha1 -b 1024 -n zone
champika.net
• Publish
your
public
key
• Signing
the
zone
• Update
the
config
file
– Modify
the
zone
statement,
replace
with
the
signed
zone
file
• Test
with
dig
Updating the DNS Configuration
• Enable
DNSSEC
in
the
configuraOon
file
(named.conf)
options {
directory “….”
dnssec-enable yes;
dnssec-validation yes;
};
• Other
opOons
that
can
be
added
later
– auto-dnssec { off | allow | maintain} ;
– These
opOons
are
used
to
automate
the
signing
and
key
rollover
Creating key pairs
• To
create
ZSK
• To create KSK
Note: There
has
to
be
at
least
one
public/private
key
pair
for
each
DNSSEC
zone
Publishing your public key
• Using
$INCLUDE
you
can
call
the
public
key
(DNSKEY
RR)
inside
the
zone
file
$INCLUDE /path/Kchampika.net.+005+33633.key ;
ZSK
$INCLUDE /path/Kchampika.net.+005+00478.key ;
KSK
dnssec-signzone –o champika.net –k
Kchampika.net.+005+40000 db.champika.net
Kchampika.net.+005+33633