Debian Codegraph @

man/systemd-imds.xml

raw
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd-imds" conditional='ENABLE_IMDS'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-imds</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-imds</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-imds</refname>
21 <refname>systemd-imds-import.service</refname>
22 <refpurpose>Cloud IMDS (Instance Metadata Service) tool</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <para><filename>systemd-imds-import.service</filename></para>
27 <cmdsynopsis>
28 <command>systemd-imds</command> <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt">KEY</arg>
29 </cmdsynopsis>
30 </refsynopsisdiv>
31
32 <refsect1>
33 <title>Description</title>
34
35 <para><command>systemd-imds</command> is a tool for acquiring data from IMDS (Instance Metadata Service),
36 as provided in many cloud environments. It is a client to
37 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
38 and provides access to IMDS data from shell environments.</para>
39
40 <para>The tool can operate in one of five modes:</para>
41
42 <itemizedlist>
43 <listitem><para>Without positional arguments (and without the <option>--well-known=</option> switch)
44 general IMDS service data and a few well known fields are displayed in human friendly
45 form.</para></listitem>
46
47 <listitem><para>With a positional argument (and without <option>--well-known=</option>) the IMDS data
48 referenced by the specified key is acquired and written to standard output, in unprocessed form. IMDS
49 keys are the part of the IMDS acquisition URL that are suffixed to the base URL. IMDS keys must begin
50 with a slash (<literal>/</literal>). Note that IMDS keys are typically
51 implementation-specific.</para></listitem>
52
53 <listitem><para>With the <option>--well-known=</option> option specified (see below), the indicated
54 well-known field is written to standard output, in unprocessed form. The concept of well-known fields
55 abstracts IMDS implementation differences to some level, exposing a unified interface for IMDS fields
56 that typically exist on many different implementations, but under implementation-specific
57 keys.</para></listitem>
58
59 <listitem><para>With the <option>--userdata</option> option specified (see below) the "userdata"
60 provided via IMDS is written to standard output. Under the hood this is similar to
61 <option>--well-known=userdata-base</option>, <option>--well-known=userdata</option> or
62 <option>--well-known=userdata-base64</option>. Each of the three is tried in turn (in this order), and
63 the first available is returned. For <option>--well-known=userdata-base</option> the
64 <literal>systemd-userdata</literal> userdata item is requested. For
65 <option>--well-known=userdata-base64</option> the returned data is automatically
66 Base64-decoded.</para></listitem>
67
68 <listitem><para>With the <option>--import</option> option specified, various well known and userdata
69 fields are imported into the local credential store, where they are used to configure and parameterize
70 the system. For details see below.</para></listitem>
71 </itemizedlist>
72 </refsect1>
73
74 <refsect1>
75 <title>Options and Commands</title>
76
77 <variablelist>
78 <varlistentry>
79 <term><option>--well-known=</option></term>
80 <term><option>-K</option></term>
81
82 <listitem><para>Takes one of <literal>hostname</literal>, <literal>region</literal>,
83 <literal>zone</literal>, <literal>ipv4-public</literal>, <literal>ipv6-public</literal>,
84 <literal>ssh-key</literal>, <literal>userdata</literal>, <literal>userdata-base</literal>,
85 <literal>userdata-base64</literal>. Acquires a specific "well-known" field from IMDS. Many of these
86 fields are commonly supported by various IMDS implementations, but typically some fields are
87 not. Note that if <option>--well-known=userdata-base</option> is used an additional subkey should be
88 specified as positional argument, which encodes the specific userdata item to acquire.</para>
89
90 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
91 </varlistentry>
92
93 <varlistentry>
94 <term><option>--refresh=</option></term>
95
96 <listitem><para>Takes a time in seconds as argument, and indicates the required "freshness" of the
97 data, in case cached data is used.</para>
98
99 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
100 </varlistentry>
101
102 <varlistentry>
103 <term><option>--cache=</option></term>
104
105 <listitem><para>Takes a boolean. If set to false local caching of IMDS is disabled, and the data is
106 always acquired fresh from the IMDS endpoint.</para>
107
108 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
109 </varlistentry>
110
111 <varlistentry>
112 <term><option>--userdata</option></term>
113 <term><option>-u</option></term>
114
115 <listitem><para>Acquire this instance's IMDS user data, if available. See above for
116 details.</para>
117
118 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
119 </varlistentry>
120
121 <varlistentry>
122 <term><option>--import</option></term>
123
124 <listitem><para>Acquires IMDS data and writes relevant fields as credentials to
125 <filename>/run/credstore/</filename>. This currently covers:</para>
126
127 <itemizedlist>
128 <listitem><para>If the IMDS user data is a valid JSON object containing a field
129 <varname>systemd.credentials</varname> (with a JSON array as value) it is processed, importing
130 arbitrary credentials listed in the array. Each array item must have a <varname>name</varname>
131 field indicating the credential name. It may have one <varname>text</varname>,
132 <varname>data</varname> or <varname>encrypted</varname> field, containing the credential data. If
133 <varname>text</varname> is used the value shall be a literal string of the credential value. If
134 <varname>data</varname> is used the value may be arbitrary binary data encoded in a Base64
135 string. If <varname>encrypted</varname> is used the value shall be a Base64 encoded encrypted
136 credential. See
137 <citerefentry><refentrytitle>systemd.system-credentials</refentrytitle><manvolnum>7</manvolnum></citerefentry>
138 for information about credentials that may be imported this way.</para></listitem>
139
140 <listitem><para>If the well-known <varname>ssh-key</varname> field is available, its value will be
141 imported into the <varname>ssh.authorized_keys.root</varname> credential.</para></listitem>
142
143 <listitem><para>If the well-known <varname>hostname</varname> field is available, its value will be
144 imported into the <varname>firstboot.hostname</varname> credential.</para></listitem>
145 </itemizedlist>
146
147 <para>This command is invoked by the <filename>systemd-imds-import.service</filename> run at
148 boot.</para>
149
150 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
151 </varlistentry>
152
153 <xi:include href="standard-options.xml" xpointer="help" />
154 <xi:include href="standard-options.xml" xpointer="version" />
155 </variablelist>
156 </refsect1>
157
158 <refsect1>
159 <title>Exit status</title>
160
161 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
162 </refsect1>
163
164 <refsect1>
165 <title>See Also</title>
166 <para><simplelist type="inline">
167 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
168 <member><citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
169 <member><citerefentry><refentrytitle>systemd-imds-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
170 <member><citerefentry><refentrytitle>systemd.system-credentials</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
171 </simplelist></para>
172 </refsect1>
173
174 </refentry>