error: partial base64 value left over

Peter Holland pholland at
Tue Jan 25 00:00:30 UTC 2011

I have generated a base64 encoded value using python's os.urandom and
base64.b64encode functions that causes isc dhcp3-server to fail when it
parses it as a HMAC-MD5 key for omapi

The python code used to generate it was:

The key in question is:

The original random byte-string can be decoded as follows:

result is:

The error received is:
dhcpd: /var/run/network/505/dhcpd.conf line 14: partial base64 value left
over: 14.
secret XQhFIJF1HGrlAZKQbIu2VBZxLGXbjEI5Y0VMw0zzoiEyKKw1U/1yTgTVU2nKVjnUdnRHa

This is easily reproducible with the clause:
key omapi_key {
    algorithm HMAC-MD5;
omapi-key omapi_key;

This is using isc-dhcpd-V3.1.3 on Ubuntu 10.04 LTS

Most random strings generated by os.urandom(64) and encoded by
base64.b64encode() are handled fine by dhcpd3, but occasionally it generates
one that dhcpd3's base64 parser can't handle.  This is just one example of a
failing string.

I'm trying to determine whether the bug is on the dhcpd parser side or the
python generator side.  My inclination is that it is dhcpd3.

Any help from someone who knows the internals of the dhcpd base64 parser
would be greatly appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the dhcp-users mailing list