@@ -36,50 +36,113 @@ netbootd exposes all "mounts" via both TFTP and HTTP simultatenously.
3636Naturally, it's not a good idea to transfer really large files over TFTP but PXE generally
3737requires use of TFTP in most cases.
3838
39- TFTP and HTTP content can either be static text (embedded in the manifest),
40- generated content (using Go's ` text/template ` templating engine) or proxied to upstream HTTP(S).
41- This last feature is mainly intended to proxy TFTP to HTTP(S) but very well may be used to
42- reverse-proxy HTTP in otherwise isolated environments and can use a proxy itself
39+ TFTP and HTTP content can either be static text (embedded in the manifest), generated content (using
40+ Go's ` text/template ` templating engine) or proxied to upstream HTTP(S). This last feature is mainly intended to proxy
41+ TFTP to HTTP(S) but very well may be used to reverse-proxy HTTP in otherwise isolated environments and can use a proxy
42+ itself
4343(` HTTP_PROXY ` and ` NO_PROXY ` is honored automatically by Go).
4444
45- netbootd cannot serve local files. An exception is a bundled version of [ iPXE] ( https://ipxe.org/ ) ,
46- which allows to download (typically) kernel and initrd over HTTP instead of TFTP.
45+ netbootd cannot serve local files. An exception is a bundled version of [ iPXE] ( https://ipxe.org/ ) , which allows
46+ downloading (typically) kernel and initrd over HTTP instead of TFTP.
4747
4848## Manifests
4949
5050A manifest represents a machine to be provisioned/served. The behavior of built-in
5151DHCP, TFTP and HTTP server is specific to a manifest, meaning that it varies based
5252on source MAC/IP. Each host may see different content at ` /something ` path.
5353
54- Note that this is not a security feature and you should not host any sensitive content.
55- MAC and IPs can be easily spoofed. In fact, netbootd includes a convenience feature to
56- spoof source IP for troubleshooting purposes. Append ` ?spoof=<ip-address> ` to HTTP request
57- to see the response for a particular host. There is no TFTP counterpart of this feature.
54+ Note that this is not a security feature and you should not host any sensitive content. MAC and IPs can be easily
55+ spoofed. In fact, netbootd includes a convenience feature to spoof source IP for troubleshooting purposes.
56+ Append ` ?spoof=<ip-address> ` to HTTP request to see the response for a particular host. There is no TFTP counterpart of
57+ this feature.
5858
5959Example manifests are included in the ` examples/ ` directory.
6060
6161## HTTP API
6262
63- TODO.
63+ In this preview/development version, this HTTP API does not support authentication.
64+
65+ <details >
66+ <summary >GET /api/manifests</summary >
67+ Returns a dictionary of all manifests keyed by their ID.
68+
69+ Supports ` Accept ` header (if provided) that allows selecting a json output (` Accept: application/json ` ).
70+ </details >
71+
72+ <details >
73+ <summary >GET /api/manifests/{id}</summary >
74+ Returns a single manifest with ID provided in the URL path.
75+
76+ Supports ` Accept ` header (if provided) that allows selecting a json output (` Accept: application/json ` ).
77+
78+ Returns:
79+
80+ * 200 for successful response
81+ * 404 if manifest with provided ID does not exist
82+
83+ </details >
84+
85+ <details >
86+ <summary >PUT /api/manifests/{id}</summary >
87+ Accepts a manifest in either JSON (` Content-type: application/json ` ) or YAML (default) format.
88+
89+ Returns:
90+
91+ * 201 Created on success
92+ * 400 for malformed request (invalid manifest)
93+
94+ </details >
95+
96+ <details >
97+ <summary >DELETE /api/manifests/{id}</summary >
98+ Ensures that manifest with provided ID does not exist.
99+
100+ Always returns 204, even if manifest already did not exist.
101+ </details >
102+
103+ <details >
104+ <summary >GET|POST /api/self/suspend-boot</summary >
105+ Allows a provisioned host to ask not to be booted again.
106+ This does not block DHCP, TFTP or HTTP requests, it only removes NBP information from DHCP responses.
107+
108+ This operation looks for a manifest matching the IP address of the requester. It is possible to spoof it
109+ with ` ?spoof=1.2.3.4 ` query parameter.
110+ </details >
111+
112+ <details >
113+ <summary >GET|POST /api/self/unsuspend-boot</summary >
114+ Re-enables booting for a provisioned host.
115+
116+ This operation looks for a manifest matching the IP address of the requester. It is possible to spoof it
117+ with ` ?spoof=1.2.3.4 ` query parameter.
118+ </details >
119+
120+ <details >
121+ <summary >GET /api/self/manifest</summary >
122+ Returns a manifest matching requester's IP Address.
123+
124+ Supports ` Accept ` header (if provided) that allows selecting a json output (` Accept: application/json ` ).
125+
126+ This operation looks for a manifest matching the IP address of the requester. It is possible to spoof it
127+ with ` ?spoof=1.2.3.4 ` query parameter.
128+ </details >
64129
65130## Usage
66131
67132```
68133Usage:
69- netbootd [flags]
134+ netbootd server [flags]
70135
71136Flags:
72137 -a, --address string IP address to listen on (DHCP, TFTP, HTTP)
73138 -r, --api-port int HTTP API port to listen on (default 8081)
74- -d, --debug enable debug logging
75- -h, --help help for netbootd
139+ -h, --help help for server
76140 -p, --http-port int HTTP port to listen on (default 8080)
77141 -i, --interface string interface to listen on, e.g. eth0 (DHCP)
78142 -m, --manifests string load manifests from directory
79- --trace enable trace logging
80143```
81144
82- Run e.g. ` ./netbootd --trace -m ./examples/ `
145+ Run e.g. ` ./netbootd --trace server -m ./examples/ `
83146
84147## Roadmap / TODOs
85148
0 commit comments