Debian Codegraph @

upstream/debian-unstable/man1/systemd-creds.1

raw
1 '\" t
2 .TH "SYSTEMD\-CREDS" "1" "" "systemd 261~rc3" "systemd-creds"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd-creds \- Lists, shows, encrypts and decrypts service credentials
24 .SH "SYNOPSIS"
25 .HP \w'\fBsystemd\-creds\fR\ 'u
26 \fBsystemd\-creds\fR [OPTIONS...] COMMAND [ARGS...]
27 .SH "DESCRIPTION"
28 .PP
29 \fBsystemd\-creds\fR
30 is a tool for listing, showing, encrypting and decrypting unit credentials\&. Credentials are limited\-size binary or textual objects that may be passed to unit processes\&. They are primarily used for passing cryptographic keys (both public and private) or certificates, user account information or identity information from the host to services\&.
31 .PP
32 Credentials are configured in unit files via the
33 \fIImportCredential=\fR,
34 \fILoadCredential=\fR,
35 \fISetCredential=\fR,
36 \fILoadCredentialEncrypted=\fR, and
37 \fISetCredentialEncrypted=\fR
38 settings, see
39 \fBsystemd.exec\fR(5)
40 for details\&.
41 .PP
42 For further information see
43 \m[blue]\fBSystem and Service Credentials\fR\m[]\&\s-2\u[1]\d\s+2
44 documentation\&.
45 .SH "COMMANDS"
46 .PP
47 The following commands are understood:
48 .PP
49 \fBlist\fR
50 .RS 4
51 Show a list of credentials passed into the current execution context\&. This command shows the files in the directory referenced by the
52 \fI$CREDENTIALS_DIRECTORY\fR
53 environment variable, and is intended to be executed from within service context\&.
54 .sp
55 Along with each credential name, the size and security state is shown\&. The latter is one of
56 "secure"
57 (in case the credential is backed by unswappable memory, i\&.e\&.
58 "ramfs"),
59 "weak"
60 (in case it is backed by any other type of memory), or
61 "insecure"
62 (if having any access mode that is not 0400, i\&.e\&. if readable by anyone but the owner)\&.
63 .sp
64 Added in version 250\&.
65 .RE
66 .PP
67 \fBcat\fR \fIcredential\&.\&.\&.\fR
68 .RS 4
69 Show contents of specified credentials passed into the current execution context\&. Takes one or more credential names, whose contents shall be written to standard output\&.
70 .sp
71 When combined with
72 \fB\-\-json=\fR
73 or
74 \fB\-\-transcode=\fR
75 the output is transcoded in simple ways before outputting\&.
76 .sp
77 Added in version 250\&.
78 .RE
79 .PP
80 \fBsetup\fR
81 .RS 4
82 Generates a host encryption key for credentials, if one has not been generated already\&. This ensures the
83 /var/lib/systemd/credential\&.secret
84 file is initialized with a random secret key if it does not exist yet\&. This secret key is used when encrypting/decrypting credentials with
85 \fBencrypt\fR
86 or
87 \fBdecrypt\fR, and is only accessible to the root user\&. Note that there\*(Aqs typically no need to invoke this command explicitly as it is implicitly called when
88 \fBencrypt\fR
89 is invoked, and credential host key encryption selected\&.
90 .sp
91 Added in version 250\&.
92 .RE
93 .PP
94 \fBencrypt\fR \fIinput|\-\fR \fIoutput|\-\fR
95 .RS 4
96 Loads the specified (unencrypted plaintext) input credential file, encrypts it and writes the (encrypted ciphertext) output to the specified target credential file\&. The resulting file may be referenced in the
97 \fILoadCredentialEncrypted=\fR
98 setting in unit files, or its contents used literally in
99 \fISetCredentialEncrypted=\fR
100 settings\&.
101 .sp
102 Takes two file system paths\&. The file name part of the output path is embedded as name in the encrypted credential, to ensure encrypted credentials cannot be renamed and reused for different purposes without this being noticed\&. The credential name to embed may be overridden with the
103 \fB\-\-name=\fR
104 setting\&. The input or output paths may be specified as
105 "\-", in which case the credential data is read from/written to standard input and standard output\&. If the output path is specified as
106 "\-"
107 the credential name cannot be derived from the file system path, and thus should be specified explicitly via the
108 \fB\-\-name=\fR
109 switch\&.
110 .sp
111 The credential data is encrypted and authenticated symmetrically with one of the following encryption keys:
112 .sp
113 .RS 4
114 .ie n \{\
115 \h'-04' 1.\h'+01'\c
116 .\}
117 .el \{\
118 .sp -1
119 .IP " 1." 4.2
120 .\}
121 A secret key automatically derived from the system\*(Aqs TPM2 chip\&. This encryption key is not stored on the host system and thus decryption is only possible with access to the original TPM2 chip\&. Or in other words, the credential secured in this way can only be decrypted again by the local machine\&.
122 .RE
123 .sp
124 .RS 4
125 .ie n \{\
126 \h'-04' 2.\h'+01'\c
127 .\}
128 .el \{\
129 .sp -1
130 .IP " 2." 4.2
131 .\}
132 A secret key stored in the
133 /var/lib/systemd/credential\&.secret
134 file which is only accessible to the root user\&. This "host" encryption key is stored on the host file system, and thus decryption is possible with access to the host file system and sufficient privileges\&. The key is automatically generated when needed, but can also be created explicitly with the
135 \fBsetup\fR
136 command, see above\&.
137 .RE
138 .sp
139 .RS 4
140 .ie n \{\
141 \h'-04' 3.\h'+01'\c
142 .\}
143 .el \{\
144 .sp -1
145 .IP " 3." 4.2
146 .\}
147 A combination of the above: an encryption key derived from both the TPM2 chip and the host file system\&. This means decryption requires both access to the original TPM2 chip and the OS installation\&. This is the default mode of operation if a TPM2 chip is available and
148 /var/lib/systemd/
149 resides on persistent media\&.
150 .RE
151 .sp
152 Which of the three keys shall be used for encryption may be configured with the
153 \fB\-\-with\-key=\fR
154 switch\&. Depending on the use\-case for the encrypted credential the key to use may differ\&. For example, for credentials that shall be accessible from the initrd, encryption with the host key is not appropriate, since access to the host key is typically not available from the initrd\&. Thus, for such credentials only the TPM2 key should be used\&.
155 .sp
156 Encrypted credentials are always encoded in Base64\&.
157 .sp
158 Use
159 \fBdecrypt\fR
160 (see below) to undo the encryption operation, and acquire the decrypted plaintext credential from the encrypted ciphertext credential\&.
161 .sp
162 The credential data is encrypted using AES256\-GCM, i\&.e\&. providing both confidentiality and integrity, keyed by a SHA256 hash of one or both of the secret keys described above\&.
163 .sp
164 Added in version 250\&.
165 .RE
166 .PP
167 \fBdecrypt\fR \fIinput|\-\fR [\fIoutput|\-\fR]
168 .RS 4
169 Undoes the effect of the
170 \fBencrypt\fR
171 operation: loads the specified (encrypted ciphertext) input credential file, decrypts and authenticates it and writes the (decrypted plaintext) output to the specified target credential file\&.
172 .sp
173 Takes one or two file system paths\&. The file name part of the input path is compared with the credential name embedded in the encrypted file\&. If it does not match decryption fails\&. This is done in order to ensure that encrypted credentials are not re\-purposed without this being detected\&. The credential name to compare with the embedded credential name may also be overridden with the
174 \fB\-\-name=\fR
175 switch\&. If the input path is specified as
176 "\-", the encrypted credential is read from standard input\&. If only one path is specified or the output path specified as
177 "\-", the decrypted credential is written to standard output\&. In this mode, the expected name embedded in the credential cannot be derived from the path and should be specified explicitly with
178 \fB\-\-name=\fR\&.
179 .sp
180 Decrypting credentials requires access to the original TPM2 chip and/or credentials host key, see above\&. Information about which keys are required is embedded in the encrypted credential data, and thus decryption is entirely automatic\&.
181 .sp
182 Added in version 250\&.
183 .RE
184 .PP
185 \fB\-\-no\-ask\-password\fR
186 .RS 4
187 Do not query the user for authentication for privileged operations\&.
188 .RE
189 .PP
190 \fB\-h\fR, \fB\-\-help\fR
191 .RS 4
192 Print a short help text and exit\&.
193 .RE
194 .PP
195 \fB\-\-version\fR
196 .RS 4
197 Print a short version string and exit\&.
198 .RE
199 .SH "OPTIONS"
200 .PP
201 \fB\-\-system\fR
202 .RS 4
203 When specified with the
204 \fBlist\fR
205 and
206 \fBcat\fR
207 commands operates on the credentials passed to system as a whole instead of on those passed to the current execution context\&. This is useful in container environments where credentials may be passed in from the container manager\&.
208 .sp
209 Added in version 250\&.
210 .RE
211 .PP
212 \fB\-\-user\fR
213 .RS 4
214 When specified with the
215 \fBencrypt\fR
216 and
217 \fBdecrypt\fR
218 commands encrypts a user\-scoped (rather than a system\-scoped) credential\&. Use
219 \fB\-\-uid=\fR
220 to select which user the credential is from\&. Such credentials may only be decrypted from the specified user\*(Aqs context, except if privileges can be acquired\&. Generally, when an encrypted credential shall be used in the per\-user service manager it should be encrypted with this option set, when it shall be used in the system service manager it should be encrypted without\&.
221 .sp
222 Internally, this ensures that the selected user\*(Aqs numeric UID and username, as well as the system\*(Aqs
223 \fBmachine-id\fR(5)
224 are incorporated into the encryption key\&.
225 .sp
226 Added in version 256\&.
227 .RE
228 .PP
229 \fB\-\-uid=\fR
230 .RS 4
231 Specifies the user to encrypt the credential for\&. Takes a user name or numeric UID\&. If set, implies
232 \fB\-\-user\fR\&. If set to the special string
233 "self"
234 sets the user to the user of the calling process\&. If
235 \fB\-\-user\fR
236 is used without
237 \fB\-\-uid=\fR
238 then
239 \fB\-\-uid=self\fR
240 is implied, i\&.e\&. the credential is encrypted for the calling user\&.
241 .sp
242 Added in version 256\&.
243 .RE
244 .PP
245 \fB\-\-transcode=\fR
246 .RS 4
247 When specified with the
248 \fBcat\fR
249 or
250 \fBdecrypt\fR
251 commands, transcodes the output before showing it\&. Takes one of
252 "base64",
253 "unbase64",
254 "hex"
255 or
256 "unhex"
257 as argument, in order to encode/decode the credential data with Base64 or as series of hexadecimal values\&. The special value
258 "help"
259 may be used to list supported transcode types\&.
260 .sp
261 Note that this has no effect on the
262 \fBencrypt\fR
263 command, as encrypted credentials are unconditionally encoded in Base64\&.
264 .sp
265 Added in version 250\&.
266 .RE
267 .PP
268 \fB\-\-newline=\fR
269 .RS 4
270 When specified with
271 \fBcat\fR
272 or
273 \fBdecrypt\fR
274 controls whether to add a trailing newline character to the end of the output if it does not end in one, anyway\&. Takes one of
275 "auto",
276 "yes"
277 or
278 "no"\&. The default mode of
279 "auto"
280 will suffix the output with a single newline character only when writing credential data to a TTY\&.
281 .sp
282 Added in version 250\&.
283 .RE
284 .PP
285 \fB\-\-pretty\fR, \fB\-p\fR
286 .RS 4
287 When specified with
288 \fBencrypt\fR
289 controls whether to show the encrypted credential as
290 \fISetCredentialEncrypted=\fR
291 setting that may be pasted directly into a unit file\&. Has effect only when used together with
292 \fB\-\-name=\fR
293 and
294 "\-"
295 as the output file\&.
296 .sp
297 Added in version 250\&.
298 .RE
299 .PP
300 \fB\-\-name=\fR\fB\fIname\fR\fR
301 .RS 4
302 When specified with the
303 \fBencrypt\fR
304 command controls the credential name to embed in the encrypted credential data\&. If not specified, the name is chosen automatically from the filename component of the specified output path\&. If specified as empty string no credential name is embedded in the encrypted credential, and no verification of credential name is done when the credential is decrypted\&.
305 .sp
306 When specified with the
307 \fBdecrypt\fR
308 command control the credential name to validate the credential name embedded in the encrypted credential with\&. If not specified, the name is chosen automatically from the filename component of the specified input path\&. If no credential name is embedded in the encrypted credential file (i\&.e\&. the
309 \fB\-\-name=\fR
310 with an empty string was used when encrypted) the specified name has no effect as no credential name validation is done\&.
311 .sp
312 Embedding the credential name in the encrypted credential is done in order to protect against reuse of credentials for purposes they were not originally intended for, under the assumption the credential name is chosen carefully to encode its intended purpose\&.
313 .sp
314 Added in version 250\&.
315 .RE
316 .PP
317 \fB\-\-timestamp=\fR\fB\fItimestamp\fR\fR
318 .RS 4
319 When specified with the
320 \fBencrypt\fR
321 command controls the timestamp to embed into the encrypted credential\&. Defaults to the current time\&. Takes a timestamp specification in the format described in
322 \fBsystemd.time\fR(7)\&.
323 .sp
324 When specified with the
325 \fBdecrypt\fR
326 command controls the timestamp to use to validate the "not\-after" timestamp that was configured with
327 \fB\-\-not\-after=\fR
328 during encryption\&. If not specified, defaults to the current system time\&.
329 .sp
330 Added in version 250\&.
331 .RE
332 .PP
333 \fB\-\-not\-after=\fR\fB\fItimestamp\fR\fR
334 .RS 4
335 When specified with the
336 \fBencrypt\fR
337 command controls the time when the credential shall not be used anymore\&. This embeds the specified timestamp in the encrypted credential\&. During decryption the timestamp is checked against the current system clock, and if the timestamp is in the past the decryption will fail\&. By default, no such timestamp is set\&. Takes a timestamp specification in the format described in
338 \fBsystemd.time\fR(7)\&.
339 .sp
340 Added in version 250\&.
341 .RE
342 .PP
343 \fB\-\-with\-key=\fR, \fB\-H\fR, \fB\-T\fR
344 .RS 4
345 When specified with the
346 \fBencrypt\fR
347 command controls the encryption/signature key to use\&. Takes one of
348 "host",
349 "tpm2",
350 "host+tpm2",
351 "null",
352 "auto",
353 "auto\-initrd"\&. See above for details on the key types\&. If set to
354 "auto"
355 (which is the default) the TPM2 key is used if a TPM2 device is found and not running in a container\&. The host key is used if
356 /var/lib/systemd/
357 is on persistent media\&. This means on typical systems the encryption is by default bound to both the TPM2 chip and the OS installation, and both need to be available to decrypt the credential again\&. If
358 "auto"
359 is selected but neither TPM2 is available (or running in container) nor
360 /var/lib/systemd/
361 is on persistent media, encryption will fail\&. If set to
362 "null"
363 a fixed zero length key is used (thus, in this mode no confidentiality nor authenticity are provided!)\&. This logic is useful to cover for systems that lack a TPM2 chip but where credentials shall be generated\&. Note that decryption of such credentials is refused on systems that have a TPM2 chip and where UEFI SecureBoot is enabled (this is done so that such a locked down system cannot be tricked into loading a credential generated this way that lacks authentication information\&. If either UEFI SecureBoot or a TPM2 are not available, then loading such credentials is allowed by default)\&. If set to
364 "auto\-initrd"
365 a TPM2 key is used if a TPM2 is found\&. If not, a fixed zero length key is used, equivalent to
366 "null"
367 mode\&. This option is particularly useful to generate credentials files that are encrypted/authenticated against TPM2 where available but still work on systems lacking support for this\&. The special value
368 "help"
369 may be used to list supported key types\&.
370 .sp
371 The
372 \fB\-H\fR
373 switch is a shortcut for
374 \fB\-\-with\-key=host\fR\&. Similar,
375 \fB\-T\fR
376 is a shortcut for
377 \fB\-\-with\-key=tpm2\fR\&.
378 .sp
379 When encrypting credentials that shall be used in the initrd (where
380 /var/lib/systemd/
381 is typically not available) make sure to use
382 \fB\-\-with\-key=auto\-initrd\fR
383 mode, to disable binding against the host secret\&.
384 .sp
385 This switch has no effect on the
386 \fBdecrypt\fR
387 command, as information on which key to use for decryption is included in the encrypted credential already\&.
388 .sp
389 Added in version 250\&.
390 .RE
391 .PP
392 \fB\-\-tpm2\-device=\fR\fB\fIPATH\fR\fR
393 .RS 4
394 Controls the TPM2 device to use\&. Expects a device node path referring to the TPM2 chip (e\&.g\&.
395 /dev/tpmrm0)\&. Alternatively the special value
396 "auto"
397 may be specified, in order to automatically determine the device node of a suitable TPM2 device (of which there must be exactly one)\&. The special value
398 "list"
399 may be used to enumerate all suitable TPM2 devices currently discovered\&.
400 .sp
401 Added in version 250\&.
402 .RE
403 .PP
404 \fB\-\-tpm2\-pcrs=\fR\fB\fIPCR\fR\fI[+PCR\&.\&.\&.]\fR\fR
405 .RS 4
406 Configures the TPM2 PCRs (Platform Configuration Registers) to bind the encryption key to\&. Takes a
407 "+"
408 separated list of numeric PCR indexes in the range 0\&...23\&. If an empty string is specified, binds the encryption key to no PCRs at all (this is also the default if this option is not used)\&. For details about the PCRs available, see the documentation of the switch of the same name for
409 \fBsystemd-cryptenroll\fR(1)\&.
410 .sp
411 Added in version 250\&.
412 .RE
413 .PP
414 \fB\-\-tpm2\-public\-key=\fR\fB\fIPATH\fR\fR, \fB\-\-tpm2\-public\-key\-pcrs=\fR\fB\fIPCR\fR\fI[+PCR\&.\&.\&.]\fR\fR
415 .RS 4
416 Configures a TPM2 signed PCR policy to bind encryption to, for use with the
417 \fBencrypt\fR
418 command\&. The
419 \fB\-\-tpm2\-public\-key=\fR
420 option accepts a path to a PEM encoded RSA public key, to bind the encryption to\&. If this is not specified explicitly, but a file
421 tpm2\-pcr\-public\-key\&.pem
422 exists in one of the directories
423 /etc/systemd/,
424 /run/systemd/,
425 /usr/lib/systemd/
426 (searched in this order), it is automatically used\&. The
427 \fB\-\-tpm2\-public\-key\-pcrs=\fR
428 option takes a list of TPM2 PCR indexes to bind to (same syntax as
429 \fB\-\-tpm2\-pcrs=\fR
430 described above)\&. If not specified, defaults to 11 (i\&.e\&. this binds the policy to any unified kernel image for which a PCR signature can be provided)\&.
431 .sp
432 Note the difference between
433 \fB\-\-tpm2\-pcrs=\fR
434 and
435 \fB\-\-tpm2\-public\-key\-pcrs=\fR: the former binds decryption to the current, specific PCR values; the latter binds decryption to any set of PCR values for which a signature by the specified public key can be provided\&. The latter is hence more useful in scenarios where software updates shall be possible without losing access to all previously encrypted secrets\&.
436 .sp
437 Added in version 252\&.
438 .RE
439 .PP
440 \fB\-\-tpm2\-signature=\fR\fB\fIPATH\fR\fR
441 .RS 4
442 Takes a path to a TPM2 PCR signature file as generated by the
443 \fBsystemd-measure\fR(1)
444 tool and that may be used to allow the
445 \fBdecrypt\fR
446 command to decrypt credentials that are bound to specific signed PCR values\&. If this is not specified explicitly, and a credential with a signed PCR policy is attempted to be decrypted, a suitable signature file
447 tpm2\-pcr\-signature\&.json
448 is searched for in
449 /etc/systemd/,
450 /run/systemd/,
451 /usr/lib/systemd/
452 (in this order) and used\&.
453 .sp
454 Added in version 252\&.
455 .RE
456 .PP
457 \fB\-\-allow\-null\fR
458 .RS 4
459 Allow decrypting credentials that use a null key\&. By default decryption of credentials encrypted/authenticated with a null key is only allowed if UEFI SecureBoot is off or if a TPM2 is not available\&.
460 .sp
461 Added in version 256\&.
462 .RE
463 .PP
464 \fB\-\-refuse\-null\fR
465 .RS 4
466 Refuse decrypting credentials that use a null key, regardless of the UEFI SecureBoot state or TPM2 availability (see above)\&.
467 .sp
468 Added in version 259\&.
469 .RE
470 .PP
471 \fB\-\-quiet\fR, \fB\-q\fR
472 .RS 4
473 Suppress additional output\&.
474 .sp
475 Added in version 251\&.
476 .RE
477 .PP
478 \fB\-\-no\-pager\fR
479 .RS 4
480 Do not pipe output into a pager\&.
481 .RE
482 .PP
483 \fB\-\-no\-legend\fR
484 .RS 4
485 Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
486 .RE
487 .PP
488 \fB\-\-json=\fR\fB\fIMODE\fR\fR
489 .RS 4
490 Shows output formatted as JSON\&. Expects one of
491 "short"
492 (for the shortest possible output without any redundant whitespace or line breaks),
493 "pretty"
494 (for a pretty version of the same, with indentation and line breaks) or
495 "off"
496 (to turn off JSON output, the default)\&.
497 .RE
498 .SH "EXIT STATUS"
499 .PP
500 On success, 0 is returned\&.
501 .SH "EXAMPLES"
502 .PP
503 \fBExample\ \&1.\ \&Encrypt a password for use as credential\fR
504 .PP
505 The following command line encrypts the specified password
506 "hunter2", writing the result to a file
507 password\&.cred\&.
508 .sp
509 .if n \{\
510 .RS 4
511 .\}
512 .nf
513 # echo \-n hunter2 | systemd\-creds encrypt \- password\&.cred
514 .fi
515 .if n \{\
516 .RE
517 .\}
518 .PP
519 This decrypts the file
520 password\&.cred
521 again, revealing the literal password:
522 .sp
523 .if n \{\
524 .RS 4
525 .\}
526 .nf
527 # systemd\-creds decrypt password\&.cred
528 hunter2
529 .fi
530 .if n \{\
531 .RE
532 .\}
533 .PP
534 \fBExample\ \&2.\ \&Encrypt a password and include it in a unit file\fR
535 .PP
536 The following command line prompts the user for a password and generates a
537 \fISetCredentialEncrypted=\fR
538 line from it for a credential named
539 "mysql\-password", suitable for inclusion in a unit file\&.
540 .sp
541 .if n \{\
542 .RS 4
543 .\}
544 .nf
545 # systemd\-ask\-password \-n | systemd\-creds encrypt \-\-name=mysql\-password \-p \- \-
546 🔐 Password: ****
547 SetCredentialEncrypted=mysql\-password: \e
548 k6iUCUh0RJCQyvL8k8q1UyAAAAABAAAADAAAABAAAAASfFsBoPLIm/dlDoGAAAAAAAAAA \e
549 NAAAAAgAAAAAH4AILIOZ3w6rTzYsBy9G7liaCAd4i+Kpvs8mAgArzwuKxd0ABDjgSeO5k \e
550 mKQc58zM94ZffyRmuNeX1lVHE+9e2YD87KfRFNoDLS7F3YmCb347gCiSk2an9egZ7Y0Xs \e
551 700Kr6heqQswQEemNEc62k9RJnEl2q7SbcEYguegnPQUATgAIAAsAAAASACA/B90W7E+6 \e
552 yAR9NgiIJvxr9bpElztwzB5lUJAxtMBHIgAQACCaSV9DradOZz4EvO/LSaRyRSq2Hj0ym \e
553 gVJk/dVzE8Uxj8H3RbsT7rIBH02CIgm/Gv1ukSXO3DMHmVQkDG0wEciyageTfrVEer8z5 \e
554 9cUQfM5ynSaV2UjeUWEHuz4fwDsXGLB9eELXLztzUU9nsAyLvs3ZRR+eEK/A==
555 .fi
556 .if n \{\
557 .RE
558 .\}
559 .PP
560 The generated line can be pasted 1:1 into a unit file, and will ensure the acquired password will be made available in the
561 \fI$CREDENTIALS_DIRECTORY\fR/mysql\-password
562 credential file for the started service\&.
563 .PP
564 Utilizing the unit file drop\-in logic this can be used to securely pass a password credential to a unit\&. A similar, more comprehensive set of commands to insert a password into a service
565 xyz\&.service:
566 .sp
567 .if n \{\
568 .RS 4
569 .\}
570 .nf
571 # mkdir \-p /etc/systemd/system/xyz\&.service\&.d
572 # systemd\-ask\-password \-n | ( echo "[Service]" && systemd\-creds encrypt \-\-name=mysql\-password \-p \- \- ) >/etc/systemd/system/xyz\&.service\&.d/50\-password\&.conf
573 # systemctl daemon\-reload
574 # systemctl restart xyz\&.service
575 .fi
576 .if n \{\
577 .RE
578 .\}
579 .SH "SEE ALSO"
580 .PP
581 \fBsystemd\fR(1), \fBsystemd.exec\fR(5), \fBsystemd-measure\fR(1)
582 .SH "NOTES"
583 .IP " 1." 4
584 System and Service Credentials
585 .RS 4
586 \%https://systemd.io/CREDENTIALS
587 .RE