-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmeta-data.8
224 lines (224 loc) · 5.2 KB
/
meta-data.8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
.\" $OpenBSD: mdoc.template,v 1.15 2014/03/31 00:09:54 dlg Exp $
.\"
.\" Copyright (c) 2017 Reyk Floeter <reyk@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate$
.Dt META-DATA 8
.Os
.Sh NAME
.Nm meta-data
.Nd meta-data server for OpenBSD's virtual machine daemon
.Sh SYNOPSIS
.Nm meta-data
.Op Fl 23
.Op Fl u Ar user
.Op Fl l Ar lease-file
.Op Ar bridge
.Sh DESCRIPTION
The
.Nm
FastCGI program provides a cloud-init datasource for
.Ox Ap s
.Xr vmd 8
that is compatible with Apache CloudStack
and partially compatible with Amazon EC2.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl 2
Run in layer
.Cm 2
mode.
.Nm
will find the guest VM by its MAC address in the DHCP
.Ar lease-file
and the
.Ar bridge
cache.
This is the default if layer
.Cm 3
mode is not specified.
The default bridge name is
.Dq bridge0 .
.It Fl 3
Run in layer
.Cm 3
mode.
.Nm
will find the guest VM by its IPv4 address in the ARP table.
The layer
.Cm 2
and
.Cm 3
modes can be combined.
.It Fl u Ar user
Change the
.Ar user
name.
The default is
.Dq _meta-data .
.It Fl l Ar lease-file
Change the
.Ar lease-file .
The default is
.Pa /var/db/dhcpd.leases .
.El
.Pp
Use the following steps to run
.Nm :
.Bl -enum
.It
Create the
.Pa meta-data
directory and add the
.Dq _meta-data
user:
.Bd -literal -offset indent
# mkdir -p /home/vm/meta-data
# groupadd -g 787 _meta-data
# useradd -g 787 -u 787 -k /var/empty -d /home/vm/meta-data \e
-s /sbin/nologin -c "meta-data user" _meta-data
.Ed
.It
Use the
.Xr kfcgi 8
FastCGI server to run
.Nm .
Start it as root, with chroot disabled, and
.Nm
will drop privileges by itself.
The
.Nm
socket has to be owned by the "www" user of the web server.
.Bd -literal -offset indent
# kfcgi -r -n 2 -u www -p / -- /usr/local/libexec/meta-data
.Ed
.It
Configure and start
.Xr httpd 8
to handle
.Nm
requests:
.Bd -literal -offset indent
server "meta-data" {
listen on 169.254.169.254 port 80
fastcgi socket "/run/httpd.sock"
root { "/", strip 1 }
}
.Ed
.El
.Sh ATTRIBUTES
.Nm
serves a number of attributes, so-called meta-data items and optional
user-data, that are specific to the requesting VM.
The following attributes are supported:
.Bl -tag -width Ds
.It Cm meta-data/availability-zone
This option is provided for compatibility.
It includes the name of the
.Ar bridge
interface.
.It Cm meta-data/instance-id
The VM identifier in the format
.Ic vm Ns Ar ID ,
e.g.\&
.Ar vm1 .
.It Cm meta-data/local-hostname
The hostname of the guest VM,
based on the VM name that was specified in
.Xr vm.conf 5
or by the
.Xr vmctl 8
.Ic start
command.
.It Cm meta-data/local-ipv4
The IPv4 address of the guest VM.
It is identical to the verified guest IP address of the HTTP request.
.It Cm meta-data/public-hostname
This option is provided for compatibility.
It includes the hostname of the
.Xr vmd 8
host where
.Nm
is running.
.It Cm meta-data/public-ipv4
This option is provided for compatibility.
It currently includes the fixed string
.Qq 127.0.0.1 .
.It Cm meta-data/public-keys/0/openssh-key
The SSH public key that is included in the
.Pa openssh-key
file in the VM's configuration directory.
See the
.Sx FILES
section below.
.Nm
returns an
.Dq HTTP 404 Not Found
error if the file does not exist.
.It Cm meta-data/service-offering
This option is provided for compatibility.
It includes the fixed string
.Qq OpenBSD .
.It Cm meta-data/username
Returns the contents of the
.Pa username
file in the VM's configuration directory,
or
.Dq root
if it does not exist.
This item is not available in other meta-data implementations.
.It Cm user-data
Returns the contents of the
.Pa user-data
file in the VM's configuration directory,
or an
.Dq HTTP 404 Not Found
if it does not exist.
The user-data file typically includes a configuration file or shell
script of a type that is indicated by the
.Dq shebang
in the first line, for example
.Qq #!/bin/sh
or
.Qq #cloud-config .
.El
.Sh FILES
.Bl -tag -width "/home/vm/meta-data/openbsd.vmX" -compact
.It Pa /home/vm/meta-data/openbsd.vm
Directory containing meta-data for the virtual machine
.Dq openbsd.vm .
.It Pa openssh-key
The SSH public key in the VM's meta-data directory.
.It Pa user-data
"user-data" file in the VM's meta-data directory.
.It Pa username
The login username (this is an extension).
.El
.\" .Sh EXAMPLES
.Sh SEE ALSO
.Xr kcgi 8 ,
.Xr kfcgi 8 ,
.Xr vmd 8
.\" .Sh STANDARDS
.Rs
.%U http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/virtual_machines.html#user-data-and-meta-data
.%T User-Data and Meta-Data
.Re
.\" .Sh HISTORY
.Sh AUTHORS
.An Reyk Floeter Aq Mt reyk@openbsd.org
.\" .Sh CAVEATS
.\" .Sh BUGS