Computing the MAC Field
The sender computes the
MAC field for the delayed authentication option by using
the HMAC and MD5 algorithms. The entire UDP payload of the DHCP message, with
two exceptions, is used as input to the HMAC-MD5 algorithm. Because the
giaddr
and hops fields may be altered by a relay agent, those fields are not included in the
MAC, and their contents are set to
0 for computation by the MAC. In addition, if a
relay agent information option appears at the end of the DHCP packet, the bytes
in this option are not included in the HMAC computation.
The
secret ID field of the delayed authentication option is set to the identifier of
the shared secret that the sender uses to generate the MAC. The
RDM field is set to 0,
and the replay detection field is set to a 64-bit monotonically increasing counter.
The current time of day, in NTP format (see RFC 1305), is a good value for the
counter field.
Validating a Message
To validate an incoming message, the receiver first checks that the value in the
replay detection field is greater than the value from the previous message, and it
discards any messages that fail this test. Next, the receiver uses the contents of the
secret ID field from the delayed authentication option to identify the key used to
generate the MAC in the message. The receiver then computes the MAC for the
message by using the algorithm described in the previous section. It sets the contents
of the
MAC field in the authentication option, the giaddr and the hops fields in the
fixed-format section of the message to 0 for the computation, and it ignores the
relay agent information option if one exists. If the MAC value the receiver
computes does not match the contents of the
MAC field in the authentication
option, the receiver discards the message. The identification and authentication in
the Delayed Authentication Protocol are based on the assumption that the receiver
and the sender of a DHCP message are the only two DHCP participants that know
the shared secret identified by the
secret ID field in the message. If the receiver
successfully validates the incoming message, the receiver can infer that the message
was sent by the sender identified in the message because only that sender knows the
key used to generate the MAC value in the message. The receiver can also infer that
the content of the message was not altered in transmission because the key would be
required to recompute a new MAC value to match the contents of the message after
any changes were made.
Using Delayed Authentication When Obtaining a New IP Address
When the
delayed authentication option is used while obtaining a new IP address,
the client uses the option format shown in Figure 7.7. At present, only one algo-
rithm is defined, and the only valid value for the
algorithm field is 1, which selects
the HMAC-MD5 MAC computation algorithm.
Authenticated DHCP Messages 99
010 3273 CH07 10/3/02 5:02 PM Page 99