BGP Rpki
BGP Rpki
2 v1.0
Headlines
https://blog.qrator.net/en/how-you-deal-route-leaks_69/
3 v1.0
Headlines
https://twitter.com/atoonk/status/1143143943531454464/photo/1
4 v1.0
Headlines
104.16.16.0/20
AS33154
[DQE] AS3356
[Level3]
104.16.16.0/21
104.16.24.0/21
104.16.16.0/20
AS396531
[ATI] AS13335
104.16.16.0/21
104.16.24.0/21
AS701
Internet
[Verizon]
5 v1.0
Headlines
6 v1.0
Headlines
https://blog.thousandeyes.com/internet-vulnerability-takes-down-google/
7 v1.0
Headlines
q Its peers, like AS6939 (HE), shared these routes with 100s of their
own peers…
q The motive?
§ During the period, DNS servers in the hijacked range only responded to queries
for myetherwallet.com
§ Responded with addresses associated with AS41995/AS48693
8 v1.0
Headlines
9 v1.0
Headlines
10 v1.0
Headlines
After leak
(JP->JP)
https://dyn.com/blog/large-bgp-leak-by-google-disrupts-internet-in-japan/
11 v1.0
Headlines
12 v1.0
Why do we keep seeing these?
13 v1.0
Why do we keep seeing these?
14 v1.0
Why do we keep seeing these?
• Routing is VARIABLE
q The view of the network depends on where you are
§ Different routing outcomes at different locations
15 v1.0
Why do we keep seeing these?
16 v1.0
Why do we keep seeing these?
17 v1.0
Why should we worry?
18 v1.0
How do we address these?
19 v1.0
Current practice
LOA Check
20 v1.0
Tools & Techniques
LOA Check
Whois Letter of
IRR (RPSL)
(manual) Authority
21 v1.0
Tools & Techniques
• Look up whois
q verify holder of
a resource
22 v1.0
Tools & Techniques
23 v1.0
Tools & Techniques
24 v1.0
Tools & Techniques
• IRR
q Helps auto generate network
(prefix/as-path) filters using RPSL
tools
§ Filter out route advertisements not
described in the registry
25 v1.0
Tools & Techniques
26 v1.0
Tools & Techniques
27 v1.0
Back to basics – identify GOOD
28 v1.0
How about trust?
29 v1.0
RPKI Chain of Trust
Trust Anchor
Allocation Certificate
Hierarchy
Cert
(CA)
ARIN AFRINIC APNIC LACNIC RIPE-NCC
Cert
Certificate (CA)
chain NIR
mirrors the
allocation
Cert Cert Cert
hierarchy (EE)
Cert
(EE) (EE) (EE)
ISP ISP ISP ISP
Image 4
30 v1.0
RPKI Chain of Trust
31 v1.0
RPKI profile ~ Resource Certificates
CA
RFC 3779 extensions – binds a list
Signed by parent’s private key
X.509 CERT •
of resources (IPv4/v6,ASN) to the
RFC 3779 subject of the certificate (private
EXTENSION key holder)
IP RESOURCES
(ADDRESS & ASN) • SIA (subject information access)
contains a URI that identifies the
SIA
(URI WHERE THIS PUBLISHES)
publication point of the objects
signed by the subject of the cert.
OWNER’S PUBLIC KEY
32 v1.0
Resource Certificates
q The resource certificate proves the holder of the private key (B) is
the legitimate holder of the number resource!
33 v1.0
Route Origin Authorization (ROA)
34 v1.0
Route Origin Authorization (ROA)
35 v1.0
What can RPKI do?
• Authoritatively proof:
q Who is the legitimate owner of an address, and
q Identify which ASNs have the permission from the holder to
originate the address
• Can help:
q prevent route hijacks/mis-origination/misconfiguration
36 v1.0
RPKI Components
APNIC
publication
RPKI Repository
Engine
rpki.apnic.net
MyAPNIC GUI
37 v1.0
RPKI Components
rsync/RRDP
IANA Repo
rpki.apnic.net
rsync/RRDP
APNIC RIPE Repo
Repo
rsync/RRDP RP
(RPKI Validated
rsync/RRDP Validator) Cache
LIR Repo LIR Repo
38 v1.0
RPKI Service Models
• Hosted model:
q The RIR (APNIC) runs the CA functions on members’ behalf
§ Manage keys, repo, etc.
§ Generate certificates for resource delegations
• Delegated model:
q Member becomes the CA (delegated by the parent CA) and operates
the full RPKI system
§ JPNIC, TWNIC, CNNIC (IDNIC in progress)
39 v1.0
Route Origin Validation (ROV)
2406:6400::/48
2406:6400::/48
65553 65552
40 v1.0
Route Origin Validation (ROV)
Global
(RPKI)
Repository
65551 65550 17821
ROA
rs 2406:6400::/32-48
yn
c/ 17821
RR 2406:6400::/48
DP
RPKI-to-Router 2406:6400::/48 65551 65550 17821 i Valid
(RTR)
2406:6400::/48 65553 65552 i Invalid
2406:6400::/32-48
Validator
17821
2406:6400::/48
65553 65552
41 v1.0
Route Origin Validation
42 v1.0
Validation States
• Valid
q the prefix (prefix length) and AS pair found in the database.
• Invalid
q prefix is found, but origin AS is wrong, OR
q the prefix length is longer than the maximum length
• Not Found/Unknown
q No valid ROA found
§ Neither valid nor invalid (perhaps not created)
43 v1.0
Validation States
BGP Routes
44 v1.0
Possible actions - RPKI states
• Do Nothing
• Tag
q If you have downstream customers or run a route server (IXP)
q Ex:
§ Valid (ASN:65XX1)
§ Not Found (ASN:65XX2)
§ Invalid (ASN:65XX3)
• Drop Invalids
q ~6K IPv4 & ~1.5K IPv6 routes (might want to check your top flows)
https://rpki-monitor.antd.nist.gov/index.php?p=0&s=0
45 v1.0
Are ROAs enough?
46 v1.0
AS keys (per-router keys)
CA
APNIC Training
202.125.96.0/24
AS45192
Public Key
Cert
(CA)
Cert
202.125.96.0/24 Public Key Public Key
(CA) AS45192 Encodes
APNIC Training ASN and
Public Key ROA router ID
Router EE
202.125.96.0/24 Router EE
Router EE
AS45192
AS45192
rtr-00
AS45192
rtr-00
AS45192 rtr-00
Public Key
Public Key
Public Key
47 v1.0
BGPsec (RFC8205)
AS1 -> AS2
(Signed AS1)
AS2->AS3
(signed AS2) AS3
AS1 AS2
AS1 -> AS2
AS1 -> AS2
(Signed AS1) (Signed AS1)
AS2->AS4 AS4
(signed AS2)
• More HW resources
q CPU - high crypto overhead to validate signatures, and
q Memory
§ Updates in BGPsec would be per prefix
§ New attributes carrying signatures and certs/key IDs for every AS in the AS
path
49 v1.0
AS Provider Authorization (draft but promising)
50 v1.0
ASPA Validation/Verification ~ simplified
§ Else, INVALID
51 v1.0
RPKI Further Reading
52 v1.0
Acknowledgement
53 v1.0
Implementation
54 v1.0
1. Create & publish your ROA
• Login MyAPNIC
§ Need to activate the RPKI engine to create ROAs
§ Go to Resources à Resource certification à RPKI (see image below)
55 v1.0
Create & publish your ROA
https://www.apnic.net/wp-content/uploads/2017/12/ROUTE_MANAGEMENT_GUIDE.pdf
56 v1.0
Create (publish) your ROA
57 v1.0
Create (publish) your ROA
58 v1.0
Create (publish) your ROA
59 v1.0
Create (publish) your ROA
60 v1.0
Create (publish) your ROA
61 v1.0
Check your ROA
http://nong.rand.apnic.net:8080/roas
62 v1.0
Check your ROA
63 v1.0
Check your ROA
64 v1.0
Check your ROA
https://bgp.he.net/
65 v1.0
Check your ROA
https://rpki.cloudflare.com/
66 v1.0
Global ROA Status
67 v1.0
Global ROA Status
68 v1.0
Rise of Invalids L
https://blog.apnic.net/2020/04/10/rise-of-the-invalids/
69 v1.0
2. Deploy RPKI Validator
• Many options:
q RIPE RPKI Validator
https://www.ripe.net/manage-ips-and-asns/resource-management/certification/tools-and-resources
q Routinator
https://github.com/NLnetLabs/routinator
70 v1.0
3. Router Configuration (IOS)
• Note:
q Cisco IOS by default does not include invalid routes for best path selection!
q If you don’t want to drop invalids, we need explicitly tell BGP (under respective address
families)
71 v1.0
Configuration (IOS)
72 v1.0
Configuration (IOS)
73 v1.0
3. Router Configuration (JunOS)
routing-options {
autonomous-system 131107;
validation {
group rpki-validator {
session <validator-IP> {
refresh-time 120;
port <323/3323/8282>;
local-address X.X.X.253;
}
}
}
}
74 v1.0
Configuration (JunOS)
75 v1.0
Router Configuration (JunOS)
protocols {
bgp {
group external-peers { group external-peers-v6 {
#output-ommitted #output-ommitted
neighbor X.X.X.1 { neighbor X6:X6:X6:X6::1 {
import ROUTE-VALIDATION; import ROUTE-VALIDATION;
family inet { family inet6 {
unicast; unicast;
} }
} }
} }
}
76 v1.0
RPKI Verification (IOS)
77 v1.0
RPKI Verification (IOS)
78 v1.0
RPKI Verification (IOS)
79 v1.0
Check routes (IOS)
#sh bgp ipv4 unicast 202.144.128.0/19
BGP routing table entry for 202.144.128.0/19, version 3814371
Paths: (1 available, best #1, table default)
Advertised to update-groups:
2
Refresh Epoch 15
4826 17660
49.255.232.169 from 49.255.232.169 (114.31.194.12)
Origin IGP, metric 0, localpref 110, valid, external, best
Community: 4826:5101 4826:6570 4826:51011 24115:17660
path 7F50C7CD98C8 RPKI State valid
rx pathid: 0, tx pathid: 0x0
80 v1.0
RPKI Verification (JunOS)
81 v1.0
RPKI Verification (JunOS)
----------
2001:200::/32-32 2500 202.125.96.46 valid
2001:200:136::/48-48 9367 202.125.96.46 valid
2001:200:900::/40-40 7660 202.125.96.46 valid
2001:200:8000::/35-35 4690 202.125.96.46 valid
2001:200:c000::/35-35 23634 202.125.96.46 valid
2001:200:e000::/35-35 7660 202.125.96.46 valid
82 v1.0
RPKI Verification (JunOS)
IPv4 records: 2
IPv6 records: 1
83 v1.0
Check routes (JunOS)
84 v1.0
Propagating RPKI states to iBGP peers
0x4300:0:0
0x4300:0:1
0x4300:0:2
§ Sender (one with RTR session) attaches the extended community to Updates, and receiver derives
the validation states from it
§ Must be enabled on both sender and receiver!
85 v1.0
Propagating RPKI states (IOS)
86 v1.0
Propagating RPKI states (IOS)
§ If announce rpki state is not configured for the neighbor, all prefixes received
from the iBGP neighbor will be marked VALID!
87 v1.0
Propagating RPKI states (JunOS)
88 v1.0
Propagating RPKI states (JunOS)
policy-statement ROUTE-VALIDATION-1 {
term valid {
from community origin-validation-state-valid;
then validation-state valid;
}
term invalid {
from community origin-validation-state-invalid;
then validation-state invalid;
}
term unknown {
from community origin-validation-state-unknown;
then validation-state unknown;
}
89 v1.0
Operational Considerations
• Max-length
q Make sure the value covers your BGP announcements
• minimal ROAs
q Reduce spoofed origin-AS attack surface
§ https://tools.ietf.org/html/draft-ietf-sidrops-rpkimaxlen-03
§ ROAs should cover only those prefixes announced in BGP
90 v1.0
Operational Considerations
91 v1.0
Operational Considerations
92 v1.0
Operational Considerations
• Default routes?
q Even if you drop Invalids, default route will match anything
93 v1.0
Operational Considerations
94 v1.0
Operational Considerations
q What if one eBGP router sends Valid tag, and the other sends Not
Found:
§ If the RTR session is down on one eBGP speaker, and/or
§ Different ROA cache entry flush timers for different router vendors
(JunOS/SROS: 1hr, IOS-XE: 5mins)
95 v1.0
Other developments
96 v1.0
https://www.apnic.net/community/security/resource-certification/#routing
97 v1.0
Any questions?
98 v1.0