So come on. There we go
Good morning, everyone. october 9 so we're at a bit of an awkward stage of the semester, in the sense of so assignment to 2 is due on Tuesday Oh, the scientists and then the midterm is on
Thursday next week. So few things here so
Tuesday term Thursday Thanksgiving
So please get your tutorials checked off today.
If you haven't done t 3 and t 4 get them checked off, there is okay, tutorial today.
Piece. Tas up office hours today, so go see them and get checked off.
If you haven't yet 2 tutorial 5 So let's so tutorial 5 you'll notice its date is octa if date is going to be available.
Is October the twentieth, which is after the midterm.
Yes, yes, it is definitely for assignment 3 so yeah i'm not given.
I am not, I mean I don't I don't see how the Tutorial 5 would be there for the midterm.
Yeah. So so yeah. So that is all later. I definitely have lots more stuff to discuss.
But i'm holding off on discussing that now, because I don't want to load your brains with too much.
If people. so today. So yeah, So get your tutorials checked off.
Midterm is Thursday up. So today my thought is, I will
So my plan today was to talk about Ssh in more detail.
If there is no Oh, oh, sorry not today. sorry I'm thinking today is Friday today is not Friday.
Today is Thursday, So tomorrow. Yes, this. Okay, also the Okay.
So I will be Yeah, the same as the the midterm basically it's the same thing you download except they'll be a Pdf.
You download to with the questions that will be on bright space as opposed to being on my wiki.
The answers. You'll upload is a text file i'll be in the in the classroom zoom to answer questions.
But you don't need to show up to the thing you just need to upload your answers is out
Me if you want a personal message me on teams i'll also answer questions.
There. Yeah, exactly the same text file ex the same text file thing for the assignment.
That's why, I do that i'm keeping things consistent so so?
Why didn't I use a bright space quiz because there yeah the the test will be
Minutes.
You can use the Internet and stuff, but you're not through the collaboration
So the interviews are fundamentally a way to make sure that your midterm is rated properly, but i'm also doing it randomly. and for some of you all to make sure you have incentive to roof to report what you actually
know, as opposed to trying to get extra information so why don't I use a bright space quiz?
So why don't I use a breakfast with it's actually very simple.
Well, there's multiple reasons. One is they are a pain to create They're very painful to put stuff in so second of all, they impose all kinds of weird restrictions on wind answers and stuff but there.
Third of all. There are then a pain to grade because I want to do short answer, and I would upgrade it by question.
You can't easily say, Oh, I want this you know this te to grade all this question, and this te to grow that question.
It's like you create these papers or not so it's just the workflows sucks. and I think it's also more painful for you all I mean just typing up your answers especially if it's not multiple
choice. it's multiple choice. your Well, the midterm yes, yeah, please pass the validator you cannot lose marks.
If you're if if we find things like my find a grading year, and it's in your favor.
I'm not gonna change that the only the only potential jeopardy Is Michael like?
Don't know as much as you put down this assignment How did you, even, you know, get this and that's what i'll have to, you know, Talk to the dean so
We have extra time to upload your work I mean i'll give a couple of minutes of buffer time here on the 80 min, so like i'll actually make it available at 1130, and i'll actually require it be done
by by one o'clock, so you're gonna there'll be like 5 min on either side.
But that's It it's just gonna be short answer I might be a couple of lines of code.
But that would be it.
Yes, sir.
I I Yeah. any practice midterm There is no practice.
Midterm you're welcome to look at past runs of the course
And look at the midterms there I mean there are they're posted along with solutions.
Yeah. but really those cover. Yeah, the practice midterm is the assignments exactly. And if you look at last year ones you can kind of just get confirmation that I do correlate.
But I don't recycle questions from last year's midterm our previous year's midterms because I change things.
You'll notice I change things around every year you might use the same tutorials.
The actual assignments vary and so the midterm well, very based on that.
I have any questions I don't know I I haven't made them up yet.
You understand, assignment. one and 2 you are very well prepared for the midterm, because that is, that's literally what I, The way I make up the midterm is, I go through the questions on the assignment.
I put them into it document And then I start you know rewriting them, changing them, riffing on them to make questions based that, ask the same basic concept.
I'm trying not my goal with the midterm is not to surprise you.
I mean it's easy to make it's easy to make a midterm or any sort of exam.
That everyone's gonna fail. you just basically be on asking reasonable questions. it's easy to make a one where everyone gets a perfect score or something.
You just make it really really easy. The trick is to do something that is fair.
Yeah, that's fair, which means this really thing Did you learn this material and like, what?
What am I asking you to learn if the material of the assignments?
So it should be about the same difficulty. but it's gonna require that you understand the concepts.
So they will not be Googleable questions for the most part.
I mean I try and Joe not to do that so much with the assignments, but particularly with the midterm.
They're going to be like sometimes. I might ask you scenarios or analogies, or what if you know your friend asks you this, and they tell you this.
And But so yeah, it all depends they shouldn't be harder than the assignments.
If you did them on your own. If you did the assignments with lots of help from lots of other people, and spend a lot of time looking up stuff and things be harder, because well, you've got limited time rough estimate questions.
I I mean i'm i'm really not sure I have to kind of see how it comes out.
And it basically about I mean, yeah, I mean I can't say exactly.
But it will be something that normally students students who know what they're doing should be able to finish it in about half the time.
So you should have time to think, but you won't have enough time to spend a lot of time looking at things up and doing a lot of experiments.
You might be able to do that for a few questions, but definitely not most of them.
So you should plan on going through the midterm, answering the questions as they you know, as they go through, and just doing that, or skipping them, and gang through most of the midterm without looking at any outside materials and
then the few questions go like, How do you do that, or hide that?
Then you go back and you spend some time thinking about those it's always be.
I'll have some questions, that'll be designed to be easy. So questions I Mill Road and some questions they'll probably try to be a little tricky.
And so yeah assignment. assignment.
One. I I will tell you I should have it made up by Tuesday.
So i'll be able to tell you then how many questions are on it.
When you get your assignment one mark you should get back
I'm hoping by tomorrow i've already. got at least half the tas have given me the mark questions I have to hunt down the rest of the teas and make sure the rest, and then i'll be able to wish them
all together, and put out marks
Wins the exact date for tutorial, 5 for section 8, 3
I'm I I it's like i'm very confused.
What you're asking about, because you know if we so we're here, the midterm is here.
We have classed the week after, and then we have fall.
The week of the 20. fourth is Paul Break the seventeenth is a normal week, and that's when the tutorial that you know.
Trail come out. Oh, yeah, actually I My, My date on there is actually a bit off the next the the next tutorial will come out actually on the I messed out in the calendar.
Tutorial tutorial 5 will come out on October seventeenth. Not October twentieth. so i'll fix that I was thinking that was always gonna come out like a before
Thursday class, but because of the midterms on a Thursday it'll come out before a tuesday class.
I'm probably gonna i'm gonna post this next week I just I didn't want to post a tutorial 5, because I know some of you be tempted to work ahead and I want to be very clear
what's on the midterm and what is not a tutorial 5 is not on the midterm.
Okay, okay, So that's that's logistics
So. So now, unless there's any specific questions about the toutorials or assignments, I wanna talk about session.
I wanna kind of start at the start beginning
Yeah, please, Jason, go ahead
Are are you talking, or Jason or are you i'm gonna type.
It. Sorry one sec guys had a little issue there. like perfect
Just with the create background. i'm just kind of stuck on getting that started.
So so what am I talking about? Create command background.
So if you look at the code here there is, yeah, we have
1 s download that
So wait here. we've got the code here for 3,000 shells here.
So if you go here and you look at the prompt loop.
Here we are the built in commands you know we're comparing these things. So what you should be doing is somewhere in here, you should, somewhere in here you should put something that checks to see for background.
And then, once you have the thing checking for background, it should actually process, you know, arguments, and then maybe call a function.
So what is it supposed to do is supposed to put things in
So I will tell you. This run program right now has support for a redirecting standard out the easiest way I found to will create you know, for me to implement.
This was to change one program, so it had 2 more arguments.
So it took a standard in file name and a standard error.
File name and and they basically have all that there as arguments.
And so those could be opened and notice here you're doing it here is doing.
If this is not open, then it, you know, creates the file.
And does this do things. So this is what's doing stand out you have to do something for standard error, and we do something different for standard in, because, of course, you're reading, reading, not writing.
And i'm. guessing we'd have to make an additional system call, or something, if you have to make many calls.
I mean that's but yeah but the idea is this is showing you how to redirect standard out.
So you wanna do the same thing for standard error and doing something similar, but a bit different for standard in.
But I would do it all in run program and so then you change the prompt loop to send the appropriate arguments here, and you have to, of course, make sure you get the command line arguments for the program.
Right cause. do you wanna make sure ours here. is the right and you don't want it to have the file names there that you wanted for redirecting standard and standard standard error.
Okay, but I will say it's easier Then It is here, because, remember, for the redirection here, we kind of have to do this whole thing and moving the arguments up in the array.
Because the redirection could happen anywhere in the command line.
But here, because the syntax of background is because background standard in standard standard error.
And then the command you just need to increment past the first couple, which is just like it is done for.
Become like this sort of manipulation. The argument list here.
You want to do something similar for it
Okay, sounds good, thank you. No problem. Yeah, you don't yeah so yeah, we don't modify the app part.
I talked about Duke 2 I thought but well i'll just go back to my
So
Does that cover things about? Do 2 Here, Carson, are you good? I know what you say.
Is it the preferred option for file io it's. It's just a it's just a thing for moving around file descriptors.
How should you answer the question? So when
So when you're answering programming questions describe at a high level, what you did like, what's the logic of the changes, or whatever you did, and then include code snippets, and explain where they should go in the program you know depending on
the code. So i'm not this doesn't matter exactly how you specify just as long as it's clear where you're putting things into the program with you can definitely have questions about tutorial 3 you know questions about any
tutorial So thank you. So it was specifically with regards to when we were running Gdb.
And comparing it with S trace. So I noticed on the 3,000 shell program so pretty much for
Any program, whether it was the the shell or the the Hello World program.
There are a lot of system calls that are generated just to initialize the the environment but for a lot of them it said, no file or directory found.
And I was wondering why was What do you mean?
No Filer Directory found when you did what so when I ran Gdp on
On 3,000 so understand that you're tracing the source you're you're debugging not just your code, but also library code.
And so at times you are in library functions, and you could walk through the source code of library functions if the source code was on your Vm.
And in the right place? So if it's not in my Vm.
How is that system call being made? Where is it coming from?
No, the source code, not there. But the object code is Oh, okay, okay.
You just have compiled binaries and compile libraries you don't have the actual source, but you could.
But it's available, and you can install in your Vm.
And then you could look at the code as it runs using.
Gdb: Okay, And because Gdb is looking at the object code, and not the source code, it's looking for object code for each of the calls and every sort of step of the way, then it actually includes rice parts of the code the line
numbers and the file names associated with each part of the code.
So that's how the debutter can go through Oh, we're at this line number.
But if you don't have the source code there it's just a line number and a file name, and if it's not compelled for debugging it just says well I don't know but you can always watch the
assembly code, because it will disassemble it's actually not assembly code.
It's actually disassembled code so it's taking the machine code and reversing it putting in assembly.
You can always see that in Gdp: Okay, Thank you.
Got me? Okay, Yeah.
So, ian your question. So when you run 3,000 user login as a student without giving root permissions running as route try, you know.
Basically say you're not giving a root permission without making it. set you Id root or ring is root trying to log into another account.
It says I can't change the group number and it quits is this: the right answer.
So let's let's look here
No, I don't so here we are on the code.
Not 3,000
Download.
So here's 3,000 user login and so it's like you get an error.
Can't change the group number so failed to change did I'm.
Assuming this is the error that you get, be able to change the Id and result is set.
Gid. So let's look at the man pay so
Set group idea set. Gid sets the effective group idea of the calling process.
If the calling process is privileged has cable set to your prologue, there's no real Gadd is saved in the right side.
Okay, So process not privileged to not have Capset Gid in its name username space, not how the mash goes away.
So So basically what this is saying is if you're changing to a group.
So you can change sometimes in some groups, because regular process. can change it if they're a member of different groups.
But if you're just changing to an arbitrary group, that's a privilege operation. and so you know, if you're not running this route, how can you do it do you see what I mean so and I is this is the
first privileged call that's being made here everything up to this point can be run as a regular user. Get Uid.
Those are all fine, you know. Get a password entry that to the priority privileges.
But the No. yeah, this is the right vote. but then, set Gid that requires privileges, because you're changing the group.
Id of the process. so So yeah, and that's really and this is what you should be doing to understand what's going on.
You shouldn't just be observing, like Oh, yeah it the programmer did this.
You should always be asking, Why did it do it and then?
Going like. Well, do I understand what's going on here and so you know.
Walk you know, walking through and going like hmm okay, why would I get this error here, and I say, Oh, yeah, because if I didn't make it run this route, I didn't run it as set uid root it doesn't have privileges destroying as a
regular user and regular use can't just change their group Willie Millie
Okay, So there's quite do you anticipate having questions where you write code in the mid charter there may be some code, but the code will be very small.
It'd be a couple of lines at most because again. my my focus is on, you understand, the concepts and writing code properly takes time.
Have a lot of time so I'll be i'll tell you more detail on Tuesday.
But is the Gdp, So will the Gdb debugger be tested?
Was Gdb. on the assignments
So your answer is no
I'm not saying Julie would be useful but it shouldn't be doing Gdb during the test.
So question. I say they're asking cause it was all the tutorials.
It's in the tutorials but it's not the assignments.
So the single the midterm is the assignments not the tutorials.
I'll emphasize that
Yeah, I try not to go into the tutorial the part of the tutorials that's not covered in the assignments.
I don't I don't try asking about those because that's you know.
There's a lot of material the tutorials if you really do them in depth.
On purpose, like Cm. as a thing to help you explore, and, you know, get a richer understanding of things.
But the assignments like, Okay, I gotta test you on something.
Know this
Yeah, the tutorials are hard. The tutorials should be harder, actually, than the assignments.
Yeah. Exactly.
Yep, Alex, you've got it exactly right
Yeah, Ryan. Yep, exactly and again this is necessity, because, like I can.
I've got 80 min to test you I we have so much time to talk to you.
So yeah, I want you to. I would ideally like you learn this.
I am, but I you know I could only you know be a something I started here. I would like to know this the tutorial kind of covers like this assignments or this and the midterm is like this so
it's it's always a narrowing of things What would the third argument for the become command in our assignment?
2,
What you're supposed. So okay, let me walk you through what you're.
So what part of the assignment was figuring out?
What how did these commands work? I didn't just demonstrate them?
But look at the code
So here's where we so here we process exit there if It's. Pmf.
We do, we process it, and we continue through the loop.
So, Matt. Nope. this is Pmf. that calls that.
But it me continue means it contains the loop, the top, the loop is this parsing loop.
When we get a new prompt become, we do this.
We process the arguments we mess with it, and but then we continue here.
We don't have an explicit continue We go back up, and what do we do there?
We do all the normal processing of external commands.
So the syntax is become a username or a you Id when you've made the modification, and then anything else that 3,000 shell you know, ken parse in terms of external commands.
You can even do output redirection, because this is actually potentially still being parsed.
That's the way you should be doing it so I would recommend testing it with typing type.
Become, you know, give it any user. and then say, Id as the command that way.
You can see what user it's running as to make sure actually is becoming another user.
We'll be discussing assignment to answers next class before the midterm.
Yes, that is exactly the purpose of the lecture on Tuesday.
Oh!
Oh, oh, it's not gonna delete that
Oh, I didn't delete that
Setup. This function is a leftover from 3,000 shell
It's used the p list I deleted P. list, but I forgot to delete setup comm function that was for doing the process listing, and that was to get the name of the executable
Okay, So does that make sense? Lisa: Lisa: Okay, so quick.
Question. So when we start modifying the that become command to accept like doid, do you like in the code wants to check that?
It matches the uid of the user we're trying to become well.
You don't know what it is right you don't know what user they want to become
And why would you specify either? the 2 are inconsistent is not clear which one you'd use?
They're the same. and then why do you specify it twice?
Okay, what? you're supposed to do is when it comes to become it's you should look at the user name and the user name may actually be a number not text.
So check the first character of it and see if it's a number if it's like using like is digit if it's, an if it's a digit that's like Oh, wow, this is a you know the user names are not
supposed to start with numbers. So if it starts with a number you just say, okay, let's consume the whole thing's a number, and then you know use them like a toy convert it to a a number and then look up that
Uid. I mean this peak get pw name takes a username.
There's a get pwuid I think something like that that looks up by a user.
Id number, and you have to check you should condition on whether it's a number or a string
Okay got it alright, cause the way the questions were did it say like not just the user name.
So it's not like we're supposed to take in well, right But yeah, it's not just user name, because I can.
I. Normally I could have to type in like student, but now I should be able to type in 1,000, and 1,000 is not a user.
Id it's not a username it's a user.
Id. but the coach can tell, because it starts with a number versus a string versus tax letters.
It's like Oh, treat this as a user Id
That's all. So up for so assignment one question 8? Okay, So let's is that one question I Is that what you're talking?
Are we going back to assignment? one, Martin? Okay.
Oh, so what's going on here? I did go through the solutions for assignment?
One but Yeah, So but let me so so what's really happening here.
If you delete the call to wait is that the child, so let's go to through line.
34. This is
Okay, So we got 3,000 menu
8, so line 34. So here what line? 34?
Here is the weight. So we're running a program we do a fork.
So we have the fork, we either, if Pid equals 0 where the child otherwise with count.
So the child is going to do the exactly e the parent what's it doing.
If right now it's calling wait since the parent did create a child, it will wait for the child to finish and then the pid of the process.
That finish will go there, and the status we'll go in the variable status.
But if we delete this line we're no longer waiting, so this immediately returns instead of waiting, and once it returns, where do we go from?
Run program. We go through. You know you know we you know run program returns, and then we go back to top and then we get program choose program.
So we're printing the menu again so we print the menu.
But the other process is still there and it's potentially writing the standard out.
So they're both working at the same time and they're both outputting, and that's why they're interfering with each other.
So. So what what's going on with the interference of Io?
They both are opening. they're both writing to the same file specifically the terminal standard out.
So they're both multiple processes can write to the same file at the same time.
Unix has no prohibition against it but if they're both writing it.
No, it's not saying the child is a zombie If the child terminates, is there, it's just.
You have 2 processes writing to the same file
So
Let me let me Let me see if I can demonstrate I mean we're gonna talk about.
So this is an idea of concurrency and it's a very it's
Yeah. Each process has its own set of file descriptors.
Each process has its own set of file descriptors completely.
If think about that for a second, you realize it has to be the case that each has their own.
Otherwise nothing would work right it. There is a concept of locking a file in Linux.
It just doesn't happen by default. There is no exclusive access to files by default.
There are ways to lock them. Bye, you have to go to go to some effort to lock them.
Oh, so if it turns out. Oh, wait a second
Actually you're right sorry sorry you're the child, is a zombie.
Sorry. Okay, Okay, she long, I. This is when you run the program and you select these things.
If these programs, every program we create, this does create some needs.
Let me see if I can show you that okay let's let's go to Okay, Okay.
Okay, So i've got that there i've got this here so
Okay.
Huh!
Almost before.
Why am I not getting zombies? Oh, wait I know why i'm not getting zombies?
Because i'm waiting. Yes, let me sorry I I I Yes, of course I'm not getting things.
If I get rid of this, then I get some of these
Hey?
Okay, there we go. Yes, you didn't call wait so you do have zombies and Now, but if we type this
No more zombies because the trust is terminated. And so other processes got it.
Yeah.
The parent process. So here I am getting zombies because if there wasn't an infinite loop.
Then, so when does zombie appear let's let's talk about that
So as long you'll get zombies at last until 3 other menu term mates correct
I know the syntax of weight. The whole point of weight is this: W.
Status. You have the process that exited, and W. status and
So So this what status basically tells you whether the process you know returns to rate normally, or by calling exit, And then it's exit status.
What did it return? so like This is all the stuff that tells you in the process terminates.
Someone has to get that value you get it by calling weight If you don't call it it's gonna stick around as a zombie entry in the process table until someone calls weight when a process terminates the tree has to
be complete, someone else will become its parent. And typically, that process will call, wait for you.
Wait or lay calls or mandatory for a child. cost not piece of it.
Yes, unless you just terminate, someone has to call. Wait. Your process can shirk that responsibility.
But then you have to terminate, and then someone else will take it on
Yeah, the zombie is do this it's a Zombie, Because you exactly yeah, Okay, that's good okay.
So if you want to run a program in the background, you should install a signal handler for Sig, child.
That calls weight. Exactly. that's exactly it and that's exactly what 3,000 shell does are there any other calls playing similar roles for weight.
There's weight and there's weight pid yeah and the reason so weight gives you return value for and the arbitrary child processes that is terminated.
Wait pid, wait for a specific child process to terminate
Oh, okay. No problem. Other questions.
You will think of other questions. Let me know, otherwise I will talk about Fch.
So back in the day
So before. Ssh! there was telnet in our login rsh.
So. what these were is
Yeah.
So the 2 ways you could get it. So the text communication was all.
So when did you? was this: This was up until the mid 19 nineties on the Internet.
So really early days of the web remember. So just you all the web dates from 1992 1993 really took off in 1994.
But the Internet itself dates back to the 1970 S.
Before the Web, the Internet was used for email for file transfers, and for a few other things.
There are things like Internet relay, chat, irc, irc.
If any of you have played with that predates the web
Was this for mainframe computers or personal computers?
This was, for I would say more for many computers, and I mean, we talk on mainframes. You kind of talk about Ibm mainframes, which are these proprietary things and stuff more workstations and servers and
stuff is what was is what the Internet was built on. unix workstations, unix workstations, unix servers.
Those are the original things that were used to create the Internet.
Oh, yeah, mosaica Personal computers back in the day did not even have proper networking.
You know they they actually didn't run a multi-tasking operating system.
So they couldn't really do networking very Well, so but then Pcs got on the Internet
Cause. So between mainframe and pc yeah exactly it's kind of between this it's kind of many classes, you know, I would say.
But the main computers were things like workstations and servers for those workstations.
But unix machines, anyway. So So there's 4 essays there are talent, not along Rsa.
So you have a plain text socket channel where you're just sending.
But you know it's a byte stream going back and forth between computers. I could explain Tcp. ip here.
Maybe i'll do that later in the semester when I talk networking, so I don't think you all.
But you all should have seen at least the basic concepts of it in your 2,406.
So the main thing to understand about this is that it's not very secure.
Because you would just type in the password
You know here's type. it in the clear to the server so it just go you know the problem with us
So you just impersonate another host. So that was you, even a person, the other host.
You could just capture passwords horribly insecure.
So
Basic. So the I So Ssh is basically a secure version of Rsh.
And It's idea is to let you connect to another machine but do it securely.
Yeah. Smtp: Yeah, although oddly enough, yeah securities of is a complex problem in a context like Smtp because it's federated.
But separate discussion. So sh the secure version of rsh.
So yeah, you all have now seen this. you, you know, basic syntax, You say?
Ssh.
Oh, by the way, you can also say command after it, so you can, as if you
If you don't type a command you get a login shell but actually even use ssh to run computer on a remote system, it'll just run it and then return.
So we'll think in typing syntax the convention is, if you use angle bracket.
If you square brackets it's an optional argument, if you use angle brackets is required so I could do that.
So
Oh, be precise Here, give it a host optionally user at, and then command
You need. Yes, you need to enter a password to send a command.
Yes, either way, you you have to authenticate in order to do this.
So
And people talk about certification
And people talk about certificates they're really talking about public key photography.
Have you all over Had a couple of kick in discussion of public key cryptography in your classes, hey?
I didn't think so
So the idea of public key cryptography, so classic group
So the relationship is symmetric in the sense of both parties, have the same secret.
They both have the same knowledge, and they just have to verify to each other that they share the same secret.
And then they've identified each other yes, we share this we share this thing Now
How do you share the secret? In the first place, if you have 2 parties, and you know you want like we both are gonna agree that the secret, you know the secret password is banana.
And so you know, if I knock on your door and I say but banana, then, you know, to let me in, because i'm the right person.
How do you exchange the path? Secret word I mean.
If you say, maybe you go I would go outside and i'm gonna say it where I don't think there's microphones. I'm going to write a little piece of paper and i'm going to give it to you
and then once you've seen it you're gonna eat it so no one else can see it. and stuff like that.
You make sure to read it. This is all bad enough in real life on the Internet.
You're in really bad shape. it's you know there's always a way for someone to watch or read the secret, especially you're talking over a network because networks can be red by all kinds of parties
Gs ideas. Okay, So yeah, there there's definitely there's lots of resources in public key cryptography, and I definitely encourage you to read about it.
I'm just giving you a very basic understanding of this but I will say, what is public key cryptography?
Is this cool thing that you know came out in the late seventies
So public key cryptographic would be split instead of one shared secret.
You have 2 related pieces of information, a public part in the secret part
Oh, yeah, yeah, no. So we'll talk about certificate authorities in a second.
But this public part and secret part have this really weird property that
So what one can do the other can undo. you.
Encrypt with one you decrypt with the other.
And why this is so powerful is
So if I publish my pu, my public part as a public, as my public, your certificate say that certificate is a public key plus metadata like my name and email address, then
Because I only have the private key that matches that public key.
Anyone can send me a secret bit of information, they just take my public key, encrypt with it, and then send me the result.
Anyone else can look at it. They can't reverse it but I get it because I have the secret key.
I can decrypt it now, and I can read the secret message that was just meant for me.
Okay, in practice there are algorithms such as Rsa which we use for both.
In practice we often use different algorithms for the 2 that's take take cryptography and learn about all those details
So this the certificate authority is not in the middle of this.
No, no, no! the certificate authority is not in the middle of this at all.
It's actually very
Yeah. So the sender can't decrypt the message either.
Nope exactly the sender can't decrypt the message If they're sending a secret message because they don't have the private key, they can just create it so
So what are we doing with S. H.
Some shortness.
Let's talk about this here i'll type out first this How does the server know you're talking the right doing? Sorry the right, server?
Well, when I let's go to
So note that Tls is another very se is another protocol. Ssh.
Has its own distinct protocol. I have not talked about certificate authorities yet.
I will talk about them shortly. because actually ssh doesn't by default user certificate authority at all.
So, if I ssh
Not need that say
So when I assh here and I do this if you do test, Okay, So if I do so I do.
Dash V. here. You'll notice it says access it tells me all this stuff it loads my identity files, and then you'll you know It's just telling you things some of the algorithms it's using
and notice this line. Right here, host access. The seo call is known and matches the Ec.
Dsa. Host Key. Keep in home Soma dot Ssh.
Known hosts line 31. So if I look at known host line 31, This line is a Ho is the key for access.
Now you might notice that it's all doubled you go here, because this is a secure hash of madness.
So So what's happening here is this is this is an identifier here, which i'll explain here for the for the remote host.
This is an algorithm designation. and then this is the public key, which is a bunch of bits.
And just in stored using a bunch of you know numbers for representing the numbers.
But you know, because you wanted the text file. But this is the key.
And what as part of the protocol here we're connecting to a host and is checking to see Is this a host?
We know. And this is, why, when you first do an ssh connection to a host, if it's not in your known host database, you'll actually say, do you want to add this key, and then from then on it won't ask you
about, except if for some reason there's a discrepancy like you say you're going to the same most but the key is changed.
It will go. Wow! it's bad because that's exactly I would attack her, would try to impersonate a server.
Oh, hey, no! We're talking about server
So I know the targeting, the right public sort of How is this sort of know your authorized user
So you know. So for show that you're an authorized user you show that you have the right secret key by by having that in the authorized key file on the remote system.
Otherwise you know how you know you're trying to server because it's there
So for this one it saved on first use. and this way.
Now I put the key phone. So so what about
Also certificate authority is is someone who signs certificates
That's all happening with with a certificate authority. it's just a certificate that signed by someone we trust
How do you know we get the right secret key so They don't Transfer the secret key to you.
They engage in a protocol, where they proved that they have the secret key corresponding to the public.
How do they do this? We it. The basic version of this would be.
They. they take a message, they encrypt it with the secret kid, or we take a message.
We encrypt it with a public key, we send it to them.
They decrypt it. they read it, and based on that.
They send us what was in, You know they proved they sent us that message.
They say, See? look you said this. this special number was 1, 2, 3, 4, 5.
It is 1, 2, 3, 5. Here you go! they go. Oh, you must have decrypted the message, so you must have the secret key.
So I believe you in practice. The cryptographic protocols are much more sophisticated because there's lots of ways to mess this up.
Yeah, you don't ever share your secret key it's secret.
You never share it. You do things with it, but you never share.
Okay, Okay, So okay, Good. So Now look let's talk a bit about great. Oh, great, Yeah.
The links. Oh, great, thank you, Jason. yeah there's I This is not a major focus in the course.
If I was taking a apply cryptography I would definitely tell you, tell you more.
But I do want to show you a little bit in the web browser to see since i'm talking about this here.
Yeah, this is it's it's a big time but what I do think you should know is i'm going to stop sharing, and i'm going to ship switch over to my firefox web browser so if I go
over here, and I go to I go to my wiki so you'll notice that when you're here there's a lock icon, because It's hcps and it says the connection is secure so what it's saying
is you're fully connected to the site verified by let's encrypt
So. Oh, let me stop sharing here, cause you can't see i'll share with screen share a portion of my screen.
There we go, so now you can see this.
Let's get some there where
So here's the little window that does this and it says this let's encrypt view certificate use things.
So what this is saying is that i'm visiting homeostasis is verified by let's encrypt, which means that I have a certificate on homeostasis, and it's been issued by
this, which means that I you know my server has its own certificate.
But it was signed by let's encrypt here which was then side by this, the Internet Security research group.
Why does my browser trust this because it's built in and this is the crazy thing.
So if you go to your settings in your browser and you go to privacy and security, and you go here, and you go down to
View certificates. These are all the certificates that's your browser.
Trust as an authority. If any website sends you basically sends a public key that has been signed by one of these entities, your browser will trust it.
There's a lot of entities here, some of them including like the Chinese Government.
And you say person.
Okay. Oh, yeah, there, there's definitely a security tap in there.
But the thing I just want you to know about certificates is all a certificate is is a statement
Maybe those security that Yup. Yup. So Oh, I list on one thing
Some i'll share with this
Awesome.
So just general rule. don't implement your own cryptography it's very, very bad.
It's way too easy to do things wrong you're gonna don't use known algorithms and use known implementations of them, because in order to make a secure implementation, you have to do lots of little tricks just like one of them
is time timing attacks a remote attacker can figure out what the secrets are on your server by just watching how long it takes you to process different messages.
It's called the timing attack just by how long it takes you to the multiplication exponential.
All these operations can take non, you know, not true amounts of time.
You can observe the algorithmic differences, and thus you leak information, and this can give away your secret very hard to avoid all these attacks.
Even experience cryptographers make mistakes it's hard stuff so don't do it.
Friends love enemies that get from the cryptography.
Yes, yes, exactly. but in terms of Ssh! how do you use?
Ssh! Just copy your your public key viewing Copy your public heat. generate a public key pair copied the most system, and that's how you avoid.
Thanks. So like for me right here with. so what do I have here?
I go to dot Sh! I look at my authorized keys file
So if you look here, this is my authorized keys file.
It trusts 2 keys here, and that's what you can use to
You know those are the keys on my system. And where?
Where did I get that information? That is.
So you'll see this right here this Id rsa Dot, you know this.
The contents of Id to Rsa dot Pub that you should notice is identical to this right here.
Now I'm showing this in a lecture. Why, am I showing it because it's a public key.
It's not secret. Now, if I do
Notice that my public key is world readable. My private key is not.
If I showed you my probably the key right now, I would have to change it, because I could have given you access to all my systems.
So i'm not going to do that one other thing to know
Notice that your Ssh Directory should in general not be world readable, should only be accessible by you.
If it's if there's any problem with that also if your home directories is
So bye, if your home directory is also
So my home Directory has to not be writable by group or other, and similarly, that can't be the case for an envelope, and the Ssh.
Directory has to be not accessible, to anyone except the owner If you don't do these ssh will look at those go like this is too insecure.
And we'll complain and won't do we won't look at those files
Anyway, I will stop here. Rsa is a great by the way.
Nowadays. yeah, open. Ssl: is pretty good, although yeah, people criticize it.
Ours is a collaboration through researchers
Ours is a collaboration. 3 researchers Yes, by the way don't use oursa anymore.
Really i'm surprised I should probably change my key from using it's not a big idea, but Rsa is not really for new implementations anymore.
Oursa is a very well known still in technically secure but there's so many little attacks on it, and there's so many attacks on it and there's so much it's relatively slow so
It's a It's Tricky, we've got better algorithms to use nowadays, and you'll look at, you know, if you look at my browser and you look at what what this is being used and what you
know, public key algorithm is being used here. Oh, let's go here.
We you know here connection secure no what's it saying connection encrypted Tls Aes Gcm.
1 20 bits. So aes is still pretty secure haven't talked hash functions, you certificate.
This is a Oh, this is an rsa key they're using ours but 4,996 bit key, anyway.
There are no office hours today. yeah there's no way to
I don't have time today necessarily. but I can stick around for a couple of minutes here to answer questions, anyway.