tpm2_startauthsession.1 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_startauthsession" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_startauthsession\f[](1) \- Start a session with the TPM.
  8. .SH SYNOPSIS
  9. .PP
  10. \f[B]tpm2_startauthsession\f[] [\f[I]OPTIONS\f[]]
  11. .SH DESCRIPTION
  12. .PP
  13. \f[B]tpm2_startauthsession\f[](1) \- Starts a session with the TPM.
  14. The default is to start a \f[I]trial\f[] session unless the \f[B]\-a\f[]
  15. option is specified.
  16. Saves the policy session data to a file.
  17. This file can then be used in subsequent tools that can use a policy
  18. file for authorization or policy events.
  19. .PP
  20. This will not work with resource managers (RMs) outside of
  21. tpm2\-abrmd (https://%20github.com/tpm2-software/tpm2-abrmd), as most
  22. RMs will flush session handles when a client disconnects from the IPC
  23. channel.
  24. .PP
  25. This will work with direct TPM access, but note that internally this
  26. calls a \f[I]ContextSave\f[] and a \f[I]ContextLoad\f[] on the session
  27. handle, thus the session \f[B]cannot\f[] be saved/loaded again.
  28. .SH OPTIONS
  29. .IP \[bu] 2
  30. \f[B]\-\-policy\-session\f[]:
  31. .RS 2
  32. .PP
  33. Start a policy session of type \f[B]TPM_SE_POLICY\f[].
  34. Default without this option is \f[B]TPM_SE_TRIAL\f[].
  35. .PP
  36. \f[B]NOTE\f[]: A \f[I]trial\f[] session is used when building a policy
  37. and a \f[I]policy\f[] session is used when authenticating with a policy.
  38. .RE
  39. .IP \[bu] 2
  40. \f[B]\-\-audit\-session\f[]:
  41. .RS 2
  42. .PP
  43. Start an HMAC session to be used as an audit session.
  44. Default without this option is \f[B]TPM2_SE_TRIAL\f[].
  45. .RE
  46. .IP \[bu] 2
  47. \f[B]\-\-hmac\-session\f[]:
  48. .RS 2
  49. .PP
  50. Start an HMAC session of type \f[B]TPM_SE_HMAC\f[].
  51. Default without this option is \f[B]TPM2_SE_TRIAL\f[].
  52. .RE
  53. .IP \[bu] 2
  54. \f[B]\-g\f[], \f[B]\-\-hash\-algorithm\f[]=\f[I]ALGORITHM\f[]:
  55. .RS 2
  56. .PP
  57. The hash algorithm used in computation of the policy digest.
  58. .RE
  59. .IP \[bu] 2
  60. \f[B]\-c\f[], \f[B]\-\-key\-context\f[]=\f[I]OBJECT\f[]:
  61. .RS 2
  62. .PP
  63. Set the tpmkey and bind objects to be the same.
  64. Session parameter encryption is turned on.
  65. Session parameter decryption is turned on.
  66. Parameter encryption/decryption symmetric\-key set to AES\-CFB.
  67. .RE
  68. .IP \[bu] 2
  69. \f[B]\-S\f[], \f[B]\-\-session\f[]=\f[I]FILE\f[]:
  70. .RS 2
  71. .PP
  72. The name of the policy session file, required.
  73. .RE
  74. .IP \[bu] 2
  75. \f[B]\-\-bind\-context\f[]=\f[I]FILE\f[]:
  76. .RS 2
  77. .PP
  78. Set the bind object.
  79. Session parameter encryption is off.
  80. Use \f[B]tpm2_sessionconfig\f[] to turn on.
  81. Session parameter decryption is off.
  82. Use \f[B]tpm2_sessionconfig\f[] to turn on.
  83. Parameter encryption/decryption symmetric\-key set to AES\-CFB.
  84. .RE
  85. .IP \[bu] 2
  86. \f[B]\-\-bind\-auth\f[]=\f[I]AUTH\f[]:
  87. .RS 2
  88. .PP
  89. Set the authorization value for the bind object.
  90. .RE
  91. .IP \[bu] 2
  92. \f[B]\-\-tpmkey\-context\f[]=\f[I]FILE\f[]:
  93. .RS 2
  94. .PP
  95. Set the tpmkey object.
  96. Session parameter encryption is off.
  97. Use \f[B]tpm2_sessionconfig\f[] to turn on.
  98. Session parameter decryption is off.
  99. Use \f[B]tpm2_sessionconfig\f[] to turn on.
  100. Parameter encryption/decryption symmetric\-key set to AES\-CFB.
  101. .RE
  102. .SS References
  103. .SH Context Object Format
  104. .PP
  105. The type of a context object, whether it is a handle or file name, is
  106. determined according to the following logic \f[I]in\-order\f[]:
  107. .IP \[bu] 2
  108. If the argument is a file path, then the file is loaded as a restored
  109. TPM transient object.
  110. .IP \[bu] 2
  111. If the argument is a \f[I]prefix\f[] match on one of:
  112. .RS 2
  113. .IP \[bu] 2
  114. owner: the owner hierarchy
  115. .IP \[bu] 2
  116. platform: the platform hierarchy
  117. .IP \[bu] 2
  118. endorsement: the endorsement hierarchy
  119. .IP \[bu] 2
  120. lockout: the lockout control persistent object
  121. .RE
  122. .IP \[bu] 2
  123. If the argument argument can be loaded as a number it will be treat as a
  124. handle, e.g.
  125. 0x81010013 and used directly.\f[I]OBJECT\f[].
  126. .SH Authorization Formatting
  127. .PP
  128. Authorization for use of an object in TPM2.0 can come in 3 different
  129. forms: 1.
  130. Password 2.
  131. HMAC 3.
  132. Sessions
  133. .PP
  134. \f[B]NOTE:\f[] "Authorizations default to the \f[B]EMPTY PASSWORD\f[]
  135. when not specified".
  136. .SS Passwords
  137. .PP
  138. Passwords are interpreted in the following forms below using prefix
  139. identifiers.
  140. .PP
  141. \f[B]Note\f[]: By default passwords are assumed to be in the string form
  142. when they do not have a prefix.
  143. .SS String
  144. .PP
  145. A string password, specified by prefix "str:" or it\[aq]s absence (raw
  146. string without prefix) is not interpreted, and is directly used for
  147. authorization.
  148. .SS Examples
  149. .IP
  150. .nf
  151. \f[C]
  152. foobar
  153. str:foobar
  154. \f[]
  155. .fi
  156. .SS Hex\-string
  157. .PP
  158. A hex\-string password, specified by prefix "hex:" is converted from a
  159. hexidecimal form into a byte array form, thus allowing passwords with
  160. non\-printable and/or terminal un\-friendly characters.
  161. .SS Example
  162. .IP
  163. .nf
  164. \f[C]
  165. hex:0x1122334455667788
  166. \f[]
  167. .fi
  168. .SS File
  169. .PP
  170. A file based password, specified be prefix "file:" should be the path of
  171. a file containing the password to be read by the tool or a "\-" to use
  172. stdin.
  173. Storing passwords in files prevents information leakage, passwords
  174. passed as options can be read from the process list or common shell
  175. history features.
  176. .SS Examples
  177. .IP
  178. .nf
  179. \f[C]
  180. #\ to\ use\ stdin\ and\ be\ prompted
  181. file:\-
  182. #\ to\ use\ a\ file\ from\ a\ path
  183. file:path/to/password/file
  184. #\ to\ echo\ a\ password\ via\ stdin:
  185. echo\ foobar\ |\ tpm2_tool\ \-p\ file:\-
  186. #\ to\ use\ a\ bash\ here\-string\ via\ stdin:
  187. tpm2_tool\ \-p\ file:\-\ <<<\ foobar
  188. \f[]
  189. .fi
  190. .SS Sessions
  191. .PP
  192. When using a policy session to authorize the use of an object, prefix
  193. the option argument with the \f[I]session\f[] keyword.
  194. Then indicate a path to a session file that was created with
  195. tpm2_startauthsession(1).
  196. Optionally, if the session requires an auth value to be sent with the
  197. session handle (eg policy password), then append a + and a string as
  198. described in the \f[B]Passwords\f[] section.
  199. .SS Examples
  200. .PP
  201. To use a session context file called \f[I]session.ctx\f[].
  202. .IP
  203. .nf
  204. \f[C]
  205. session:session.ctx
  206. \f[]
  207. .fi
  208. .PP
  209. To use a session context file called \f[I]session.ctx\f[] \f[B]AND\f[]
  210. send the authvalue mypassword.
  211. .IP
  212. .nf
  213. \f[C]
  214. session:session.ctx+mypassword
  215. \f[]
  216. .fi
  217. .PP
  218. To use a session context file called \f[I]session.ctx\f[] \f[B]AND\f[]
  219. send the \f[I]HEX\f[] authvalue 0x11223344.
  220. .IP
  221. .nf
  222. \f[C]
  223. session:session.ctx+hex:11223344
  224. \f[]
  225. .fi
  226. .SS PCR Authorizations
  227. .PP
  228. You can satisfy a PCR policy using the "pcr:" prefix and the PCR
  229. minilanguage.
  230. The PCR minilanguage is as follows:
  231. \f[C]<pcr\-spec>=<raw\-pcr\-file>\f[]
  232. .PP
  233. The PCR spec is documented in in the section "PCR bank specifiers".
  234. .PP
  235. The \f[C]raw\-pcr\-file\f[] is an \f[B]optional\f[] the output of the
  236. raw PCR contents as returned by \f[I]tpm2_pcrread(1)\f[].
  237. .PP
  238. PCR bank specifiers (common/pcr.md)
  239. .SS Examples
  240. .PP
  241. To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3 use a specifier
  242. of:
  243. .IP
  244. .nf
  245. \f[C]
  246. pcr:sha256:0,1,2,3
  247. \f[]
  248. .fi
  249. .PP
  250. specifying \f[I]AUTH\f[].
  251. .SH COMMON OPTIONS
  252. .PP
  253. This collection of options are common to many programs and provide
  254. information that many users may expect.
  255. .IP \[bu] 2
  256. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  257. manpage.
  258. By default, it attempts to invoke the manpager for the tool, however, on
  259. failure will output a short tool summary.
  260. This is the same behavior if the "man" option argument is specified,
  261. however if explicit "man" is requested, the tool will provide errors
  262. from man on stderr.
  263. If the "no\-man" option if specified, or the manpager fails, the short
  264. options will be output to stdout.
  265. .RS 2
  266. .PP
  267. To successfully use the manpages feature requires the manpages to be
  268. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  269. .RE
  270. .IP \[bu] 2
  271. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  272. tool, supported tctis and exit.
  273. .IP \[bu] 2
  274. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  275. tool prints to the console during its execution.
  276. When using this option the file and line number are printed.
  277. .IP \[bu] 2
  278. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  279. .IP \[bu] 2
  280. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  281. errata fixups.
  282. Useful if an errata fixup needs to be applied to commands sent to the
  283. TPM.
  284. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  285. information many users may expect.
  286. .SH TCTI Configuration
  287. .PP
  288. The TCTI or "Transmission Interface" is the communication mechanism with
  289. the TPM.
  290. TCTIs can be changed for communication with TPMs across different
  291. mediums.
  292. .PP
  293. To control the TCTI, the tools respect:
  294. .IP "1." 3
  295. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  296. .IP "2." 3
  297. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  298. .PP
  299. \f[B]Note:\f[] The command line option always overrides the environment
  300. variable.
  301. .PP
  302. The current known TCTIs are:
  303. .IP \[bu] 2
  304. tabrmd \- The resource manager, called
  305. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  306. Note that tabrmd and abrmd as a tcti name are synonymous.
  307. .IP \[bu] 2
  308. mssim \- Typically used for communicating to the TPM software simulator.
  309. .IP \[bu] 2
  310. device \- Used when talking directly to a TPM device file.
  311. .IP \[bu] 2
  312. none \- Do not initalize a connection with the TPM.
  313. Some tools allow for off\-tpm options and thus support not using a TCTI.
  314. Tools that do not support it will error when attempted to be used
  315. without a TCTI connection.
  316. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  317. the exact text of "none".
  318. .PP
  319. The arguments to either the command line option or the environment
  320. variable are in the form:
  321. .PP
  322. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  323. .PP
  324. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  325. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  326. that portion respectively.
  327. .SS TCTI Defaults
  328. .PP
  329. When a TCTI is not specified, the default TCTI is searched for using
  330. \f[I]dlopen(3)\f[] semantics.
  331. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  332. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  333. FOUND\f[].
  334. You can query what TCTI will be chosen as the default by using the
  335. \f[B]\-v\f[] option to print the version information.
  336. The "default\-tcti" key\-value pair will indicate which of the
  337. aforementioned TCTIs is the default.
  338. .SS Custom TCTIs
  339. .PP
  340. Any TCTI that implements the dynamic TCTI interface can be loaded.
  341. The tools internally use \f[I]dlopen(3)\f[], and the raw
  342. \f[I]tcti\-name\f[] value is used for the lookup.
  343. Thus, this could be a path to the shared library, or a library name as
  344. understood by \f[I]dlopen(3)\f[] semantics.
  345. .SH TCTI OPTIONS
  346. .PP
  347. This collection of options are used to configure the various known TCTI
  348. modules available:
  349. .IP \[bu] 2
  350. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  351. use by the device TCTI can be specified.
  352. The default is \f[I]/dev/tpm0\f[].
  353. .RS 2
  354. .PP
  355. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  356. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  357. .RE
  358. .IP \[bu] 2
  359. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  360. port number used by the simulator can be specified.
  361. The default are 127.0.0.1 and 2321.
  362. .RS 2
  363. .PP
  364. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  365. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  366. .RE
  367. .IP \[bu] 2
  368. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  369. series of simple key value pairs separated by a \[aq],\[aq] character.
  370. Each key and value string are separated by a \[aq]=\[aq] character.
  371. .RS 2
  372. .IP \[bu] 2
  373. TCTI abrmd supports two keys:
  374. .RS 2
  375. .IP "1." 3
  376. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  377. string).
  378. .IP "2." 3
  379. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  380. \[aq]session\[aq] and \[aq]system\[aq].
  381. .RE
  382. .PP
  383. Specify the tabrmd tcti name and a config string of
  384. \f[C]bus_name=com.example.FooBar\f[]:
  385. .PP
  386. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  387. .PP
  388. Specify the default (abrmd) tcti and a config string of
  389. \f[C]bus_type=session\f[]:
  390. .PP
  391. \f[C]\\\-\-tcti:bus_type=session\f[]
  392. .PP
  393. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  394. the various known TCTI modules.
  395. # EXAMPLES
  396. .RE
  397. .SS Start a \f[I]trial\f[] session and save the session data to a file
  398. .IP
  399. .nf
  400. \f[C]
  401. tpm2_startauthsession\ \-S\ mysession.ctx
  402. \f[]
  403. .fi
  404. .SS Start a \f[I]policy\f[] session and save the session data to a file
  405. .IP
  406. .nf
  407. \f[C]
  408. tpm2_startauthsession\ \-\-policy\-session\ \-S\ mysession.ctx
  409. \f[]
  410. .fi
  411. .SS Start an encrypted and bound \f[I]policy\f[] session and save the
  412. session data to a file
  413. .IP
  414. .nf
  415. \f[C]
  416. tpm2_createprimary\ \-c\ primary.ctx
  417. tpm2_startauthsession\ \-\-policy\-session\ \-c\ primary.ctx\ \-S\ mysession.ctx
  418. \f[]
  419. .fi
  420. .SH Returns
  421. .PP
  422. Tools can return any of the following codes:
  423. .IP \[bu] 2
  424. 0 \- Success.
  425. .IP \[bu] 2
  426. 1 \- General non\-specific error.
  427. .IP \[bu] 2
  428. 2 \- Options handling error.
  429. .IP \[bu] 2
  430. 3 \- Authentication error.
  431. .IP \[bu] 2
  432. 4 \- TCTI related error.
  433. .IP \[bu] 2
  434. 5 \- Non supported scheme.
  435. Applicable to tpm2_testparams.
  436. .SH BUGS
  437. .PP
  438. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  439. .SH HELP
  440. .PP
  441. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)