WEBVTT

00:00.000 --> 00:06.200
Next up we have Carl Kosher talking about enabling HTTPS for home network devices using Let's Encrypt.

00:06.860 --> 00:08.060
All right.

00:08.060 --> 00:09.100
Thanks.

00:10.080 --> 00:12.060
So I'm Carl Kosher.

00:12.060 --> 00:18.360
I'm a research scientist at the University of Washington doing wireless and embedded system security.

00:18.360 --> 00:33.940
I'm going to talk about some of the challenges of using TLS on home network devices or other internal network devices and a way to easily issue certificates for these devices.

00:34.380 --> 00:37.180
So why is TLS important?

00:37.180 --> 00:39.960
Isn't, you know, WPA on your network enough?

00:39.960 --> 00:44.100
I mean, it's already encrypting and authenticating your communication.

00:44.100 --> 00:49.580
Well, as it turns out, browsers are really pushing for TLS these days.

00:49.580 --> 01:07.040
Chrome and some other browsers are now requiring TLS to use certain powerful APIs such as accessing the user's web camera or running service workers or pushing notifications.

01:07.160 --> 01:18.580
And so if you want to write an app that uses these, what they call powerful features, you need to serve that over TLS.

01:18.800 --> 01:40.100
And the problem with that is if you want to make a web application that uses those features and also communicates with local network devices, you can't really do that because it also blocks cross-origin requests from a secure origin to a non-secure origin.

01:40.360 --> 02:11.400
And so to make this a bit more concrete, I was trying to write an app for the Chromecast which requires applications to be served over HTTPS to connect to this HD home run TV tuner so that I could watch TV channels on my TV through my Chromecast while it connects to the TV tuner and pulls down the impact stream.

02:11.400 --> 02:20.320
The problem is that, so the HD home run device, it gets its IP address.

02:20.320 --> 02:31.180
However, because the HD home run device only speaks HTTP, it can't actually do that cross-origin request to get that, uh, impact data stream.

02:31.180 --> 02:39.440
And so this is sort of the problem that really, um, uh, caused me to, to look at this issue.

02:39.540 --> 02:43.740
So why is, uh, doing local TLS hard?

02:43.740 --> 02:54.460
Well, uh, as I alluded to, um, local TLS is often discovered by their IP address and not by a particular host name.

02:54.980 --> 02:59.120
Uh, TLS certs, on the other hand, are issued for a specific host name.

02:59.120 --> 03:08.000
So, um, in the common name or the, uh, subject alternate name, you have a list of, uh, fully qualified domain names that a certificate is valid for.

03:08.280 --> 03:16.340
And, um, so if you're just connecting to an IP address, uh, that doesn't match what it is in the, the certs.

03:17.040 --> 03:29.100
Some, uh, device manufacturers will, uh, ship a cert , uh, on the device, uh, and that certificate is the same across all devices.

03:29.100 --> 03:32.620
Uh, however, that can be easily abused.

03:32.620 --> 03:37.960
Um, you might remember the super fish scandal that happened several years ago.

03:37.960 --> 03:52.960
Basically, uh, this software, uh, pre-installed a, uh, certificate, um, that was, uh, used as a CA certificate that could, uh, sign, uh, any host name, uh, whatsoever.

03:52.960 --> 04:05.780
And the problem there was that the private key was shared across all laptops and so anyone with the super fish software could then create, uh, certificates for any domain name.

04:05.820 --> 04:13.520
Um, so you can also do that, uh, when you have shared certificates across these network devices.

04:14.020 --> 04:30.040
Uh, even if you do unique certificates, again, because you're, uh, discovering these devices by IP address, um, they will often be for a common host name like, uh, router dot homeland dot com or something like that.

04:30.140 --> 04:47.260
And so if you have any of these certificates, uh, you can get them re- you can, um, basically use those to, uh, do man in the middle attacks on, uh, on that domain name.

04:47.340 --> 04:57.820
Um, if you want to do something with, like, let's encrypt, uh, the problem there is that a lot of end users typically don't own a domain.

04:57.820 --> 05:03.740
Uh, I imagine most people in this room probably do, but, uh, real users don't.

05:03.820 --> 05:10.500
Uh, and so there's not really, uh, a domain that people can use to, uh, get their own certificate.

05:11.120 --> 05:29.260
And finally, even if they do have their own domain name and they want to get a domain with let's encrypt, uh, these local devices aren't externally facing, so the typical way of using certbot to automatically generate these certificates, uh, doesn't really work because,

05:29.260 --> 05:36.460
uh, let's encrypt can't talk back to the device to verify, uh, domain ownership or control.

05:36.640 --> 05:43.740
So it turns out that one company has actually solved this issue and that company is Plex.

05:43.740 --> 05:53.540
So Plex is, uh, well, it's a little sketchy, but it's basically, uh, Netflix for your own, uh, home media, um, server.

05:53.580 --> 06:11.140
And, uh, the way that they solved it is they issue each server a 16 byte GUID and then Plex issues a wildcard cert for this GUID dot Plex dot direct.

06:11.140 --> 06:29.160
And so whenever you want to talk to your Plex server on a particular IP address, you go to IP address dot GUID dot Plex dot direct and they have name servers set up that automatically resolve that, uh, directly to A dot B dot C dot D.

06:29.160 --> 06:48.440
Now this seems a little weird, but, um, the key here is that by going to that fully qualified domain name instead of an IP address, um, the, uh, fully qualified domain name matches with the wildcard cert that the server has, uh, and then the connection is trusted automatically.

06:48.440 --> 06:54.460
And so this allows for, um, uh, friends to connect to your server over the internet.

06:54.500 --> 07:10.400
Even if you have a dynamic, uh, IP address from your ISP, it also, uh, lets you connect directly, uh, on internal, um, like 192 dot 168, uh, IP addresses as well and everything is, uh, nice and secure.

07:10.720 --> 07:23.000
So, Plex partnered with, uh, certificate authority to issue these certs and that's kind of costly and, uh, most IOT vendors won't bother doing this.

07:23.100 --> 07:32.680
So, I was wondering if we could actually use Let's Encrypt which provides free certificates to do this and as it turns out, you actually can.

07:33.320 --> 07:38.360
So, let's talk a little bit about how Let's Encrypt, uh, automatically issues certificates.

07:38.360 --> 07:56.540
So, they use what's known as the ACME protocol, the automation, uh, automated certificate management environment protocol and this is implemented by, uh, a client called Certbot and by, uh, CA software called Boulder and this is a way to, uh, basically automate,

07:56.540 --> 08:04.060
uh, domain validation to prove that you have control over a domain that you want, um, a certificate for.

08:04.900 --> 08:18.820
Uh, so, the way that this, that the ACME protocol works is that the certificate authority issues you a challenge , uh, to prove, uh, control over a domain that you want a certificate for.

08:18.820 --> 08:36.120
And there's a couple of different types of challenges, uh, the two main ones right now are HTTP01 where the, uh, certificate authority asks you to create a file at a specific URL with, uh , specific contents and it verifies that you put that file there and if you did,

08:36.120 --> 08:39.920
uh, then you have control over that domain and they give you a certificate for that.

08:39.920 --> 09:02.880
There's also DNS01 where you add a text record, um, for the domain name, uh, with a, a specific content, uh, uh, secure token, uh, and, uh, this is the only way to get, uh, wild card certificates, um, but it's nice that they do, uh, give you wild card certificates now.

09:03.580 --> 09:11.540
Um, so for accounts, um, basically they are associated with a public private key pair.

09:11.540 --> 09:22.620
Um, you're the, so you automatically generate this private key, um, and derive the public key from that and that public key is essentially your account ID.

09:22.620 --> 09:39.040
Now they do have sort of, uh, an internal account ID that you actually use, um, for efficiency and, and other reasons, but basically your account is this public private key pair and you use this private key that you generate yourself to sign all requests,

09:39.040 --> 09:46.780
including the initial registration with Let's Encrypt where you tell them that you agree to the terms of service and, and so on and so forth.

09:47.140 --> 10:08.920
Uh, so my proposed solution for, um, using Let's Encrypt, uh, for local devices is, um, this service that I'm calling TLS my net, which lets you issue wild card certificates for subdomain that is tied to your Let's Encrypt, uh, account public key.

10:09.840 --> 10:23.060
So, time is of the essence and tying the, um, the subdomain to your Let's Encrypt account, uh, basically lets you verify legit, legitimacy at an application level.

10:23.080 --> 10:44.880
Um, so, uh, you know that you are always going to talk to your server at a particular subdomain and as long as that subdomain matches, you know that, um, the private, uh, that at least someone with the corresponding private key, um, proved, uh, that they had that private key and they,

10:44.880 --> 10:47.320
um, got a certificate for that domain.

10:47.840 --> 11:11.320
So, the basic way that this works is you use, uh, Let's Encrypt, um, as normal, but, uh, instead of proving, um, control over your own domain, you ask a third party, uh, to, uh, prove control of a subdomain, um, and, uh, that third party then, um, um,

11:11.320 --> 11:15.340
can, um, solves that challenge for you by creating that text record.

11:15.800 --> 11:22.380
So, the way that this works is the device initiates a subdomain wildcard certificate request with Let's Encrypt.

11:22.380 --> 11:26.200
Let's Encrypt says, okay, here's a DNS challenge.

11:26.200 --> 11:30.640
Uh, the device then sends that challenge request to TLS MyNet.

11:30.640 --> 11:35.960
This request is signed with the public key using, uh, JSON web signatures.

11:36.300 --> 11:53.800
Uh, the thumbprint of the corresponding public key, um, is used as the subdomain, uh, and because of limitations of DNS, we actually have to encode this as a base 36, which is kind of icky, but, um, it, it works.

11:54.020 --> 12:03.040
Uh, and basically the, the public private key pair here is the same, uh, public private key that is tied to your Let's Encrypt account.

12:04.120 --> 12:14.720
Uh, so this is currently implemented in, uh, 2 Python scripts, um, uh, that are on GitHub right now and I'll, uh, give you that URL later.

12:14.720 --> 12:20.980
The first is, uh, DNS server.py and this does 2 things primarily.

12:20.980 --> 12:29.020
One, it resolves, uh, that, uh, IP address dot thumbprint dot TLS my dot net to that IP address.

12:29.320 --> 12:31.600
Um, so it, it handles that for you.

12:31.600 --> 12:41.900
The second, uh, second is that it also resolves these, uh, text records, um, that are used for, uh, subdomain, uh, verification with Let's Encrypt.

12:41.900 --> 12:52.400
Uh, it uses this library called DNSlib, which, uh, lets you easily create, uh, DNS clients and serve, uh, servers, uh, using Python.

12:52.540 --> 13:07.640
Right now the server is sort of, uh, single threaded and synchronous and so there could theoretically be some performance issues, but, uh, I'm planning on migrating that to, uh, Python's async IO, uh, fairly shortly.

13:08.140 --> 13:19.520
Uh, the second half of this, uh, system is the, the web server, which receives these requests, uh, for creating these text records to respond to these challenges.

13:19.520 --> 13:28.840
Uh, this does use async IO, so even though it's single threaded, um, it can handle multiple requests and while it's waiting on one, it can service another.

13:29.180 --> 13:38.060
Uh, and it uses, uh, also this, uh, JWcrypto library for doing, uh, JSON web signatures and, and JSON web keys and things like that.

13:38.060 --> 13:49.760
And then in between there's just a standard Redis server that's a temporary, uh, key value store for storing, um, specific text records, uh, for specific subdomains.

13:49.980 --> 13:54.160
Um, and those, uh, those last for 5 minutes.

13:54.160 --> 14:03.620
Um, and so the nice thing here is that really there doesn't need to be any state that you actually store on this server.

14:03.620 --> 14:10.660
Uh, you just need the, the key value store long enough to, uh, do the domain verification.

14:10.660 --> 14:20.220
Um, you don't need accounts because, uh, those are automatically proven by using the public uh, private key pairs.

14:20.640 --> 14:27.700
Uh, and, uh, you know, the resolving an IP address, uh, is, you know, straightforward.

14:28.200 --> 14:31.980
So, currently this is still, uh, a work in progress.

14:31.980 --> 14:43.200
Um, there is a test client right now, uh, on GitHub that, uh, sends a, uh, request to create a challenge, um, to the web server.

14:43.340 --> 14:48.060
Uh, it, it could be better, um, but, you know, hopefully that's coming soon.

14:48.060 --> 14:55.140
Um, I am planning on integrating this with CertBot as a plug-in.

14:55.140 --> 15:09.840
However, there's a, a little , um, issue there where the, uh, CertBot plug-ins don't automatically expose the account , uh, public and private keys to, uh, the extensions there.

15:09.840 --> 15:12.940
So, that's a little issue I'll, I'll have to work through.

15:12.980 --> 15:18.740
The server currently has a little brokenness with case sensitivity, but, but I'm going to fix that today.

15:18.740 --> 15:29.260
Um, it, uh, I have tested it and it does work and as I said before, uh, the DNS server will be modified to use, uh, async IO for a bit more performance.

15:29.300 --> 15:37.860
Um, so the code is up right now on GitHub, on, uh, github.com slash superset slash TLS my.net.

15:38.800 --> 15:45.960
Uh, so before I, uh, finish this talk, uh, I might want to talk a bit about the risk model here.

15:45.960 --> 15:57.660
Um, this seems a bit, um, non-standard and you might have some concerns about this and, uh, I'll just talk, uh, a little bit about those.

15:57.660 --> 16:12.920
So, the third party domain that you use, uh, in this instance, TLS my.net is, um, assumed to be trusted because they can always prove, uh, control over, uh, that domain and any of its subdomains.

16:13.300 --> 16:28.120
Uh, but, the way I envision this being used is that, uh, each device manufacturer runs their own service for this and you're already trusting that manufacturer anyway, um, so there, there's some sort of implicit trust there.

16:28.120 --> 16:50.820
Um, also, as of, uh, fairly recently, there's these things called certificate transparency logs where every certificate that is issued is, um, uh, appended to these, uh, append only logs which, you know, blockchain, whatever, um, basically to, to prove,

16:50.820 --> 17:01.820
um, or to, basically to, uh, show that certificate authorities are not issuing certificates that are unauthorized.

17:01.820 --> 17:18.800
So, if you're concerned about your, uh, third party domain provider, um, issuing a certificate, uh, for your subdomain or issuing a wildcard cert for the entire domain, you can go through and search these, uh, certificate transparency logs to make sure that they are,

17:18.800 --> 17:20.320
uh, doing the right thing.

17:20.780 --> 17:40.720
Uh, so my plan is to release, uh, TLS MyNet as a public service, uh, and, um, you know, get this idea out there perhaps, maybe get, uh, Let's Encrypt to, to support this natively and do the same DNS resolution, uh, and challenges that, um, uh, that we support right now.

17:40.720 --> 17:56.800
Um, I'm, mostly see this as sort of a proof of concept service, uh, to encourage, uh, TLS adoption for these local network devices, um, that, uh, are currently hard to get, uh, TLS certificates for.

17:56.800 --> 18:01.360
And, uh, please, please, please bug your manufacturers to, to support TLS.

18:01.360 --> 18:14.540
So, even if you have, um, these certificates, you know, these devices still need a way to, uh, load these certificates into them, uh, and actually speak HTTPS and, and TLS and these things.

18:14.540 --> 18:19.620
And even if you do get a certificate, uh, the device still needs to talk TLS.

18:20.360 --> 18:30.900
Um, so, in summary, I would say, you know, going forward, TLS, uh, is absolutely essential for, uh, these innovative web applications.

18:30.900 --> 18:32.880
Uh, browsers are demanding it.

18:32.880 --> 18:35.360
Devices like the Chromecast are demanding it.

18:35.480 --> 18:42.500
Uh, basically, you need TLS if you want to, um, use a lot of these new powerful features.

18:42.600 --> 18:52.100
Um, currently, they, uh, these TLS certificates are difficult to acquire for, uh, these internal network devices for a bunch of reasons that I talked about.

18:52.100 --> 19:02.100
Um, but I, uh, proposed here a way of, uh, easily getting these, uh, wildcard certificates, uh, using a third -party service.

19:02.360 --> 19:06.000
Uh, so with that, I'd like to, uh, thank you for your attention.

19:06.000 --> 19:12.200
Uh, this is my email address, my Twitter handle, and the GitHub account for the TLS MyNet service.

19:12.200 --> 19:13.640
So, thanks .

19:14.280 --> 19:15.360
Alright.

19:15.440 --> 19:16.760
Thank you, Carl.

19:16.760 --> 19:20.860
If you have questions, please come up and line up by me.

19:32.230 --> 19:38.770
Did you have any problems with running into, uh, DNS needing a CAA record?

19:39.270 --> 19:42.930
So, we, uh, no.

19:42.930 --> 19:46.930
So, we do not return CAA records for that.

19:46.930 --> 20:06.110
We could return CAA records for that, but, um, the, so, for people who don't know, the CAA records, uh, basically, uh, say, or they tell a certificate authority which CAAs are allowed to issue certificates for a particular domain.

20:06.110 --> 20:10.010
Um, we currently don't, uh, return any CAA records.

20:10.010 --> 20:16.970
So, theoretically, any CAA could issue, um, uh, certs for, uh, TLS MyNet.

20:16.970 --> 20:19.410
Um, I, I could add it.

20:21.530 --> 20:23.390
Other questions?

20:25.370 --> 20:25.950
No?

20:25.950 --> 20:26.350
Alright.

20:26.350 --> 20:29.170
Well, then let's give Carl one last big round of applause.

20:29.170 --> 20:29.510
Alright.

20:29.510 --> 20:29.950
Thanks.

20:29.950 --> 20:30.570
Thank you, Carl.

