error: partial base64 value left over

Peter Holland pholland at skytap.com
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:
base64.b64encode(os.urandom(64))

The key in question is:
XQhFIJF1HGrlAZKQbIu2VBZxLGXbjEI5Y0VMw0zzoiEyKKw1U/
1yTgTVU2nKVjnUdnRHa+p66+NO+iwteSPRrg==

The original random byte-string can be decoded as follows:
base64.b64decode('XQhFIJF1HGrlAZKQbIu2VBZxLGXbjEI5Y0VMw0zzoiEyKKw1U/1yTgTVU2nKVjnUdnRHa+p66+NO+iwteSPRrg==')

result is:
']\x08E
\x91u\x1cj\xe5\x01\x92\x90l\x8b\xb6T\x16q,e\xdb\x8cB9cEL\xc3L\xf3\xa2!2(\xac5S\xfdrN\x04\xd5Si\xcaV9\xd4vtGk\xeaz\xeb\xe3N\xfa,-y#\xd1\xae'


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;
    secret
XQhFIJF1HGrlAZKQbIu2VBZxLGXbjEI5Y0VMw0zzoiEyKKw1U/1yTgTVU2nKVjnUdnRHa+p66+NO+iwteSPRrg==;
};
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.

Thanks,
Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20110124/2dcba3b1/attachment.html>


More information about the dhcp-users mailing list