1*426d2b71SDavid du Colombier.HTML "Security in Plan 9 2b7b24591SDavid du Colombier.de SS 3b7b24591SDavid du Colombier.NH 2 4b7b24591SDavid du Colombier.. 59a747e4fSDavid du Colombier.EQ 69a747e4fSDavid du Colombierdelim $# 79a747e4fSDavid du Colombier.EN 89a747e4fSDavid du Colombier.TL 99a747e4fSDavid du ColombierSecurity in Plan 9 109a747e4fSDavid du Colombier.AU 119a747e4fSDavid du ColombierRuss Cox, MIT LCS 129a747e4fSDavid du Colombier.br 139a747e4fSDavid du ColombierEric Grosse, Bell Labs 149a747e4fSDavid du Colombier.br 159a747e4fSDavid du ColombierRob Pike, Bell Labs 169a747e4fSDavid du Colombier.br 179a747e4fSDavid du ColombierDave Presotto, Avaya Labs and Bell Labs 189a747e4fSDavid du Colombier.br 199a747e4fSDavid du ColombierSean Quinlan, Bell Labs 209a747e4fSDavid du Colombier.br 219a747e4fSDavid du Colombier.CW {rsc,ehg,rob,presotto,seanq}@plan9.bell-labs.com 229a747e4fSDavid du Colombier.AB 239a747e4fSDavid du ColombierThe security architecture of the Plan 9™ 249a747e4fSDavid du Colombieroperating system has recently been redesigned 259a747e4fSDavid du Colombierto address some technical shortcomings. 269a747e4fSDavid du ColombierThis redesign provided an opportunity also to make the system more 279a747e4fSDavid du Colombierconvenient to use securely. 289a747e4fSDavid du ColombierPlan 9 has thus improved in two ways not usually seen together: 299a747e4fSDavid du Colombierit has become more secure 309a747e4fSDavid du Colombier.I and 319a747e4fSDavid du Colombiereasier to use. 329a747e4fSDavid du Colombier.LP 339a747e4fSDavid du ColombierThe central component of the new architecture is a per-user 349a747e4fSDavid du Colombierself-contained agent called 359a747e4fSDavid du Colombier.CW factotum . 369a747e4fSDavid du Colombier.CW Factotum 379a747e4fSDavid du Colombiersecurely holds a 389a747e4fSDavid du Colombiercopy of the user's keys and negotiates authentication protocols, on 399a747e4fSDavid du Colombierbehalf of the user, with secure services around the network. 409a747e4fSDavid du ColombierConcentrating security code in a single program offers several 419a747e4fSDavid du Colombieradvantages including: ease of update or repair to broken security 429a747e4fSDavid du Colombiersoftware and protocols; the ability to run secure services at a lower 439a747e4fSDavid du Colombierprivilege level; uniform management of keys for all services; and an 449a747e4fSDavid du Colombieropportunity to provide single sign on, even to unchanged legacy 459a747e4fSDavid du Colombierapplications. 469a747e4fSDavid du Colombier.CW Factotum 479a747e4fSDavid du Colombierhas an unusual architecture: it is implemented 489a747e4fSDavid du Colombieras a Plan 9 file server. 49b7b24591SDavid du Colombier.FS 50*426d2b71SDavid du ColombierAppeared, in a slightly different form, in 51b7b24591SDavid du Colombier.I 52b7b24591SDavid du ColombierProc. of the 2002 Usenix Security Symposium, 53b7b24591SDavid du Colombier.R 54b7b24591SDavid du ColombierSan Francisco. 55b7b24591SDavid du Colombier.FE 569a747e4fSDavid du Colombier.AE 579a747e4fSDavid du Colombier.NH 1 589a747e4fSDavid du ColombierIntroduction 599a747e4fSDavid du Colombier.LP 609a747e4fSDavid du ColombierSecure computing systems face two challenges: 619a747e4fSDavid du Colombierfirst, they must employ sophisticated technology that is difficult to design 629a747e4fSDavid du Colombierand prove correct; and second, 639a747e4fSDavid du Colombierthey must be easy for regular people to use. 649a747e4fSDavid du ColombierThe question of ease of use is sometimes neglected, but it is essential: 659a747e4fSDavid du Colombierweak but easy-to-use security can be more effective than strong but 669a747e4fSDavid du Colombierdifficult-to-use security if it is more likely to be used. 679a747e4fSDavid du ColombierPeople lock their front doors when they leave the house, knowing 689a747e4fSDavid du Colombierfull well that a burglar is capable of picking the lock (or avoiding 699a747e4fSDavid du Colombierthe door altogether); yet few would accept the cost and 709a747e4fSDavid du Colombierawkwardness of a bank vault door on the 719a747e4fSDavid du Colombierhouse even though that might reduce the probability of a robbery. 729a747e4fSDavid du ColombierA related point is that users need a clear model of how the security 739a747e4fSDavid du Colombieroperates (if not how it actually provides security) in order to use it 749a747e4fSDavid du Colombierwell; for example, the clarity of a lock icon on a web browser 759a747e4fSDavid du Colombieris offset by the confusing and typically insecure 769a747e4fSDavid du Colombiersteps for installing X.509 certificates. 779a747e4fSDavid du Colombier.LP 789a747e4fSDavid du ColombierThe security architecture of the Plan 9 795d459b5aSDavid du Colombieroperating system 805d459b5aSDavid du Colombier[Pike95] 819a747e4fSDavid du Colombierhas recently been redesigned to make it both more secure 829a747e4fSDavid du Colombierand easier to use. 839a747e4fSDavid du ColombierBy 849a747e4fSDavid du Colombier.I security 859a747e4fSDavid du Colombierwe mean three things: 869a747e4fSDavid du Colombierfirst, the business of authenticating users and services; 879a747e4fSDavid du Colombiersecond, the safe handling, deployment, and use of keys 889a747e4fSDavid du Colombierand other secret information; and 899a747e4fSDavid du Colombierthird, the use of encryption and integrity checks 909a747e4fSDavid du Colombierto safeguard communications 919a747e4fSDavid du Colombierfrom prying eyes. 929a747e4fSDavid du Colombier.LP 939a747e4fSDavid du ColombierThe old security architecture of Plan 9 949a747e4fSDavid du Colombierhad several engineering problems in common with other operating systems. 959a747e4fSDavid du ColombierFirst, it had an inadequate notion of security domain. 969a747e4fSDavid du ColombierOnce a user provided a password to connect to a local file store, 979a747e4fSDavid du Colombierthe system required that the same password be used to access all the other file 989a747e4fSDavid du Colombierstores. 999a747e4fSDavid du ColombierThat is, the system treated all network services as 1009a747e4fSDavid du Colombierbelonging to the same security domain. 1019a747e4fSDavid du Colombier.LP 1029a747e4fSDavid du ColombierSecond, the algorithms and protocols used in authentication, 1039a747e4fSDavid du Colombierby nature tricky and difficult to get right, were compiled into the 1049a747e4fSDavid du Colombiervarious applications, kernel modules, and file servers. 1059a747e4fSDavid du ColombierChanges and fixes to a security protocol 1069a747e4fSDavid du Colombierrequired that all components using that protocol needed to be recompiled, 1079a747e4fSDavid du Colombieror at least relinked, and restarted. 1089a747e4fSDavid du Colombier.LP 1095d459b5aSDavid du ColombierThird, the file transport protocol, 9P 1105d459b5aSDavid du Colombier[Pike93], 1119a747e4fSDavid du Colombierthat forms the core of 1129a747e4fSDavid du Colombierthe Plan 9 system, had its authentication protocol embedded in its design. 1139a747e4fSDavid du ColombierThis meant that fixing or changing the authentication used by 9P 1149a747e4fSDavid du Colombierrequired deep changes to the system. 1159a747e4fSDavid du ColombierIf someone were to find a way to break the protocol, the system would 1169a747e4fSDavid du Colombierbe wide open and very hard to fix. 1179a747e4fSDavid du Colombier.LP 1189a747e4fSDavid du ColombierThese and a number of lesser problems, combined with a desire 1199a747e4fSDavid du Colombierfor more widespread use of encryption in the system, spurred us to 1209a747e4fSDavid du Colombierrethink the entire security architecture of Plan 9. 1219a747e4fSDavid du Colombier.LP 1229a747e4fSDavid du ColombierThe centerpiece of the new architecture is an agent, 1239a747e4fSDavid du Colombiercalled 1249a747e4fSDavid du Colombier.CW factotum , 1259a747e4fSDavid du Colombierthat handles the user's keys and negotiates all security 1269a747e4fSDavid du Colombierinteractions with system services and applications. 1275d459b5aSDavid du ColombierLike a trusted assistant with a copy of the owner's keys, 1289a747e4fSDavid du Colombier.CW factotum 1299a747e4fSDavid du Colombierdoes all the negotiation for security and authentication. 1309a747e4fSDavid du ColombierPrograms no longer need to be compiled with cryptographic 1319a747e4fSDavid du Colombiercode; instead they communicate with 1329a747e4fSDavid du Colombier.CW factotum 1339a747e4fSDavid du Colombieragents 1349a747e4fSDavid du Colombierthat represent distinct entities in the cryptographic exchange, 1359a747e4fSDavid du Colombiersuch as a user and server of a secure service. 1369a747e4fSDavid du ColombierIf a security protocol needs to be added, deleted, or modified, 1379a747e4fSDavid du Colombieronly 1389a747e4fSDavid du Colombier.CW factotum 1399a747e4fSDavid du Colombierneeds to be updated for all system services 1409a747e4fSDavid du Colombierto be kept secure. 1419a747e4fSDavid du Colombier.LP 1429a747e4fSDavid du ColombierBuilding on 1439a747e4fSDavid du Colombier.CW factotum , 1449a747e4fSDavid du Colombierwe modified 1459a747e4fSDavid du Colombiersecure services in the system to move 1469a747e4fSDavid du Colombieruser authentication code into 1479a747e4fSDavid du Colombier.CW factotum ; 1489a747e4fSDavid du Colombiermade authentication a separable component of the file server protocol; 1499a747e4fSDavid du Colombierdeployed new security protocols; 1509a747e4fSDavid du Colombierdesigned a secure file store, 1519a747e4fSDavid du Colombiercalled 1529a747e4fSDavid du Colombier.CW secstore , 1539a747e4fSDavid du Colombierto protect our keys but make them easy to get when they are needed; 1549a747e4fSDavid du Colombierdesigned a new kernel module to support transparent use of 1559a747e4fSDavid du ColombierTransport Layer Security (TLS) 1569a747e4fSDavid du Colombier[RFC2246]; 1579a747e4fSDavid du Colombierand began using encryption for all communications within the system. 1589a747e4fSDavid du ColombierThe overall architecture is illustrated in Figure 1a. 159*426d2b71SDavid du Colombier.if h .B1 10 60 1609a747e4fSDavid du Colombier.KF 1619a747e4fSDavid du Colombier.EQ 1629a747e4fSDavid du Colombiergsize 9 1639a747e4fSDavid du Colombier.EN 1649a747e4fSDavid du Colombier.PS 3i 1659a747e4fSDavid du Colombier 1669a747e4fSDavid du Colombier# Secstore 1679a747e4fSDavid du ColombierSec: box "Secstore" wid 1.3i ht .5i 1689a747e4fSDavid du Colombier 1699a747e4fSDavid du Colombier# Terminal 1709a747e4fSDavid du ColombierTerm0: box invis ht .1i with .e at Sec.e + (-1.1i, -.5i) 1719a747e4fSDavid du ColombierTerm: box wid 1.1i ht 1i with .nw at Term0.ne 1729a747e4fSDavid du ColombierTermlab: "\s-2Terminal\s+2" at Term.s + (0, -.15i) 1739a747e4fSDavid du ColombierFT: ellipse "$ F sub T#" wid .40i ht .30i with .ne at Term.ne + (-.1i, -.1i) 1749a747e4fSDavid du ColombierPT: ellipse "$ P sub T#" wid .6i ht .45i with .sw at Term.sw + (.2i, .2i) 1759a747e4fSDavid du Colombier 1769a747e4fSDavid du Colombier# CPU 1779a747e4fSDavid du ColombierCpu0: box invis ht .1i with .w at Term0.w + (3i, 0) 1789a747e4fSDavid du ColombierCpu: box wid 1.1i ht 1i with .nw at Cpu0.ne 1799a747e4fSDavid du ColombierCpulab: "\s-2CPU Server\s+2" at Cpu.s + (0, -.15i) 1809a747e4fSDavid du ColombierFC: ellipse "$ F sub C#" wid .40 ht .30i with .nw at Cpu.nw + (.1i, -.1i) 1819a747e4fSDavid du ColombierPC: ellipse "$ P sub C#" wid .6i ht .45i with .se at Cpu.se + (-.2i, .2i) 1829a747e4fSDavid du Colombier 1839a747e4fSDavid du Colombier# Authentication Server 1849a747e4fSDavid du ColombierAuth: box dashed "Auth Server" wid 1.3i ht .5i with .e at Sec.e + (0, -2.3i) 1859a747e4fSDavid du Colombier 1869a747e4fSDavid du Colombier# File Server 1879a747e4fSDavid du ColombierFile0: box invis ht .1i with .w at Cpu0.w + (0, -1.5i) 1889a747e4fSDavid du ColombierFile: box wid 1.1i ht 1i with .nw at File0.ne 1899a747e4fSDavid du ColombierFilelab: "\s-2File Server\s+2" at File.s + (0, -.15i) 1909a747e4fSDavid du ColombierFF: ellipse "$ F sub F#" wid .40i ht .30i with .nw at File.nw + (.1i, -.1i) 1919a747e4fSDavid du ColombierPF: ellipse "$ P sub F#" wid .6i ht .45i with .se at File.se + (-.2i, .2i) 1929a747e4fSDavid du Colombier 1939a747e4fSDavid du Colombier# Connections 1949a747e4fSDavid du Colombierline from PT.e + (0, +0.05i) to PC.w + (0, +0.05i) 1959a747e4fSDavid du Colombierspline from PT.e + (0, -0.05i) right 1i then down 1.5i right .5i then right to PF.w + (0, -0.05i) 1969a747e4fSDavid du Colombierspline from PC.w + (0, -0.05i) left 1.1i then down 1.4i then right to PF.w + (0, 0.05i) 1979a747e4fSDavid du Colombierline <-> from FC.se to PC.nw 1989a747e4fSDavid du Colombierline <-> from FT.sw to PT.ne 1999a747e4fSDavid du Colombierline <-> from FF.se to PF.nw 2009a747e4fSDavid du Colombierspline <-> from Sec.e right .5i then down .655i then left to FT.e 2019a747e4fSDavid du Colombier#spline from Auth.e + (0, 0.05i) right .5i then up 1i then to FT.se 2029a747e4fSDavid du Colombier#spline from Auth.e + (0, 0.00i) right .7i then up 1i then to FC.sw 2039a747e4fSDavid du Colombier#spline from Auth.e + (0, -0.05i) right .5i then to FF.w 2049a747e4fSDavid du Colombier.PE 2059a747e4fSDavid du Colombier.LP 2069a747e4fSDavid du Colombier.ps 9 2079a747e4fSDavid du Colombier.vs 10 2089a747e4fSDavid du ColombierFigure 1a. Components of the security architecture. 2099a747e4fSDavid du ColombierEach box is a (typically) separate machine; each ellipse a process. 2109a747e4fSDavid du ColombierThe ellipses labeled $F sub X# 2119a747e4fSDavid du Colombierare 2129a747e4fSDavid du Colombier.CW factotum 2139a747e4fSDavid du Colombierprocesses; those labeled 2149a747e4fSDavid du Colombier$P sub X# 2159a747e4fSDavid du Colombierare the pieces and proxies of a distributed program. 2169a747e4fSDavid du ColombierThe authentication server is one of several repositories for users' security information 2179a747e4fSDavid du Colombierthat 2189a747e4fSDavid du Colombier.CW factotum 2199a747e4fSDavid du Colombierprocesses consult as required. 2209a747e4fSDavid du Colombier.CW Secstore 2219a747e4fSDavid du Colombieris a shared resource for storing private information such as keys; 2229a747e4fSDavid du Colombier.CW factotum 2239a747e4fSDavid du Colombierconsults it for the user during bootstrap. 2249a747e4fSDavid du Colombier.sp 2259a747e4fSDavid du Colombier.KE 226*426d2b71SDavid du Colombier.if h .B2 2279a747e4fSDavid du Colombier.EQ 2289a747e4fSDavid du Colombiergsize 11 2299a747e4fSDavid du Colombier.EN 2309a747e4fSDavid du Colombier.LP 2319a747e4fSDavid du ColombierSecure protocols and algorithms are well understood 2329a747e4fSDavid du Colombierand are usually not the weakest link in a system's security. 2339a747e4fSDavid du ColombierIn practice, most security problems arise from buggy servers, 2349a747e4fSDavid du Colombierconfusing software, or administrative oversights. 2359a747e4fSDavid du ColombierIt is these practical problems that we are addressing. 2369a747e4fSDavid du ColombierAlthough this paper describes the algorithms and protocols we are using, 2379a747e4fSDavid du Colombierthey are included mainly for concreteness. 2385d459b5aSDavid du ColombierOur main intent is to present a simple security architecture built 2399a747e4fSDavid du Colombierupon a small trusted code base that is easy to verify (whether by manual or 2409a747e4fSDavid du Colombierautomatic means), easy to understand, and easy to use. 2419a747e4fSDavid du Colombier.LP 2429a747e4fSDavid du ColombierAlthough it is a subjective assessment, 2439a747e4fSDavid du Colombierwe believe we have achieved our goal of ease of use. 2449a747e4fSDavid du ColombierThat we have achieved 2459a747e4fSDavid du Colombierour goal of improved security is supported by our plan to 2469a747e4fSDavid du Colombiermove our currently private computing environment onto the Internet 2479a747e4fSDavid du Colombieroutside the corporate firewall. 2489a747e4fSDavid du ColombierThe rest of this paper explains the architecture and how it is used, 2499a747e4fSDavid du Colombierto explain why a system that is easy to use securely is also safe 2509a747e4fSDavid du Colombierenough to run in the open network. 2519a747e4fSDavid du Colombier.NH 1 2529a747e4fSDavid du ColombierAn Agent for Security 2539a747e4fSDavid du Colombier.LP 2549a747e4fSDavid du ColombierOne of the primary reasons for the redesign of the Plan 9 2559a747e4fSDavid du Colombiersecurity infrastructure was to remove the authentication 2569a747e4fSDavid du Colombiermethod both from the applications and from the kernel. 2579a747e4fSDavid du ColombierCryptographic code 2589a747e4fSDavid du Colombieris large and intricate, so it should 2599a747e4fSDavid du Colombierbe packaged as a separate component that can be repaired or 2609a747e4fSDavid du Colombiermodified without altering or even relinking applications 2619a747e4fSDavid du Colombierand services that depend on it. 2629a747e4fSDavid du ColombierIf a security protocol is broken, it should be trivial to repair, 2639a747e4fSDavid du Colombierdisable, or replace it on the fly. 2649a747e4fSDavid du ColombierSimilarly, it should be possible for multiple programs to use 2659a747e4fSDavid du Colombiera common security protocol without embedding it in each program. 2669a747e4fSDavid du Colombier.LP 2679a747e4fSDavid du ColombierSome systems use dynamically linked libraries (DLLs) to address these configuration issues. 2689a747e4fSDavid du ColombierThe problem with this approach is that it leaves 2699a747e4fSDavid du Colombiersecurity code in the same address space as the program using it. 2709a747e4fSDavid du ColombierThe interactions between the program and the DLL 2719a747e4fSDavid du Colombiercan therefore accidentally or deliberately violate the interface, 2729a747e4fSDavid du Colombierweakening security. 2739a747e4fSDavid du ColombierAlso, a program using a library to implement secure services 2749a747e4fSDavid du Colombiermust run at a privilege level necessary to provide the service; 2759a747e4fSDavid du Colombierseparating the security to a different program makes it possible 2769a747e4fSDavid du Colombierto run the services at a weaker privilege level, isolating the 2779a747e4fSDavid du Colombierprivileged code to a single, more trustworthy component. 2789a747e4fSDavid du Colombier.LP 2799a747e4fSDavid du ColombierFollowing the lead of the SSH agent 2809a747e4fSDavid du Colombier[Ylon96], 2819a747e4fSDavid du Colombierwe give each user 2829a747e4fSDavid du Colombieran agent process responsible 2839a747e4fSDavid du Colombierfor holding and using the user's keys. 2849a747e4fSDavid du ColombierThe agent program is called 2859a747e4fSDavid du Colombier.CW factotum 2869a747e4fSDavid du Colombierbecause of its similarity to the proverbial servant with the 2879a747e4fSDavid du Colombierpower to act on behalf of his master because he holds the 2889a747e4fSDavid du Colombierkeys to all the master's possessions. It is essential that 2899a747e4fSDavid du Colombier.CW factotum 2909a747e4fSDavid du Colombierkeep the keys secret and use them only in the owner's interest. 2919a747e4fSDavid du ColombierLater we'll discuss some changes to the kernel to reduce the possibility of 2929a747e4fSDavid du Colombier.CW factotum 2939a747e4fSDavid du Colombierleaking information inadvertently. 2949a747e4fSDavid du Colombier.LP 2959a747e4fSDavid du Colombier.CW Factotum 2969a747e4fSDavid du Colombieris implemented, like most Plan 9 services, as a file server. 2979a747e4fSDavid du ColombierIt is conventionally mounted upon the directory 2985d459b5aSDavid du Colombier.CW /mnt/factotum , 2999a747e4fSDavid du Colombierand the files it serves there are analogous to virtual devices that provide access to, 3009a747e4fSDavid du Colombierand control of, the services of the 3019a747e4fSDavid du Colombier.CW factotum . 3029a747e4fSDavid du ColombierThe next few sections describe the design of 3039a747e4fSDavid du Colombier.CW factotum 3049a747e4fSDavid du Colombierand how it operates with the other pieces of Plan 9 to provide 3059a747e4fSDavid du Colombiersecurity services. 3069a747e4fSDavid du Colombier.SS 3079a747e4fSDavid du ColombierLogging in 3089a747e4fSDavid du Colombier.LP 3099a747e4fSDavid du ColombierTo make the discussions that follow more concrete, 3109a747e4fSDavid du Colombierwe begin with a couple of examples showing how the 3119a747e4fSDavid du ColombierPlan 9 security architecture appears to the user. 3129a747e4fSDavid du ColombierThese examples both involve a user 3139a747e4fSDavid du Colombier.CW gre 3149a747e4fSDavid du Colombierlogging in after booting a local machine. 3159a747e4fSDavid du ColombierThe user may or may not have a secure store in which 3169a747e4fSDavid du Colombierall his keys are kept. 3179a747e4fSDavid du ColombierIf he does, 3189a747e4fSDavid du Colombier.CW factotum 3199a747e4fSDavid du Colombierwill prompt him for the password to the secure store 3209a747e4fSDavid du Colombierand obtain keys from it, prompting only when a key 3219a747e4fSDavid du Colombierisn't found in the store. 3225d459b5aSDavid du ColombierOtherwise, 3239a747e4fSDavid du Colombier.CW factotum 3249a747e4fSDavid du Colombiermust prompt for each key. 3259a747e4fSDavid du Colombier.LP 3265d459b5aSDavid du ColombierIn the typescripts, \f6\s9\en\s0\fP 3279a747e4fSDavid du Colombierrepresents a literal newline 3289a747e4fSDavid du Colombiercharacter typed to force a default response. 3299a747e4fSDavid du ColombierUser input is in italics, and 3309a747e4fSDavid du Colombierlong lines are folded and indented to fit. 3319a747e4fSDavid du Colombier.LP 3329a747e4fSDavid du ColombierThis first example shows a user logging in without 3339a747e4fSDavid du Colombierhelp from the secure store. 3349a747e4fSDavid du ColombierFirst, 3359a747e4fSDavid du Colombier.CW factotum 3369a747e4fSDavid du Colombierprompts for a user name that the local kernel 3379a747e4fSDavid du Colombierwill use: 3389a747e4fSDavid du Colombier.P1 3399a747e4fSDavid du Colombieruser[none]: \f6\s9gre\s0\fP 3409a747e4fSDavid du Colombier.P2 3419a747e4fSDavid du Colombier(Default responses appear in square brackets.) 3429a747e4fSDavid du ColombierThe kernel then starts accessing local resources 3439a747e4fSDavid du Colombierand requests, through 3449a747e4fSDavid du Colombier.CW factotum , 3459a747e4fSDavid du Colombiera user/password pair to do so: 3469a747e4fSDavid du Colombier.P1 3479a747e4fSDavid du Colombier!Adding key: dom=cs.bell-labs.com 3489a747e4fSDavid du Colombier proto=p9sk1 3499a747e4fSDavid du Colombieruser[gre]: \f6\s9\en\s0\fP 3509a747e4fSDavid du Colombierpassword: \f6****\fP 3519a747e4fSDavid du Colombier.P2 3529a747e4fSDavid du ColombierNow the user is logged in to the local system, and 3539a747e4fSDavid du Colombierthe mail client starts up: 3549a747e4fSDavid du Colombier.P1 3559a747e4fSDavid du Colombier!Adding key: proto=apop 3569a747e4fSDavid du Colombier server=plan9.bell-labs.com 3579a747e4fSDavid du Colombieruser[gre]: \f6\s9\en\s0\fP 3589a747e4fSDavid du Colombierpassword: \f6****\fP 3599a747e4fSDavid du Colombier.P2 3609a747e4fSDavid du Colombier.CW Factotum 3619a747e4fSDavid du Colombieris doing all the prompting and the applications 3629a747e4fSDavid du Colombierbeing started are not even touching the keys. 3635d459b5aSDavid du ColombierNote that it's always clear which key is being requested. 3649a747e4fSDavid du Colombier.LP 3659a747e4fSDavid du ColombierNow consider the same login sequence, but in the case where 3669a747e4fSDavid du Colombier.CW gre 3679a747e4fSDavid du Colombierhas a secure store account: 3689a747e4fSDavid du Colombier.P1 3699a747e4fSDavid du Colombieruser[none]: \f6\s9gre\s0\fP 3705d459b5aSDavid du Colombiersecstore password: \f6*********\fP 3715d459b5aSDavid du ColombierSTA PIN+SecurID: \f6*********\fP 3729a747e4fSDavid du Colombier.P2 3739a747e4fSDavid du ColombierThat's the last 3749a747e4fSDavid du Colombier.CW gre 3759a747e4fSDavid du Colombierwill hear from 3769a747e4fSDavid du Colombier.CW factotum 3779a747e4fSDavid du Colombierunless an attempt is made to contact 3789a747e4fSDavid du Colombiera system for which no key is kept in the secure store. 3799a747e4fSDavid du Colombier.SS 3809a747e4fSDavid du ColombierThe factotum 3819a747e4fSDavid du Colombier.LP 3829a747e4fSDavid du ColombierEach computer running Plan 9 has one user id that owns all the 3839a747e4fSDavid du Colombierresources on that system \(em the scheduler, local disks, 3849a747e4fSDavid du Colombiernetwork interfaces, etc. 3859a747e4fSDavid du ColombierThat user, the 3869a747e4fSDavid du Colombier.I "host owner" , 3879a747e4fSDavid du Colombieris the closest analogue in Plan 9 to a Unix 3889a747e4fSDavid du Colombier.CW root 3899a747e4fSDavid du Colombieraccount (although it is far weaker; 3909a747e4fSDavid du Colombierrather than having special powers, as its name implies the host owner 3919a747e4fSDavid du Colombieris just a regular user that happens to own the 3929a747e4fSDavid du Colombierresources of the local machine). 3939a747e4fSDavid du ColombierOn a single-user system, which we call a terminal, 3949a747e4fSDavid du Colombierthe host owner is the id of the terminal's user. 3959a747e4fSDavid du ColombierShared servers such as CPU servers normally have a pseudo-user 3969a747e4fSDavid du Colombierthat initially owns all resources. 3975d459b5aSDavid du ColombierAt boot time, the Plan 9 kernel starts a 3989a747e4fSDavid du Colombier.CW factotum 3995d459b5aSDavid du Colombierexecuting as, and therefore with the privileges of, 4009a747e4fSDavid du Colombierthe host owner. 4019a747e4fSDavid du Colombier.LP 4029a747e4fSDavid du ColombierNew processes run as 4039a747e4fSDavid du Colombierthe same user as the process which created them. 4049a747e4fSDavid du ColombierWhen a process must take on the identity of a new user, 4059a747e4fSDavid du Colombiersuch as to provide a login shell 4069a747e4fSDavid du Colombieron a shared CPU server, 4079a747e4fSDavid du Colombierit does so by proving to the host owner's 4089a747e4fSDavid du Colombier.CW factotum 4099a747e4fSDavid du Colombierthat it is 4109a747e4fSDavid du Colombierauthorized to do so. 4119a747e4fSDavid du ColombierThis is done by running an 4129a747e4fSDavid du Colombierauthentication protocol with 4139a747e4fSDavid du Colombier.CW factotum 4149a747e4fSDavid du Colombierto 4159a747e4fSDavid du Colombierprove that the process has access to secret information 4169a747e4fSDavid du Colombierwhich only the new user should possess. 4179a747e4fSDavid du ColombierFor example, consider the setup in Figure 1a. 4189a747e4fSDavid du ColombierIf a user on the terminal 4195d459b5aSDavid du Colombierwants to log in to the CPU server using the 4209a747e4fSDavid du ColombierPlan 9 4219a747e4fSDavid du Colombier.CW cpu 4225d459b5aSDavid du Colombierservice 4235d459b5aSDavid du Colombier[Pike93], 4249a747e4fSDavid du Colombierthen 4259a747e4fSDavid du Colombier$P sub T# 4269a747e4fSDavid du Colombiermight be the 4279a747e4fSDavid du Colombier.CW cpu 4289a747e4fSDavid du Colombierclient program and 4299a747e4fSDavid du Colombier$P sub C# 4309a747e4fSDavid du Colombierthe 4319a747e4fSDavid du Colombier.CW cpu 4329a747e4fSDavid du Colombierserver. 4339a747e4fSDavid du ColombierNeither $P sub C# nor $P sub T# 4349a747e4fSDavid du Colombierknows the details of the authentication. 4359a747e4fSDavid du ColombierThey 4369a747e4fSDavid du Colombierdo need to be able to shuttle messages back and 4379a747e4fSDavid du Colombierforth between the two 4389a747e4fSDavid du Colombier.CW factotums , 4399a747e4fSDavid du Colombierbut this is 4409a747e4fSDavid du Colombiera generic function easily performed without 4419a747e4fSDavid du Colombierknowing, or being able to extract, secrets in 4429a747e4fSDavid du Colombierthe messages. 4439a747e4fSDavid du Colombier$P sub T# 4449a747e4fSDavid du Colombierwill make a network connection to $P sub C#. 4459a747e4fSDavid du Colombier$P sub T# 4469a747e4fSDavid du Colombierand 4479a747e4fSDavid du Colombier$P sub C# 4489a747e4fSDavid du Colombierwill then relay messages between 4499a747e4fSDavid du Colombierthe 4509a747e4fSDavid du Colombier.CW factotum 4519a747e4fSDavid du Colombierowned by the user, $F sub T#, 4529a747e4fSDavid du Colombierand the one owned by the CPU server, $F sub C#, 4539a747e4fSDavid du Colombieruntil mutual authentication has been established. 4549a747e4fSDavid du ColombierLater 4559a747e4fSDavid du Colombiersections describe the RPC between 4569a747e4fSDavid du Colombier.CW factotum 4579a747e4fSDavid du Colombierand 4589a747e4fSDavid du Colombierapplications and the library functions to support proxy operations. 4599a747e4fSDavid du Colombier.LP 4609a747e4fSDavid du ColombierThe kernel always uses a single local instance of 4619a747e4fSDavid du Colombier.CW factotum , 4629a747e4fSDavid du Colombierrunning as the 4639a747e4fSDavid du Colombierhost owner, for 4649a747e4fSDavid du Colombierits authentication purposes, but 4655d459b5aSDavid du Colombiera regular user may start other 4669a747e4fSDavid du Colombier.CW factotum 4679a747e4fSDavid du Colombieragents. 4689a747e4fSDavid du ColombierIn fact, the 4699a747e4fSDavid du Colombier.CW factotum 4709a747e4fSDavid du Colombierrepresenting the user need not be 4719a747e4fSDavid du Colombierrunning on the same machine as its client. 4729a747e4fSDavid du ColombierFor instance, it is easy for a user on a CPU server, 4739a747e4fSDavid du Colombierthrough standard Plan 9 operations, 4749a747e4fSDavid du Colombierto replace the 4759a747e4fSDavid du Colombier.CW /mnt/factotum 4769a747e4fSDavid du Colombierin the user's private file name space on the server 4779a747e4fSDavid du Colombierwith a connection to the 4789a747e4fSDavid du Colombier.CW factotum 4799a747e4fSDavid du Colombierrunning on the terminal. 4809a747e4fSDavid du Colombier(The usual file system permissions prevent interlopers 4819a747e4fSDavid du Colombierfrom doing so maliciously.) 4829a747e4fSDavid du ColombierThis permits secure operations on the CPU server to be 4839a747e4fSDavid du Colombiertransparently validated by the user's own 4849a747e4fSDavid du Colombier.CW factotum , 4859a747e4fSDavid du Colombierso 4869a747e4fSDavid du Colombiersecrets need never leave the user's terminal. 4875d459b5aSDavid du ColombierThe SSH agent 4889a747e4fSDavid du Colombier[Ylon96] 4899a747e4fSDavid du Colombierdoes much the 4909a747e4fSDavid du Colombiersame with special SSH protocol messages, but 4919a747e4fSDavid du Colombieran advantage to making our agent a file system 4929a747e4fSDavid du Colombieris that we need no new mechanism to access our remote 4939a747e4fSDavid du Colombieragent; remote file access is sufficient. 4949a747e4fSDavid du Colombier.LP 4959a747e4fSDavid du ColombierWithin 4969a747e4fSDavid du Colombier.CW factotum , 4979a747e4fSDavid du Colombiereach protocol is implemented as a state 4989a747e4fSDavid du Colombiermachine with a generic interface, so protocols are in 4999a747e4fSDavid du Colombieressence pluggable modules, easy to add, modify, or drop. 5009a747e4fSDavid du ColombierWriting a message to and reading a message from 5019a747e4fSDavid du Colombier.CW factotum 5029a747e4fSDavid du Colombiereach require a separate RPC and result in 5039a747e4fSDavid du Colombiera single state transition. 5049a747e4fSDavid du ColombierTherefore 5059a747e4fSDavid du Colombier.CW factotum 5069a747e4fSDavid du Colombieralways runs to completion on every RPC and never blocks 5079a747e4fSDavid du Colombierwaiting for input during any authentication. 5089a747e4fSDavid du ColombierMoreover, the number of simultaneous 5099a747e4fSDavid du Colombierauthentications is limited only by the amount of memory we're 5109a747e4fSDavid du Colombierwilling to dedicate to representing the state machines. 5119a747e4fSDavid du Colombier.LP 5129a747e4fSDavid du ColombierAuthentication protocols are implemented only 5139a747e4fSDavid du Colombierwithin 5149a747e4fSDavid du Colombier.CW factotum , 5159a747e4fSDavid du Colombierbut adding and removing 5169a747e4fSDavid du Colombierprotocols does require relinking the binary, so 5179a747e4fSDavid du Colombier.CW factotum 5189a747e4fSDavid du Colombierprocesses (but no others) 5199a747e4fSDavid du Colombierneed to be restarted in order to take advantage of 5209a747e4fSDavid du Colombiernew or repaired protocols. 5219a747e4fSDavid du Colombier.LP 5229a747e4fSDavid du ColombierAt the time of writing, 5239a747e4fSDavid du Colombier.CW factotum 5249a747e4fSDavid du Colombiercontains authentication 5255d459b5aSDavid du Colombiermodules for the Plan 9 shared key protocol (p9sk1), 5269a747e4fSDavid du ColombierSSH's RSA authentication, passwords in the clear, APOP, CRAM, PPP's CHAP, 5275d459b5aSDavid du ColombierMicrosoft PPP's MSCHAP, and VNC's challenge/response. 5289a747e4fSDavid du Colombier.SS 5299a747e4fSDavid du ColombierLocal capabilities 5309a747e4fSDavid du Colombier.LP 5319a747e4fSDavid du ColombierA capability system, managed by the kernel, is used to empower 5329a747e4fSDavid du Colombier.CW factotum 5339a747e4fSDavid du Colombierto grant permission to another process to change its user id. 5349a747e4fSDavid du ColombierA 5359a747e4fSDavid du Colombierkernel device driver 5369a747e4fSDavid du Colombierimplements two files, 5379a747e4fSDavid du Colombier.CW /dev/caphash 5389a747e4fSDavid du Colombierand 5399a747e4fSDavid du Colombier.CW /dev/capuse . 5409a747e4fSDavid du ColombierThe write-only file 5419a747e4fSDavid du Colombier.CW /dev/caphash 5429a747e4fSDavid du Colombiercan be opened only by the host owner, and only once. 5439a747e4fSDavid du Colombier.CW Factotum 5449a747e4fSDavid du Colombieropens this file immediately after booting. 5459a747e4fSDavid du Colombier.LP 5469a747e4fSDavid du ColombierTo use the files, 5479a747e4fSDavid du Colombier.CW factotum 5489a747e4fSDavid du Colombiercreates a string of the form 5499a747e4fSDavid du Colombier.I userid1\f(CW@\fPuserid2\f(CW@\fPrandom-string , 5509a747e4fSDavid du Colombieruses SHA1 HMAC to hash 5519a747e4fSDavid du Colombier.I userid1\f(CW@\fPuserid2 5529a747e4fSDavid du Colombierwith key 5539a747e4fSDavid du Colombier.I random-string , 5549a747e4fSDavid du Colombierand writes that hash to 5559a747e4fSDavid du Colombier.CW /dev/caphash . 5569a747e4fSDavid du Colombier.CW Factotum 5579a747e4fSDavid du Colombierthen passes the original string to another 5589a747e4fSDavid du Colombierprocess on the same machine, running 5599a747e4fSDavid du Colombieras user 5609a747e4fSDavid du Colombier.I userid1 , 5619a747e4fSDavid du Colombierwhich 5629a747e4fSDavid du Colombierwrites the string to 5639a747e4fSDavid du Colombier.CW /dev/capuse . 5649a747e4fSDavid du ColombierThe kernel hashes the string and looks for 5659a747e4fSDavid du Colombiera matching hash in its list. 5669a747e4fSDavid du ColombierIf it finds one, 5679a747e4fSDavid du Colombierthe writing process's user id changes from 5689a747e4fSDavid du Colombier.I userid1 5699a747e4fSDavid du Colombierto 5709a747e4fSDavid du Colombier.I userid2 . 5719a747e4fSDavid du ColombierOnce used, or if a timeout expires, 5729a747e4fSDavid du Colombierthe capability is discarded by the kernel. 5739a747e4fSDavid du Colombier.LP 5745d459b5aSDavid du ColombierThe capabilities are local to the machine on which they are created. 5759a747e4fSDavid du ColombierHence a 5769a747e4fSDavid du Colombier.CW factotum 5775d459b5aSDavid du Colombierrunning on one machine cannot pass capabilities 5789a747e4fSDavid du Colombierto processes on another and expect them to work. 5799a747e4fSDavid du Colombier.SS 5809a747e4fSDavid du ColombierKeys 5819a747e4fSDavid du Colombier.LP 5829a747e4fSDavid du ColombierWe define the word 5839a747e4fSDavid du Colombier.I key 5849a747e4fSDavid du Colombierto mean not only a secret, but also a description of the 5859a747e4fSDavid du Colombiercontext in which that secret is to be used: the protocol, 5869a747e4fSDavid du Colombierserver, user, etc. to which it applies. 5879a747e4fSDavid du ColombierThat is, 5889a747e4fSDavid du Colombiera key is a combination of secret and descriptive information 5899a747e4fSDavid du Colombierused to authenticate the identities of parties 5909a747e4fSDavid du Colombiertransmitting or receiving information. 5919a747e4fSDavid du ColombierThe set of keys used 5929a747e4fSDavid du Colombierin any authentication depends both on the protocol and on 5939a747e4fSDavid du Colombierparameters passed by the program requesting the authentication. 5949a747e4fSDavid du Colombier.LP 5959a747e4fSDavid du ColombierTaking a tip from SDSI 5969a747e4fSDavid du Colombier[RiLa], 5979a747e4fSDavid du Colombierwhich represents security information as textual S-expressions, 5989a747e4fSDavid du Colombierkeys in Plan 9 are represented as plain UTF-8 text. 5999a747e4fSDavid du ColombierText is easily 6009a747e4fSDavid du Colombierunderstood and manipulated by users. 6019a747e4fSDavid du ColombierBy contrast, 6029a747e4fSDavid du Colombiera binary or other cryptic format 6039a747e4fSDavid du Colombiercan actually reduce overall security. 6049a747e4fSDavid du ColombierBinary formats are difficult for users to examine and can only be 6059a747e4fSDavid du Colombiercracked by special tools, themselves poorly understood by most users. 6069a747e4fSDavid du ColombierFor example, very few people know or understand what's inside 6079a747e4fSDavid du Colombiertheir X.509 certificates. 6089a747e4fSDavid du ColombierMost don't even know where in the system to 6099a747e4fSDavid du Colombierfind them. 6109a747e4fSDavid du ColombierTherefore, they have no idea what they are trusting, and why, and 6119a747e4fSDavid du Colombierare powerless to change their trust relationships. 6129a747e4fSDavid du ColombierTextual, centrally stored and managed keys are easier to use and safer. 6139a747e4fSDavid du Colombier.LP 6149a747e4fSDavid du ColombierPlan 9 has historically represented databases as attribute/value pairs, 6159a747e4fSDavid du Colombiersince they are a good foundation for selection and projection operations. 6169a747e4fSDavid du Colombier.CW Factotum 6179a747e4fSDavid du Colombiertherefore represents 6189a747e4fSDavid du Colombierthe keys in the format 6199a747e4fSDavid du Colombier.I attribute\f(CW=\fPvalue , 6209a747e4fSDavid du Colombierwhere 6219a747e4fSDavid du Colombier.I attribute 6229a747e4fSDavid du Colombieris an identifier, possibly with a single-character prefix, and 6239a747e4fSDavid du Colombier.I value 6249a747e4fSDavid du Colombieris an arbitrary quoted string. 6259a747e4fSDavid du ColombierThe pairs themselves are separated by white space. 6269a747e4fSDavid du ColombierFor example, a Plan 9 key and an APOP key 6279a747e4fSDavid du Colombiermight be represented like this: 6289a747e4fSDavid du Colombier.P1 6299a747e4fSDavid du Colombierdom=bell-labs.com proto=p9sk1 user=gre 6309a747e4fSDavid du Colombier !password='don''t tell' 6319a747e4fSDavid du Colombierproto=apop server=x.y.com user=gre 6325d459b5aSDavid du Colombier !password='open sesame' 6339a747e4fSDavid du Colombier.P2 6349a747e4fSDavid du ColombierIf a value is empty or contains white space or single quotes, it must be quoted; 6359a747e4fSDavid du Colombierquotes are represented by doubled single quotes. 6369a747e4fSDavid du ColombierAttributes that begin with an exclamation mark 6379a747e4fSDavid du Colombier.CW ! ) ( 6389a747e4fSDavid du Colombierare considered 6399a747e4fSDavid du Colombier.I secret . 6409a747e4fSDavid du Colombier.CW Factotum 6419a747e4fSDavid du Colombierwill never let a secret value escape its address space 6429a747e4fSDavid du Colombierand will suppress keyboard echo when asking the user to type one. 6439a747e4fSDavid du Colombier.LP 6449a747e4fSDavid du ColombierA program requesting authentication selects a key 6459a747e4fSDavid du Colombierby providing a 6469a747e4fSDavid du Colombier.I query , 6479a747e4fSDavid du Colombiera list of elements to be matched by the key. 6489a747e4fSDavid du ColombierEach element in the list is either an 6499a747e4fSDavid du Colombier.I attribute\f(CW=\fPvalue 6509a747e4fSDavid du Colombierpair, which is satisfied by keys with 6519a747e4fSDavid du Colombierexactly that pair; 6529a747e4fSDavid du Colombieror an attribute followed by a question mark, 6539a747e4fSDavid du Colombier.I attribute\f(CW? , 6549a747e4fSDavid du Colombierwhich is satisfied by keys with some pair specifying 6559a747e4fSDavid du Colombierthe attribute. 6569a747e4fSDavid du ColombierA key matches a query if every element in the list 6579a747e4fSDavid du Colombieris satisfied. 6589a747e4fSDavid du ColombierFor instance, to select the APOP key in the previous example, 6599a747e4fSDavid du Colombieran APOP client process might specify the query 6609a747e4fSDavid du Colombier.P1 6619a747e4fSDavid du Colombierserver=x.y.com proto=apop 6629a747e4fSDavid du Colombier.P2 6639a747e4fSDavid du ColombierInternally, 6649a747e4fSDavid du Colombier.CW factotum 's 6659a747e4fSDavid du ColombierAPOP module would add the requirements of 6669a747e4fSDavid du Colombierhaving 6679a747e4fSDavid du Colombier.CW user 6689a747e4fSDavid du Colombierand 6699a747e4fSDavid du Colombier.CW !password 6709a747e4fSDavid du Colombierattributes, forming the query 6719a747e4fSDavid du Colombier.P1 6729a747e4fSDavid du Colombierserver=x.y.com proto=apop user? !password? 6739a747e4fSDavid du Colombier.P2 6749a747e4fSDavid du Colombierwhen searching for an appropriate key. 6759a747e4fSDavid du Colombier.LP 6769a747e4fSDavid du Colombier.CW Factotum 6779a747e4fSDavid du Colombiermodules expect keys to have some well-known attributes. 6789a747e4fSDavid du ColombierFor instance, the 6799a747e4fSDavid du Colombier.CW proto 6809a747e4fSDavid du Colombierattribute specifies the protocol module 6819a747e4fSDavid du Colombierresponsible for using a particular key, 6829a747e4fSDavid du Colombierand protocol modules may expect other well-known attributes 6839a747e4fSDavid du Colombier(many expect keys to have 6849a747e4fSDavid du Colombier.CW !password 6859a747e4fSDavid du Colombierattributes, for example). 6869a747e4fSDavid du ColombierAdditional attributes can be used as comments or for 6879a747e4fSDavid du Colombierfurther discrimination without intervention by 6889a747e4fSDavid du Colombier.CW factotum ; 6899a747e4fSDavid du Colombierfor example, the APOP and IMAP mail clients conventionally 6909a747e4fSDavid du Colombierinclude a 6919a747e4fSDavid du Colombier.CW server 6929a747e4fSDavid du Colombierattribute to select an appropriate key for authentication. 6939a747e4fSDavid du Colombier.LP 6949a747e4fSDavid du ColombierUnlike in SDSI, 6959a747e4fSDavid du Colombierkeys in Plan 9 have no nested structure. This design 6969a747e4fSDavid du Colombierkeeps the representation simple and straightforward. 6979a747e4fSDavid du ColombierIf necessary, we could add a nested attribute 6989a747e4fSDavid du Colombieror, in the manner of relational databases, an attribute that 6999a747e4fSDavid du Colombierselects another tuple, but so far the simple design has been sufficient. 7009a747e4fSDavid du Colombier.LP 7019a747e4fSDavid du ColombierA simple common structure for all keys makes them easy for users 7029a747e4fSDavid du Colombierto administer, 7039a747e4fSDavid du Colombierbut the set of attributes and their interpretation is still 7049a747e4fSDavid du Colombierprotocol-specific and can be subtle. 7059a747e4fSDavid du ColombierUsers may still 7069a747e4fSDavid du Colombierneed to consult a manual to understand all details. 7079a747e4fSDavid du ColombierMany attributes 7089a747e4fSDavid du Colombier.CW proto , ( 7099a747e4fSDavid du Colombier.CW user , 7109a747e4fSDavid du Colombier.CW password , 7119a747e4fSDavid du Colombier.CW server ) 7129a747e4fSDavid du Colombierare self-explanatory and our short experience 7139a747e4fSDavid du Colombierhas not uncovered any particular difficulty in handling keys. 7149a747e4fSDavid du ColombierThings 7159a747e4fSDavid du Colombierwill likely get messier, however, 7169a747e4fSDavid du Colombierwhen we grapple with public 7179a747e4fSDavid du Colombierkeys and their myriad components. 7189a747e4fSDavid du Colombier.SS 7199a747e4fSDavid du ColombierProtecting keys 7209a747e4fSDavid du Colombier.LP 7219a747e4fSDavid du ColombierSecrets must be prevented from escaping 7229a747e4fSDavid du Colombier.CW factotum . 7239a747e4fSDavid du ColombierThere are a number of ways they could leak: 7249a747e4fSDavid du Colombieranother process might be able to debug the agent process, the 7259a747e4fSDavid du Colombieragent might swap out to disk, or the process might willingly 7269a747e4fSDavid du Colombierdisclose the key. 7279a747e4fSDavid du ColombierThe last is the easiest to avoid: 7289a747e4fSDavid du Colombiersecret information in a key is marked 7299a747e4fSDavid du Colombieras such, and 7309a747e4fSDavid du Colombierwhenever 7319a747e4fSDavid du Colombier.CW factotum 7329a747e4fSDavid du Colombierprints keys or queries for new 7339a747e4fSDavid du Colombierones, it is careful to avoid displaying secret information. 7349a747e4fSDavid du Colombier(The only exception to this is the 7359a747e4fSDavid du Colombier``plaintext password'' protocol, which consists 7369a747e4fSDavid du Colombierof sending the values of the 7379a747e4fSDavid du Colombier.CW user 7389a747e4fSDavid du Colombierand 7399a747e4fSDavid du Colombier.CW !password 7409a747e4fSDavid du Colombierattributes. 7419a747e4fSDavid du ColombierOnly keys tagged with 7429a747e4fSDavid du Colombier.CW proto=pass 7439a747e4fSDavid du Colombiercan have their passwords disclosed by this mechanism.) 7449a747e4fSDavid du Colombier.LP 7459a747e4fSDavid du ColombierPreventing the first two forms of leakage 7469a747e4fSDavid du Colombierrequires help from the kernel. 7479a747e4fSDavid du ColombierIn Plan 9, every process is 7489a747e4fSDavid du Colombierrepresented by a directory in the 7499a747e4fSDavid du Colombier.CW /proc 7509a747e4fSDavid du Colombierfile system. 7519a747e4fSDavid du ColombierUsing the files in this directory, 7529a747e4fSDavid du Colombierother processes could (with appropriate access permission) examine 7539a747e4fSDavid du Colombier.CW factotum 's 7549a747e4fSDavid du Colombiermemory and registers. 7559a747e4fSDavid du Colombier.CW Factotum 7569a747e4fSDavid du Colombieris protected from processes of other users 7579a747e4fSDavid du Colombierby the default access bits of its 7589a747e4fSDavid du Colombier.CW /proc 7599a747e4fSDavid du Colombierdirectory. 7609a747e4fSDavid du ColombierHowever, we'd also like to protect the 7619a747e4fSDavid du Colombieragent from other processes owned by the same user, 7629a747e4fSDavid du Colombierboth to avoid honest mistakes and to prevent 7639a747e4fSDavid du Colombieran unattended terminal being 7649a747e4fSDavid du Colombierexploited to discover secret passwords. 7659a747e4fSDavid du ColombierTo do this, we added a control message to 7669a747e4fSDavid du Colombier.CW /proc 7679a747e4fSDavid du Colombiercalled 7689a747e4fSDavid du Colombier.CW private . 7699a747e4fSDavid du ColombierOnce the 7709a747e4fSDavid du Colombier.CW factotum 7719a747e4fSDavid du Colombierprocess has written 7729a747e4fSDavid du Colombier.CW private 7739a747e4fSDavid du Colombierto its 7749a747e4fSDavid du Colombier.CW /proc/\f2pid\fP/ctl 7759a747e4fSDavid du Colombierfile, no process can access 7769a747e4fSDavid du Colombier.CW factotum 's 7779a747e4fSDavid du Colombiermemory 7789a747e4fSDavid du Colombierthrough 7799a747e4fSDavid du Colombier.CW /proc . 7809a747e4fSDavid du Colombier(Plan 9 has no other mechanism, such as 7819a747e4fSDavid du Colombier.CW /dev/kmem , 7829a747e4fSDavid du Colombierfor accessing a process's memory.) 7839a747e4fSDavid du Colombier.LP 7849a747e4fSDavid du ColombierSimilarly, the agent's address space should not be 7859a747e4fSDavid du Colombierswapped out, to prevent discovering unencrypted 7869a747e4fSDavid du Colombierkeys on the swapping media. 7879a747e4fSDavid du ColombierThe 7889a747e4fSDavid du Colombier.CW noswap 7899a747e4fSDavid du Colombiercontrol message in 7909a747e4fSDavid du Colombier.CW /proc 7919a747e4fSDavid du Colombierprevents this scenario. 7929a747e4fSDavid du ColombierNeither 7939a747e4fSDavid du Colombier.CW private 7949a747e4fSDavid du Colombiernor 7959a747e4fSDavid du Colombier.CW noswap 7969a747e4fSDavid du Colombieris specific to 7975d459b5aSDavid du Colombier.CW factotum . 7985d459b5aSDavid du ColombierUser-level file servers such as 7995d459b5aSDavid du Colombier.CW dossrv , 8005d459b5aSDavid du Colombierwhich interprets FAT file systems, 8015d459b5aSDavid du Colombiercould use 8025d459b5aSDavid du Colombier.CW noswap 8035d459b5aSDavid du Colombierto keep their buffer caches from being 8045d459b5aSDavid du Colombierswapped to disk. 8059a747e4fSDavid du Colombier.LP 8069a747e4fSDavid du ColombierDespite our precautions, attackers might still 8079a747e4fSDavid du Colombierfind a way to gain access to a process running as the host 8089a747e4fSDavid du Colombierowner on a machine. 8099a747e4fSDavid du ColombierAlthough they could not directly 8109a747e4fSDavid du Colombieraccess the keys, attackers could use the local 8119a747e4fSDavid du Colombier.CW factotum 8129a747e4fSDavid du Colombierto perform authentications for them. 8139a747e4fSDavid du ColombierIn the case 8149a747e4fSDavid du Colombierof some keys, for example those locking bank 8159a747e4fSDavid du Colombieraccounts, we want a way to disable or at least 8169a747e4fSDavid du Colombierdetect such access. 8179a747e4fSDavid du ColombierThat is the role of the 8189a747e4fSDavid du Colombier.CW confirm 8199a747e4fSDavid du Colombierattribute in a key. 8209a747e4fSDavid du ColombierWhenever a key with a 8219a747e4fSDavid du Colombier.CW confirm 8229a747e4fSDavid du Colombierattribute is accessed, the local user must 8239a747e4fSDavid du Colombierconfirm use of the key via a local GUI. 8249a747e4fSDavid du ColombierThe next section describes the actual mechanism. 8259a747e4fSDavid du Colombier.LP 8269a747e4fSDavid du ColombierWe have not addressed leaks possible as a result of 8279a747e4fSDavid du Colombiersomeone rebooting or resetting a machine running 8289a747e4fSDavid du Colombier.CW factotum . 8299a747e4fSDavid du ColombierFor example, someone could reset a machine 8309a747e4fSDavid du Colombierand reboot it with a debugger instead of a kernel, 8319a747e4fSDavid du Colombierallowing them to examine the contents of memory 8329a747e4fSDavid du Colombierand find keys. We have not found a satisfactory 8339a747e4fSDavid du Colombiersolution to this problem. 8349a747e4fSDavid du Colombier.SS 8359a747e4fSDavid du ColombierFactotum transactions 8369a747e4fSDavid du Colombier.LP 8379a747e4fSDavid du ColombierExternal programs manage 8389a747e4fSDavid du Colombier.CW factotum 's 8399a747e4fSDavid du Colombierinternal key state 8409a747e4fSDavid du Colombierthrough its file interface, 8419a747e4fSDavid du Colombierwriting textual 8429a747e4fSDavid du Colombier.CW key 8439a747e4fSDavid du Colombierand 8449a747e4fSDavid du Colombier.CW delkey 8459a747e4fSDavid du Colombiercommands to the 8469a747e4fSDavid du Colombier.CW /mnt/factotum/ctl 8479a747e4fSDavid du Colombierfile. 8489a747e4fSDavid du ColombierBoth commands take a list of attributes as an argument. 8499a747e4fSDavid du Colombier.CW Key 8509a747e4fSDavid du Colombiercreates a key with the given attributes, replacing any 8519a747e4fSDavid du Colombierextant key with an identical set of public attributes. 8529a747e4fSDavid du Colombier.CW Delkey 8539a747e4fSDavid du Colombierdeletes all keys that match the given set of attributes. 8549a747e4fSDavid du ColombierReading the 8559a747e4fSDavid du Colombier.CW ctl 8569a747e4fSDavid du Colombierfile returns a list of keys, one per line, displaying only public attributes. 8579a747e4fSDavid du ColombierThe following example illustrates these interactions. 8589a747e4fSDavid du Colombier.P1 8599a747e4fSDavid du Colombier% cd /mnt/factotum 8609a747e4fSDavid du Colombier% ls -l 8619a747e4fSDavid du Colombier-lrw------- gre gre 0 Jan 30 22:17 confirm 8629a747e4fSDavid du Colombier--rw------- gre gre 0 Jan 30 22:17 ctl 8639a747e4fSDavid du Colombier-lr-------- gre gre 0 Jan 30 22:17 log 8649a747e4fSDavid du Colombier-lrw------- gre gre 0 Jan 30 22:17 needkey 8659a747e4fSDavid du Colombier--r--r--r-- gre gre 0 Jan 30 22:17 proto 8669a747e4fSDavid du Colombier--rw-rw-rw- gre gre 0 Jan 30 22:17 rpc 8679a747e4fSDavid du Colombier% cat >ctl 8689a747e4fSDavid du Colombierkey dom=bell-labs.com proto=p9sk1 user=gre 8699a747e4fSDavid du Colombier !password='don''t tell' 8709a747e4fSDavid du Colombierkey proto=apop server=x.y.com user=gre 8719a747e4fSDavid du Colombier !password='bite me' 8729a747e4fSDavid du Colombier^D 8739a747e4fSDavid du Colombier% cat ctl 8749a747e4fSDavid du Colombierkey dom=bell-labs.com proto=p9sk1 user=gre 8759a747e4fSDavid du Colombierkey proto=apop server=x.y.com user=gre 8769a747e4fSDavid du Colombier% echo 'delkey proto=apop' >ctl 8779a747e4fSDavid du Colombier% cat ctl 8789a747e4fSDavid du Colombierkey dom=bell-labs.com proto=p9sk1 user=gre 8799a747e4fSDavid du Colombier% 8809a747e4fSDavid du Colombier.P2 8819a747e4fSDavid du Colombier(A file with the 8829a747e4fSDavid du Colombier.CW l 8839a747e4fSDavid du Colombierbit set can be opened by only one process at a time.) 8849a747e4fSDavid du Colombier.LP 8859a747e4fSDavid du ColombierThe heart of the interface is the 8869a747e4fSDavid du Colombier.CW rpc 8879a747e4fSDavid du Colombierfile. 8889a747e4fSDavid du ColombierPrograms authenticate with 8899a747e4fSDavid du Colombier.CW factotum 8909a747e4fSDavid du Colombierby writing a request to the 8919a747e4fSDavid du Colombier.CW rpc 8929a747e4fSDavid du Colombierfile 8939a747e4fSDavid du Colombierand reading back the reply; this sequence is called an RPC 8949a747e4fSDavid du Colombier.I transaction . 8959a747e4fSDavid du ColombierRequests and replies have the same format: 8969a747e4fSDavid du Colombiera textual verb possibly followed by arguments, 8979a747e4fSDavid du Colombierwhich may be textual or binary. 8989a747e4fSDavid du ColombierThe most common reply verb is 8999a747e4fSDavid du Colombier.CW ok , 9009a747e4fSDavid du Colombierindicating success. 9019a747e4fSDavid du ColombierAn RPC session begins with a 9029a747e4fSDavid du Colombier.CW start 9039a747e4fSDavid du Colombiertransaction; the argument is a key query as described 9049a747e4fSDavid du Colombierearlier. 9059a747e4fSDavid du ColombierOnce started, an RPC conversation usually consists of 9069a747e4fSDavid du Colombiera sequence of 9079a747e4fSDavid du Colombier.CW read 9089a747e4fSDavid du Colombierand 9099a747e4fSDavid du Colombier.CW write 9109a747e4fSDavid du Colombiertransactions. 9119a747e4fSDavid du ColombierIf the conversation is successful, an 9129a747e4fSDavid du Colombier.CW authinfo 9139a747e4fSDavid du Colombiertransaction will return information about 9149a747e4fSDavid du Colombierthe identities learned during the transaction. 9159a747e4fSDavid du ColombierThe 9169a747e4fSDavid du Colombier.CW attr 9179a747e4fSDavid du Colombiertransaction returns a list of attributes for the current 9189a747e4fSDavid du Colombierconversation; the list includes any attributes given in 9199a747e4fSDavid du Colombierthe 9209a747e4fSDavid du Colombier.CW start 9219a747e4fSDavid du Colombierquery as well as any public attributes from keys being used. 9229a747e4fSDavid du Colombier.LP 9235d459b5aSDavid du ColombierAs an example of the 9245d459b5aSDavid du Colombier.CW rpc 9255d459b5aSDavid du Colombierfile in action, consider a mail client 9269a747e4fSDavid du Colombierconnecting to a mail server and authenticating using 9279a747e4fSDavid du Colombierthe POP3 protocol's APOP challenge-response command. 9289a747e4fSDavid du ColombierThere are four programs involved: the mail client $P sub C#, the client 9299a747e4fSDavid du Colombier.CW factotum 9309a747e4fSDavid du Colombier$F sub C#, the mail server $P sub S#, and the server 9319a747e4fSDavid du Colombier.CW factotum 9329a747e4fSDavid du Colombier$F sub S#. 9339a747e4fSDavid du ColombierAll authentication computations are handled by the 9349a747e4fSDavid du Colombier.CW factotum 9359a747e4fSDavid du Colombierprocesses. 9369a747e4fSDavid du ColombierThe mail programs' role is just to relay messages. 9379a747e4fSDavid du Colombier.LP 9389a747e4fSDavid du ColombierAt startup, the mail server at 9399a747e4fSDavid du Colombier.CW x.y.com 9409a747e4fSDavid du Colombierbegins an APOP conversation 9419a747e4fSDavid du Colombierwith its 9429a747e4fSDavid du Colombier.CW factotum 9439a747e4fSDavid du Colombierto obtain the banner greeting, which 9449a747e4fSDavid du Colombierincludes a challenge: 9459a747e4fSDavid du Colombier.P1 9469a747e4fSDavid du Colombier$P sub S -> F sub S#: start proto=apop role=server 9479a747e4fSDavid du Colombier$F sub S -> P sub S#: ok 9489a747e4fSDavid du Colombier$P sub S -> F sub S#: read 9499a747e4fSDavid du Colombier$F sub S -> P sub S#: ok +OK POP3 \f2challenge\fP 9509a747e4fSDavid du Colombier.P2 9519a747e4fSDavid du ColombierHaving obtained the challenge, the server greets the client: 9529a747e4fSDavid du Colombier.P1 9539a747e4fSDavid du Colombier$P sub S -> P sub C#: +OK POP3 \f2challenge\fP 9549a747e4fSDavid du Colombier.P2 9559a747e4fSDavid du ColombierThe client then uses an APOP conversation with its 9569a747e4fSDavid du Colombier.CW factotum 9579a747e4fSDavid du Colombierto obtain a response: 9589a747e4fSDavid du Colombier.P1 9599a747e4fSDavid du Colombier$P sub C -> F sub C#: start proto=apop role=client 9609a747e4fSDavid du Colombier server=x.y.com 9619a747e4fSDavid du Colombier$F sub C -> P sub C#: ok 9629a747e4fSDavid du Colombier$P sub C -> F sub C#: write +OK POP3 \f2challenge\fP 9639a747e4fSDavid du Colombier$F sub C -> P sub C#: ok 9649a747e4fSDavid du Colombier$P sub C -> F sub C#: read 9659a747e4fSDavid du Colombier$F sub C -> P sub C#: ok APOP gre \f2response\fP 9669a747e4fSDavid du Colombier.P2 9679a747e4fSDavid du Colombier.CW Factotum 9689a747e4fSDavid du Colombierrequires that 9699a747e4fSDavid du Colombier.CW start 9709a747e4fSDavid du Colombierrequests include a 9719a747e4fSDavid du Colombier.CW proto 9729a747e4fSDavid du Colombierattribute, and the APOP module requires an additional 9739a747e4fSDavid du Colombier.CW role 9749a747e4fSDavid du Colombierattribute, but the other attributes are optional and only 9759a747e4fSDavid du Colombierrestrict the key space. 9769a747e4fSDavid du ColombierBefore responding to the 9779a747e4fSDavid du Colombier.CW start 9789a747e4fSDavid du Colombiertransaction, the client 9799a747e4fSDavid du Colombier.CW factotum 9809a747e4fSDavid du Colombierlooks for a key to 9819a747e4fSDavid du Colombieruse for the rest of the conversation. 9829a747e4fSDavid du ColombierBecause of the arguments in the 9839a747e4fSDavid du Colombier.CW start 9849a747e4fSDavid du Colombierrequest, the key must have public attributes 9859a747e4fSDavid du Colombier.CW proto=apop 9869a747e4fSDavid du Colombierand 9879a747e4fSDavid du Colombier.CW server=x.y.com ; 9889a747e4fSDavid du Colombieras mentioned earlier, 9899a747e4fSDavid du Colombierthe APOP module additionally requires that the key have 9909a747e4fSDavid du Colombier.CW user 9919a747e4fSDavid du Colombierand 9929a747e4fSDavid du Colombier.CW !password 9939a747e4fSDavid du Colombierattributes. 9949a747e4fSDavid du ColombierNow that the client has obtained a response 9959a747e4fSDavid du Colombierfrom its 9969a747e4fSDavid du Colombier.CW factotum , 9979a747e4fSDavid du Colombierit echoes that response to the server: 9989a747e4fSDavid du Colombier.P1 9999a747e4fSDavid du Colombier$P sub C -> P sub S#: APOP gre \f2response\fP 10009a747e4fSDavid du Colombier.P2 10019a747e4fSDavid du ColombierSimilarly, the server passes this message to 10029a747e4fSDavid du Colombierits 10039a747e4fSDavid du Colombier.CW factotum 10049a747e4fSDavid du Colombierand obtains another to send back. 10059a747e4fSDavid du Colombier.P1 10069a747e4fSDavid du Colombier$P sub S -> F sub S#: write APOP gre \f2response\fP 10079a747e4fSDavid du Colombier$F sub S -> P sub S#: ok 10089a747e4fSDavid du Colombier$P sub S -> F sub S#: read 10099a747e4fSDavid du Colombier$F sub S -> P sub S#: ok +OK welcome 10109a747e4fSDavid du Colombier 10119a747e4fSDavid du Colombier$P sub S -> P sub C#: +OK welcome 10129a747e4fSDavid du Colombier.P2 10139a747e4fSDavid du ColombierNow the authentication protocol is done, and 10149a747e4fSDavid du Colombierthe server can retrieve information 10159a747e4fSDavid du Colombierabout what the protocol established. 10169a747e4fSDavid du Colombier.P1 10179a747e4fSDavid du Colombier$P sub S -> F sub S#: authinfo 10189a747e4fSDavid du Colombier$F sub S -> P sub S#: ok client=gre 10199a747e4fSDavid du Colombier capability=\f2capability\fP 10209a747e4fSDavid du Colombier.P2 10219a747e4fSDavid du ColombierThe 10229a747e4fSDavid du Colombier.CW authinfo 10239a747e4fSDavid du Colombierdata is a list of 10249a747e4fSDavid du Colombier.I attr\f(CW=\fPvalue 10259a747e4fSDavid du Colombierpairs, here a client user name and a capability. 10269a747e4fSDavid du Colombier(Protocols that establish shared secrets or provide 10279a747e4fSDavid du Colombiermutual authentication indicate this by adding 10289a747e4fSDavid du Colombierappropriate 10299a747e4fSDavid du Colombier.I attr\f(CW=\fPvalue 10309a747e4fSDavid du Colombierpairs.) 10319a747e4fSDavid du ColombierThe capability can be used by the server to change its 10329a747e4fSDavid du Colombieridentity to that of the client, as described earlier. 10339a747e4fSDavid du ColombierOnce it has changed its identity, the server can access and serve 10349a747e4fSDavid du Colombierthe client's mailbox. 10359a747e4fSDavid du Colombier.LP 10369a747e4fSDavid du ColombierTwo more files provide hooks for a graphical 10379a747e4fSDavid du Colombier.CW factotum 10389a747e4fSDavid du Colombiercontrol interface. 10399a747e4fSDavid du ColombierThe first, 10409a747e4fSDavid du Colombier.CW confirm , 10419a747e4fSDavid du Colombierallows the user detailed control over the use of certain keys. 10429a747e4fSDavid du ColombierIf a key has a 10439a747e4fSDavid du Colombier.CW confirm= 10449a747e4fSDavid du Colombierattribute, then the user must approve each use of the key. 10459a747e4fSDavid du ColombierA separate program with a graphical interface reads from the 10469a747e4fSDavid du Colombier.CW confirm 10479a747e4fSDavid du Colombierfile to see when a confirmation is necessary. 10489a747e4fSDavid du ColombierThe read blocks until a key usage needs to be approved, whereupon 10499a747e4fSDavid du Colombierit will return a line of the form 10509a747e4fSDavid du Colombier.P1 10519a747e4fSDavid du Colombierconfirm tag=1 \f2attributes\fP 10529a747e4fSDavid du Colombier.P2 10539a747e4fSDavid du Colombierrequesting permission to use the key with those public attributes. 10549a747e4fSDavid du ColombierThe graphical interface then prompts the user for approval 10559a747e4fSDavid du Colombierand writes back 10569a747e4fSDavid du Colombier.P1 10579a747e4fSDavid du Colombiertag=1 answer=yes 10589a747e4fSDavid du Colombier.P2 10599a747e4fSDavid du Colombier(or 10609a747e4fSDavid du Colombier.CW answer=no ). 10619a747e4fSDavid du Colombier.LP 10629a747e4fSDavid du ColombierThe second file, 10639a747e4fSDavid du Colombier.CW needkey , 10649a747e4fSDavid du Colombierdiverts key requests. 10659a747e4fSDavid du ColombierIn the APOP example, if a suitable key had not been found 10669a747e4fSDavid du Colombierduring the 10679a747e4fSDavid du Colombier.CW start 10689a747e4fSDavid du Colombiertransaction, 10699a747e4fSDavid du Colombier.CW factotum 10709a747e4fSDavid du Colombierwould have indicated failure by 10719a747e4fSDavid du Colombierreturning a response indicating 10729a747e4fSDavid du Colombierwhat key was needed: 10739a747e4fSDavid du Colombier.P1 10749a747e4fSDavid du Colombier$F sub C -> P sub C#: needkey proto=apop 10759a747e4fSDavid du Colombier server=x.y.com user? !password? 10769a747e4fSDavid du Colombier.P2 10779a747e4fSDavid du ColombierA typical client would then prompt the user for the desired 10789a747e4fSDavid du Colombierkey information, create a new key via the 10799a747e4fSDavid du Colombier.CW ctl 10809a747e4fSDavid du Colombierfile, and then reissue the 10819a747e4fSDavid du Colombier.CW start 10829a747e4fSDavid du Colombierrequest. 10839a747e4fSDavid du ColombierIf the 10849a747e4fSDavid du Colombier.CW needkey 10859a747e4fSDavid du Colombierfile is open, 10869a747e4fSDavid du Colombierthen instead of failing, the transaction 10879a747e4fSDavid du Colombierwill block, and the next read from the 10889a747e4fSDavid du Colombier.CW /mnt/factotum/needkey 10899a747e4fSDavid du Colombierfile will return a line of the form 10909a747e4fSDavid du Colombier.P1 10919a747e4fSDavid du Colombierneedkey tag=1 \f2attributes\f2 10929a747e4fSDavid du Colombier.P2 10939a747e4fSDavid du ColombierThe graphical interface then prompts the user for the needed 10949a747e4fSDavid du Colombierkey information, creates the key via the 10959a747e4fSDavid du Colombier.CW ctl 10969a747e4fSDavid du Colombierfile, and writes back 10979a747e4fSDavid du Colombier.CW tag=1 10989a747e4fSDavid du Colombierto resume the transaction. 10999a747e4fSDavid du Colombier.LP 11009a747e4fSDavid du ColombierThe remaining files are informational and used for debugging. 11019a747e4fSDavid du ColombierThe 11029a747e4fSDavid du Colombier.CW proto 11039a747e4fSDavid du Colombierfile contains a list of supported protocols (to see what protocols the 11049a747e4fSDavid du Colombiersystem supports, 11059a747e4fSDavid du Colombier.CW cat 11069a747e4fSDavid du Colombier.CW /mnt/factotum/proto ), 11079a747e4fSDavid du Colombierand the 11089a747e4fSDavid du Colombier.CW log 11099a747e4fSDavid du Colombierfile contains a log of operations and debugging output 11109a747e4fSDavid du Colombierenabled by a 11119a747e4fSDavid du Colombier.CW debug 11129a747e4fSDavid du Colombiercontrol message. 11139a747e4fSDavid du Colombier.LP 11149a747e4fSDavid du ColombierThe next few sections explain how 11159a747e4fSDavid du Colombier.CW factotum 11169a747e4fSDavid du Colombieris used by system services. 11179a747e4fSDavid du Colombier.NH 1 11189a747e4fSDavid du ColombierAuthentication in 9P 11199a747e4fSDavid du Colombier.LP 11205d459b5aSDavid du ColombierPlan 9 uses a remote file access protocol, 9P 11215d459b5aSDavid du Colombier[Pike93], 11229a747e4fSDavid du Colombierto connect to resources such as the 11239a747e4fSDavid du Colombierfile server and remote processes. 11249a747e4fSDavid du ColombierThe original design for 9P included special messages at the start of a conversation 11259a747e4fSDavid du Colombierto authenticate the user. 11269a747e4fSDavid du ColombierMultiple users can share a single connection, such as when a CPU server 11279a747e4fSDavid du Colombierruns processes for many users connected to a single file server, 11289a747e4fSDavid du Colombierbut each must authenticate separately. 11295d459b5aSDavid du ColombierThe authentication protocol, similar to that of Kerberos 11305d459b5aSDavid du Colombier[Stei88], 11319a747e4fSDavid du Colombierused a sequence of messages passed between client, file server, and authentication 11329a747e4fSDavid du Colombierserver to verify the identities of the user, calling machine, and serving machine. 11339a747e4fSDavid du ColombierOne major drawback to the design was that the authentication method was defined by 9P 11349a747e4fSDavid du Colombieritself and could not be changed. 11359a747e4fSDavid du ColombierMoreover, there was no mechanism to relegate 11369a747e4fSDavid du Colombierauthentication to an external (trusted) agent, 11379a747e4fSDavid du Colombierso a process implementing 9P needed, besides support for file service, 11385d459b5aSDavid du Colombiera substantial body of cryptographic code to implement a handful of startup messages 11399a747e4fSDavid du Colombierin the protocol. 11409a747e4fSDavid du Colombier.LP 11419a747e4fSDavid du ColombierA recent redesign of 9P 11429a747e4fSDavid du Colombieraddressed a number of file service issues outside the scope of this paper. 11439a747e4fSDavid du ColombierOn issues of authentication, there were two goals: 11449a747e4fSDavid du Colombierfirst, to remove details about authentication from the 11459a747e4fSDavid du Colombierprotocol itself; second, to allow an external program to execute the authentication 11469a747e4fSDavid du Colombierpart of the protocol. 11479a747e4fSDavid du ColombierIn particular, we wanted a way to quickly incorporate 11489a747e4fSDavid du Colombierideas found in other systems such as SFS 11499a747e4fSDavid du Colombier[Mazi99]. 11509a747e4fSDavid du Colombier.LP 11519a747e4fSDavid du ColombierSince 9P is a file service protocol, the solution involved creating a new type of file 11529a747e4fSDavid du Colombierto be served: an 11539a747e4fSDavid du Colombier.I authentication 11549a747e4fSDavid du Colombier.I file . 11555d459b5aSDavid du ColombierConnections to a 9P service begin in a state that 11565d459b5aSDavid du Colombierallows no general file access but permits the client 11575d459b5aSDavid du Colombierto open an authentication file 11589a747e4fSDavid du Colombierby sending a special message, generated by the new 11599a747e4fSDavid du Colombier.CW fauth 11609a747e4fSDavid du Colombiersystem call: 11619a747e4fSDavid du Colombier.P1 11629a747e4fSDavid du Colombierafd = fauth(int fd, char *servicename); 11639a747e4fSDavid du Colombier.P2 11649a747e4fSDavid du ColombierHere 11659a747e4fSDavid du Colombier.CW fd 11669a747e4fSDavid du Colombieris the user's file descriptor for the established network connection to the 9P server 11679a747e4fSDavid du Colombierand 11689a747e4fSDavid du Colombier.CW servicename 11695d459b5aSDavid du Colombieris the name of the desired service offered on that server, typically the file subsystem 11709a747e4fSDavid du Colombierto be accessed. 11719a747e4fSDavid du ColombierThe returned file descriptor, 11729a747e4fSDavid du Colombier.CW afd , 11739a747e4fSDavid du Colombieris a unique handle representing the authentication file 11749a747e4fSDavid du Colombiercreated for this connection to authenticate to 11759a747e4fSDavid du Colombierthis service; it is analogous to a capability. 11769a747e4fSDavid du ColombierThe authentication file represented by 11779a747e4fSDavid du Colombier.CW afd 11789a747e4fSDavid du Colombieris not otherwise addressable on the server, such as through 11799a747e4fSDavid du Colombierthe file name hierarchy. 11805d459b5aSDavid du ColombierIn all other respects, it behaves like a regular file; 11819a747e4fSDavid du Colombiermost important, it accepts standard read and write operations. 11829a747e4fSDavid du Colombier.LP 11839a747e4fSDavid du ColombierTo prove its identity, the user process (via 11849a747e4fSDavid du Colombier.CW factotum ) 11859a747e4fSDavid du Colombierexecutes the authentication protocol, 11869a747e4fSDavid du Colombierdescribed in the next section of this paper, 11879a747e4fSDavid du Colombierover the 11889a747e4fSDavid du Colombier.CW afd 11899a747e4fSDavid du Colombierfile descriptor with ordinary reads and writes. 11909a747e4fSDavid du ColombierWhen client and server have successfully negotiated, the authentication file 11919a747e4fSDavid du Colombierchanges state so it can be used as evidence of authority in 11929a747e4fSDavid du Colombier.CW mount . 11939a747e4fSDavid du Colombier.LP 11949a747e4fSDavid du ColombierOnce identity is established, the process presents the (now verified) 11959a747e4fSDavid du Colombier.CW afd 11969a747e4fSDavid du Colombieras proof of identity to the 11979a747e4fSDavid du Colombier.CW mount 11989a747e4fSDavid du Colombiersystem call: 11999a747e4fSDavid du Colombier.P1 12009a747e4fSDavid du Colombiermount(int fd, int afd, char *mountpoint, 12019a747e4fSDavid du Colombier int flag, char *servicename) 12029a747e4fSDavid du Colombier.P2 12039a747e4fSDavid du ColombierIf the 12049a747e4fSDavid du Colombier.CW mount 12059a747e4fSDavid du Colombiersucceeds, the user now 12069a747e4fSDavid du Colombierhas appropriate permissions for the file hierarchy made 12079a747e4fSDavid du Colombiervisible at the mount point. 12089a747e4fSDavid du Colombier.LP 12099a747e4fSDavid du ColombierThis sequence of events has several advantages. 12109a747e4fSDavid du ColombierFirst, the actual authentication protocol is implemented using regular reads and writes, 12119a747e4fSDavid du Colombiernot special 9P messages, so 12129a747e4fSDavid du Colombierthey can be processed, forwarded, proxied, and so on by 12139a747e4fSDavid du Colombierany 9P agent without special arrangement. 12149a747e4fSDavid du ColombierSecond, the business of negotiating the authentication by reading and writing the 12159a747e4fSDavid du Colombierauthentication file can be delegated to an outside agent, in particular 12169a747e4fSDavid du Colombier.CW factotum ; 12179a747e4fSDavid du Colombierthe programs that implement the client and server ends of a 9P conversation need 12189a747e4fSDavid du Colombierno authentication or cryptographic code. 12199a747e4fSDavid du ColombierThird, 12209a747e4fSDavid du Colombiersince the authentication protocol is not defined by 9P itself, it is easy to change and 12219a747e4fSDavid du Colombiercan even be negotiated dynamically. 12229a747e4fSDavid du ColombierFinally, since 12239a747e4fSDavid du Colombier.CW afd 12249a747e4fSDavid du Colombieracts like a capability, it can be treated like one: 12259a747e4fSDavid du Colombierhanded to another process to give it special permissions; 12269a747e4fSDavid du Colombierkept around for later use when authentication is again required; 12279a747e4fSDavid du Colombieror closed to make sure no other process can use it. 12289a747e4fSDavid du Colombier.LP 12299a747e4fSDavid du ColombierAll these advantages stem from moving the authentication negotiation into 12309a747e4fSDavid du Colombierreads and writes on a separate file. 12319a747e4fSDavid du ColombierAs is often the case in Plan 9, 12329a747e4fSDavid du Colombiermaking a resource (here authentication) accessible with a file-like interface 12339a747e4fSDavid du Colombierreduces 12349a747e4fSDavid du Colombier.I a 12359a747e4fSDavid du Colombier.I priori 12369a747e4fSDavid du Colombierthe need for special interfaces. 12379a747e4fSDavid du Colombier.LP 12389a747e4fSDavid du Colombier.SS 12399a747e4fSDavid du ColombierPlan 9 shared key protocol 12409a747e4fSDavid du Colombier.LP 12419a747e4fSDavid du ColombierIn addition to the various standard protocols supported by 12429a747e4fSDavid du Colombier.CW factotum , 12439a747e4fSDavid du Colombierwe use a shared key protocol for native 12449a747e4fSDavid du ColombierPlan 9 authentication. 12459a747e4fSDavid du ColombierThis protocol provides backward compatibility with 12469a747e4fSDavid du Colombierolder versions of the system. One reason for the new 12479a747e4fSDavid du Colombierarchitecture is to let us replace such protocols 12489a747e4fSDavid du Colombierin the near future with more cryptographically secure ones. 12499a747e4fSDavid du Colombier.LP 12509a747e4fSDavid du Colombier.I P9sk1 12519a747e4fSDavid du Colombieris a shared key protocol that uses tickets much like those 12529a747e4fSDavid du Colombierin the original Kerberos. 12539a747e4fSDavid du ColombierThe difference is that we've 12549a747e4fSDavid du Colombierreplaced the expiration time in Kerberos tickets with 12559a747e4fSDavid du Colombiera random nonce parameter and a counter. 12569a747e4fSDavid du ColombierWe summarize it here: 12579a747e4fSDavid du Colombier.P1 12589a747e4fSDavid du Colombier$C -> S: ~~ "nonce" sub C# 12599a747e4fSDavid du Colombier$S -> C: ~~ "nonce" sub S , "uid" sub S , "domain" sub S# 12609a747e4fSDavid du Colombier 12619a747e4fSDavid du Colombier$C -> A: ~~ "nonce" sub S , "uid" sub S , "domain" sub S , "uid" sub C ,# 12629a747e4fSDavid du Colombier $"factotum" sub C# 12639a747e4fSDavid du Colombier$A -> C: ~~ K sub C roman "{" "nonce" sub S , "uid" sub C , "uid" sub S, K sub n roman "}",# 12649a747e4fSDavid du Colombier $K sub S roman "{" "nonce" sub S , "uid" sub C , "uid" sub S, K sub n roman "}"# 12659a747e4fSDavid du Colombier 12669a747e4fSDavid du Colombier$C -> S: ~~ K sub S roman "{" "nonce" sub S , "uid" sub C , "uid" sub S , K sub n roman "}",# 12679a747e4fSDavid du Colombier $K sub n roman "{" "nonce" sub S , "counter" roman "}"# 12689a747e4fSDavid du Colombier$S -> C: ~~ K sub n roman "{" "nonce" sub C , "counter" roman "}"# 12699a747e4fSDavid du Colombier.P2 12709a747e4fSDavid du Colombier(Here $K roman "{" x roman "}"# indicates $x# encrypted with 12719a747e4fSDavid du ColombierDES key $K#.) 12729a747e4fSDavid du ColombierThe first two messages exchange nonces and server identification. 12739a747e4fSDavid du ColombierAfter this initial exchange, the client contacts the authentication 12749a747e4fSDavid du Colombierserver to obtain a pair of encrypted tickets, one encrypted with 12759a747e4fSDavid du Colombierthe client key and one with the server key. 12769a747e4fSDavid du ColombierThe client relays the server ticket to the server. 12779a747e4fSDavid du ColombierThe server believes that the ticket is new 12789a747e4fSDavid du Colombierbecause it contains 12799a747e4fSDavid du Colombier$"nonce" sub S# 12809a747e4fSDavid du Colombierand that the ticket is from the authentication 12819a747e4fSDavid du Colombierserver because it is encrypted in the server key $K sub S#. 12829a747e4fSDavid du ColombierThe ticket is basically a statement from the authentication 12839a747e4fSDavid du Colombierserver that now $"uid" sub C# and $"uid" sub S# share a 12849a747e4fSDavid du Colombiersecret $K sub n#. 12859a747e4fSDavid du ColombierThe authenticator $K sub n roman "{" "nonce" sub S , "counter" roman "}"# 12869a747e4fSDavid du Colombierconvinces the server that the client knows $K sub n# and thus 12879a747e4fSDavid du Colombiermust be $"uid" sub C#. 12885d459b5aSDavid du ColombierSimilarly, authenticator $K sub n roman "{" "nonce" sub C , "counter" roman "}"# 12899a747e4fSDavid du Colombierconvinces the client that the server knows $K sub n# and thus 12909a747e4fSDavid du Colombiermust be $"uid" sub S#. 12919a747e4fSDavid du ColombierTickets can be reused, without contacting the authentication 12929a747e4fSDavid du Colombierserver again, by incrementing the counter before each 12939a747e4fSDavid du Colombierauthenticator is generated. 12949a747e4fSDavid du Colombier.LP 12959a747e4fSDavid du ColombierIn the future we hope to introduce a public key version of 12969a747e4fSDavid du Colombierp9sk1, 12979a747e4fSDavid du Colombierwhich would allow authentication even 12989a747e4fSDavid du Colombierwhen the authentication server is not available. 12999a747e4fSDavid du Colombier.SS 13009a747e4fSDavid du ColombierThe authentication server 13019a747e4fSDavid du Colombier.LP 13029a747e4fSDavid du ColombierEach Plan 9 security domain has an authentication server (AS) 13039a747e4fSDavid du Colombierthat all users trust to keep the complete set of shared keys. 13049a747e4fSDavid du ColombierIt also offers services for users and administrators to manage the 13059a747e4fSDavid du Colombierkeys, create and disable accounts, and so on. 13069a747e4fSDavid du ColombierIt typically runs on 13079a747e4fSDavid du Colombiera standalone machine with few other services. 13089a747e4fSDavid du ColombierThe AS comprises two services, 13099a747e4fSDavid du Colombier.CW keyfs 13109a747e4fSDavid du Colombierand 13119a747e4fSDavid du Colombier.CW authsrv . 13129a747e4fSDavid du Colombier.LP 13139a747e4fSDavid du Colombier.CW Keyfs 13149a747e4fSDavid du Colombieris a user-level file system that manages an 13159a747e4fSDavid du Colombierencrypted database of user accounts. 13169a747e4fSDavid du ColombierEach account is represented by a directory containing the 13179a747e4fSDavid du Colombierfiles 13189a747e4fSDavid du Colombier.CW key , 13199a747e4fSDavid du Colombiercontaining the Plan 9 key for p9sk1; 13209a747e4fSDavid du Colombier.CW secret 13219a747e4fSDavid du Colombierfor the challenge/response protocols (APOP, VNC, CHAP, MSCHAP, 13229a747e4fSDavid du ColombierCRAM); 13239a747e4fSDavid du Colombier.CW log 13249a747e4fSDavid du Colombierfor authentication outcomes; 13259a747e4fSDavid du Colombier.CW expire 13269a747e4fSDavid du Colombierfor an expiration time; and 13279a747e4fSDavid du Colombier.CW status . 13289a747e4fSDavid du ColombierIf the expiration time passes, 13299a747e4fSDavid du Colombierif the number of successive failed authentications 13309a747e4fSDavid du Colombierexceeds 50, or if 13319a747e4fSDavid du Colombier.CW disabled 13329a747e4fSDavid du Colombieris written to the status file, 13339a747e4fSDavid du Colombierany attempt to access the 13349a747e4fSDavid du Colombier.CW key 13359a747e4fSDavid du Colombieror 13369a747e4fSDavid du Colombier.CW secret 13379a747e4fSDavid du Colombierfiles will fail. 13389a747e4fSDavid du Colombier.LP 13399a747e4fSDavid du Colombier.CW Authsrv 13409a747e4fSDavid du Colombieris a network service that brokers shared key authentications 13419a747e4fSDavid du Colombierfor the protocols p9sk1, APOP, VNC, CHAP, MSCHAP, 13429a747e4fSDavid du Colombierand CRAM. Remote users can also call 13439a747e4fSDavid du Colombier.CW authsrv 13449a747e4fSDavid du Colombierto change their passwords. 13459a747e4fSDavid du Colombier.LP 13469a747e4fSDavid du ColombierThe 13479a747e4fSDavid du Colombierp9sk1 13489a747e4fSDavid du Colombierprotocol was described in the previous 13499a747e4fSDavid du Colombiersection. 13509a747e4fSDavid du ColombierThe challenge/response protocols differ 13519a747e4fSDavid du Colombierin detail but all follow the general structure: 13529a747e4fSDavid du Colombier.P1 13535d459b5aSDavid du Colombier$C -> S: ~~ "nonce" sub C# 13545d459b5aSDavid du Colombier$S -> C: ~~ "nonce" sub S , "uid" sub S ,"domain" sub S# 13555d459b5aSDavid du Colombier$C -> A: ~~ "nonce" sub S , "uid" sub S , "domain" sub S ,# 13565d459b5aSDavid du Colombier $"hostid" sub C , "uid" sub C# 13575d459b5aSDavid du Colombier$A -> C: ~~ K sub C roman "{" "nonce" sub S , "uid" sub C , "uid" sub S, K sub n roman "}",# 13585d459b5aSDavid du Colombier $K sub S roman "{" "nonce" sub S , "uid" sub C , "uid" sub S, K sub n roman "}"# 13595d459b5aSDavid du Colombier$C -> S: ~~ K sub S roman "{" "nonce" sub S , "uid" sub C , "uid" sub S, K sub n roman "}",# 13605d459b5aSDavid du Colombier $K sub n roman "{" "nonce" sub S roman "}"# 13615d459b5aSDavid du Colombier$S -> C: ~~ K sub n roman "{" "nonce" sub C roman "}"# 13629a747e4fSDavid du Colombier.P2 13639a747e4fSDavid du ColombierThe password protocol is: 13649a747e4fSDavid du Colombier.P1 13659a747e4fSDavid du Colombier$C -> A: ~~ "uid" sub C# 13669a747e4fSDavid du Colombier$A -> C: ~~ K sub c roman "{" K sub n roman "}"# 13679a747e4fSDavid du Colombier$C -> A: ~~ K sub n roman "{" "password" sub "old" , "password" sub "new" roman "}"# 13689a747e4fSDavid du Colombier$A -> C: ~~ OK# 13699a747e4fSDavid du Colombier.P2 13709a747e4fSDavid du ColombierTo avoid replay attacks, the pre-encryption 13719a747e4fSDavid du Colombierclear text for each of the protocols (as well as for p9sk1) includes 13729a747e4fSDavid du Colombiera tag indicating the encryption's role in the 13739a747e4fSDavid du Colombierprotocol. We elided them in these outlines. 13749a747e4fSDavid du Colombier.SS 13759a747e4fSDavid du ColombierProtocol negotiation 13769a747e4fSDavid du Colombier.LP 13779a747e4fSDavid du ColombierRather than require particular protocols for particular services, 13789a747e4fSDavid du Colombierwe implemented a negotiation metaprotocol, 13799a747e4fSDavid du Colombier.I p9any , 13809a747e4fSDavid du Colombierwhich chooses the actual authentication protocol to use. 13819a747e4fSDavid du ColombierP9any 13829a747e4fSDavid du Colombieris used now by all native services on Plan 9. 13839a747e4fSDavid du Colombier.LP 13849a747e4fSDavid du ColombierThe metaprotocol is simple. The callee sends a 13859a747e4fSDavid du Colombiernull-terminated string of the form: 13869a747e4fSDavid du Colombier.P1 13875d459b5aSDavid du Colombierv.$n# $proto sub 1#@$domain sub 1# $proto sub 2#@$domain sub 2# ... 13889a747e4fSDavid du Colombier.P2 13899a747e4fSDavid du Colombierwhere 13909a747e4fSDavid du Colombier.I n 13919a747e4fSDavid du Colombieris a decimal version number, $proto sub k# 13929a747e4fSDavid du Colombieris the name of a protocol for which the 13939a747e4fSDavid du Colombier.CW factotum 13949a747e4fSDavid du Colombierhas a key, and $domain sub k# 13959a747e4fSDavid du Colombieris the name of the domain in which the key is 13969a747e4fSDavid du Colombiervalid. 13979a747e4fSDavid du ColombierThe caller then responds 13989a747e4fSDavid du Colombier.P1 13999a747e4fSDavid du Colombier\f2proto\fP@\f2domain\fP 14009a747e4fSDavid du Colombier.P2 14019a747e4fSDavid du Colombierindicating its choice. 14029a747e4fSDavid du ColombierFinally the callee responds 14039a747e4fSDavid du Colombier.P1 14049a747e4fSDavid du ColombierOK 14059a747e4fSDavid du Colombier.P2 14069a747e4fSDavid du ColombierAny other string indicates failure. 14079a747e4fSDavid du ColombierAt this point the chosen protocol commences. 14089a747e4fSDavid du ColombierThe final fixed-length reply is used to make it easy to 14099a747e4fSDavid du Colombierdelimit the I/O stream should the chosen protocol 14109a747e4fSDavid du Colombierrequire the caller rather than the callee to send the first message. 14119a747e4fSDavid du Colombier.LP 14129a747e4fSDavid du ColombierWith this negotiation metaprotocol, the underlying 14139a747e4fSDavid du Colombierauthentication protocols used for Plan 9 services 14149a747e4fSDavid du Colombiercan be changed under any application just 14159a747e4fSDavid du Colombierby changing the keys known by the 14169a747e4fSDavid du Colombier.CW factotum 14179a747e4fSDavid du Colombieragents at each end. 14189a747e4fSDavid du Colombier.LP 14199a747e4fSDavid du ColombierP9any is vulnerable to man in the middle attacks 14209a747e4fSDavid du Colombierto the extent that the attacker may constrain the 14219a747e4fSDavid du Colombierpossible choices by changing the stream. However, 14229a747e4fSDavid du Colombierwe believe this is acceptable since the attacker 14239a747e4fSDavid du Colombiercannot force either side to choose algorithms 14249a747e4fSDavid du Colombierthat it is unwilling to use. 14259a747e4fSDavid du Colombier.NH 1 14269a747e4fSDavid du ColombierLibrary Interface to Factotum 14279a747e4fSDavid du Colombier.LP 14289a747e4fSDavid du ColombierAlthough programs can access 14299a747e4fSDavid du Colombier.CW factotum 's 14309a747e4fSDavid du Colombierservices through its file system interface, 14319a747e4fSDavid du Colombierit is more common to use a C library that 14329a747e4fSDavid du Colombierpackages the interaction. 14339a747e4fSDavid du ColombierThere are a number of routines in the library, 14349a747e4fSDavid du Colombiernot all of which are relevant here, but a few 14359a747e4fSDavid du Colombierexamples should give their flavor. 14369a747e4fSDavid du Colombier.LP 14379a747e4fSDavid du ColombierFirst, consider the problem of mounting a remote file server using 9P. 14389a747e4fSDavid du ColombierAn earlier discussion showed how the 14399a747e4fSDavid du Colombier.CW fauth 14409a747e4fSDavid du Colombierand 14419a747e4fSDavid du Colombier.CW mount 14429a747e4fSDavid du Colombiersystem calls use an authentication file, 14439a747e4fSDavid du Colombier.CW afd , 14449a747e4fSDavid du Colombieras a capability, 14459a747e4fSDavid du Colombierbut not how 14469a747e4fSDavid du Colombier.CW factotum 14479a747e4fSDavid du Colombiermanages 14489a747e4fSDavid du Colombier.CW afd . 14499a747e4fSDavid du ColombierThe library contains a routine, 14509a747e4fSDavid du Colombier.CW amount 14519a747e4fSDavid du Colombier(authenticated mount), that is used by most programs in preference to 14529a747e4fSDavid du Colombierthe raw 14539a747e4fSDavid du Colombier.CW fauth 14549a747e4fSDavid du Colombierand 14559a747e4fSDavid du Colombier.CW mount 14569a747e4fSDavid du Colombiercalls. 14579a747e4fSDavid du Colombier.CW Amount 14589a747e4fSDavid du Colombierengages 14599a747e4fSDavid du Colombier.CW factotum 14609a747e4fSDavid du Colombierto validate 14619a747e4fSDavid du Colombier.CW afd ; 14629a747e4fSDavid du Colombierhere is the complete code: 14639a747e4fSDavid du Colombier.P1 14649a747e4fSDavid du Colombier.ta 3n +3n +3n +3n 14659a747e4fSDavid du Colombierint 14669a747e4fSDavid du Colombieramount(int fd, char *mntpt, 14679a747e4fSDavid du Colombier int flags, char *aname) 14689a747e4fSDavid du Colombier{ 14699a747e4fSDavid du Colombier int afd, ret; 14709a747e4fSDavid du Colombier AuthInfo *ai; 14719a747e4fSDavid du Colombier 14729a747e4fSDavid du Colombier afd = fauth(fd, aname); 14739a747e4fSDavid du Colombier if(afd >= 0){ 14749a747e4fSDavid du Colombier ai = auth_proxy(afd, amount_getkey, 14759a747e4fSDavid du Colombier "proto=p9any role=client"); 14769a747e4fSDavid du Colombier if(ai != NULL) 14779a747e4fSDavid du Colombier auth_freeAI(ai); 14789a747e4fSDavid du Colombier } 14799a747e4fSDavid du Colombier ret = mount(fd, afd, mntpt, 14809a747e4fSDavid du Colombier flags, aname); 14819a747e4fSDavid du Colombier if(afd >= 0) 14829a747e4fSDavid du Colombier close(afd); 14839a747e4fSDavid du Colombier return ret; 14849a747e4fSDavid du Colombier} 14859a747e4fSDavid du Colombier.P2 14865d459b5aSDavid du Colombierwhere parameter 14875d459b5aSDavid du Colombier.CW fd 14885d459b5aSDavid du Colombieris a file descriptor returned by 14895d459b5aSDavid du Colombier.CW open 14905d459b5aSDavid du Colombieror 14915d459b5aSDavid du Colombier.CW dial 14925d459b5aSDavid du Colombierfor a new connection to a file server. 14939a747e4fSDavid du ColombierThe conversation with 14949a747e4fSDavid du Colombier.CW factotum 14959a747e4fSDavid du Colombieroccurs in the call to 14969a747e4fSDavid du Colombier.CW auth_proxy , 14979a747e4fSDavid du Colombierwhich specifies, as a key query, 14989a747e4fSDavid du Colombierwhich authentication protocol to use 14999a747e4fSDavid du Colombier(here the metaprotocol 15009a747e4fSDavid du Colombier.CW p9any ) 15019a747e4fSDavid du Colombierand the role being played 15029a747e4fSDavid du Colombier.CW client ). ( 15039a747e4fSDavid du Colombier.CW Auth_proxy 15049a747e4fSDavid du Colombierwill read and write the 15059a747e4fSDavid du Colombier.CW factotum 15069a747e4fSDavid du Colombierfiles, and the authentication file descriptor 15079a747e4fSDavid du Colombier.CW afd , 15089a747e4fSDavid du Colombierto validate the user's right to access the service. 15099a747e4fSDavid du ColombierIf the call is successful, any auxiliary data, held in an 15109a747e4fSDavid du Colombier.CW AuthInfo 15119a747e4fSDavid du Colombierstructure, is freed. 15129a747e4fSDavid du ColombierIn any case, the 15139a747e4fSDavid du Colombier.CW mount 15149a747e4fSDavid du Colombieris then called with the (perhaps validated) 15159a747e4fSDavid du Colombier.CW afd. 15169a747e4fSDavid du ColombierA 9P server can cause the 15179a747e4fSDavid du Colombier.CW fauth 15189a747e4fSDavid du Colombiersystem call to fail, as an indication that authentication is 15199a747e4fSDavid du Colombiernot required to access the service. 15209a747e4fSDavid du Colombier.LP 15219a747e4fSDavid du ColombierThe second argument to 15229a747e4fSDavid du Colombier.CW auth_proxy 15239a747e4fSDavid du Colombieris a function, here 15249a747e4fSDavid du Colombier.CW amount_getkey , 15259a747e4fSDavid du Colombierto be called if secret information such as a password or 15269a747e4fSDavid du Colombierresponse to a challenge is required as part of the authentication. 15279a747e4fSDavid du ColombierThis function, of course, will provide this data to 15289a747e4fSDavid du Colombier.CW factotum 15299a747e4fSDavid du Colombieras a 15309a747e4fSDavid du Colombier.CW key 15319a747e4fSDavid du Colombiermessage on the 15329a747e4fSDavid du Colombier.CW /mnt/factotum/ctl 15339a747e4fSDavid du Colombierfile. 15349a747e4fSDavid du Colombier.LP 15359a747e4fSDavid du ColombierAlthough the final argument to 15369a747e4fSDavid du Colombier.CW auth_proxy 15379a747e4fSDavid du Colombierin this example is a simple string, in general 15389a747e4fSDavid du Colombierit can be a formatted-print specifier in the manner of 15399a747e4fSDavid du Colombier.CW printf , 15409a747e4fSDavid du Colombierto enable the construction of more elaborate key queries. 15419a747e4fSDavid du Colombier.LP 15429a747e4fSDavid du ColombierAs another example, consider the Plan 9 15439a747e4fSDavid du Colombier.CW cpu 15449a747e4fSDavid du Colombierservice, which exports local devices to a shell process on 15459a747e4fSDavid du Colombiera remote machine, typically 15469a747e4fSDavid du Colombierto connect the local screen and keyboard to a more powerful computer. 15479a747e4fSDavid du ColombierAt heart, 15489a747e4fSDavid du Colombier.CW cpu 15499a747e4fSDavid du Colombieris a superset of a service called 15509a747e4fSDavid du Colombier.CW exportfs 15519a747e4fSDavid du Colombier[Pike93], 15529a747e4fSDavid du Colombierwhich allows one machine to see an arbitrary portion of the file name space 15539a747e4fSDavid du Colombierof another machine, such as to 15549a747e4fSDavid du Colombierexport the network device to another machine 15559a747e4fSDavid du Colombierfor gatewaying. 15569a747e4fSDavid du ColombierHowever, 15579a747e4fSDavid du Colombier.CW cpu 15589a747e4fSDavid du Colombieris not just 15599a747e4fSDavid du Colombier.CW exportfs 15609a747e4fSDavid du Colombierbecause it also delivers signals such as interrupt 15619a747e4fSDavid du Colombierand negotiates the initial environment 15629a747e4fSDavid du Colombierfor the remote shell. 15639a747e4fSDavid du Colombier.LP 15649a747e4fSDavid du ColombierTo authenticate an instance of 15659a747e4fSDavid du Colombier.CW cpu 15669a747e4fSDavid du Colombierrequires 15679a747e4fSDavid du Colombier.CW factotum 15689a747e4fSDavid du Colombierprocesses on both ends: the local, client 15699a747e4fSDavid du Colombierend running as the user on a terminal 15709a747e4fSDavid du Colombierand the remote, server 15719a747e4fSDavid du Colombierend running as the host owner of the server machine. 15729a747e4fSDavid du ColombierHere is schematic code for the two ends: 15739a747e4fSDavid du Colombier.P1 15749a747e4fSDavid du Colombier.ta 3n +3n +3n +3n 15759a747e4fSDavid du Colombier/* client */ 15769a747e4fSDavid du Colombierint 15779a747e4fSDavid du Colombierp9auth(int fd) 15789a747e4fSDavid du Colombier{ 15799a747e4fSDavid du Colombier AuthInfo *ai; 15809a747e4fSDavid du Colombier 15819a747e4fSDavid du Colombier ai = auth_proxy(fd, auth_getkey, 15829a747e4fSDavid du Colombier "proto=p9any role=client"); 15839a747e4fSDavid du Colombier if(ai == NULL) 15849a747e4fSDavid du Colombier return -1; 15859a747e4fSDavid du Colombier 15869a747e4fSDavid du Colombier /* start cpu protocol here */ 15879a747e4fSDavid du Colombier} 15889a747e4fSDavid du Colombier 15899a747e4fSDavid du Colombier/* server */ 15909a747e4fSDavid du Colombierint 15919a747e4fSDavid du Colombiersrvp9auth(int fd, char *user) 15929a747e4fSDavid du Colombier{ 15939a747e4fSDavid du Colombier AuthInfo *ai; 15949a747e4fSDavid du Colombier 15959a747e4fSDavid du Colombier ai = auth_proxy(fd, NULL, 15969a747e4fSDavid du Colombier "proto=p9any role=server"); 15979a747e4fSDavid du Colombier if(ai == NULL) 15989a747e4fSDavid du Colombier return -1; 15999a747e4fSDavid du Colombier /* set user id for server process */ 16009a747e4fSDavid du Colombier if(auth_chuid(ai, NULL) < 0) 16019a747e4fSDavid du Colombier return -1; 16029a747e4fSDavid du Colombier 16039a747e4fSDavid du Colombier /* start cpu protocol here */ 16049a747e4fSDavid du Colombier} 16059a747e4fSDavid du Colombier.P2 16069a747e4fSDavid du Colombier.CW Auth_chuid 16079a747e4fSDavid du Colombierencapsulates the negotiation to change a user id using the 16089a747e4fSDavid du Colombier.CW caphash 16099a747e4fSDavid du Colombierand 16109a747e4fSDavid du Colombier.CW capuse 16119a747e4fSDavid du Colombierfiles of the (server) kernel. 16129a747e4fSDavid du ColombierNote that although the client process may ask the user for new keys, using 16139a747e4fSDavid du Colombier.CW auth_getkey , 16149a747e4fSDavid du Colombierthe server machine, presumably a shared machine with a pseudo-user for 16159a747e4fSDavid du Colombierthe host owner, sets the key-getting function to 16169a747e4fSDavid du Colombier.CW NULL . 16179a747e4fSDavid du Colombier.NH 1 16189a747e4fSDavid du ColombierSecure Store 16199a747e4fSDavid du Colombier.LP 16209a747e4fSDavid du Colombier.CW Factotum 16215d459b5aSDavid du Colombierkeeps its keys in volatile memory, which must somehow be 16225d459b5aSDavid du Colombierinitialized at boot time. 16235d459b5aSDavid du ColombierTherefore, 16249a747e4fSDavid du Colombier.CW factotum 16259a747e4fSDavid du Colombiermust be 16269a747e4fSDavid du Colombiersupplemented by a persistent store, perhaps 16279a747e4fSDavid du Colombiera floppy disk containing a key file of commands to be copied into 16289a747e4fSDavid du Colombier.CW /mnt/factotum/ctl 16299a747e4fSDavid du Colombierduring bootstrap. 16309a747e4fSDavid du ColombierBut removable media are a nuisance to carry and 16319a747e4fSDavid du Colombierare vulnerable to theft. 16329a747e4fSDavid du ColombierKeys could be stored encrypted on a shared file system, but 16339a747e4fSDavid du Colombieronly if those keys are not necessary for authenticating to 16349a747e4fSDavid du Colombierthe file system in the first place. 16359a747e4fSDavid du ColombierEven if the keys are encrypted under a user 16369a747e4fSDavid du Colombierpassword, a thief might well succeed with a dictionary attack. 16379a747e4fSDavid du ColombierOther risks of local storage are loss of the contents 16389a747e4fSDavid du Colombierthrough mechanical mishap or dead batteries. 16399a747e4fSDavid du ColombierThus for convenience and 16409a747e4fSDavid du Colombiersafety we provide a 16419a747e4fSDavid du Colombier.CW secstore 16429a747e4fSDavid du Colombier(secure store) server in the network to hold each user's permanent list of keys, a 16439a747e4fSDavid du Colombier.I key 16449a747e4fSDavid du Colombier.I file . 16459a747e4fSDavid du Colombier.LP 16469a747e4fSDavid du Colombier.CW Secstore 16479a747e4fSDavid du Colombieris a file server for encrypted data, 16489a747e4fSDavid du Colombierused only during bootstrapping. 16499a747e4fSDavid du ColombierIt must provide strong 16509a747e4fSDavid du Colombierauthentication and resistance to passive and active protocol attacks 16519a747e4fSDavid du Colombierwhile assuming nothing more from the client than a password. 16529a747e4fSDavid du ColombierOnce 16539a747e4fSDavid du Colombier.CW factotum 16549a747e4fSDavid du Colombierhas loaded the key file, further encrypted or authenticated 16559a747e4fSDavid du Colombierfile storage can be accomplished by standard mechanisms. 16569a747e4fSDavid du Colombier.EQ 16579a747e4fSDavid du Colombierdefine mod % ~ roman "mod" ~ % 16589a747e4fSDavid du Colombierdefine sha1 % "sha1" % 16599a747e4fSDavid du Colombier.EN 16609a747e4fSDavid du Colombier.LP 16619a747e4fSDavid du ColombierThe cryptographic technology that enables 16629a747e4fSDavid du Colombier.CW secstore 16639a747e4fSDavid du Colombieris a form of encrypted 16649a747e4fSDavid du Colombierkey exchange 16659a747e4fSDavid du Colombiercalled PAK 16669a747e4fSDavid du Colombier[Boyk00], 16679a747e4fSDavid du Colombieranalogous to 16689a747e4fSDavid du ColombierEKE 16699a747e4fSDavid du Colombier[Bell93], 16709a747e4fSDavid du ColombierSRP 16719a747e4fSDavid du Colombier[Wu98], 16729a747e4fSDavid du Colombieror 16739a747e4fSDavid du ColombierSPEKE 16749a747e4fSDavid du Colombier[Jabl]. 16759a747e4fSDavid du ColombierPAK was chosen 16769a747e4fSDavid du Colombierbecause it comes with a proof of equivalence in strength to 16779a747e4fSDavid du ColombierDiffie-Hellman; subtle flaws in some earlier encrypted key exchange 16789a747e4fSDavid du Colombierprotocols and implementations have encouraged us to take special care. 16799a747e4fSDavid du ColombierIn outline, the PAK protocol is: 16809a747e4fSDavid du Colombier.P1 16819a747e4fSDavid du Colombier$C -> S:~ C, g sup x H# 16829a747e4fSDavid du Colombier$S -> C:~ S, g sup y , hash(g sup xy , C, S)# 16839a747e4fSDavid du Colombier$C -> S:~ hash(g sup xy , S, C)# 16849a747e4fSDavid du Colombier.P2 16859a747e4fSDavid du Colombierwhere $H# is a preshared secret between client $C# and server $S#. 16869a747e4fSDavid du ColombierThere are several variants of PAK, all presented in papers 16879a747e4fSDavid du Colombiermainly concerned with proofs of cryptographic properties. 16889a747e4fSDavid du ColombierTo aid implementers, we have distilled a description of the specific 16899a747e4fSDavid du Colombierversion we use into an Appendix to this paper. 16905d459b5aSDavid du ColombierThe Plan 9 open source license provides for use of Lucent's 16915d459b5aSDavid du Colombierencrypted key exchange patents in this context. 16929a747e4fSDavid du Colombier.LP 16939a747e4fSDavid du ColombierAs a further layer of defense against password theft, 16949a747e4fSDavid du Colombierwe provide (within the encrypted channel $C -> S#) 16959a747e4fSDavid du Colombierinformation that is validated at a RADIUS server, 16969a747e4fSDavid du Colombiersuch as the digits from a hardware token 16979a747e4fSDavid du Colombier[RFC2138]. 16989a747e4fSDavid du ColombierThis provides two-factor authentication, which potentially 16999a747e4fSDavid du Colombierrequires tricking two independent administrators in any attack by 17009a747e4fSDavid du Colombiersocial engineering. 17019a747e4fSDavid du Colombier.LP 17029a747e4fSDavid du ColombierThe key file stored on the server is encrypted with AES (Rijndael) using CBC 17039a747e4fSDavid du Colombierwith a 10-byte initialization vector and trailing authentication padding. 17049a747e4fSDavid du ColombierAll this is invisible to the user of 17059a747e4fSDavid du Colombier.CW secstore . 17069a747e4fSDavid du ColombierFor that matter, it is invisible to the 17079a747e4fSDavid du Colombier.CW secstore 17089a747e4fSDavid du Colombierserver as well; 17099a747e4fSDavid du Colombierif the AES Modes of Operation are standardized and a new encryption format 17109a747e4fSDavid du Colombierdesigned, it can be implemented by a client without change to the server. 17119a747e4fSDavid du ColombierThe 17129a747e4fSDavid du Colombier.CW secstore 17139a747e4fSDavid du Colombieris deliberately not backed up; the user is expected to 17149a747e4fSDavid du Colombieruse more than one 17159a747e4fSDavid du Colombier.CW secstore 17169a747e4fSDavid du Colombieror save the key file on removable media 17179a747e4fSDavid du Colombierand lock it away. 17189a747e4fSDavid du ColombierThe user's password is hashed to create the $H# used 17199a747e4fSDavid du Colombierin the PAK protocol; a different hash of the password is used as 17209a747e4fSDavid du Colombierthe file encryption key. 17219a747e4fSDavid du ColombierFinally, there is a command (inside the authenticated, 17229a747e4fSDavid du Colombierencrypted channel between client and 17239a747e4fSDavid du Colombier.CW secstore ) 17249a747e4fSDavid du Colombierto change passwords by sending 17259a747e4fSDavid du Colombiera new $H#; 17269a747e4fSDavid du Colombierfor consistency, the client process must at the same time fetch and re-encrypt all files. 17279a747e4fSDavid du Colombier.LP 17289a747e4fSDavid du ColombierWhen 17299a747e4fSDavid du Colombier.CW factotum 17309a747e4fSDavid du Colombierstarts, it dials the local 17319a747e4fSDavid du Colombier.CW secstore 17329a747e4fSDavid du Colombierand checks whether the user has an account. 17339a747e4fSDavid du ColombierIf so, 17349a747e4fSDavid du Colombierit prompts for the user's 17359a747e4fSDavid du Colombier.CW secstore 17369a747e4fSDavid du Colombierpassword and fetches the key file. 17379a747e4fSDavid du ColombierThe PAK protocol 17389a747e4fSDavid du Colombierensures mutual authentication and prevents dictionary attacks on the password 17399a747e4fSDavid du Colombierby passive wiretappers or active intermediaries. 17409a747e4fSDavid du ColombierPasswords saved in 17419a747e4fSDavid du Colombierthe key file can be long random strings suitable for 17429a747e4fSDavid du Colombiersimpler challenge/response authentication protocols. 17439a747e4fSDavid du ColombierThus the user need only remember 17449a747e4fSDavid du Colombiera single, weaker password to enable strong, ``single sign on'' authentication to 17459a747e4fSDavid du Colombierunchanged legacy applications scattered across multiple authentication domains. 17469a747e4fSDavid du Colombier.NH 1 17479a747e4fSDavid du ColombierTransport Layer Security 17489a747e4fSDavid du Colombier.LP 17499a747e4fSDavid du ColombierSince the Plan 9 operating system is designed for use in network elements 17509a747e4fSDavid du Colombierthat must withstand direct attack, unguarded by firewall or VPN, we seek 17519a747e4fSDavid du Colombierto ensure that all applications use channels with appropriate mutual 17529a747e4fSDavid du Colombierauthentication and encryption. 17539a747e4fSDavid du ColombierA principal tool for this is TLS 1.0 17549a747e4fSDavid du Colombier[RFC2246]. 17559a747e4fSDavid du Colombier(TLS 1.0 is nearly the same as SSL 3.0, 17569a747e4fSDavid du Colombierand our software is designed to interoperate 17579a747e4fSDavid du Colombierwith implementations of either standard.) 17589a747e4fSDavid du Colombier.LP 17595d459b5aSDavid du ColombierTLS defines a record layer protocol for message integrity and privacy 17609a747e4fSDavid du Colombierthrough the use of message digesting and encryption with shared secrets. 17619a747e4fSDavid du ColombierWe implement this service as a kernel device, though it could 17629a747e4fSDavid du Colombierbe performed at slightly higher cost by invoking a separate program. 17639a747e4fSDavid du ColombierThe library interface to the TLS kernel device is: 17649a747e4fSDavid du Colombier.P1 17659a747e4fSDavid du Colombierint pushtls(int fd, char *hashalg, 17669a747e4fSDavid du Colombier char *cryptalg, int isclient, 17679a747e4fSDavid du Colombier char *secret, char *dir); 17689a747e4fSDavid du Colombier.P2 17699a747e4fSDavid du ColombierGiven a file descriptor, the names of message digest and 17709a747e4fSDavid du Colombierencryption algorithms, and the shared secret, 17719a747e4fSDavid du Colombier.CW pushtls 17729a747e4fSDavid du Colombierreturns a new file descriptor for the encrypted connection. 17739a747e4fSDavid du Colombier(The final argument 17749a747e4fSDavid du Colombier.CW dir 17759a747e4fSDavid du Colombierreceives the name of the directory in the TLS device that 17769a747e4fSDavid du Colombieris associated with the new connection.) 17779a747e4fSDavid du ColombierThe function is named by analogy with the ``push'' operation 17789a747e4fSDavid du Colombiersupported by the stream I/O system of Research Unix and the 17799a747e4fSDavid du Colombierfirst two editions of Plan 9. 17809a747e4fSDavid du ColombierBecause adding encryption is as simple as replacing one 17819a747e4fSDavid du Colombierfile descriptor with another, adding encryption to a particular 17829a747e4fSDavid du Colombiernetwork service is usually trivial. 17839a747e4fSDavid du Colombier.LP 17849a747e4fSDavid du ColombierThe Plan 9 shared key authentication protocols establish a shared 56-bit secret 17859a747e4fSDavid du Colombieras a side effect. 17869a747e4fSDavid du ColombierNative Plan 9 network services such as 17879a747e4fSDavid du Colombier.CW cpu 17889a747e4fSDavid du Colombierand 17899a747e4fSDavid du Colombier.CW exportfs 17909a747e4fSDavid du Colombieruse these protocols for authentication and then invoke 17919a747e4fSDavid du Colombier.CW pushtls 17929a747e4fSDavid du Colombierwith the shared secret. 17939a747e4fSDavid du Colombier.LP 17949a747e4fSDavid du ColombierAbove the record layer, TLS specifies a handshake protocol using public keys 17959a747e4fSDavid du Colombierto establish the session secret. 17969a747e4fSDavid du ColombierThis protocol is widely used with HTTP and IMAP4 17979a747e4fSDavid du Colombierto provide server authentication, though with client certificates it could provide 17989a747e4fSDavid du Colombiermutual authentication. The library function 17999a747e4fSDavid du Colombier.P1 18009a747e4fSDavid du Colombierint tlsClient(int fd, TLSconn *conn) 18019a747e4fSDavid du Colombier.P2 18029a747e4fSDavid du Colombierhandles the initial handshake and returns the result of 18039a747e4fSDavid du Colombier.CW pushtls . 18049a747e4fSDavid du ColombierOn return, it fills the 18059a747e4fSDavid du Colombier.CW conn 18069a747e4fSDavid du Colombierstructure with the session ID used 18079a747e4fSDavid du Colombierand the X.509 certificate presented by the 18089a747e4fSDavid du Colombierserver, but makes no effort to verify the certificate. 18099a747e4fSDavid du ColombierAlthough the original design intent of X.509 certificates expected 18109a747e4fSDavid du Colombierthat they would be used with a Public Key Infrastructure, 18119a747e4fSDavid du Colombierreliable deployment has been so long delayed and problematic 18129a747e4fSDavid du Colombierthat we have adopted the simpler policy of just using the 18139a747e4fSDavid du ColombierX.509 certificate as a representation of the public key, 18149a747e4fSDavid du Colombierdepending on a locally-administered directory of SHA1 thumbprints 18159a747e4fSDavid du Colombierto allow applications to decide which public keys to trust 18169a747e4fSDavid du Colombierfor which purposes. 18179a747e4fSDavid du Colombier.NH 1 18189a747e4fSDavid du ColombierRelated Work and Discussion 18199a747e4fSDavid du Colombier.LP 18209a747e4fSDavid du ColombierKerberos, one of the earliest distributed authentication 18219a747e4fSDavid du Colombiersystems, keeps a set of authentication tickets in a temporary file called 18229a747e4fSDavid du Colombiera ticket cache. The ticket cache is protected by Unix file permissions. 18239a747e4fSDavid du ColombierAn environment variable containing the file name of the ticket cache 18249a747e4fSDavid du Colombierallows for different ticket caches in different simultaneous login sessions. 18259a747e4fSDavid du ColombierA user logs in by typing his or her Kerberos password. 18269a747e4fSDavid du ColombierThe login program uses the Kerberos password to obtain a temporary 18279a747e4fSDavid du Colombierticket-granting ticket from the authentication server, initializes the 18289a747e4fSDavid du Colombierticket cache with the ticket-granting ticket, and then forgets the password. 18299a747e4fSDavid du ColombierOther applications can use the ticket-granting ticket to sign tickets 18309a747e4fSDavid du Colombierfor themselves on behalf of the user during the login session. 18315d459b5aSDavid du ColombierThe ticket cache is removed when the user logs out 18325d459b5aSDavid du Colombier[Stei88]. 18339a747e4fSDavid du ColombierThe ticket cache relieves the user from typing a password 18349a747e4fSDavid du Colombierevery time authentication is needed. 18359a747e4fSDavid du Colombier.LP 18369a747e4fSDavid du ColombierThe secure shell SSH develops this idea further, replacing the 18379a747e4fSDavid du Colombiertemporary file with a named Unix domain socket connected to 18389a747e4fSDavid du Colombiera user-level program, called an agent. 18399a747e4fSDavid du ColombierOnce the SSH agent is started and initialized with one or 18409a747e4fSDavid du Colombiermore RSA private keys, SSH clients can employ it 18419a747e4fSDavid du Colombierto perform RSA authentications on their behalf. 18429a747e4fSDavid du ColombierIn the absence of an agent, SSH typically uses RSA keys 18439a747e4fSDavid du Colombierread from encrypted disk files or uses passphrase-based 18449a747e4fSDavid du Colombierauthentication, both of which would require prompting the user 18459a747e4fSDavid du Colombierfor a passphrase whenever authentication is needed 18469a747e4fSDavid du Colombier[Ylon96]. 18479a747e4fSDavid du ColombierThe self-certifying file system SFS uses a similar agent 18489a747e4fSDavid du Colombier[Kami00], 18499a747e4fSDavid du Colombiernot only for moderating the use of client authentication keys 18509a747e4fSDavid du Colombierbut also for verifying server public keys 18519a747e4fSDavid du Colombier[Mazi99]. 18529a747e4fSDavid du Colombier.LP 18539a747e4fSDavid du Colombier.CW Factotum 18549a747e4fSDavid du Colombieris a logical continuation of this evolution, 18559a747e4fSDavid du Colombierreplacing the program-specific SSH or SFS agents with 18569a747e4fSDavid du Colombiera general agent capable of serving a wide variety of programs. 18579a747e4fSDavid du ColombierHaving one agent for all programs removes the need 18589a747e4fSDavid du Colombierto have one agent for each program. 18599a747e4fSDavid du ColombierIt also allows the programs themselves to be protocol-agnostic, 18609a747e4fSDavid du Colombierso that, for example, one could build an SSH workalike 18619a747e4fSDavid du Colombiercapable of using any protocol supported by 18629a747e4fSDavid du Colombier.CW factotum , 18639a747e4fSDavid du Colombierwithout that program knowing anything about the protocols. 18649a747e4fSDavid du ColombierTraditionally each program needs to implement each 18659a747e4fSDavid du Colombierauthentication protocol for itself, an $O(n sup 2 )# coding 18665d459b5aSDavid du Colombierproblem that 18675d459b5aSDavid du Colombier.CW factotum 18685d459b5aSDavid du Colombierreduces to $O(n)#. 18699a747e4fSDavid du Colombier.LP 18709a747e4fSDavid du ColombierPrevious work on agents has concentrated on their use by clients 18719a747e4fSDavid du Colombierauthenticating to servers. 18729a747e4fSDavid du ColombierLooking in the other direction, Sun Microsystem's 18735d459b5aSDavid du Colombierpluggable authentication module (PAM) is one 18749a747e4fSDavid du Colombierof the earliest attempts to 18759a747e4fSDavid du Colombierprovide a general authentication mechanism for Unix-like 18769a747e4fSDavid du Colombieroperating systems 18779a747e4fSDavid du Colombier[Sama96]. 18789a747e4fSDavid du ColombierWithout a central authority like PAM, system policy is tied 18799a747e4fSDavid du Colombierup in the various implementations of network services. 18809a747e4fSDavid du ColombierFor example, on a typical Unix, if a system administrator 18819a747e4fSDavid du Colombierdecides not to allow plaintext passwords for authentication, 18829a747e4fSDavid du Colombierthe configuration files for a half dozen different servers \(em 18839a747e4fSDavid du Colombier.CW rlogind , 18849a747e4fSDavid du Colombier.CW telnetd , 18859a747e4fSDavid du Colombier.CW ftpd , 18869a747e4fSDavid du Colombier.CW sshd , 18879a747e4fSDavid du Colombierand so on \(em 18889a747e4fSDavid du Colombierneed to be edited. 18899a747e4fSDavid du ColombierPAM solves this problem by hiding the details of a given 18909a747e4fSDavid du Colombierauthentication mechanism behind a common library interface. 18919a747e4fSDavid du ColombierDirected by a system-wide configuration file, 18929a747e4fSDavid du Colombieran application selects a particular authentication mechanism 18939a747e4fSDavid du Colombierby dynamically loading the appropriate shared library. 18949a747e4fSDavid du ColombierPAM is widely used on Sun's Solaris and some Linux distributions. 18959a747e4fSDavid du Colombier.LP 18969a747e4fSDavid du Colombier.CW Factotum 18979a747e4fSDavid du Colombierachieves the same goals 18989a747e4fSDavid du Colombierusing the agent approach. 18999a747e4fSDavid du Colombier.CW Factotum 19009a747e4fSDavid du Colombieris the only process that needs to create 19019a747e4fSDavid du Colombiercapabilities, so all the network servers can run as 19029a747e4fSDavid du Colombieruntrusted users (e.g., 19039a747e4fSDavid du ColombierPlan 9's 19049a747e4fSDavid du Colombier.CW none 19059a747e4fSDavid du Colombieror Unix's 19069a747e4fSDavid du Colombier.CW nobody ), 19079a747e4fSDavid du Colombierwhich greatly reduces the harm done if a server is buggy 19089a747e4fSDavid du Colombierand is compromised. 19099a747e4fSDavid du ColombierIn fact, if 19109a747e4fSDavid du Colombier.CW factotum 19119a747e4fSDavid du Colombierwere implemented on Unix along with 19129a747e4fSDavid du Colombieran analogue to the Plan 9 capability device, venerable 19139a747e4fSDavid du Colombierprograms like 19149a747e4fSDavid du Colombier.CW su 19159a747e4fSDavid du Colombierand 19169a747e4fSDavid du Colombier.CW login 19179a747e4fSDavid du Colombierwould no longer need to be installed ``setuid root.'' 19189a747e4fSDavid du Colombier.LP 19199a747e4fSDavid du ColombierSeveral other systems, such as Password Safe [Schn], 19209a747e4fSDavid du Colombierstore multiple passwords in an encrypted file, 19219a747e4fSDavid du Colombierso that the user only needs to remember one password. 19229a747e4fSDavid du ColombierOur 19239a747e4fSDavid du Colombier.CW secstore 19249a747e4fSDavid du Colombiersolution differs from these by placing the storage in 19259a747e4fSDavid du Colombiera hardened location in the network, so that the encrypted file is 19269a747e4fSDavid du Colombierless liable to be stolen for offline dictionary attack and so that 19279a747e4fSDavid du Colombierit is available even when a user has several computers. 19289a747e4fSDavid du ColombierIn contrast, Microsoft's Passport system 19299a747e4fSDavid du Colombier[Micr] 19309a747e4fSDavid du Colombierkeeps credentials in 19319a747e4fSDavid du Colombierthe network, but centralized at one extremely-high-value target. 19329a747e4fSDavid du ColombierThe important feature of Passport, setting up trust relationships 19339a747e4fSDavid du Colombierwith e-merchants, is outside our scope. 19349a747e4fSDavid du ColombierThe 19359a747e4fSDavid du Colombier.CW secstore 19369a747e4fSDavid du Colombierarchitecture is almost identical to 19379a747e4fSDavid du ColombierPerlman and Kaufman's 19389a747e4fSDavid du Colombier[Perl99] 19399a747e4fSDavid du Colombierbut with newer EKE technology. 19409a747e4fSDavid du ColombierLike them, we chose to defend mainly against outside attacks 19419a747e4fSDavid du Colombieron 19429a747e4fSDavid du Colombier.CW secstore ; 19439a747e4fSDavid du Colombierif additional defense of the files on the server 19449a747e4fSDavid du Colombieritself is desired, one can use distributed techniques 19459a747e4fSDavid du Colombier[Ford00]. 19469a747e4fSDavid du Colombier.LP 19479a747e4fSDavid du ColombierWe made a conscious choice of placing encryption, message integrity, 19489a747e4fSDavid du Colombierand key management at the application layer 19499a747e4fSDavid du Colombier(TLS, just above layer 4) rather than at layer 3, as in IPsec. 19509a747e4fSDavid du ColombierThis leads to a simpler structure for the network stack, easier 19519a747e4fSDavid du Colombierintegration with applications and, most important, easier network 19529a747e4fSDavid du Colombieradministration since we can recognize which applications are misbehaving 19539a747e4fSDavid du Colombierbased on TCP port numbers. TLS does suffer (relative to IPsec) from 19549a747e4fSDavid du Colombierthe possibility of forged TCP Reset, but we feel that this is adequately 19559a747e4fSDavid du Colombierdealt with by randomized TCP sequence numbers. 19565d459b5aSDavid du ColombierIn contrast with other TLS libraries, Plan 9 does not 19575d459b5aSDavid du Colombierrequire the application to change 19585d459b5aSDavid du Colombier.CW write 19595d459b5aSDavid du Colombiercalls to 19605d459b5aSDavid du Colombier.CW sslwrite 19615d459b5aSDavid du Colombierbut simply to add a few lines of code at startup 19625d459b5aSDavid du Colombier[Resc01]. 19635d459b5aSDavid du Colombier.NH 1 19645d459b5aSDavid du ColombierConclusion 19659a747e4fSDavid du Colombier.LP 19669a747e4fSDavid du ColombierWriting safe code is difficult. 19679a747e4fSDavid du ColombierStack attacks, 19689a747e4fSDavid du Colombiermistakes in logic, and bugs in compilers and operating systems 19699a747e4fSDavid du Colombiercan each make it possible for an attacker 19709a747e4fSDavid du Colombierto subvert the intended execution sequence of a 19719a747e4fSDavid du Colombierservice. 19729a747e4fSDavid du ColombierIf the server process has the privileges 19739a747e4fSDavid du Colombierof a powerful user, such as 19749a747e4fSDavid du Colombier.CW root 19759a747e4fSDavid du Colombieron Unix, then so does the attacker. 19769a747e4fSDavid du Colombier.CW Factotum 19779a747e4fSDavid du Colombierallows us 19789a747e4fSDavid du Colombierto constrain the privileged execution to a single 19799a747e4fSDavid du Colombierprocess whose core is a few thousand lines of code. 19809a747e4fSDavid du ColombierVerifying such a process, both through manual and automatic means, 19819a747e4fSDavid du Colombieris much easier and less error prone 19829a747e4fSDavid du Colombierthan requiring it of all servers. 19835d459b5aSDavid du Colombier.LP 19845d459b5aSDavid du ColombierAn implementation of these ideas is in Plan 9 from Bell Labs, Fourth Edition, 19855d459b5aSDavid du Colombierfreely available from \f(CWhttp://\%plan9.bell-labs.com/\%plan9\fP. 19869a747e4fSDavid du Colombier.SH 19879a747e4fSDavid du ColombierAcknowledgments 19889a747e4fSDavid du Colombier.LP 19899a747e4fSDavid du ColombierWilliam Josephson contributed to the implementation of password changing in 19909a747e4fSDavid du Colombier.CW secstore . 19919a747e4fSDavid du ColombierWe thank Phil MacKenzie and Martín Abadi for helpful comments on early parts 19929a747e4fSDavid du Colombierof the design. 19939a747e4fSDavid du ColombierChuck Blake, 19949a747e4fSDavid du ColombierPeter Bosch, 19959a747e4fSDavid du ColombierFrans Kaashoek, 19969a747e4fSDavid du ColombierSape Mullender, 19979a747e4fSDavid du Colombierand 19989a747e4fSDavid du ColombierLakshman Y. N., 19999a747e4fSDavid du Colombierpredominantly Dutchmen, gave helpful comments on the paper. 20005d459b5aSDavid du ColombierRuss Cox is supported by a fellowship from the Fannie and John Hertz Foundation. 20019a747e4fSDavid du Colombier.SH 20029a747e4fSDavid du ColombierReferences 20039a747e4fSDavid du Colombier.LP 20049a747e4fSDavid du Colombier[Bell93] 20059a747e4fSDavid du ColombierS.M. Bellovin and M. Merritt, 20069a747e4fSDavid du Colombier``Augmented Encrypted Key Exchange,'' 20075d459b5aSDavid du ColombierProceedings of the 1st ACM Conference on Computer and Communications Security, 1993, pp. 244 - 250. 20089a747e4fSDavid du Colombier.LP 20099a747e4fSDavid du Colombier[Boyk00] 20109a747e4fSDavid du ColombierVictor Boyko, Philip MacKenzie, and Sarvar Patel, 20119a747e4fSDavid du Colombier``Provably Secure Password-Authenticated Key Exchange using Diffie-Hellman,'' 20129a747e4fSDavid du ColombierEurocrypt 2000, 156\-171. 20139a747e4fSDavid du Colombier... http://www.bell-labs.com/who/philmac/research/pak-final.ps.gz 20149a747e4fSDavid du Colombier.LP 20159a747e4fSDavid du Colombier[RFC2246] 20169a747e4fSDavid du ColombierT . Dierks and C. Allen, 20179a747e4fSDavid du Colombier``The TLS Protocol, Version 1.0,'' 20189a747e4fSDavid du ColombierRFC 2246. 20199a747e4fSDavid du Colombier.LP 20209a747e4fSDavid du Colombier[Ford00] 20219a747e4fSDavid du ColombierWarwick Ford and Burton S. Kaliski, Jr., 20229a747e4fSDavid du Colombier``Server-Assisted Generation of a Strong Secret from a Password,'' 20239a747e4fSDavid du ColombierIEEE Fifth International Workshop on Enterprise Security, 20249a747e4fSDavid du ColombierNational Institute of Standards and Technology (NIST), 20259a747e4fSDavid du ColombierGaithersburg MD, June 14 - 16, 2000. 20269a747e4fSDavid du Colombier.LP 20279a747e4fSDavid du Colombier[Jabl] 20289a747e4fSDavid du ColombierDavid P. Jablon, 20299a747e4fSDavid du Colombier``Strong Password-Only Authenticated Key Exchange,'' 20305d459b5aSDavid du Colombier\f(CWhttp://\%integritysciences.com/\%speke97.html\fP. 20319a747e4fSDavid du Colombier.LP 20329a747e4fSDavid du Colombier[Kami00] 20339a747e4fSDavid du ColombierMichael Kaminsky. 20349a747e4fSDavid du Colombier``Flexible Key Management with SFS Agents,'' 20359a747e4fSDavid du ColombierMaster's Thesis, MIT, May 2000. 20369a747e4fSDavid du Colombier.LP 20379a747e4fSDavid du Colombier[Mack] 20389a747e4fSDavid du ColombierPhilip MacKenzie, 20399a747e4fSDavid du Colombierprivate communication. 20409a747e4fSDavid du Colombier.LP 20419a747e4fSDavid du Colombier[Mazi99] 20429a747e4fSDavid du ColombierDavid Mazières, Michael Kaminsky, M. Frans Kaashoek and Emmett Witchel, 20439a747e4fSDavid du Colombier``Separating key management from file system security,'' 20449a747e4fSDavid du ColombierSymposium on Operating Systems Principles, 1999, pp. 124-139. 20459a747e4fSDavid du Colombier.LP 20469a747e4fSDavid du Colombier[Micr] 20479a747e4fSDavid du ColombierMicrosoft Passport, 20485d459b5aSDavid du Colombier\f(CWhttp://\%www.passport.com/\fP. 20499a747e4fSDavid du Colombier.LP 20509a747e4fSDavid du Colombier[Perl99] 20519a747e4fSDavid du ColombierRadia Perlman and Charlie Kaufman, 20529a747e4fSDavid du Colombier``Secure Password-Based Protocol for Downloading a Private Key,'' 20539a747e4fSDavid du ColombierProc. 1999 Network and Distributed System Security Symposium, 20549a747e4fSDavid du ColombierInternet Society, January 1999. 20559a747e4fSDavid du Colombier.LP 20569a747e4fSDavid du Colombier[Pike95] 20579a747e4fSDavid du ColombierRob Pike, Dave Presotto, Sean Dorward, Bob Flandrena, Ken Thompson, Howard Trickey, and Phil Winterbottom, 20589a747e4fSDavid du Colombier``Plan 9 from Bell Labs,'' 20599a747e4fSDavid du ColombierComputing Systems, \f3\&8\fP, 3, Summer 1995, pp. 221-254. 20609a747e4fSDavid du Colombier.LP 20619a747e4fSDavid du Colombier[Pike93] 20629a747e4fSDavid du ColombierRob Pike, Dave Presotto, Ken Thompson, Howard Trickey, Phil Winterbottom, 20639a747e4fSDavid du Colombier``The Use of Name Spaces in Plan 9,'' 20649a747e4fSDavid du ColombierOperating Systems Review, \f3\&27\fP, 2, April 1993, pp. 72-76 20659a747e4fSDavid du Colombier(reprinted from Proceedings of the 5th ACM SIGOPS European Workshop, 20669a747e4fSDavid du ColombierMont Saint-Michel, 1992, Paper nº 34). 20679a747e4fSDavid du Colombier.LP 20685d459b5aSDavid du Colombier[Resc01] 20695d459b5aSDavid du ColombierEric Rescorla, 20705d459b5aSDavid du Colombier``SSL and TLS: Designing and Building Secure Systems,'' 20715d459b5aSDavid du ColombierAddison-Wesley, 2001. ISBN 0-201-61598-3, p. 387. 20725d459b5aSDavid du Colombier.LP 20739a747e4fSDavid du Colombier[RFC2138] 20749a747e4fSDavid du ColombierC. Rigney, A. Rubens, W. Simpson, S. Willens, 20759a747e4fSDavid du Colombier``Remote Authentication Dial In User Service (RADIUS),'' 20769a747e4fSDavid du ColombierRFC2138, April 1997. 20779a747e4fSDavid du Colombier.LP 20789a747e4fSDavid du Colombier[RiLa] 20799a747e4fSDavid du ColombierRonald L. Rivest and Butler Lampson, 20809a747e4fSDavid du Colombier``SDSI\(emA Simple Distributed Security Infrastructure,'' 20819a747e4fSDavid du Colombier\f(CWhttp://\%theory.lcs.mit.edu/\%~rivest/\%sdsi10.ps\fP. 20829a747e4fSDavid du Colombier.LP 20839a747e4fSDavid du Colombier[Schn] 20849a747e4fSDavid du ColombierBruce Schneier, Password Safe, 20859a747e4fSDavid du Colombier\f(CWhttp://\%www.counterpane.com/\%passsafe.html\fP. 20869a747e4fSDavid du Colombier.LP 20879a747e4fSDavid du Colombier[Sama96] 20889a747e4fSDavid du ColombierVipin Samar, 20899a747e4fSDavid du Colombier``Unified Login with Pluggable Authentication Modules (PAM),'' 20909a747e4fSDavid du ColombierProceedings of the Third ACM Conference on Computer Communications and Security, 20919a747e4fSDavid du ColombierMarch 1996, New Delhi, India. 20929a747e4fSDavid du Colombier... http://www1.acm.org/pubs/articles/proceedings/commsec/238168/p1-samar/p1-samar.pdf 20939a747e4fSDavid du Colombier.LP 20949a747e4fSDavid du Colombier[Stei88] 20959a747e4fSDavid du ColombierJennifer G. Steiner, Clifford Neumann, and Jeffrey I. Schiller, 20969a747e4fSDavid du Colombier``\fIKerberos\fR: An Authentication Service for Open Network Systems,'' 20975d459b5aSDavid du ColombierProceedings of USENIX Winter Conference, Dallas, Texas, February 1988, pp. 191\-202. 20989a747e4fSDavid du Colombier... ftp://athena-dist.mit.edu/pub/kerberos/doc/usenix.PS 20999a747e4fSDavid du Colombier.LP 21009a747e4fSDavid du Colombier[Wu98] 21019a747e4fSDavid du ColombierT. Wu, 21029a747e4fSDavid du Colombier``The Secure Remote Password Protocol,'' 21039a747e4fSDavid du ColombierProceedings of 21049a747e4fSDavid du Colombierthe 1998 Internet Society Network and Distributed System Security 21055d459b5aSDavid du ColombierSymposium, San Diego, CA, March 1998, pp. 97-111. 21069a747e4fSDavid du Colombier.LP 21079a747e4fSDavid du Colombier[Ylon96] 21089a747e4fSDavid du ColombierYlonen, T., 21099a747e4fSDavid du Colombier``SSH\(emSecure Login Connections Over the Internet,'' 21105d459b5aSDavid du Colombier6th USENIX Security Symposium, pp. 37-42. San Jose, CA, July 1996. 21119a747e4fSDavid du Colombier.SH 21129a747e4fSDavid du ColombierAppendix: Summary of the PAK protocol 21139a747e4fSDavid du Colombier.LP 21149a747e4fSDavid du ColombierLet $q>2 sup 160# and $p>2 sup 1024# be primes 21159a747e4fSDavid du Colombiersuch that $p=rq+1# with $r# not a multiple of $q#. 21169a747e4fSDavid du ColombierTake $h ∈ Z sub p sup *# such that $g == h sup r# is not 1. 21179a747e4fSDavid du ColombierThese parameters may be chosen by the NIST algorithm for DSA, 21189a747e4fSDavid du Colombierand are public, fixed values. 21199a747e4fSDavid du ColombierThe client $C# knows a secret $pi# 21209a747e4fSDavid du Colombierand computes $H == (H sub 1 (C, ~ pi )) sup r# and $H sup -1#, 21219a747e4fSDavid du Colombierwhere $H sub 1# is a hash function yielding a random element of $Z sub p sup *#, 21229a747e4fSDavid du Colombierand $H sup -1# may be computed by gcd. 21239a747e4fSDavid du Colombier(All arithmetic is modulo $p#.) 21249a747e4fSDavid du ColombierThe client gives $H sup -1# to the server $S# ahead of time by a private channel. 21259a747e4fSDavid du ColombierTo start a new connection, the client generates a random value $x#, 21269a747e4fSDavid du Colombiercomputes $m == g sup x H#, 21279a747e4fSDavid du Colombierthen calls the server and sends $C# and $m#. 21289a747e4fSDavid du ColombierThe server checks $m != 0 mod p#, 21299a747e4fSDavid du Colombiergenerates random $y#, 21309a747e4fSDavid du Colombiercomputes $ mu == g sup y#, 21319a747e4fSDavid du Colombier$ sigma == (m H sup -1 ) sup y#, 21329a747e4fSDavid du Colombierand sends $S#, $mu#, $k == sha1 ( roman "\"server\"", C, S, m, mu , sigma , H sup -1 )#. 21339a747e4fSDavid du ColombierNext the client computes $sigma = mu sup x#, 21349a747e4fSDavid du Colombierverifies $k#, 21359a747e4fSDavid du Colombierand sends $k' == sha1 ( roman "\"client\"", C, S, m, mu , sigma , H sup -1 )#. 21369a747e4fSDavid du ColombierThe server then verifies $k'# and both sides begin 21379a747e4fSDavid du Colombierusing session key $K == sha1 ( roman "\"session\"", C, S, m, mu , sigma , H sup -1 )#. 21389a747e4fSDavid du ColombierIn the published version of PAK, the server name $S# 21399a747e4fSDavid du Colombieris included in the initial 21409a747e4fSDavid du Colombierhash $H#, but doing so is inconvenient in our application, 21419a747e4fSDavid du Colombieras the server may be known by various equivalent names. 21429a747e4fSDavid du Colombier.LP 21439a747e4fSDavid du ColombierMacKenzie has shown 21449a747e4fSDavid du Colombier[Mack] 21459a747e4fSDavid du Colombierthat the 21469a747e4fSDavid du Colombierequivalence proof [Boyk00] 21479a747e4fSDavid du Colombiercan be adapted to cover our version. 2148