tpm2_changeauth.1 14 KB

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