start	end	text
0	5200	Next up we have Carl Kosher talking about enabling HTTPS for home network devices using
5200	13900	Let's Encrypt. All right. Thanks. So I'm Carl Kosher. I'm a research scientist at the
13900	19440	University of Washington doing wireless and embedded system security. I'm going to talk
19440	27720	about some of the challenges of using TLS on home network devices or other internal network
27720	37180	devices and a way to easily issue certificates for these devices. So why is TLS important?
37180	41820	Isn't, you know, WPA on your network enough? I mean, it's already encrypting and
41820	47840	authenticating your communication. Well, as it turns out, browsers are really pushing for
47840	54600	TLS these days. Chrome and some other browsers are now requiring TLS to use certain
54600	65500	powerful APIs such as accessing the user's web camera or running service workers or pushing
65500	74080	notifications. And so if you want to write an app that uses these, what they call powerful
74080	83560	features, you need to serve that over TLS. And the problem with that is if you want to make a
83560	89820	web application that uses those features and also communicates with local network devices,
89820	98020	you can't really do that because it also blocks cross-origin requests from a secure origin to
98160	107360	a non-secure origin. And so to make this a bit more concrete, I was trying to write an app for
107360	115140	the Chromecast which requires applications to be served over HTTPS to connect to this HD
115140	125780	home run TV tuner so that I could watch TV channels on my TV through my Chromecast while it
125780	137340	connects to the TV tuner and pulls down the impact stream. The problem is that, so the
137340	143680	HD home run device, it gets its IP address. However, because the HD home run device only
143680	150340	speaks HTTP, it can't actually do that cross-origin request to get that, uh, impact data
150340	158540	stream. And so this is sort of the problem that really, um, uh, caused me to, to look at this
158540	167320	issue. So why is, uh, doing local TLS hard? Well, uh, as I alluded to, um, local TLS is
167940	175960	often discovered by their IP address and not by a particular host name. Uh, TLS certs, on
175960	181940	the other hand, are issued for a specific host name. So, um, in the common name or the, uh,
181940	186860	subject alternate name, you have a list of, uh, fully qualified domain names that a
186860	193100	certificate is valid for. And, um, so if you're just connecting to an IP address, uh, that
193100	203720	doesn't match what it is in the, the certs. Some, uh, device manufacturers will, uh, ship a
203720	210620	cert, uh, on the device, uh, and that certificate is the same across all devices. Uh, however,
210620	216500	that can be easily abused. Um, you might remember the super fish scandal that happened
216500	224660	several years ago. Basically, uh, this software, uh, pre-installed a, uh, certificate, um, that
224660	233440	was, uh, used as a CA certificate that could, uh, sign, uh, any host name, uh, whatsoever. And
233440	240060	the problem there was that the private key was shared across all laptops and so anyone with
240060	247000	the super fish software could then create, uh, certificates for any domain name. Um, so you
247000	254720	can also do that, uh, when you have shared certificates across these network devices. Uh,
254720	259900	even if you do unique certificates, again, because you're, uh, discovering these devices
259900	267820	by IP address, um, they will often be for a common host name like, uh, router dot homeland
267820	275020	dot com or something like that. And so if you have any of these certificates, uh, you can get
275020	285660	them re- you can, um, basically use those to, uh, do man in the middle attacks on, uh, on that
285660	293160	domain name. Um, if you want to do something with, like, let's encrypt, uh, the problem there
293160	299860	is that a lot of end users typically don't own a domain. Uh, I imagine most people in this room
299860	306820	probably do, but, uh, real users don't. Uh, and so there's not really, uh, a domain that
306820	314020	people can use to, uh, get their own certificate. And finally, even if they do have their own
314020	320260	domain name and they want to get a domain with let's encrypt, uh, these local devices aren't
320260	326260	externally facing, so the typical way of using certbot to automatically generate these
326260	331840	certificates, uh, doesn't really work because, uh, let's encrypt can't talk back to the
331840	338900	device to verify, uh, domain ownership or control. So it turns out that one company has
338900	346720	actually solved this issue and that company is Plex. So Plex is, uh, well, it's a little
346720	355740	sketchy, but it's basically, uh, Netflix for your own, uh, home media, um, server. And, uh,
355740	366440	the way that they solved it is they issue each server a 16 byte GUID and then Plex issues a
366440	374240	wildcard cert for this GUID dot Plex dot direct. And so whenever you want to talk to your
374240	381940	Plex server on a particular IP address, you go to IP address dot GUID dot Plex dot direct and
381940	388480	they have name servers set up that automatically resolve that, uh, directly to A dot B dot C
388480	395040	dot D. Now this seems a little weird, but, um, the key here is that by going to that fully
395040	401280	qualified domain name instead of an IP address, um, the, uh, fully qualified domain name
401280	407140	matches with the wildcard cert that the server has, uh, and then the connection is trusted
407140	414160	automatically. And so this allows for, um, uh, friends to connect to your server over the
414160	420720	internet. Even if you have a dynamic, uh, IP address from your ISP, it also, uh, lets you
420720	427800	connect directly, uh, on internal, um, like 192 dot 168, uh, IP addresses as well and
427800	434880	everything is, uh, nice and secure. So, Plex partnered with, uh, certificate authority to
434880	441880	issue these certs and that's kind of costly and, uh, most IOT vendors won't bother doing
441880	447680	this. So, I was wondering if we could actually use Let's Encrypt which provides free
447680	454560	certificates to do this and as it turns out, you actually can. So, let's talk a little bit
454560	459780	about how Let's Encrypt, uh, automatically issues certificates. So, they use what's known
459780	464460	as the ACME protocol, the automation, uh, automated certificate management environment
464460	470980	protocol and this is implemented by, uh, a client called Certbot and by, uh, CA software
470980	478520	called Boulder and this is a way to, uh, basically automate, uh, domain validation to prove
478520	486820	that you have control over a domain that you want, um, a certificate for. Uh, so, the way
486820	493540	that this, that the ACME protocol works is that the certificate authority issues you a
493540	499280	challenge, uh, to prove, uh, control over a domain that you want a certificate for. And
499380	503340	there's a couple of different types of challenges, uh, the two main ones right now are
503340	511080	HTTP01 where the, uh, certificate authority asks you to create a file at a specific URL with,
511080	516500	uh, specific contents and it verifies that you put that file there and if you did, uh, then you
516500	521080	have control over that domain and they give you a certificate for that. There's also DNS01
521080	529680	where you add a text record, um, for the domain name, uh, with a, a specific content, uh, uh,
530200	538760	secure token, uh, and, uh, this is the only way to get, uh, wild card certificates, um, but it's
538760	546660	nice that they do, uh, give you wild card certificates now. Um, so for accounts, um,
546660	553920	basically they are associated with a public private key pair. Um, you're the, so you
553920	559720	automatically generate this private key, um, and derive the public key from that and that
559720	565580	public key is essentially your account ID. Now they do have sort of, uh, an internal account
565580	571640	ID that you actually use, um, for efficiency and, and other reasons, but basically your
571640	577420	account is this public private key pair and you use this private key that you generate
577420	581480	yourself to sign all requests, including the initial registration with Let's Encrypt
581480	587600	where you tell them that you agree to the terms of service and, and so on and so forth. Uh, so
587600	596880	my proposed solution for, um, using Let's Encrypt, uh, for local devices is, um, this service
596880	603840	that I'm calling TLS my net, which lets you issue wild card certificates for subdomain that
603840	611460	is tied to your Let's Encrypt, uh, account public key. So, time is of the essence and
611480	620040	tying the, um, the subdomain to your Let's Encrypt account, uh, basically lets you verify
620040	628160	legit, legitimacy at an application level. Um, so, uh, you know that you are always going to
628160	633660	talk to your server at a particular subdomain and as long as that subdomain matches, you
633660	641340	know that, um, the private, uh, that at least someone with the corresponding private key, um,
641340	647320	proved, uh, that they had that private key and they, um, got a certificate for that domain.
647840	655220	So, the basic way that this works is you use, uh, Let's Encrypt, um, as normal, but, uh,
655220	663540	instead of proving, um, control over your own domain, you ask a third party, uh, to, uh,
663540	671320	prove control of a subdomain, um, and, uh, that third party then, um, um, can, um,
671960	677800	solves that challenge for you by creating that text record. So, the way that this works is the
677800	682740	device initiates a subdomain wildcard certificate request with Let's Encrypt. Let's
682740	688500	Encrypt says, okay, here's a DNS challenge. Uh, the device then sends that challenge
688500	694960	request to TLS MyNet. This request is signed with the public key using, uh, JSON web
694960	702880	signatures. Uh, the thumbprint of the corresponding public key, um, is used as the
702880	708420	subdomain, uh, and because of limitations of DNS, we actually have to encode this as a base
708420	716720	36, which is kind of icky, but, um, it, it works. Uh, and basically the, the public private
716720	721880	key pair here is the same, uh, public private key that is tied to your Let's Encrypt
721880	730880	account. Uh, so this is currently implemented in, uh, 2 Python scripts, um, uh, that are on
730880	738040	GitHub right now and I'll, uh, give you that URL later. The first is, uh, DNS server.py and
738040	745840	this does 2 things primarily. One, it resolves, uh, that, uh, IP address dot thumbprint dot
745840	751860	TLS my dot net to that IP address. Um, so it, it handles that for you. The second, uh,
751880	758600	second is that it also resolves these, uh, text records, um, that are used for, uh,
758600	766300	subdomain, uh, verification with Let's Encrypt. Uh, it uses this library called DNSlib, which,
766300	773160	uh, lets you easily create, uh, DNS clients and serve, uh, servers, uh, using Python. Right
773160	779060	now the server is sort of, uh, single threaded and synchronous and so there could
779060	784520	theoretically be some performance issues, but, uh, I'm planning on migrating that to, uh,
784520	792500	Python's async IO, uh, fairly shortly. Uh, the second half of this, uh, system is the, the web
792500	798520	server, which receives these requests, uh, for creating these text records to respond to
798520	803820	these challenges. Uh, this does use async IO, so even though it's single threaded, um, it
803820	809280	can handle multiple requests and while it's waiting on one, it can service another. Uh, and
809280	816460	it uses, uh, also this, uh, JWcrypto library for doing, uh, JSON web signatures and, and JSON
816460	820820	web keys and things like that. And then in between there's just a standard Redis server
820820	827840	that's a temporary, uh, key value store for storing, um, specific text records, uh, for
827840	835780	specific subdomains. Um, and those, uh, those last for 5 minutes. Um, and so the nice thing
835780	844040	here is that really there doesn't need to be any state that you actually store on this server. Uh,
844040	851860	you just need the, the key value store long enough to, uh, do the domain verification. Um, you
851860	857820	don't need accounts because, uh, those are automatically proven by using the public
857840	866680	uh, private key pairs. Uh, and, uh, you know, the resolving an IP address, uh, is, you know,
866680	873580	straightforward. So, currently this is still, uh, a work in progress. Um, there is a test
873580	881960	client right now, uh, on GitHub that, uh, sends a, uh, request to create a challenge, um, to
881960	887480	the web server. Uh, it, it could be better, um, but, you know, hopefully that's coming
887480	896720	soon. Um, I am planning on integrating this with CertBot as a plug-in. However, there's a, a
896720	906100	little, um, issue there where the, uh, CertBot plug-ins don't automatically expose the
906100	911040	account, uh, public and private keys to, uh, the extensions there. So, that's a little
911040	916080	issue I'll, I'll have to work through. The server currently has a little brokenness with case
916080	921640	sensitivity, but, but I'm going to fix that today. Um, it, uh, I have tested it and it does
921640	927920	work and as I said before, uh, the DNS server will be modified to use, uh, async IO for a bit
927920	934920	more performance. Um, so the code is up right now on GitHub, on, uh, github.com slash
934920	944000	superset slash TLS my.net. Uh, so before I, uh, finish this talk, uh, I might want to talk a bit
944000	952020	about the risk model here. Um, this seems a bit, um, non-standard and you might have some
952020	958940	concerns about this and, uh, I'll just talk, uh, a little bit about those. So, the third party
958940	965760	domain that you use, uh, in this instance, TLS my.net is, um, assumed to be trusted because
966280	973980	they can always prove, uh, control over, uh, that domain and any of its subdomains. Uh, but,
974000	979680	the way I envision this being used is that, uh, each device manufacturer runs their own
979680	985960	service for this and you're already trusting that manufacturer anyway, um, so there, there's
985960	993640	some sort of implicit trust there. Um, also, as of, uh, fairly recently, there's these things
993640	1000400	called certificate transparency logs where every certificate that is issued is, um, uh,
1000400	1008960	appended to these, uh, append only logs which, you know, blockchain, whatever, um, basically
1008960	1019320	to, to prove, um, or to, basically to, uh, show that certificate authorities are not issuing
1019320	1025300	certificates that are unauthorized. So, if you're concerned about your, uh, third party
1025300	1031340	domain provider, um, issuing a certificate, uh, for your subdomain or issuing a wildcard
1031340	1035640	cert for the entire domain, you can go through and search these, uh, certificate
1035640	1042040	transparency logs to make sure that they are, uh, doing the right thing. Uh, so my plan is
1042040	1048480	to release, uh, TLS MyNet as a public service, uh, and, um, you know, get this idea out
1048480	1054440	there perhaps, maybe get, uh, Let's Encrypt to, to support this natively and do the same
1054440	1063000	DNS resolution, uh, and challenges that, um, uh, that we support right now. Um, I'm, mostly
1063000	1069540	see this as sort of a proof of concept service, uh, to encourage, uh, TLS adoption for these
1069540	1077240	local network devices, um, that, uh, are currently hard to get, uh, TLS certificates for. And,
1077240	1083360	uh, please, please, please bug your manufacturers to, to support TLS. So, even if you have,
1083360	1088760	um, these certificates, you know, these devices still need a way to, uh, load these
1088760	1095640	certificates into them, uh, and actually speak HTTPS and, and TLS and these things. And even
1095640	1103360	if you do get a certificate, uh, the device still needs to talk TLS. Um, so, in summary, I
1103360	1108840	would say, you know, going forward, TLS, uh, is absolutely essential for, uh, these
1108840	1114440	innovative web applications. Uh, browsers are demanding it. Devices like the Chromecast are
1114440	1121740	demanding it. Uh, basically, you need TLS if you want to, um, use a lot of these new powerful
1121740	1128440	features. Um, currently, they, uh, these TLS certificates are difficult to acquire for, uh,
1128440	1134680	these internal network devices for a bunch of reasons that I talked about. Um, but I, uh,
1134680	1141100	proposed here a way of, uh, easily getting these, uh, wildcard certificates, uh, using a
1141100	1146540	third-party service. Uh, so with that, I'd like to, uh, thank you for your attention. Uh, this
1146540	1153080	is my email address, my Twitter handle, and the GitHub account for the TLS MyNet service. So,
1153080	1160860	thanks. Alright. Thank you, Carl. If you have questions, please come up and line up by me.
1172230	1183430	Did you have any problems with running into, uh, DNS needing a CAA record? So, we, uh, no. So,
1183430	1191890	we do not return CAA records for that. We could return CAA records for that, but, um, the, so,
1191890	1200090	for people who don't know, the CAA records, uh, basically, uh, say, or they tell a
1200090	1206450	certificate authority which CAAs are allowed to issue certificates for a particular domain. Um,
1206450	1214410	we currently don't, uh, return any CAA records. So, theoretically, any CAA could issue, um, uh,
1214410	1227090	certs for, uh, TLS MyNet. Um, I, I could add it. Other questions? No? Alright. Well, then let's
1227090	1230570	give Carl one last big round of applause. Alright. Thanks. Thank you, Carl.
