| 1 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 2 | Time: Mon Sep 10 21:55:41 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 3 | From: Alex Dehnert <adehnert> |
|---|
| 4 | |
|---|
| 5 | The current constitution-gatherer is vulnerable to somebody |
|---|
| 6 | supplying, say, /mit/asa-db/.my.cnf and, once the gatherer sticks |
|---|
| 7 | stuff in an asa-internal-readable directory, getting the sql |
|---|
| 8 | password. This seems undesirable. Does getting daemon.asa-db-deputy |
|---|
| 9 | and using Popen("pagsh", "cat", "constitution") seem like a good |
|---|
| 10 | solution to this? |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 14 | Time: Mon Sep 10 21:56:47 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 15 | From: Wobbuffet! <geofft> |
|---|
| 16 | |
|---|
| 17 | Hrm. Why do you need a separate daemon principal? We don't allow |
|---|
| 18 | non-public automatically-gathered constitutions, do we? |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 22 | Time: Mon Sep 10 21:57:01 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 23 | From: Alex Dehnert <adehnert> |
|---|
| 24 | |
|---|
| 25 | We do. Or rather, we will. |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 29 | Time: Mon Sep 10 21:57:02 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 30 | From: Wobbuffet! <geofft> |
|---|
| 31 | |
|---|
| 32 | You should just be able to pagsh and drop privs and do the gathering |
|---|
| 33 | anonymously |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 37 | Time: Mon Sep 10 21:57:10 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 38 | From: Wobbuffet! <geofft> |
|---|
| 39 | |
|---|
| 40 | Lame. |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 44 | Time: Mon Sep 10 21:57:25 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 45 | From: Alex Dehnert <adehnert> |
|---|
| 46 | |
|---|
| 47 | See http://asa.scripts.mit.edu/trac/ticket/60. |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 51 | Time: Mon Sep 10 21:57:32 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 52 | From: Wobbuffet! <geofft> |
|---|
| 53 | |
|---|
| 54 | Is the worry escalation from asa-internal to asa-db? |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 58 | Time: Mon Sep 10 21:57:37 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 59 | From: Alex Dehnert <adehnert> |
|---|
| 60 | |
|---|
| 61 | There are people who think private constitutions should be a thing. |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 65 | Time: Mon Sep 10 21:57:56 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 66 | From: Alex Dehnert <adehnert> |
|---|
| 67 | |
|---|
| 68 | Yes (or, rather, -internal to -db-root). |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 72 | Time: Mon Sep 10 21:58:19 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 73 | From: Wobbuffet! <geofft> |
|---|
| 74 | |
|---|
| 75 | Because it also seems that it's pretty likely that group A can attack |
|---|
| 76 | group B's private constitution by listing it, and then asking the ASA |
|---|
| 77 | DB for a copy of their own constitution, or whatever |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 81 | Time: Mon Sep 10 21:58:43 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 82 | From: Wobbuffet! <geofft> |
|---|
| 83 | |
|---|
| 84 | What daemon principal do you currently intend to use? |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 88 | Time: Mon Sep 10 22:01:58 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 89 | From: Wobbuffet! <geofft> |
|---|
| 90 | |
|---|
| 91 | The constraints listed in that ticket don't imply non-public |
|---|
| 92 | _automatically gathered_ constitutions. |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 96 | Time: Mon Sep 10 22:03:25 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 97 | From: Alex Dehnert <adehnert> |
|---|
| 98 | |
|---|
| 99 | I want to gather all constitutions. |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 103 | Time: Mon Sep 10 22:04:00 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 104 | From: Alex Dehnert <adehnert> |
|---|
| 105 | |
|---|
| 106 | I was thinking daemon.asa-db-deputy. daemon.asa-db could work, but it |
|---|
| 107 | would some rearchitecting to remove some bits it has. |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 111 | Time: Mon Sep 10 22:04:14 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 112 | From: Alex Dehnert <adehnert> |
|---|
| 113 | |
|---|
| 114 | I don't intend to make the DB serve up constitutions. |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 118 | Time: Mon Sep 10 22:04:32 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 119 | From: Wobbuffet! <geofft> |
|---|
| 120 | |
|---|
| 121 | I suspect you are safer deciding that you only want to gather |
|---|
| 122 | publicly-readable constitutions. |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 126 | Time: Mon Sep 10 22:04:55 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 127 | From: Wobbuffet! <geofft> |
|---|
| 128 | |
|---|
| 129 | In particular, you want to not use something called "-deputy", because |
|---|
| 130 | you'll be tempted to use it for some other purpose |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 134 | Time: Mon Sep 10 22:05:03 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 135 | From: Wobbuffet! <geofft> |
|---|
| 136 | |
|---|
| 137 | and then you get into the classic UNIX "nobody" account problem |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 141 | Time: Mon Sep 10 22:05:22 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 142 | From: Wobbuffet! <geofft> |
|---|
| 143 | |
|---|
| 144 | daemon.asa-db-constitution-gatherer would be reasonable, but it seems |
|---|
| 145 | like it's less effort to ... not. |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 149 | Time: Mon Sep 10 22:05:23 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 150 | From: Alex Dehnert <adehnert> |
|---|
| 151 | |
|---|
| 152 | I mean, I could grab daemon.asa-db-const or something instead. |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 156 | Time: Mon Sep 10 22:06:02 2012 Host: BIOHAZARD-CAFE.MIT.EDU |
|---|
| 157 | From: Lemur Rowlands (Please use "it/its/it".) <rowlands> |
|---|
| 158 | |
|---|
| 159 | "nobody" account problem? |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 163 | Time: Mon Sep 10 22:06:03 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 164 | From: Alex Dehnert <adehnert> |
|---|
| 165 | |
|---|
| 166 | (Using it for other things is not an issue assuming it's used for |
|---|
| 167 | similarly-privileged stuff.) |
|---|
| 168 | |
|---|
| 169 | |
|---|
| 170 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 171 | Time: Mon Sep 10 22:09:40 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 172 | From: Wobbuffet! <geofft> |
|---|
| 173 | |
|---|
| 174 | Lemur: Every single UNIX application has the brilliant idea of "this |
|---|
| 175 | is unprivileged, so it should run as the user named 'nobody'" |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 179 | Time: Mon Sep 10 22:09:58 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 180 | From: Wobbuffet! <geofft> |
|---|
| 181 | |
|---|
| 182 | The end result is that... any one application can attack any of the |
|---|
| 183 | several other applications that also had the same brilliant idea |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 187 | Time: Mon Sep 10 22:11:33 2012 Host: BIOHAZARD-CAFE.MIT.EDU |
|---|
| 188 | From: Lemur Rowlands (Please use "it/its/it".) <rowlands> |
|---|
| 189 | |
|---|
| 190 | Ah. |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 194 | Time: Mon Sep 10 22:12:11 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 195 | From: Wobbuffet! <geofft> |
|---|
| 196 | |
|---|
| 197 | (i.e., if you find a vulnerability in one you can attack the rest, |
|---|
| 198 | which somewhat defeats the point) |
|---|
| 199 | |
|---|
| 200 | |
|---|
| 201 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 202 | Time: Mon Sep 10 22:13:10 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 203 | From: Alex Dehnert <adehnert> |
|---|
| 204 | |
|---|
| 205 | Hmm. I guess ptrace (pre-child restrictions) means you can't even say |
|---|
| 206 | "yeah, they run as the same UID, but own no files". |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 210 | Time: Mon Sep 10 22:13:28 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 211 | From: Wobbuffet! <geofft> |
|---|
| 212 | |
|---|
| 213 | Yeah |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 217 | Time: Mon Sep 10 22:46:51 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 218 | From: Alex Dehnert <adehnert> |
|---|
| 219 | |
|---|
| 220 | I think I do want to gather non-public constitutions. I think there |
|---|
| 221 | are going to be enough of them. |
|---|
| 222 | |
|---|
| 223 | |
|---|
| 224 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 225 | Time: Mon Sep 10 22:47:40 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 226 | From: Alex Dehnert <adehnert> |
|---|
| 227 | |
|---|
| 228 | (The plan, FWIW, is to tell people "system:asa-constitution-access |
|---|
| 229 | needs to have access if it's in AFS", so I can rename the principal |
|---|
| 230 | later.) |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 234 | Time: Mon Sep 10 22:47:50 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 235 | From: Zoobar Foundation for Disciplined Discourse: Supporting the brave minds of the new world order <geofft> |
|---|
| 236 | |
|---|
| 237 | Oh, yeah, I'd assume so |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 241 | Time: Mon Sep 10 22:48:13 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 242 | From: Alex Dehnert <adehnert> |
|---|
| 243 | |
|---|
| 244 | Err, assume what? |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 248 | Time: Mon Sep 10 22:48:19 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 249 | From: Zoobar Foundation for Patriotic Learning: Supporting the leading representatives of the counterinsurgency <geofft> |
|---|
| 250 | |
|---|
| 251 | that you were doing that. |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 255 | Time: Mon Sep 10 22:49:06 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 256 | From: Alex Dehnert <adehnert> |
|---|
| 257 | |
|---|
| 258 | Oh. |
|---|
| 259 | |
|---|
| 260 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 261 | Time: Sat Sep 15 22:51:43 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 262 | From: Alex Dehnert <adehnert> |
|---|
| 263 | |
|---|
| 264 | Yo, anybody want to do some code review? |
|---|
| 265 | |
|---|
| 266 | |
|---|
| 267 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 268 | Time: Sat Sep 15 22:52:51 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 269 | From: Alex Dehnert <adehnert> |
|---|
| 270 | |
|---|
| 271 | (Yes, I think there's one and some variably sized fractional people |
|---|
| 272 | on this class qualified to review DB code, and one of them is me...) |
|---|
| 273 | |
|---|
| 274 | |
|---|
| 275 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 276 | Time: Sat Sep 15 22:55:50 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 277 | From: Zoobar Foundation for Awesome Advocacy: Supporting the leading researchers of the United States <geofft> |
|---|
| 278 | |
|---|
| 279 | Why do I feel like I'm being looked at |
|---|
| 280 | |
|---|
| 281 | |
|---|
| 282 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 283 | Time: Sat Sep 15 22:56:11 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 284 | From: Zoobar Foundation for Ethical Learning: Supporting the loyal representatives of the United States <geofft> |
|---|
| 285 | |
|---|
| 286 | Send me a list of commits or a pull request or something? (-> getting |
|---|
| 287 | laundry, be back in a few minutes) |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 291 | Time: Sat Sep 15 23:00:39 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 292 | From: Alex Dehnert <adehnert> |
|---|
| 293 | |
|---|
| 294 | /mit/asa/Scripts/django/db2.0/ pag, top two commits |
|---|
| 295 | (08d4fa6744d2785023666d10a1936460811fcdb2 and |
|---|
| 296 | cf4b7f41af8c34c64e5330e7f0e82be75522991d) |
|---|
| 297 | |
|---|
| 298 | |
|---|
| 299 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 300 | Time: Sat Sep 15 23:00:44 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 301 | From: Alex Dehnert <adehnert> |
|---|
| 302 | |
|---|
| 303 | <_< >_> |
|---|
| 304 | |
|---|
| 305 | |
|---|
| 306 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 307 | Time: Sat Sep 15 23:02:59 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 308 | From: Alex Dehnert <adehnert> |
|---|
| 309 | |
|---|
| 310 | It occurs to me that there *are* other people ~qualified --- pweaver |
|---|
| 311 | and kkb, at least? --- but I think you are the only person besides |
|---|
| 312 | Rachel and I to have commits... |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 316 | Time: Sun Sep 16 00:12:37 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 317 | From: Zoobar Foundation for Patriotic Learning: Supporting the shrewd thinkers of the 21st-century <geofft> |
|---|
| 318 | |
|---|
| 319 | You're going to hate me for this: |
|---|
| 320 | |
|---|
| 321 | team-rocket:/tmp geofft$ cat pagpy |
|---|
| 322 | import os, struct, fcntl |
|---|
| 323 | os.system("tokens") |
|---|
| 324 | fcntl.ioctl(open("/proc/fs/openafs/afs_ioctl"), 0x40084301, struct.pack("lllll", 0, 0, 0, 0, 21)); |
|---|
| 325 | os.system("tokens") |
|---|
| 326 | team-rocket:/tmp geofft$ python pagpy |
|---|
| 327 | |
|---|
| 328 | Tokens held by the Cache Manager: |
|---|
| 329 | |
|---|
| 330 | User's (AFS ID 40490) tokens for afs@sipb.mit.edu [Expires Sep 16 17:59] |
|---|
| 331 | User's (AFS ID 40490) tokens for afs@athena.mit.edu [Expires Sep 16 17:59] |
|---|
| 332 | --End of list-- |
|---|
| 333 | |
|---|
| 334 | Tokens held by the Cache Manager: |
|---|
| 335 | |
|---|
| 336 | --End of list-- |
|---|
| 337 | |
|---|
| 338 | |
|---|
| 339 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 340 | Time: Sun Sep 16 00:17:39 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 341 | From: Zoobar Foundation for Sensible Discourse: Supporting the brightest students of the information superhighway <geofft> |
|---|
| 342 | |
|---|
| 343 | I, uh, think it's actually safer than pagsh, having looked at pagsh's |
|---|
| 344 | code. |
|---|
| 345 | |
|---|
| 346 | |
|---|
| 347 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 348 | Time: Sun Sep 16 00:22:38 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 349 | From: Alex Dehnert <adehnert> |
|---|
| 350 | |
|---|
| 351 | Does that... let you change your PAG using an ioctl? |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 355 | Time: Sun Sep 16 00:22:44 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 356 | From: Zoobar Foundation for Disciplined Research: Supporting the leading advocates of the new world order <geofft> |
|---|
| 357 | |
|---|
| 358 | Yes. |
|---|
| 359 | |
|---|
| 360 | |
|---|
| 361 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 362 | Time: Sun Sep 16 00:23:00 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 363 | From: Alex Dehnert <adehnert> |
|---|
| 364 | |
|---|
| 365 | Oh, it lets you drop your PAG using an ioctl. Can you get it back? |
|---|
| 366 | |
|---|
| 367 | |
|---|
| 368 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 369 | Time: Sun Sep 16 00:23:17 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 370 | From: Alex Dehnert <adehnert> |
|---|
| 371 | |
|---|
| 372 | (AFZ dinner.) |
|---|
| 373 | |
|---|
| 374 | |
|---|
| 375 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 376 | Time: Sun Sep 16 00:23:20 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 377 | From: Zoobar Foundation for Awesome Learning: Supporting the leading soldiers of the counterinsurgency <geofft> |
|---|
| 378 | |
|---|
| 379 | No, it's just the setpag() ~system call. |
|---|
| 380 | |
|---|
| 381 | |
|---|
| 382 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 383 | Time: Sun Sep 16 00:23:37 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 384 | From: Zoobar Foundation for Sustainable Policy: Supporting the leading soldiers of the next generation <geofft> |
|---|
| 385 | |
|---|
| 386 | pagsh boils down to |
|---|
| 387 | proc_afs_syscall(AFSCALL_SETPAG,0,0,0,0,&errcode); |
|---|
| 388 | exec(some mangling of argv); |
|---|
| 389 | |
|---|
| 390 | |
|---|
| 391 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 392 | Time: Sun Sep 16 00:25:50 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 393 | From: Zoobar Foundation for Objective Dialogue: Supporting the important researchers of the next generation <geofft> |
|---|
| 394 | |
|---|
| 395 | Well, I guess it has some fallbacks past proc_afs_syscall: on Linux, |
|---|
| 396 | it used to use an actual syscall named afs_syscall (which is reserved |
|---|
| 397 | by Linux proper), but apparently sketching on Linux's syscall tables |
|---|
| 398 | became hard, so the preferred implementation is to use an ioctl on |
|---|
| 399 | that proc node. It does fall back to syscall(AFS_SYSCALL, |
|---|
| 400 | AFSCALL_SETPAG) eventually, but that doesn't work on at least the |
|---|
| 401 | machine I'm on |
|---|
| 402 | |
|---|
| 403 | |
|---|
| 404 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 405 | Time: Sun Sep 16 00:26:33 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 406 | From: Zoobar Foundation for Patriotic Dialogue: Supporting the best minds of the next generation <geofft> |
|---|
| 407 | |
|---|
| 408 | Anyway, I'm not sure why you're asking "can you get it back" -- you |
|---|
| 409 | really want to have Python fork and do this, because you don't want to |
|---|
| 410 | change the running pag of the DB itself... |
|---|
| 411 | |
|---|
| 412 | |
|---|
| 413 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 414 | Time: Sun Sep 16 00:30:09 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 415 | From: Zoobar Foundation for Ethical Discourse: Supporting the best researchers of the 21st-century <geofft> |
|---|
| 416 | |
|---|
| 417 | Apparently there's another AFS syscall that lets you restore pags. Hrm |
|---|
| 418 | |
|---|
| 419 | |
|---|
| 420 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 421 | Time: Sun Sep 16 00:35:47 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 422 | From: Zoobar Foundation for Trustworthy Thinking: Supporting the important soldiers of the information superhighway <geofft> |
|---|
| 423 | |
|---|
| 424 | Your code itself looks sane. pagsh on the other hand not so much. |
|---|
| 425 | |
|---|
| 426 | |
|---|
| 427 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 428 | Time: Sun Sep 16 01:27:02 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 429 | From: Alex Dehnert <adehnert> |
|---|
| 430 | |
|---|
| 431 | Yeah, I'm not really a fan of pagsh. Though, the code itself doesn't |
|---|
| 432 | look *that* bad? Though I'll admit to being rather confused by the |
|---|
| 433 | getuid/setuid bit and why it is using getpwuid() and such. I'm not |
|---|
| 434 | really sure that running some other Python script that does much the |
|---|
| 435 | same thing but nobody else wants to maintain is really an improvement. |
|---|
| 436 | |
|---|
| 437 | |
|---|
| 438 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 439 | Time: Sun Sep 16 01:28:58 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 440 | From: Alex Dehnert <adehnert> |
|---|
| 441 | |
|---|
| 442 | I really don't get why pagexec isn't a thing, but... |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 446 | Time: Sun Sep 16 01:44:01 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 447 | From: Zoobar Foundation for Awesome Advocacy: Supporting the brave students of the information superhighway <geofft> |
|---|
| 448 | |
|---|
| 449 | Well, my point is that it's one line of python, and you're guaranteed |
|---|
| 450 | ABI stability for a long while to come. |
|---|
| 451 | |
|---|
| 452 | |
|---|
| 453 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 454 | Time: Sun Sep 16 02:25:24 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 455 | From: Alex Dehnert <adehnert> |
|---|
| 456 | |
|---|
| 457 | I guess I could... open a pipe, fork, do the ioctl, aklog (once that |
|---|
| 458 | becomes useful), and copy the file over the pipe? |
|---|
| 459 | |
|---|
| 460 | Really, I think I'm partially sad about the prospect of killing off |
|---|
| 461 | this cleverness... <_< >_> |
|---|
| 462 | |
|---|
| 463 | |
|---|
| 464 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 465 | Time: Sun Sep 16 02:44:42 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 466 | From: Zoobar Foundation for Inquisitive Dialogue: Supporting the foremost representatives of the next generation <geofft> |
|---|
| 467 | |
|---|
| 468 | You might find multiprocessing more palatable than forking and piping |
|---|
| 469 | yourself: |
|---|
| 470 | |
|---|
| 471 | >>> import os, struct, fcntl, multiprocessing |
|---|
| 472 | >>> def setpag(): |
|---|
| 473 | ... fcntl.ioctl(open("/proc/fs/openafs/afs_ioctl"), 0x40084301, struct.pack("lllll", 0, 0, 0, 0, 21)) |
|---|
| 474 | ... |
|---|
| 475 | >>> def pagopen(file, queue): |
|---|
| 476 | ... setpag() |
|---|
| 477 | ... queue.put(open(file).read()) |
|---|
| 478 | ... |
|---|
| 479 | >>> p = multiprocessing.Process(target=pagopen, args=("/etc/mailname", q)) |
|---|
| 480 | >>> p.run() |
|---|
| 481 | >>> q.get() |
|---|
| 482 | 'team-rocket.mit.edu\n' |
|---|
| 483 | >>> p = multiprocessing.Process(target=pagopen, args=("/mit/geofft/.my.cnf", q)) |
|---|
| 484 | >>> p.run() |
|---|
| 485 | Traceback (most recent call last): |
|---|
| 486 | File "<stdin>", line 1, in <module> |
|---|
| 487 | File "/usr/lib/python2.6/multiprocessing/process.py", line 88, in run |
|---|
| 488 | self._target(*self._args, **self._kwargs) |
|---|
| 489 | File "<stdin>", line 3, in pagopen |
|---|
| 490 | IOError: [Errno 13] Permission denied: '/mit/geofft/.my.cnf' |
|---|
| 491 | |
|---|
| 492 | |
|---|
| 493 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 494 | Time: Sun Sep 16 02:46:20 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 495 | From: Zoobar Foundation for Vigilant Dialogue: Supporting the proven minds of the 21st-century <geofft> |
|---|
| 496 | |
|---|
| 497 | Sadly, it appears you can't proxy the file object itself with the |
|---|
| 498 | batteries that are included, and I didn't feel like writing a proxy. |
|---|
| 499 | You might be able to persuade me to. |
|---|
| 500 | |
|---|
| 501 | |
|---|
| 502 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 503 | Time: Sun Sep 16 02:46:35 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 504 | From: Zoobar Foundation for Principled Policy: Supporting the brightest advocates of the counterinsurgency <geofft> |
|---|
| 505 | |
|---|
| 506 | I do agree that one way or another this is useful functionality that |
|---|
| 507 | should live in the mit module. |
|---|
| 508 | |
|---|
| 509 | |
|---|
| 510 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 511 | Time: Sun Sep 16 02:52:08 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 512 | From: Alex Dehnert <adehnert> |
|---|
| 513 | |
|---|
| 514 | Does multiprocessing useprocesses, not threads? (Is a PAG |
|---|
| 515 | per-process, not per-thread?) |
|---|
| 516 | |
|---|
| 517 | |
|---|
| 518 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 519 | Time: Sun Sep 16 02:52:46 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 520 | From: Zoobar Foundation for Sustainable Thinking: Supporting the skillful minds of the information superhighway <geofft> |
|---|
| 521 | |
|---|
| 522 | Multiprocessing uses processes. PAGs are per-thread, nonetheless. |
|---|
| 523 | |
|---|
| 524 | |
|---|
| 525 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 526 | Time: Sun Sep 16 02:52:54 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 527 | From: Alex Dehnert <adehnert> |
|---|
| 528 | |
|---|
| 529 | Ah, that does look better. |
|---|
| 530 | |
|---|
| 531 | |
|---|
| 532 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 533 | Time: Sun Sep 16 02:53:37 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 534 | From: Zoobar Foundation for Patriotic Advocacy: Supporting the meritorious soldiers of the counterinsurgency <geofft> |
|---|
| 535 | |
|---|
| 536 | You could use the threading module, but my understanding is that it's |
|---|
| 537 | more annoying. The multiprocessing module docs imply the GIL gets in |
|---|
| 538 | your way for _actual_ parallelism, which is irrelevant here |
|---|
| 539 | |
|---|
| 540 | |
|---|
| 541 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 542 | Time: Sun Sep 16 02:54:00 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 543 | From: Alex Dehnert <adehnert> |
|---|
| 544 | |
|---|
| 545 | I vaguely wonder if I want an mit.afs... |
|---|
| 546 | |
|---|
| 547 | |
|---|
| 548 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 549 | Time: Sun Sep 16 02:54:03 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 550 | From: Zoobar Foundation for Patriotic Policy: Supporting the skillful advocates of the United States <geofft> |
|---|
| 551 | |
|---|
| 552 | Oh hrm, given that threads share FDs... |
|---|
| 553 | |
|---|
| 554 | |
|---|
| 555 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 556 | Time: Sun Sep 16 02:54:31 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 557 | From: Alex Dehnert <adehnert> |
|---|
| 558 | |
|---|
| 559 | This thing is going to be full of awesome quasi-hacks, isn't it... |
|---|
| 560 | |
|---|
| 561 | |
|---|
| 562 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 563 | Time: Sun Sep 16 03:01:31 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 564 | From: Zoobar Foundation for Ethical Advocacy: Supporting the brightest minds of the counterinsurgency <geofft> |
|---|
| 565 | |
|---|
| 566 | Yeah, this Just Works. |
|---|
| 567 | |
|---|
| 568 | >>> def pagopen(file): |
|---|
| 569 | ... setpag() |
|---|
| 570 | ... l.append(open(file)) |
|---|
| 571 | ... |
|---|
| 572 | >>> t = threading.Thread(target=pagopen, args=("/etc/mailname",)) |
|---|
| 573 | >>> t.start() |
|---|
| 574 | >>> t.join() |
|---|
| 575 | >>> l |
|---|
| 576 | [<open file '/etc/mailname', mode 'r' at 0x7f65fb692270>] |
|---|
| 577 | >>> l[0].read() |
|---|
| 578 | 'team-rocket.mit.edu\n' |
|---|
| 579 | >>> t = threading.Thread(target=pagopen, args=("/mit/geofft/.my.cnf",)) |
|---|
| 580 | >>> t.start() |
|---|
| 581 | >>> Exception in thread Thread-3: |
|---|
| 582 | Traceback (most recent call last): |
|---|
| 583 | File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner |
|---|
| 584 | self.run() |
|---|
| 585 | File "/usr/lib/python2.6/threading.py", line 484, in run |
|---|
| 586 | self.__target(*self.__args, **self.__kwargs) |
|---|
| 587 | File "<stdin>", line 3, in pagopen |
|---|
| 588 | IOError: [Errno 13] Permission denied: '/mit/geofft/.my.cnf' |
|---|
| 589 | |
|---|
| 590 | |
|---|
| 591 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 592 | Time: Sun Sep 16 03:02:43 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 593 | From: Zoobar Foundation for Inquisitive Learning: Supporting the meritorious thinkers of the 21st-century <geofft> |
|---|
| 594 | |
|---|
| 595 | Oh, there's an |
|---|
| 596 | >>> l = [] |
|---|
| 597 | at the top |
|---|
| 598 | |
|---|
| 599 | |
|---|
| 600 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 601 | Time: Sun Sep 16 03:04:08 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 602 | From: Zoobar Foundation for Responsible Policy: Supporting the shrewd students of the counterinsurgency <geofft> |
|---|
| 603 | |
|---|
| 604 | You may want to do something like |
|---|
| 605 | try: |
|---|
| 606 | l.append((True, open(file))) |
|---|
| 607 | except Exception as e: |
|---|
| 608 | l.append((False, e)) |
|---|
| 609 | |
|---|
| 610 | and then something like |
|---|
| 611 | if l[0][0]: |
|---|
| 612 | return l[0][1] |
|---|
| 613 | else: |
|---|
| 614 | raise l[0][1] |
|---|
| 615 | |
|---|
| 616 | |
|---|
| 617 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 618 | Time: Sun Sep 16 03:07:26 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 619 | From: Alex Dehnert <adehnert> |
|---|
| 620 | |
|---|
| 621 | Want to go put this into the DB code, either based on the |
|---|
| 622 | scripts-db2.0/pag branch or on origin/master? |
|---|
| 623 | |
|---|
| 624 | |
|---|
| 625 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 626 | Time: Sun Sep 16 03:09:29 2012 Host: TEAM-ROCKET.MIT.EDU |
|---|
| 627 | From: Zoobar Foundation for Ethical Dialogue: Supporting the foremost students of the United States <geofft> |
|---|
| 628 | |
|---|
| 629 | I mean, honestly, the pagsh solution seems fine to me, this was just |
|---|
| 630 | curiosity. :) |
|---|
| 631 | |
|---|
| 632 | |
|---|
| 633 | Class: [asa-internal] Instance: db Opcode: crypt |
|---|
| 634 | Time: Sun Sep 16 03:47:35 2012 Host: NOVGOROD.MIT.EDU |
|---|
| 635 | From: Alex Dehnert <adehnert> |
|---|
| 636 | |
|---|
| 637 | I'm conflicted. This solution is so cute/elegant... |
|---|