Login to Linux using Ethereum Name Service

EthPrague 2024 · 1 Jun 2024 · 26:36

At EthPrague 2024, Jarkko Sakkinen shows how to log in to a Linux system with the Ethereum Name Service. The talk looks at performing authentication with the ENS public resolver by integrating it into popular login and session managers, so they can run the challenge-response needed to attest a user.

Speakers

Topics

From EthPrague 2024, hosted by ETHPrague.

Transcript

okay um I just wanted to introduce you first yo you are so eager to talk uh welcome again everyone to the flower stage in E Prague in Saturday um the next talk will be from Yaro sakan uh he will be talking about logging to Linux using ethereum name service so a big round of applause for Yaro okay thank you so okay I'm Yos akakin and and and okay those are visible there okay perfect I'm a software developer Linux kernel hacker I I and also Linux kernel maintainer I maintain like like mostly

like crypto stuff like I'm a co-maintainer for Linux keing I'm I'm Co data for tpm2 and Intel sgx and and and and that sort of stuff so when it comes to ethereum I'm not really interested on eum per se but but more I'm more interested because I'm I'm the person if you for example s a new key type to Kernel I'm the person with the vetto right for that key type because I review all the stuff uh so when it comes to ethereum my main interest is to find something in that EOS system that will also be like

for the benefit for other ecosystem that used for example similar basic like like like crypto keys in the case of ethereum it would be the p256 K1 curve that also Bitcoin uses and some other blockchains I don't know if the Estonian government uses those also for their IDs but it could be possible I don't know but any anyway it's very common so so in from that perspective it would make sense to enable that curve for example in the kernel and and and some other like even in some some like standard Hardware

chips and stuff like that so so my original idea was to develop a Pam module for for Linux which is basically like like a shared Library module you can put it in the config file and and it will give based on credentials yes no answer to you and you can St pile them up and and all the like session managers like GT and and and gnome gdm in gnan and and and and others use those to make like the decision whether you get in or out and and ethereum ecosystem has like some tools for it like like for like for instance this ethereum name service that can be

used like a like basically like corporates use l up you know store Key valy stories where you can you can store data per person and and use that for authentication and and then there's this this exch kind of key exchange or authentication scam calls C and and that in particular would be like in my opinion suitable for for open SSH which already has this feature that you can you can have multiple different ways to exchange the problem with implementing that for for open SS AG is comes down to that that enss does not

provide any c libraries which would be like I think with all these Technologies it's a huge minus that almost none of them have have any any like basic C libraries it's it's it's super important if you want to get like the data centers and like like the internet backr to still today to have C libraries because then when you have to see libraries like the Legacy but still wisely used like DNS D and and and and and and software like that could just take those C libraries and add in you know the E senig guns in the existing like software that which is not today

possible because basic basically all of it is implemented with web technology so so I would highly promote to also do like like standard like basic SE libraries that I I I did some experiments with with lip curl lip sodium and and there was one third Library uh I don't remember what it was but anyway mostly with lip curl and lip Solon all right and lip G Li Jon and I could do like Basics quite qu within like hour I could do like basic like

lookups from ens and basic transactions and stuff like that so so so it wouldn't be like like like that huge of an effort and if you had that C library then you could easily easily move into extending like open SSH to support C for example but the main problem for me came out by identifying the two roles well this exist like in any any remote testation or authentication seam so you have basically like two roles you have you have the user who is logging in and

then you have the machine which also should have an identity and and here the problem is that both parties need a private key but but neither of those private Keys should be exposed so so I kind of gave up gave up implementing anything the PM module because I I thought that this is much more like like like like important problem to solve so so how to store the identities well

there's there there's there's this whole Market of these crypto wallets and and they probably work for you if you if you are like particularly interested in eum but they don't work for me because I haven't eaten yet the red peill so yeah and I I I do have a UB key but I use that for like you know for my when I access for kernel orc I use UB for authentication but but it's I use it because I have to use it so so something is needed that could bring like almost like equivalent characteristic as as as crypto wallet but but with the lower barrier so so I

think TPMS especially the new tpm2 standard or semi new it's 10 years old but like as an industry stand are still quite new every PC H has has one of these and all of them did today support tpm2 it's it's primary Keys it it doesn't store any primary key it's actually stor like like a few random seats so so so that way the trusted Computing group can add new algorithms to the standard without changing the Hardware Hardware only needs like like like like like basically a firmware

update so if they want to add a new eliptic curve type they first make the decision in the in in this cross corporate Industry Group called TC that okay we want to add this then then they update this single specification hold on I can open it here and uh I find it out okay so and and they have for x and for elliptic curves they have this table that these are like at the moment TPM

chips support this set of elliptic curves so the one one curve is obvious curve is missing there's the N curve p here here n p256 256 R1 and but but but the blockchain stand semi-standard curve p256 K1 is nonexistent so and also T already today tpm2 chips can can can do like ecdsa but only with these elliptic curves so so so ecdsa is supported they support elliptic curve so

they have all the like like like the computational like like tools to also support like this this curve that that Bitcoin and ethereum use so it's mainly just get that thing to decided in TC level and I I talk with one like pretty senior member of that group from and and and and it was not like that at least from that that person that he said that it's it it was not like that he would be against like adding

this curve because blockchains or what or what what whatever it was only that he did not know that anyone uses p256 K1 because if you do do your crypto stuff here and not are not involed in blockchain there then you might sometimes the some curve lacking from some standard it might be just because of pure ignorance not because they evil Corporation don't want to add it or or or an NSA wants to prevent adding it or whatever ever I heard this internet rumor that that that that the curve does not exist in this table because because

NSA does not want it to be there but but I don't believe so because that was based on that that because because K1 is based on prime numbers that for some reason NSA would only want to have composite number but that cannot hold because also 25519 curve is based on on prime numbers and and and at this it's claimed to be more more secure than than p256 K1 so so that kind of kind of disapproves that that that that internet rumor so so where okay TR at Computing it's it's

trusted Computing anyway so so so so so I think a good call for eum to make it spread e more easily and get the same benefit it's as as with with with with crypto wallets like to every PC and even like a lot of android devices like like a huge spread uh would be to get an ID to that PDF file that would like like like like enable like most of the laptops in the wall to have an Hardware crypto wallet so it's it it it

would have like huge volume and and yeah it would bring equal benefit for both Bitcoin and ethereum and all all all sorts of blockchains that that are based on this so so so one thing that I maintain in the Linux kernel is it's Linux kernel keying it's a runtime keying uh and so and it's used like like for like like when you log in to gnome or whatever to stall some some session keys and stuff like that and and it also have like so so you can have like you can define various key rings in it and and and and and and key herchies and and

it also has an as asimetric key type that that can import like x509 asn1 encoded pretty standard stuff and and and and the current currently for no particular reason even in software it only does ecdsa verification and only for the n n curves I'm I'm I'm planning to at some point Implement also signing for e ecdsa in just in software and and and at least in software at also support for for for this blockchain curve

type but but but the first first thing that I started working on was this kernel badet that can sign stuff with the TP with the private key in the TPM uh both using R RSA P PK PK oh oh letters are in wrong order pkcs1 bad seam because that that you need you need to Pat Pat what you sign in RSA to get it actually secure and and also also I implemented ecdsa for for the N Cur because those

are in the table and here I don't so so it's it's going quite well so it's relatively simple Now to create create so so this this this just this is normally you would have this primary key here already like like in so you usually when you use tpm2 you don't usually use it nonvolatile memory you only use the nonvolatile memory in TPM for for for like like like to have some some primary keys or like root keys

for the tbmj itself for like creating other keys so this is just for the demo I create like a simple primary key here and and then I then I export it out of the TM it's it's and and and then I create like a n n uh elliptic curve key with open SSL and [Music] and and what does this do okay okay okay then I import that then I convert that back to do do various steps I don't remember exactly all all the details from this uh but anyway through these

steps I create create create the key and and and and and finally export asn1 that is like like like only loadable by the TPM chip it's there so it exist in the hard drive but but it's it's sealed with the TPM only the TPM can can can unseal it when it does an operation so Basic G in when using TPM for signing operations is that you don't keep the key always in the TPM they have very low memory but in in that you when you sign you load the key inside the TPM it will open it up inside the TPM then you then then then you do

the sign operation and then you FL plus the loaded key out of the TPM and okay so for for for for nist Curves I have now like so hold on okay so so to make this less confusing these operations here are only like for doing necessary conversions an encryption for a key that was originally created by open SSL and not the tpn by

itself so so so this whole whole whole framework support importing the existing private keys for the you asp aspm ke okay so so anyway with with with easy we with this n n curve based keys I can now do like perfectly signing and verification operation which is like like like the whole gist of what it need also for blockchains so and basically all this code that I've done for

this would only need like few line modifications to be able to sign also like p526 K1 curve so I'm planning to get this this feature Upstream for Linux 6.11 so at that point at least the software stack almost supports uh uh ecds there there there's my ecds encoding code it's so but any any anyway so so after

this is in if if TCG added that that one algorithm ID to their table then Linux could be could support within few months also like signing these blockchains so and and and I I I whether that's worth it or not I would think think it from this perfect it would the VA be better place if tbms could sign blockchains or not I I I I think I I mean crypto wallet might make sense for some but I think you know this could be like more like you know more inviting way to do it because because then then any one then

you could easily for example have even for Windows a crypto Wallet app that would like automat automatically like just like with bit Locker it would just automatically use the hardware ceiling yeah so so in in this example hold on oh okay yeah I'm I'm almost done so in this example as you can see uh there okay no that's RSA example okay there it's n curb but if I created it change it that whole whole

whole transcript by you creating like six 6 p256 K1 which is the one that that etherum uses it will it at at the at the moment it is not accepted by the TPM so so this is this constant this is what would make a lot of sense for all all blockchain Technologies and I think I think it's possible to do so okay so so okay DCC membership is quite costly so it at most would make sense for like like ethereum Foundation or or

or Bitcoin Foundation as a whole or but but but ethereum has like membership companies like Microsoft who who invest a lot to ethereum so if I was active in etherum I would contact these these companies who have have investment in etherum and and and talk them about this this issue and then they could in within TGC meetings bring this up so I think that would might be possibly the best road to get this in but yeah so questions thank thank you very much

Yaro um we have four minutes for questions if we have questions from the audience feel free to ask don't be afraid yes one question here a mic is coming uh yeah do you have any idea about like the details of the process for getting stuff through the TCG and like how long it takes normally I I don't know but I with for with Intel it's just like that when they otherwise do like a bios update then they will also that will also like in include like the update for their for their firmware TBM so depend but but I would say that within like a

at least six Monon timeline it is quite Pro probable that it it would end end up so not not that huge timeline than any other questions one more over here thanks a lot for the work um two years ago I was talking to a guy who was who wants to who was like planning on building lightweight uh ethereum wallet thanks like with UB keys actually or or some other so I think it's very related to what you are like talking here about so I would love to get you in touch okay yeah and the but the question is so are you personally looking for a grand on

like working on this as well yes so so in in the sense that I'm I'm I I I spent last n nine days implementing the like the basic feature for kernel like T tpm2 asimetric keys and it can already already do easy DSA with the nist curves so so and it would it would be quite easy to add later on some new new curve types amazing work thanks yeah thanks more questions we have two more minutes if there are any the last yeah there we go um did did do you intend on doing anything more on this um and if so what

or like what what yeah so so so so since since the since DCT does not yet support this curve type and and so after this patch goes to the main line I was thinking to just like so that at least like some some for some prototyping it would make sense to have the ecdsa for this curve type supported by the kernel in software so you know so I I was thinking to implement that next just software keys for for for easy for for ecdsa signing where where where do you need

help I don't know uh if there's anyone in the room who's interested in supporting this uh well well I I I I think like like like I don't I don't have time and energy to fight with DCT so so so so you know there must be like like for example Microsoft Microsoft Microsoft is is investing to both tpm2 as a technology and also to etherum in the data center so I would if I I was like active in eum I would talk to Microsoft Maybe

cool because I think for Microsoft it would make make a lot of sense to have have have this in especially if they use it in the data centers you know cool thank you everyone for your questions we if you have other questions you can catch Yaro we have to continue with the schedule but big round of applause for yo for this thought-provoking talk and our stage will continue in 4 minutes at 11:30 with the schedule see you in 4 minutes [Music]