Debian Codegraph @

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

raw
1 '\" t
2 .TH "SYSTEMD\-CREDS" "1" "" "systemd 257.13" "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\-h\fR, \fB\-\-help\fR
186 .RS 4
187 Print a short help text and exit\&.
188 .RE
189 .PP
190 \fB\-\-version\fR
191 .RS 4
192 Print a short version string and exit\&.
193 .RE
194 .SH "OPTIONS"
195 .PP
196 \fB\-\-system\fR
197 .RS 4
198 When specified with the
199 \fBlist\fR
200 and
201 \fBcat\fR
202 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\&.
203 .sp
204 Added in version 250\&.
205 .RE
206 .PP
207 \fB\-\-user\fR
208 .RS 4
209 When specified with the
210 \fBencrypt\fR
211 and
212 \fBdecrypt\fR
213 commands encrypts a user\-scoped (rather than a system\-scoped) credential\&. Use
214 \fB\-\-uid=\fR
215 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\&.
216 .sp
217 Internally, this ensures that the selected user\*(Aqs numeric UID and username, as well as the system\*(Aqs
218 \fBmachine-id\fR(5)
219 are incorporated into the encryption key\&.
220 .sp
221 Added in version 256\&.
222 .RE
223 .PP
224 \fB\-\-uid=\fR
225 .RS 4
226 Specifies the user to encrypt the credential for\&. Takes a user name or numeric UID\&. If set, implies
227 \fB\-\-user\fR\&. If set to the special string
228 "self"
229 sets the user to the user of the calling process\&. If
230 \fB\-\-user\fR
231 is used without
232 \fB\-\-uid=\fR
233 then
234 \fB\-\-uid=self\fR
235 is implied, i\&.e\&. the credential is encrypted for the calling user\&.
236 .sp
237 Added in version 256\&.
238 .RE
239 .PP
240 \fB\-\-transcode=\fR
241 .RS 4
242 When specified with the
243 \fBcat\fR
244 or
245 \fBdecrypt\fR
246 commands, transcodes the output before showing it\&. Takes one of
247 "base64",
248 "unbase64",
249 "hex"
250 or
251 "unhex"
252 as argument, in order to encode/decode the credential data with Base64 or as series of hexadecimal values\&.
253 .sp
254 Note that this has no effect on the
255 \fBencrypt\fR
256 command, as encrypted credentials are unconditionally encoded in Base64\&.
257 .sp
258 Added in version 250\&.
259 .RE
260 .PP
261 \fB\-\-newline=\fR
262 .RS 4
263 When specified with
264 \fBcat\fR
265 or
266 \fBdecrypt\fR
267 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
268 "auto",
269 "yes"
270 or
271 "no"\&. The default mode of
272 "auto"
273 will suffix the output with a single newline character only when writing credential data to a TTY\&.
274 .sp
275 Added in version 250\&.
276 .RE
277 .PP
278 \fB\-\-pretty\fR, \fB\-p\fR
279 .RS 4
280 When specified with
281 \fBencrypt\fR
282 controls whether to show the encrypted credential as
283 \fISetCredentialEncrypted=\fR
284 setting that may be pasted directly into a unit file\&. Has effect only when used together with
285 \fB\-\-name=\fR
286 and
287 "\-"
288 as the output file\&.
289 .sp
290 Added in version 250\&.
291 .RE
292 .PP
293 \fB\-\-name=\fR\fB\fIname\fR\fR
294 .RS 4
295 When specified with the
296 \fBencrypt\fR
297 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\&.
298 .sp
299 When specified with the
300 \fBdecrypt\fR
301 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
302 \fB\-\-name=\fR
303 with an empty string was used when encrypted) the specified name has no effect as no credential name validation is done\&.
304 .sp
305 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\&.
306 .sp
307 Added in version 250\&.
308 .RE
309 .PP
310 \fB\-\-timestamp=\fR\fB\fItimestamp\fR\fR
311 .RS 4
312 When specified with the
313 \fBencrypt\fR
314 command controls the timestamp to embed into the encrypted credential\&. Defaults to the current time\&. Takes a timestamp specification in the format described in
315 \fBsystemd.time\fR(7)\&.
316 .sp
317 When specified with the
318 \fBdecrypt\fR
319 command controls the timestamp to use to validate the "not\-after" timestamp that was configured with
320 \fB\-\-not\-after=\fR
321 during encryption\&. If not specified, defaults to the current system time\&.
322 .sp
323 Added in version 250\&.
324 .RE
325 .PP
326 \fB\-\-not\-after=\fR\fB\fItimestamp\fR\fR
327 .RS 4
328 When specified with the
329 \fBencrypt\fR
330 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
331 \fBsystemd.time\fR(7)\&.
332 .sp
333 Added in version 250\&.
334 .RE
335 .PP
336 \fB\-\-with\-key=\fR, \fB\-H\fR, \fB\-T\fR
337 .RS 4
338 When specified with the
339 \fBencrypt\fR
340 command controls the encryption/signature key to use\&. Takes one of
341 "host",
342 "tpm2",
343 "host+tpm2",
344 "null",
345 "auto",
346 "auto\-initrd"\&. See above for details on the three key types\&. If set to
347 "auto"
348 (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
349 /var/lib/systemd/
350 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
351 "auto"
352 is selected but neither TPM2 is available (or running in container) nor
353 /var/lib/systemd/
354 is on persistent media, encryption will fail\&. If set to
355 "null"
356 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 set to
357 "auto\-initrd"
358 a TPM2 key is used if a TPM2 is found\&. If not a fixed zero length key is used, equivalent to
359 "null"
360 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\&.
361 .sp
362 The
363 \fB\-H\fR
364 switch is a shortcut for
365 \fB\-\-with\-key=host\fR\&. Similar,
366 \fB\-T\fR
367 is a shortcut for
368 \fB\-\-with\-key=tpm2\fR\&.
369 .sp
370 When encrypting credentials that shall be used in the initrd (where
371 /var/lib/systemd/
372 is typically not available) make sure to use
373 \fB\-\-with\-key=auto\-initrd\fR
374 mode, to disable binding against the host secret\&.
375 .sp
376 This switch has no effect on the
377 \fBdecrypt\fR
378 command, as information on which key to use for decryption is included in the encrypted credential already\&.
379 .sp
380 Added in version 250\&.
381 .RE
382 .PP
383 \fB\-\-tpm2\-device=\fR\fB\fIPATH\fR\fR
384 .RS 4
385 Controls the TPM2 device to use\&. Expects a device node path referring to the TPM2 chip (e\&.g\&.
386 /dev/tpmrm0)\&. Alternatively the special value
387 "auto"
388 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
389 "list"
390 may be used to enumerate all suitable TPM2 devices currently discovered\&.
391 .sp
392 Added in version 250\&.
393 .RE
394 .PP
395 \fB\-\-tpm2\-pcrs=\fR\fB\fIPCR\fR\fI[+PCR\&.\&.\&.]\fR\fR
396 .RS 4
397 Configures the TPM2 PCRs (Platform Configuration Registers) to bind the encryption key to\&. Takes a
398 "+"
399 separated list of numeric PCR indexes in the range 0\&...23\&. If not used, defaults to PCR 7 only\&. If an empty string is specified, binds the encryption key to no PCRs at all\&. For details about the PCRs available, see the documentation of the switch of the same name for
400 \fBsystemd-cryptenroll\fR(1)\&.
401 .sp
402 Added in version 250\&.
403 .RE
404 .PP
405 \fB\-\-tpm2\-public\-key=\fR\fB\fIPATH\fR\fR, \fB\-\-tpm2\-public\-key\-pcrs=\fR\fB\fIPCR\fR\fI[+PCR\&.\&.\&.]\fR\fR
406 .RS 4
407 Configures a TPM2 signed PCR policy to bind encryption to, for use with the
408 \fBencrypt\fR
409 command\&. The
410 \fB\-\-tpm2\-public\-key=\fR
411 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
412 tpm2\-pcr\-public\-key\&.pem
413 exists in one of the directories
414 /etc/systemd/,
415 /run/systemd/,
416 /usr/lib/systemd/
417 (searched in this order), it is automatically used\&. The
418 \fB\-\-tpm2\-public\-key\-pcrs=\fR
419 option takes a list of TPM2 PCR indexes to bind to (same syntax as
420 \fB\-\-tpm2\-pcrs=\fR
421 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)\&.
422 .sp
423 Note the difference between
424 \fB\-\-tpm2\-pcrs=\fR
425 and
426 \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\&.
427 .sp
428 Added in version 252\&.
429 .RE
430 .PP
431 \fB\-\-tpm2\-signature=\fR\fB\fIPATH\fR\fR
432 .RS 4
433 Takes a path to a TPM2 PCR signature file as generated by the
434 \fBsystemd-measure\fR(1)
435 tool and that may be used to allow the
436 \fBdecrypt\fR
437 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
438 tpm2\-pcr\-signature\&.json
439 is searched for in
440 /etc/systemd/,
441 /run/systemd/,
442 /usr/lib/systemd/
443 (in this order) and used\&.
444 .sp
445 Added in version 252\&.
446 .RE
447 .PP
448 \fB\-\-allow\-null\fR
449 .RS 4
450 Allow decrypting credentials that use an empty key\&.
451 .sp
452 Added in version 256\&.
453 .RE
454 .PP
455 \fB\-\-quiet\fR, \fB\-q\fR
456 .RS 4
457 Suppress additional output\&.
458 .sp
459 Added in version 251\&.
460 .RE
461 .PP
462 \fB\-\-no\-pager\fR
463 .RS 4
464 Do not pipe output into a pager\&.
465 .RE
466 .PP
467 \fB\-\-no\-legend\fR
468 .RS 4
469 Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
470 .RE
471 .PP
472 \fB\-\-json=\fR\fB\fIMODE\fR\fR
473 .RS 4
474 Shows output formatted as JSON\&. Expects one of
475 "short"
476 (for the shortest possible output without any redundant whitespace or line breaks),
477 "pretty"
478 (for a pretty version of the same, with indentation and line breaks) or
479 "off"
480 (to turn off JSON output, the default)\&.
481 .RE
482 .SH "EXIT STATUS"
483 .PP
484 On success, 0 is returned\&.
485 .SH "EXAMPLES"
486 .PP
487 \fBExample\ \&1.\ \&Encrypt a password for use as credential\fR
488 .PP
489 The following command line encrypts the specified password
490 "hunter2", writing the result to a file
491 password\&.cred\&.
492 .sp
493 .if n \{\
494 .RS 4
495 .\}
496 .nf
497 # echo \-n hunter2 | systemd\-creds encrypt \- password\&.cred
498 .fi
499 .if n \{\
500 .RE
501 .\}
502 .PP
503 This decrypts the file
504 password\&.cred
505 again, revealing the literal password:
506 .sp
507 .if n \{\
508 .RS 4
509 .\}
510 .nf
511 # systemd\-creds decrypt password\&.cred
512 hunter2
513 .fi
514 .if n \{\
515 .RE
516 .\}
517 .PP
518 \fBExample\ \&2.\ \&Encrypt a password and include it in a unit file\fR
519 .PP
520 The following command line prompts the user for a password and generates a
521 \fISetCredentialEncrypted=\fR
522 line from it for a credential named
523 "mysql\-password", suitable for inclusion in a unit file\&.
524 .sp
525 .if n \{\
526 .RS 4
527 .\}
528 .nf
529 # systemd\-ask\-password \-n | systemd\-creds encrypt \-\-name=mysql\-password \-p \- \-
530 🔐 Password: ****
531 SetCredentialEncrypted=mysql\-password: \e
532 k6iUCUh0RJCQyvL8k8q1UyAAAAABAAAADAAAABAAAAASfFsBoPLIm/dlDoGAAAAAAAAAA \e
533 NAAAAAgAAAAAH4AILIOZ3w6rTzYsBy9G7liaCAd4i+Kpvs8mAgArzwuKxd0ABDjgSeO5k \e
534 mKQc58zM94ZffyRmuNeX1lVHE+9e2YD87KfRFNoDLS7F3YmCb347gCiSk2an9egZ7Y0Xs \e
535 700Kr6heqQswQEemNEc62k9RJnEl2q7SbcEYguegnPQUATgAIAAsAAAASACA/B90W7E+6 \e
536 yAR9NgiIJvxr9bpElztwzB5lUJAxtMBHIgAQACCaSV9DradOZz4EvO/LSaRyRSq2Hj0ym \e
537 gVJk/dVzE8Uxj8H3RbsT7rIBH02CIgm/Gv1ukSXO3DMHmVQkDG0wEciyageTfrVEer8z5 \e
538 9cUQfM5ynSaV2UjeUWEHuz4fwDsXGLB9eELXLztzUU9nsAyLvs3ZRR+eEK/A==
539 .fi
540 .if n \{\
541 .RE
542 .\}
543 .PP
544 The generated line can be pasted 1:1 into a unit file, and will ensure the acquired password will be made available in the
545 \fI$CREDENTIALS_DIRECTORY\fR/mysql\-password
546 credential file for the started service\&.
547 .PP
548 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
549 xyz\&.service:
550 .sp
551 .if n \{\
552 .RS 4
553 .\}
554 .nf
555 # mkdir \-p /etc/systemd/system/xyz\&.service\&.d
556 # systemd\-ask\-password \-n | ( echo "[Service]" && systemd\-creds encrypt \-\-name=mysql\-password \-p \- \- ) >/etc/systemd/system/xyz\&.service\&.d/50\-password\&.conf
557 # systemctl daemon\-reload
558 # systemctl restart xyz\&.service
559 .fi
560 .if n \{\
561 .RE
562 .\}
563 .SH "SEE ALSO"
564 .PP
565 \fBsystemd\fR(1), \fBsystemd.exec\fR(5), \fBsystemd-measure\fR(1)
566 .SH "NOTES"
567 .IP " 1." 4
568 System and Service Credentials
569 .RS 4
570 \%https://systemd.io/CREDENTIALS
571 .RE