| 1 |
<html> |
| 2 |
<body> |
| 3 |
|
| 4 |
<h2><a href="cvm.html">CVM</a></h2> |
| 5 |
<h2><a href="protocol-1.html">CVM Version 1 Protocol</a></h2> |
| 6 |
|
| 7 |
<h1>CVM Version 2 Protocol</h1> |
| 8 |
|
| 9 |
<p>The version 2 protocol was built based on lessons learned while |
| 10 |
working with the version 1 protocol. In particular, it is impossible to |
| 11 |
pass binary data with the version 1 protocol without escaping to avoid |
| 12 |
NUL bytes. It is also difficult to differentiate between different |
| 13 |
types of credentials (ie secret vs. password vs. challenge/response) |
| 14 |
since there is no indication given in the request packet what types of |
| 15 |
credentials are being sent. Spoofing attacks are possible against |
| 16 |
version 1 UDP clients, since an attacker may forge valid responses with |
| 17 |
relative ease. This second version protocol retains the efficiency of |
| 18 |
the original protocol while correcting these deficiencies.</p> |
| 19 |
|
| 20 |
<h2>General Packet Format</h2> |
| 21 |
|
| 22 |
<p>Input to and output from the module follows a similar packet format: |
| 23 |
a packet identifier byte, a length byte L, L bytes of random data (used |
| 24 |
to help prevent spoofing of UDP responses), followed by a series of |
| 25 |
tagged strings and completed with a single NUL (zero) byte. The total |
| 26 |
size of either the input or the output must not exceed 512 bytes. The |
| 27 |
random data in the response is copied exactly from the request.</p> |
| 28 |
|
| 29 |
<p>A tagged string consists of a tag byte T, a length byte L, and L |
| 30 |
bytes of data. The tag byte identifies what <a |
| 31 |
href="credentials.html">credential</a> (in the input request) or what <a |
| 32 |
href="facts.html">fact</a> (in the output response) is represented by |
| 33 |
the data. Note that the initial random data in the packet may be viewed |
| 34 |
as a tagged string that just differs in the tag value convention.</p> |
| 35 |
|
| 36 |
<h2>Input</h2> |
| 37 |
|
| 38 |
<p>The packet identifier in the input (request) packet is the protocol |
| 39 |
version number (2). Example (all numbers are hexadecimal):</p> |
| 40 |
|
| 41 |
<pre> |
| 42 |
0000000: 0208 0102 0304 0506 0708 0108 7573 6572 ............user |
| 43 |
0000010: 6e61 6d65 0209 6c6f 6361 6c68 6f73 7403 name..localhost. |
| 44 |
0000020: 0870 6173 7377 6f72 6400 .password. |
| 45 |
</pre> |
| 46 |
|
| 47 |
<h2>Output</h2> |
| 48 |
|
| 49 |
<p>The packet identifier in the output (response) packet is the <a |
| 50 |
href="errors.html">error code</a> value, with zero representing |
| 51 |
successful validation.</p> |
| 52 |
|
| 53 |
<h2>Implementation Considerations</h2> |
| 54 |
|
| 55 |
<p>The module must report a temporary error if it detects malformed |
| 56 |
input (incorrect credentials, etc.). Extra data following the final |
| 57 |
NUL byte in the credentials is a fault in the invoking code, and must |
| 58 |
be rejected by the module. Similarly, extra data following the final |
| 59 |
NUL byte in the facts is a fault in the module code.</p> |
| 60 |
|
| 61 |
<p>All data following an unsuccessful result status code must be |
| 62 |
ignored by the invoking code. Modules should not produce any facts |
| 63 |
when validation fails.</p> |
| 64 |
|
| 65 |
<p>An executable module must exit 0 if authentication succeeds. |
| 66 |
Non-zero exit codes from an executable module should be treated as a |
| 67 |
temporary error.</p> |
| 68 |
|
| 69 |
<p>The invoker of an executable module must assume a temporary error |
| 70 |
if the module either fails to completely read its input or produces |
| 71 |
incomplete output, even if the module exits without error.</p> |
| 72 |
|
| 73 |
</body> |
| 74 |
</html> |