keyfs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. .TH KEYFS 4
  2. .SH NAME
  3. keyfs, warning \- authentication database files
  4. .SH SYNOPSIS
  5. .B auth/keyfs
  6. [
  7. .B -p
  8. ]
  9. [
  10. .B -w
  11. .RB [ np ]
  12. ]
  13. [
  14. .BI -m mntpt
  15. ]
  16. [
  17. .I keyfile
  18. ]
  19. .PP
  20. .B auth/warning
  21. [
  22. .B -n
  23. ]
  24. [
  25. .B -p
  26. ]
  27. .SH DESCRIPTION
  28. .I Keyfs
  29. serves a two-level file tree for manipulating authentication information.
  30. It runs on the machine providing authentication service for the local
  31. Plan 9 network, which may be a dedicated authentication server or
  32. a CPU server.
  33. The programs described in
  34. .IR auth (8)
  35. use
  36. .I keyfs
  37. as their interface to the authentication database.
  38. .PP
  39. .I Keyfs
  40. reads and decrypts file
  41. .I keyfile
  42. (default
  43. .BR /adm/keys )
  44. using the DES key,
  45. which is by default read from
  46. .B #r/nvram
  47. (see
  48. .IR rtc (3)).
  49. With option
  50. .BR -p ,
  51. .I keyfs
  52. prompts for a password from which the key is derived.
  53. .I Keyfile
  54. holds a 41-byte record for each user in the database.
  55. Each record is encrypted separately
  56. and contains the user's name,
  57. DES key,
  58. status,
  59. host status,
  60. and expiration date.
  61. The name is a
  62. null-terminated
  63. .SM UTF
  64. string
  65. .B NAMELEN
  66. bytes long.
  67. The status is a byte containing
  68. binary 0 if the account is enabled,
  69. 1 if it is disabled.
  70. Host status is a byte containing
  71. binary 1 if the user is a host,
  72. 0 otherwise.
  73. The expiration date is four-byte little-endian integer
  74. which represents the time in seconds since the epoch
  75. (see
  76. .IR date (1))
  77. at which the account will expire.
  78. If any changes are made to the database that affect the information stored in
  79. .IR keyfile ,
  80. a new version of the file is written.
  81. .PP
  82. There are two authentication databases,
  83. one for Plan 9 user information,
  84. and one for SecureNet user information.
  85. A user need not be installed in both databases
  86. but must be installed in the Plan 9 database to connect to a Plan 9 server.
  87. .PP
  88. .I Keyfs
  89. serves an interpretation of the
  90. .I keyfile
  91. in the file tree rooted at
  92. .I mntpt
  93. (default
  94. .BR /mnt/keys ).
  95. Each user
  96. .I user
  97. in
  98. .I keyfile
  99. is represented as the directory
  100. .IR mntpt / user .
  101. .PP
  102. Making a new directory in
  103. .I mntpt
  104. creates a new user entry in the database.
  105. Removing a directory removes the user entry,
  106. and renaming it changes the name in the entry.
  107. Such changes are reflected immediately in
  108. .IR keyfile .
  109. .I Keyfs
  110. does not allow duplicate names when creating or renaming user entries.
  111. .PP
  112. All files in the user directories except for
  113. .B key
  114. contain
  115. .SM UTF
  116. strings with a trailing newline when read,
  117. and should be written as
  118. .SM UTF
  119. strings with or without a trailing newline.
  120. .B Key
  121. contains the
  122. .BR DESKEYLEN -byte
  123. encryption key for the user.
  124. .PP
  125. The following files appear in the user directories.
  126. .TF expire
  127. .TP
  128. .B key
  129. The authentication key for the user.
  130. If the user's account is disabled or expired,
  131. reading this file returns an error.
  132. Writing
  133. .I key
  134. changes the key in the database.
  135. .TP
  136. .B log
  137. The number of consecutive failed authentication attempts for the user.
  138. Writing the string
  139. .B bad
  140. increments this number; writing
  141. .B good
  142. resets it to 0.
  143. If the number reaches fifty,
  144. .I keyfs
  145. disables the account.
  146. Once the account is disabled,
  147. the only way to enable it is to write the string
  148. .B ok
  149. to
  150. .BR status .
  151. This number is not stored in
  152. .IR keyfile ,
  153. and is initialized to 0 when
  154. .I keyfs
  155. starts.
  156. .TP
  157. .B status
  158. The current status of the account, either
  159. .B ok
  160. or
  161. .BR disabled .
  162. Writing
  163. .B ok
  164. enables the account;
  165. writing
  166. .B disabled
  167. disables it.
  168. .TP
  169. .B expire
  170. The expiration time for the account.
  171. When read, it contains either the string
  172. .B never
  173. or the time in seconds since the epoch
  174. that the account will expire.
  175. When written with strings of the same form,
  176. it sets the expiration date for the user.
  177. If the expiration date is reached,
  178. the account is not disabled,
  179. but
  180. .I key
  181. cannot be read without an error.
  182. .PD
  183. .PP
  184. If the
  185. .B -w
  186. option is on,
  187. .I keyfs
  188. runs the command
  189. .I warning
  190. once every 24 hours to mail people about expiring keys.
  191. Warnings are sent 14 days and 7 days prior to expiration.
  192. The argument to
  193. .BR -w ,
  194. either
  195. .B p
  196. or
  197. .BR n ,
  198. is passed to
  199. .I warning
  200. to restrict the warnings to
  201. the Plan 9 or SecureNet database.
  202. The default for
  203. .I keyfs
  204. is not to call
  205. .I warning
  206. at all;
  207. .I warning's
  208. own default is to warn about both.
  209. The files
  210. .B /adm/netkeys.who
  211. and
  212. .B /adm/keys.who
  213. are used to find the mail addresses to send to.
  214. The first word on each line identifies
  215. a user.
  216. Any subsequent strings on the line delimited '<' and '>' are considered mail
  217. addresses to send warnings to.
  218. If multiple lines match a user, the last in the file is used.
  219. .B Changeuser
  220. (see
  221. .IR auth (8))
  222. adds lines to these files.
  223. .SH FILES
  224. .TF /adm/netkeys.who
  225. .TP
  226. .B /adm/keys
  227. Encrypted key file for the Plan 9 database.
  228. .TP
  229. .B /adm/netkeys
  230. Encrypted key file for the SecureNet database.
  231. .TP
  232. .B /adm/keys.who
  233. List of users in the Plan 9 database.
  234. .TP
  235. .B /adm/netkeys.who
  236. List of users in the SecureNet database.
  237. .TP
  238. .B #r/nvram
  239. The non-volatile RAM on the server, which holds the key used
  240. to decrypt key files.
  241. .SH SOURCE
  242. .B /sys/src/cmd/auth/keyfs.c
  243. .br
  244. .B /sys/src/cmd/auth/warning.c
  245. .SH "SEE ALSO"
  246. .IR authsrv (6),
  247. .IR namespace (6),
  248. .IR auth (8)