kdb5_util.8 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH "KDB5_UTIL" "8" " " "1.20.1" "MIT Kerberos"
  4. .SH NAME
  5. kdb5_util \- Kerberos database maintenance utility
  6. .
  7. .nr rst2man-indent-level 0
  8. .
  9. .de1 rstReportMargin
  10. \\$1 \\n[an-margin]
  11. level \\n[rst2man-indent-level]
  12. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  13. -
  14. \\n[rst2man-indent0]
  15. \\n[rst2man-indent1]
  16. \\n[rst2man-indent2]
  17. ..
  18. .de1 INDENT
  19. .\" .rstReportMargin pre:
  20. . RS \\$1
  21. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  22. . nr rst2man-indent-level +1
  23. .\" .rstReportMargin post:
  24. ..
  25. .de UNINDENT
  26. . RE
  27. .\" indent \\n[an-margin]
  28. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .nr rst2man-indent-level -1
  30. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  31. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  32. ..
  33. .SH SYNOPSIS
  34. .sp
  35. \fBkdb5_util\fP
  36. [\fB\-r\fP \fIrealm\fP]
  37. [\fB\-d\fP \fIdbname\fP]
  38. [\fB\-k\fP \fImkeytype\fP]
  39. [\fB\-kv\fP \fImkeyVNO\fP]
  40. [\fB\-M\fP \fImkeyname\fP]
  41. [\fB\-m\fP]
  42. [\fB\-sf\fP \fIstashfilename\fP]
  43. [\fB\-P\fP \fIpassword\fP]
  44. [\fB\-x\fP \fIdb_args\fP]
  45. \fIcommand\fP [\fIcommand_options\fP]
  46. .SH DESCRIPTION
  47. .sp
  48. kdb5_util allows an administrator to perform maintenance procedures on
  49. the KDC database. Databases can be created, destroyed, and dumped to
  50. or loaded from ASCII files. kdb5_util can create a Kerberos master
  51. key stash file or perform live rollover of the master key.
  52. .sp
  53. When kdb5_util is run, it attempts to acquire the master key and open
  54. the database. However, execution continues regardless of whether or
  55. not kdb5_util successfully opens the database, because the database
  56. may not exist yet or the stash file may be corrupt.
  57. .sp
  58. Note that some KDC database modules may not support all kdb5_util
  59. commands.
  60. .SH COMMAND-LINE OPTIONS
  61. .INDENT 0.0
  62. .TP
  63. \fB\-r\fP \fIrealm\fP
  64. specifies the Kerberos realm of the database.
  65. .TP
  66. \fB\-d\fP \fIdbname\fP
  67. specifies the name under which the principal database is stored;
  68. by default the database is that listed in kdc.conf(5)\&. The
  69. password policy database and lock files are also derived from this
  70. value.
  71. .TP
  72. \fB\-k\fP \fImkeytype\fP
  73. specifies the key type of the master key in the database. The
  74. default is given by the \fBmaster_key_type\fP variable in
  75. kdc.conf(5)\&.
  76. .TP
  77. \fB\-kv\fP \fImkeyVNO\fP
  78. Specifies the version number of the master key in the database;
  79. the default is 1. Note that 0 is not allowed.
  80. .TP
  81. \fB\-M\fP \fImkeyname\fP
  82. principal name for the master key in the database. If not
  83. specified, the name is determined by the \fBmaster_key_name\fP
  84. variable in kdc.conf(5)\&.
  85. .TP
  86. \fB\-m\fP
  87. specifies that the master database password should be read from
  88. the keyboard rather than fetched from a file on disk.
  89. .TP
  90. \fB\-sf\fP \fIstash_file\fP
  91. specifies the stash filename of the master database password. If
  92. not specified, the filename is determined by the
  93. \fBkey_stash_file\fP variable in kdc.conf(5)\&.
  94. .TP
  95. \fB\-P\fP \fIpassword\fP
  96. specifies the master database password. Using this option may
  97. expose the password to other users on the system via the process
  98. list.
  99. .TP
  100. \fB\-x\fP \fIdb_args\fP
  101. specifies database\-specific options. See kadmin(1) for
  102. supported options.
  103. .UNINDENT
  104. .SH COMMANDS
  105. .SS create
  106. .INDENT 0.0
  107. .INDENT 3.5
  108. \fBcreate\fP [\fB\-s\fP]
  109. .UNINDENT
  110. .UNINDENT
  111. .sp
  112. Creates a new database. If the \fB\-s\fP option is specified, the stash
  113. file is also created. This command fails if the database already
  114. exists. If the command is successful, the database is opened just as
  115. if it had already existed when the program was first run.
  116. .SS destroy
  117. .INDENT 0.0
  118. .INDENT 3.5
  119. \fBdestroy\fP [\fB\-f\fP]
  120. .UNINDENT
  121. .UNINDENT
  122. .sp
  123. Destroys the database, first overwriting the disk sectors and then
  124. unlinking the files, after prompting the user for confirmation. With
  125. the \fB\-f\fP argument, does not prompt the user.
  126. .SS stash
  127. .INDENT 0.0
  128. .INDENT 3.5
  129. \fBstash\fP [\fB\-f\fP \fIkeyfile\fP]
  130. .UNINDENT
  131. .UNINDENT
  132. .sp
  133. Stores the master principal\(aqs keys in a stash file. The \fB\-f\fP
  134. argument can be used to override the \fIkeyfile\fP specified in
  135. kdc.conf(5)\&.
  136. .SS dump
  137. .INDENT 0.0
  138. .INDENT 3.5
  139. \fBdump\fP [\fB\-b7\fP|\fB\-r13\fP|\fB\-r18\fP]
  140. [\fB\-verbose\fP] [\fB\-mkey_convert\fP] [\fB\-new_mkey_file\fP
  141. \fImkey_file\fP] [\fB\-rev\fP] [\fB\-recurse\fP] [\fIfilename\fP
  142. [\fIprincipals\fP\&...]]
  143. .UNINDENT
  144. .UNINDENT
  145. .sp
  146. Dumps the current Kerberos and KADM5 database into an ASCII file. By
  147. default, the database is dumped in current format, "kdb5_util
  148. load_dump version 7". If filename is not specified, or is the string
  149. "\-", the dump is sent to standard output. Options:
  150. .INDENT 0.0
  151. .TP
  152. \fB\-b7\fP
  153. causes the dump to be in the Kerberos 5 Beta 7 format ("kdb5_util
  154. load_dump version 4"). This was the dump format produced on
  155. releases prior to 1.2.2.
  156. .TP
  157. \fB\-r13\fP
  158. causes the dump to be in the Kerberos 5 1.3 format ("kdb5_util
  159. load_dump version 5"). This was the dump format produced on
  160. releases prior to 1.8.
  161. .TP
  162. \fB\-r18\fP
  163. causes the dump to be in the Kerberos 5 1.8 format ("kdb5_util
  164. load_dump version 6"). This was the dump format produced on
  165. releases prior to 1.11.
  166. .TP
  167. \fB\-verbose\fP
  168. causes the name of each principal and policy to be printed as it
  169. is dumped.
  170. .TP
  171. \fB\-mkey_convert\fP
  172. prompts for a new master key. This new master key will be used to
  173. re\-encrypt principal key data in the dumpfile. The principal keys
  174. themselves will not be changed.
  175. .TP
  176. \fB\-new_mkey_file\fP \fImkey_file\fP
  177. the filename of a stash file. The master key in this stash file
  178. will be used to re\-encrypt the key data in the dumpfile. The key
  179. data in the database will not be changed.
  180. .TP
  181. \fB\-rev\fP
  182. dumps in reverse order. This may recover principals that do not
  183. dump normally, in cases where database corruption has occurred.
  184. .TP
  185. \fB\-recurse\fP
  186. causes the dump to walk the database recursively (btree only).
  187. This may recover principals that do not dump normally, in cases
  188. where database corruption has occurred. In cases of such
  189. corruption, this option will probably retrieve more principals
  190. than the \fB\-rev\fP option will.
  191. .sp
  192. Changed in version 1.15: Release 1.15 restored the functionality of the \fB\-recurse\fP
  193. option.
  194. .sp
  195. Changed in version 1.5: The \fB\-recurse\fP option ceased working until release 1.15,
  196. doing a normal dump instead of a recursive traversal.
  197. .UNINDENT
  198. .SS load
  199. .INDENT 0.0
  200. .INDENT 3.5
  201. \fBload\fP [\fB\-b7\fP|\fB\-r13\fP|\fB\-r18\fP] [\fB\-hash\fP]
  202. [\fB\-verbose\fP] [\fB\-update\fP] \fIfilename\fP
  203. .UNINDENT
  204. .UNINDENT
  205. .sp
  206. Loads a database dump from the named file into the named database. If
  207. no option is given to determine the format of the dump file, the
  208. format is detected automatically and handled as appropriate. Unless
  209. the \fB\-update\fP option is given, \fBload\fP creates a new database
  210. containing only the data in the dump file, overwriting the contents of
  211. any previously existing database. Note that when using the LDAP KDC
  212. database module, the \fB\-update\fP flag is required.
  213. .sp
  214. Options:
  215. .INDENT 0.0
  216. .TP
  217. \fB\-b7\fP
  218. requires the database to be in the Kerberos 5 Beta 7 format
  219. ("kdb5_util load_dump version 4"). This was the dump format
  220. produced on releases prior to 1.2.2.
  221. .TP
  222. \fB\-r13\fP
  223. requires the database to be in Kerberos 5 1.3 format ("kdb5_util
  224. load_dump version 5"). This was the dump format produced on
  225. releases prior to 1.8.
  226. .TP
  227. \fB\-r18\fP
  228. requires the database to be in Kerberos 5 1.8 format ("kdb5_util
  229. load_dump version 6"). This was the dump format produced on
  230. releases prior to 1.11.
  231. .TP
  232. \fB\-hash\fP
  233. stores the database in hash format, if using the DB2 database
  234. type. If this option is not specified, the database will be
  235. stored in btree format. This option is not recommended, as
  236. databases stored in hash format are known to corrupt data and lose
  237. principals.
  238. .TP
  239. \fB\-verbose\fP
  240. causes the name of each principal and policy to be printed as it
  241. is dumped.
  242. .TP
  243. \fB\-update\fP
  244. records from the dump file are added to or updated in the existing
  245. database. Otherwise, a new database is created containing only
  246. what is in the dump file and the old one destroyed upon successful
  247. completion.
  248. .UNINDENT
  249. .SS ark
  250. .INDENT 0.0
  251. .INDENT 3.5
  252. \fBark\fP [\fB\-e\fP \fIenc\fP:\fIsalt\fP,...] \fIprincipal\fP
  253. .UNINDENT
  254. .UNINDENT
  255. .sp
  256. Adds new random keys to \fIprincipal\fP at the next available key version
  257. number. Keys for the current highest key version number will be
  258. preserved. The \fB\-e\fP option specifies the list of encryption and
  259. salt types to be used for the new keys.
  260. .SS add_mkey
  261. .INDENT 0.0
  262. .INDENT 3.5
  263. \fBadd_mkey\fP [\fB\-e\fP \fIetype\fP] [\fB\-s\fP]
  264. .UNINDENT
  265. .UNINDENT
  266. .sp
  267. Adds a new master key to the master key principal, but does not mark
  268. it as active. Existing master keys will remain. The \fB\-e\fP option
  269. specifies the encryption type of the new master key; see
  270. Encryption_types in kdc.conf(5) for a list of possible
  271. values. The \fB\-s\fP option stashes the new master key in the stash
  272. file, which will be created if it doesn\(aqt already exist.
  273. .sp
  274. After a new master key is added, it should be propagated to replica
  275. servers via a manual or periodic invocation of kprop(8)\&. Then,
  276. the stash files on the replica servers should be updated with the
  277. kdb5_util \fBstash\fP command. Once those steps are complete, the key
  278. is ready to be marked active with the kdb5_util \fBuse_mkey\fP command.
  279. .SS use_mkey
  280. .INDENT 0.0
  281. .INDENT 3.5
  282. \fBuse_mkey\fP \fImkeyVNO\fP [\fItime\fP]
  283. .UNINDENT
  284. .UNINDENT
  285. .sp
  286. Sets the activation time of the master key specified by \fImkeyVNO\fP\&.
  287. Once a master key becomes active, it will be used to encrypt newly
  288. created principal keys. If no \fItime\fP argument is given, the current
  289. time is used, causing the specified master key version to become
  290. active immediately. The format for \fItime\fP is getdate string.
  291. .sp
  292. After a new master key becomes active, the kdb5_util
  293. \fBupdate_princ_encryption\fP command can be used to update all
  294. principal keys to be encrypted in the new master key.
  295. .SS list_mkeys
  296. .INDENT 0.0
  297. .INDENT 3.5
  298. \fBlist_mkeys\fP
  299. .UNINDENT
  300. .UNINDENT
  301. .sp
  302. List all master keys, from most recent to earliest, in the master key
  303. principal. The output will show the kvno, enctype, and salt type for
  304. each mkey, similar to the output of kadmin(1) \fBgetprinc\fP\&. A
  305. \fB*\fP following an mkey denotes the currently active master key.
  306. .SS purge_mkeys
  307. .INDENT 0.0
  308. .INDENT 3.5
  309. \fBpurge_mkeys\fP [\fB\-f\fP] [\fB\-n\fP] [\fB\-v\fP]
  310. .UNINDENT
  311. .UNINDENT
  312. .sp
  313. Delete master keys from the master key principal that are not used to
  314. protect any principals. This command can be used to remove old master
  315. keys all principal keys are protected by a newer master key.
  316. .INDENT 0.0
  317. .TP
  318. \fB\-f\fP
  319. does not prompt for confirmation.
  320. .TP
  321. \fB\-n\fP
  322. performs a dry run, showing master keys that would be purged, but
  323. not actually purging any keys.
  324. .TP
  325. \fB\-v\fP
  326. gives more verbose output.
  327. .UNINDENT
  328. .SS update_princ_encryption
  329. .INDENT 0.0
  330. .INDENT 3.5
  331. \fBupdate_princ_encryption\fP [\fB\-f\fP] [\fB\-n\fP] [\fB\-v\fP]
  332. [\fIprinc\-pattern\fP]
  333. .UNINDENT
  334. .UNINDENT
  335. .sp
  336. Update all principal records (or only those matching the
  337. \fIprinc\-pattern\fP glob pattern) to re\-encrypt the key data using the
  338. active database master key, if they are encrypted using a different
  339. version, and give a count at the end of the number of principals
  340. updated. If the \fB\-f\fP option is not given, ask for confirmation
  341. before starting to make changes. The \fB\-v\fP option causes each
  342. principal processed to be listed, with an indication as to whether it
  343. needed updating or not. The \fB\-n\fP option performs a dry run, only
  344. showing the actions which would have been taken.
  345. .SS tabdump
  346. .INDENT 0.0
  347. .INDENT 3.5
  348. \fBtabdump\fP [\fB\-H\fP] [\fB\-c\fP] [\fB\-e\fP] [\fB\-n\fP] [\fB\-o\fP \fIoutfile\fP]
  349. \fIdumptype\fP
  350. .UNINDENT
  351. .UNINDENT
  352. .sp
  353. Dump selected fields of the database in a tabular format suitable for
  354. reporting (e.g., using traditional Unix text processing tools) or
  355. importing into relational databases. The data format is tab\-separated
  356. (default), or optionally comma\-separated (CSV), with a fixed number of
  357. columns. The output begins with a header line containing field names,
  358. unless suppression is requested using the \fB\-H\fP option.
  359. .sp
  360. The \fIdumptype\fP parameter specifies the name of an output table (see
  361. below).
  362. .sp
  363. Options:
  364. .INDENT 0.0
  365. .TP
  366. \fB\-H\fP
  367. suppress writing the field names in a header line
  368. .TP
  369. \fB\-c\fP
  370. use comma separated values (CSV) format, with minimal quoting,
  371. instead of the default tab\-separated (unquoted, unescaped) format
  372. .TP
  373. \fB\-e\fP
  374. write empty hexadecimal string fields as empty fields instead of
  375. as "\-1".
  376. .TP
  377. \fB\-n\fP
  378. produce numeric output for fields that normally have symbolic
  379. output, such as enctypes and flag names. Also requests output of
  380. time stamps as decimal POSIX time_t values.
  381. .TP
  382. \fB\-o\fP \fIoutfile\fP
  383. write the dump to the specified output file instead of to standard
  384. output
  385. .UNINDENT
  386. .sp
  387. Dump types:
  388. .INDENT 0.0
  389. .TP
  390. \fBkeydata\fP
  391. principal encryption key information, including actual key data
  392. (which is still encrypted in the master key)
  393. .INDENT 7.0
  394. .TP
  395. \fBname\fP
  396. principal name
  397. .TP
  398. \fBkeyindex\fP
  399. index of this key in the principal\(aqs key list
  400. .TP
  401. \fBkvno\fP
  402. key version number
  403. .TP
  404. \fBenctype\fP
  405. encryption type
  406. .TP
  407. \fBkey\fP
  408. key data as a hexadecimal string
  409. .TP
  410. \fBsalttype\fP
  411. salt type
  412. .TP
  413. \fBsalt\fP
  414. salt data as a hexadecimal string
  415. .UNINDENT
  416. .TP
  417. \fBkeyinfo\fP
  418. principal encryption key information (as in \fBkeydata\fP above),
  419. excluding actual key data
  420. .TP
  421. \fBprinc_flags\fP
  422. principal boolean attributes. Flag names print as hexadecimal
  423. numbers if the \fB\-n\fP option is specified, and all flag positions
  424. are printed regardless of whether or not they are set. If \fB\-n\fP
  425. is not specified, print all known flag names for each principal,
  426. but only print hexadecimal flag names if the corresponding flag is
  427. set.
  428. .INDENT 7.0
  429. .TP
  430. \fBname\fP
  431. principal name
  432. .TP
  433. \fBflag\fP
  434. flag name
  435. .TP
  436. \fBvalue\fP
  437. boolean value (0 for clear, or 1 for set)
  438. .UNINDENT
  439. .TP
  440. \fBprinc_lockout\fP
  441. state information used for tracking repeated password failures
  442. .INDENT 7.0
  443. .TP
  444. \fBname\fP
  445. principal name
  446. .TP
  447. \fBlast_success\fP
  448. time stamp of most recent successful authentication
  449. .TP
  450. \fBlast_failed\fP
  451. time stamp of most recent failed authentication
  452. .TP
  453. \fBfail_count\fP
  454. count of failed attempts
  455. .UNINDENT
  456. .TP
  457. \fBprinc_meta\fP
  458. principal metadata
  459. .INDENT 7.0
  460. .TP
  461. \fBname\fP
  462. principal name
  463. .TP
  464. \fBmodby\fP
  465. name of last principal to modify this principal
  466. .TP
  467. \fBmodtime\fP
  468. timestamp of last modification
  469. .TP
  470. \fBlastpwd\fP
  471. timestamp of last password change
  472. .TP
  473. \fBpolicy\fP
  474. policy object name
  475. .TP
  476. \fBmkvno\fP
  477. key version number of the master key that encrypts this
  478. principal\(aqs key data
  479. .TP
  480. \fBhist_kvno\fP
  481. key version number of the history key that encrypts the key
  482. history data for this principal
  483. .UNINDENT
  484. .TP
  485. \fBprinc_stringattrs\fP
  486. string attributes (key/value pairs)
  487. .INDENT 7.0
  488. .TP
  489. \fBname\fP
  490. principal name
  491. .TP
  492. \fBkey\fP
  493. attribute name
  494. .TP
  495. \fBvalue\fP
  496. attribute value
  497. .UNINDENT
  498. .TP
  499. \fBprinc_tktpolicy\fP
  500. per\-principal ticket policy data, including maximum ticket
  501. lifetimes
  502. .INDENT 7.0
  503. .TP
  504. \fBname\fP
  505. principal name
  506. .TP
  507. \fBexpiration\fP
  508. principal expiration date
  509. .TP
  510. \fBpw_expiration\fP
  511. password expiration date
  512. .TP
  513. \fBmax_life\fP
  514. maximum ticket lifetime
  515. .TP
  516. \fBmax_renew_life\fP
  517. maximum renewable ticket lifetime
  518. .UNINDENT
  519. .UNINDENT
  520. .sp
  521. Examples:
  522. .INDENT 0.0
  523. .INDENT 3.5
  524. .sp
  525. .nf
  526. .ft C
  527. $ kdb5_util tabdump \-o keyinfo.txt keyinfo
  528. $ cat keyinfo.txt
  529. name keyindex kvno enctype salttype salt
  530. K/M@EXAMPLE.COM 0 1 aes256\-cts\-hmac\-sha384\-192 normal \-1
  531. foo@EXAMPLE.COM 0 1 aes128\-cts\-hmac\-sha1\-96 normal \-1
  532. bar@EXAMPLE.COM 0 1 aes128\-cts\-hmac\-sha1\-96 normal \-1
  533. $ sqlite3
  534. sqlite> .mode tabs
  535. sqlite> .import keyinfo.txt keyinfo
  536. sqlite> select * from keyinfo where enctype like \(aqaes256\-%\(aq;
  537. K/M@EXAMPLE.COM 1 1 aes256\-cts\-hmac\-sha384\-192 normal \-1
  538. sqlite> .quit
  539. $ awk \-F\(aq\et\(aq \(aq$4 ~ /aes256\-/ { print }\(aq keyinfo.txt
  540. K/M@EXAMPLE.COM 1 1 aes256\-cts\-hmac\-sha384\-192 normal \-1
  541. .ft P
  542. .fi
  543. .UNINDENT
  544. .UNINDENT
  545. .SH ENVIRONMENT
  546. .sp
  547. See kerberos(7) for a description of Kerberos environment
  548. variables.
  549. .SH SEE ALSO
  550. .sp
  551. kadmin(1), kerberos(7)
  552. .SH AUTHOR
  553. MIT
  554. .SH COPYRIGHT
  555. 1985-2022, MIT
  556. .\" Generated by docutils manpage writer.
  557. .