github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/Doc/CloudProxyAuthorizationNotes.txt (about) 1 Authorization in CloudProxy 2 =========================== 3 4 Current Authorization Mechanisms 5 -------------------------------- 6 7 The current authorization mechanisms in the cloudproxy implementation are 8 ad-hoc. Most are trivial identity-based policies. One can be though of as a 9 approximation of a capability-based approach. 10 11 ### LinuxTao Execution Policy 12 13 An "administrative domain" is a set of cloudproxy nodes executing various 14 programs, with the nodes and programs are governed by a single domain-wide 15 policy key K_pol. Authorization for a program to execute within the 16 administrative domain is controlled by a set of signed attestations rooted in 17 K_pol. Actually, the policy is simple in practice: A LinuxTao instance will only 18 execute a program with hash H_prog if H_prog is found on the whitelist signed by 19 K_pol. Essentially, the presence of H_prog on the whitelist is an attestation: 20 21 < K_pol signs attestation for H_prog > 22 23 However, note that a (trusted or untrusted) TPM platform will execute any 24 kernel+initrd combination. 25 26 ### Sealing/Unsealing Policy 27 28 LinuxTao (and presumably other Tao implementations) allow any hosted program, 29 e.g. with hash H_prog, to seal data. Only a hosted program with an identical 30 hash H_prog, running on the same platform, is authorized to unseal the data. 31 32 ### CloudProxy File Server User and Access Policies 33 34 The cloudproxy user manager binds each user key K_user to a user name N_user. Each binding must be 35 signed directly by K_pol: 36 37 < K_pol signs binding for K_user, N_user > 38 39 The cloudproxy file server implements ACLs binding user names to access rights. 40 It uses a challenge/response to ensure the remote file client has the private 41 half of K_user. 42 43 ### CloudProxy Client/Server Connection Policies 44 45 Cloudproxy clients and servers communicate over TLS network connections but need 46 to mutually authenticate the remote endpoint to ensure they are both part of the 47 same administrative domain. To authenticate the remote endpoint requires a chain 48 of attestations rooted in K_pol. Specifically, for a well-formed chain: 49 * All keys used form a simple chain rooted in K_pol, 50 * and all of the hashes mentioned appear on the whitelist signed by K_pol 51 52 Currently, the whitelist signed by K_pol contains: 53 * H_os for each trusted kernel+initrd (to be run on a trusted TPM platform) 54 * H_prog for each trusted program (to be run on trusted kernel+initrd and TPM) 55 56 We have these attestations created during setup: 57 58 0. For each Fake Tao that is trusted: 59 < K_pol signs attestation for K_fake > 60 61 1. For each trusted TPM platform: 62 < K_pol signs attestation for K_aik > 63 64 A trusted TPM platform will execute any kernel+initrd with hash H_os and key 65 K_os, but upon doing so it will issue an attestation: 66 67 2. For any running kernel+initrd on this platform: 68 < K_aik signs attestation for K_os and H_os > 69 70 LinuxTao only executes a program with hash H_prog and key K_prog if it is on the 71 whitelist signed by K_pol, and upon doing so it will issue an attestation: 72 73 3. For each authorized program running on this os: 74 < K_os signs attestation for K_prog and H_prog > 75 76 Such a program can then form the chain (1)+(2)+(3) 77 < K_pol signs attestation for K_aik > 78 < K_aik signs attestation for K_os and H_os > 79 < K_os signs attestation for K_prog and H_prog > 80 81 Functionally, this mechanism emulates a transferrable capability C, where "The 82 owner of key K (e.g. program P) holds capability C" is interepreted as "there is 83 a well-formed attestation chain for K, rooted in the policy key and with all 84 hashes on the signed whitelist". Note that any program holding C can 85 arbitrarily transfer C to any other key. For example, the program above with 86 hash H_prog and key K_prog could issue this attestation: 87 88 4. < K_prog signs attestation for K and H_prog > 89 90 Then the chain (1)+(2)+(3)+(4) is well formed. This works regardless of whether 91 or not key K is actually owned by a program with hash H_prog. 92 93 Program P can also issue variations of (1) as well, essentially designating new 94 TPM platforms as trusted by the administrative domain: 95 96 5. < K_prog signs attestation for K_aik' > 97 6. < K_aik' signs attestation for K_os' and H_os > 98 7. < K_os' signs attestation for K' and H_prog > 99 100 Now, the chain (1)+(2)+(3)+(5)+(6)+(7) is well formed. 101 102 In fact, except for H_os, the hashes mentioned in these chains serve little 103 purpose. H_os is needed because TPM platforms will hand out attestations like 104 (2) for any kernel+initrd without regard to whether they are on the whitelist. 105 But LinuxTao is trusted to give out (3) only after having checked the whitelist. 106 Presumably other intermediate principals like program P can be trusted to do the 107 same since, in both cases, they are trusted not to lie about the hash anyway. 108 109 ### Condensed Attestation Chains 110 111 TaoCA (tcca) provides a service which condenses any well-formed attestation 112 chain down to a single attestation. For example, chain (1)+(2)+(3): 113 114 < K_pol signs attestation for K_aik > 115 < K_aik signs attestation for K_os and H_os > 116 < K_os signs attestation for K_prog and H_prog > 117 118 would be condensed to: 119 120 < K_pol signs attestation for K_prog and H_prog > 121 122 I do not see any particuarly strong motivation for doing this at this time. 123 124 ### Location of Authorization Mechanisms 125 126 * Execution policy is implemented by LinuxTao (and a little in WhiteListAuth). 127 * Seal/unseal policy is implemented by LinuxTao. 128 * File server policies are implemented by FileServer and CloudUserManager. 129 * Cloudproxy client/server connection policies are implemented in CloudServer 130 and (mostly) in WhitelistAuth. 131 132 Open Issues 133 ----------- 134 135 * Policy granularity is inconsistent. Seal/unseal policy is fine-grained (the 136 program hash must match exactly, and program must be running on the same host 137 platform). Cloudproxy client/server connection policy is very coarse-grained 138 (a transferrable capability, essentially). The LinuxTao execution policy is 139 somewhere in the middle. Why do they not all use the same policy? 140 141 * Policy is implicit in code. To figure out what the policy is requires digging 142 through a lot of code. 143 144 * Policy is rigid. Except for the ACLs implemented by file server and the 145 whitelist signed by K_pol, there is very little flexibility in chosing 146 policies. And changing a policy in any significant way requires changing and 147 redeploying code. 148 149 * Policy checking is expensive. Even though all of these platforms are trusted 150 and communicate over secure channels, we still do a lot of asymmetric key 151 operations. These keys are big and are expensive to generate and use. 152 153 Proposals 154 --------- 155 156 ### Symmetric and Identity-Based (ID) Cryptography 157 158 Where possible, we should be using symmetric cryptography. But for many 159 principals, we should ideally use some form of ID-based cryptography. For 160 example, assuming LinuxTao has a symmetric or asymmetric key, we should leverage 161 that to generate ID-based keys for each hosted program, where the ID is an 162 encoding of the program hash, name, and other parameters. This would essentially 163 make explicit that hosted programs are sub-principals of LinuxTao. 164 165 Note: Macaroons are, essentially, one way of doing ID-based symmetric keys. By 166 creating a sub-token and giving it to some other principal, you are essentially 167 creating a new sub-key, the bearer of which acts on behalf of the corresponding 168 sub-principal. There are plenty of other ID-based crypto schemes, though. 169 170 ### Explicit Logic-based and Proof-Based Authorization 171 172 Already the Attestation, Statement, and SignedSpeaksFor objects in the code are 173 becoming unwieldy. It is not at all clear what the semantics of these objects 174 are, what the various combinations of optional fields mean, etc. And this is 175 only enough to support the very limited policies that are currently implemented. 176 Leaving aside questions of where to implement various functionality, it seems 177 clear that we should explicitly define a logic -- the semantics and encoding of 178 formulas and proofs -- to be used within the implementation. Statements and 179 SignedSpeaksFor objects would become encoded formulas. Attestation chains would 180 be Proofs. 181 182 ### Location of Authorization Mechanisms: Macaroons 183 184 The most difficult question is where to locate the mechanisms. 185 186 Macaroons has one answer: 187 * Servers have some built-in functionality that is sufficient for checking a 188 variety of simple policies. Each server can implement different conditions. 189 * More complex policies are pushed to external, third-party verifiers. 190 * Clients (recipients of tokens) do varying amounts of work, depending on the 191 policy. 192 193 In the simplest cases, recipients of macaroon tokens do not need much mechanism. 194 The token is, essentially, a proof that the bearer is authorized, so they simply 195 send the token with a request and hope that it is sufficient. If a principal has 196 many tokens avaialable, it isn't clear how to decide which to send (since the 197 principal can't necessarily check or even understand the various conditions 198 embedded in the tokens). And if the token contains third-party caveats, then the 199 client must obtain the necessary tokens out-of-band and send these together with 200 the original token, all using unspecified client-side mechanisms. 201 202 Macaroon delegation in the simplest cases is trivial: just forward a token to 203 another principal. In more complex cases, unspecified client-side mechanisms are 204 used to decide which conditions to embed within sub-tokens before forwarding 205 them to other principals. 206 207 ### Location of Authorization Mechanisms: Code modules 208 209 Presumably, within an authorization domain, a checker can be some external code 210 module, with certain parameters, run on any of the trusted platforms within the 211 domain. If we have id-based crypto, then fitting this into the macaroon 212 framework is simple as well, we just add a condition that uses the checker's 213 keys, and encodes the parameters into the statement the checker must make. 214 215 Question: Should servers run these automatically on behalf of themselves? Or on 216 behalf of clients? Or should clients run these to obtain a token, which is 217 passed to the server. It seems that the principal adding the condition should 218 be responsible for running the module. 219 220 ### Notes on Macaroons 221 222 Macaroons proposes, essentially, a proof carrying authorization with 223 a. unique, random goal formulas for each policy, 224 b. a very limited, built-in proof system, 225 c. and an extensibility mechanism based on external third-party proof checkers. 226 227 The goal formula is always of the form 228 K says OK 229 where K is a random symmetric key. K is then given out to one or more 230 principals. Those principals can send back < K says OK > at any time, or they 231 can generate an attestation: 232 K says (conditions imply (K2 speaks for K)) 233 and hand out K2 to one or more other principals. Eventually we get a chain: 234 K says (conditions imply (K2 speaks for K)) 235 K2 says (conditions2 imply (K3 speaks for K2)) 236 K3 says (conditions3 imply (K4 speaks for K3)) 237 K4 says OK 238 239 The proof system only has says, speaksfor, and conditions. The conditions are 240 simple and are directly checkable by the server that is checking the policy (and 241 not necessarily checkable by others). 242 243 External third-party proof checkers are made using a condition of the form "Ke 244 says OK" where Ke is a key held by the third-party. In this case, to use e.g. 245 K3 says ((Ke says OK) imply (K4 speaks for K3)) 246 We would need a second chain rooted in Ke, e.g. 247 Ke says (conditions' imply (Ke2 speaks for Ke)) 248 Ke2 says (conditions2' imply (Ke3 speaks for Ke2)) 249 Ke3 says OK 250 Note that here, conditions' and conditions2' are still relative the original 251 first-party server that is checking the policy. However, Ke3 would presumably 252 only issue (Ke3 says OK) after having checked some proof. 253 254 Notes on 19-3-2014 Discussion with kwalsh, tmroeder 255 --------------------------------------------------- 256 257 Tom relays John's desire to use a simple, flat namespace where possible, rather 258 than hierarchical names. Kevin agrees, except that the flat names should either 259 be semantically meaningful (or, failing that, completely opaque). The current 260 scheme is neither really meaninful nor opaque: tcca keeps the hashes at the 261 lowest level of the name (e.g. the program hash) but discards all hashes above 262 that, then tcca uses the policy key to attest to this flat, truncated name. 263 264 Tom relays Google engineer's desire for a Hardware Key Management module 265 replacement implemented in cloudproxy. A simple service would be trivial to 266 implement. Making it robust at scale would be the challenge. 267 268 Tom prefers symmetric keys (ala Macaroons) wherever possible, though mutual 269 authentication as done by cloudserver/cloudproxy may be more complex because 270 only the originator can verify a macaroon. 271 272 Kevin proposes use of ID-based crypto, if possible, using either symmetric or 273 symmetric keys, where the sub-keys are semantically meaningful. Perhaps allow 274 multiple namespaces rooted in different keys to get different levels of 275 granularity: For each hosted program, generate a platform-specific subkey, and 276 if desired also obtain a domain subkey and one or more group subkeys. Then, we 277 can name, e.g. K_os.H_prog, K_pol.H_prog, or K_grp.H_prog. 278 279 Tom points out that many (asymmetric) IBE schemes use exotic and expensive 280 cryptographic primitives. Kevin proposes that cloudproxy may be able to use 281 a simpler scheme by allowing for centralized communication during both 282 private-key and public-key generation, whereas other schemes strive for offline 283 public-key generation. 284 285 In the macaroons approach, tokens authorize the bearer. We should insist that 286 tokens are never shared. Instead sub-tokens are always used when sharing tokens, 287 where the sub-tokens should identify the principal to which it will be given. 288 This way, tokens become more like identifiers (or secret keys) for principals, 289 and the token chain becomes an audit trail. The assumptions here are no worse 290 than the no-key-sharing assumptions in a scheme using private keys. 291 292 It was agreed: 293 * Extensibility within the logic needs to be a first-class notion. One mistake 294 of NAL experience was putting too much into the logic so that we never gained 295 much experience with policies that required third parties. 296 * The logic itself should be explicit, rich enough for at least basic 297 policies, with a clear semantics. On the other hand, we should not try to 298 formalize everything -- we should alllow third parties to encode predicates in 299 abitrary formats, for example. We need, at minimum, says, speaks-for (and/or 300 speaks-on-for), conjunction, disjunction, and implication. 301 * The ability to name code modules in policies is important. If we do 302 the ID-based keys correctly, then we can hopefully leverage that into natural 303 support via Macaroon-style third party caveats. 304